Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<link rel="manifest" href="/OpenWebSheet/manifest.json">
<meta name="theme-color" content="#00454d">
<title>Open web sheet</title>
<script type="module" crossorigin src="/OpenWebSheet/assets/index-BmubRFE9.js"></script>
<link rel="stylesheet" crossorigin href="/OpenWebSheet/assets/index-C8Mjwljw.css">
<script type="module" crossorigin src="/OpenWebSheet/assets/index-Cx29MV9W.js"></script>
<link rel="stylesheet" crossorigin href="/OpenWebSheet/assets/index-BHpHweNg.css">
</head>
<body>
<noscript>
Expand Down
25 changes: 25 additions & 0 deletions src/app/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,31 @@
@apply h-7 border border-gray-300 rounded-sm bg-white text-gray-900;
}

/* Compact color swatch instead of the bulky native color input. */
.ows-field input[type='color'] {
@apply h-6 w-8 p-0 rounded cursor-pointer shadow-sm;
border: 1px solid #c4c4c4;
background: transparent;
}

.ows-field input[type='color']:hover {
border-color: #00454d;
}

.ows-field input[type='color']::-webkit-color-swatch-wrapper {
padding: 2px;
}

.ows-field input[type='color']::-webkit-color-swatch {
@apply rounded-sm;
border: none;
}

.ows-field input[type='color']::-moz-color-swatch {
@apply rounded-sm;
border: none;
}

.ows-formula-bar {
@apply flex items-center border-b border-t border-gray-300 bg-white;
}
Expand Down
9 changes: 9 additions & 0 deletions src/lib/editor/CellEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export class CellEditor {

public initialize() {
this.editorArea = document.createElement('div');
// The overlay math below assumes content-box sizing (the 2px selection border and
// the editor input border sit *outside* the declared width/height). A global
// `box-sizing: border-box` reset (such as Tailwind's preflight) would otherwise
// shrink the green selection box and the editor, so each element opts back into
// content-box explicitly.
this.editorArea.style.boxSizing = 'content-box';
this.editorArea.style.position = 'absolute';
this.editorArea.style.top = ColumnHeaderHeight + 'px';
this.editorArea.style.left = RowHeaderWidth + 'px';
Expand All @@ -70,6 +76,7 @@ export class CellEditor {
this.controler.renderer.Element.appendChild(this.editorArea);

this.selectionElement = document.createElement('div');
this.selectionElement.style.boxSizing = 'content-box';
this.selectionElement.style.position = 'absolute';
this.selectionElement.style.border = `solid 2px ${COLOR_1}`;
this.selectionElement.style.overflow = 'hidden';
Expand All @@ -79,6 +86,7 @@ export class CellEditor {

this.editorElement = document.createElement('input');
this.editorElement.type = 'text';
this.editorElement.style.boxSizing = 'content-box';
this.editorElement.style.display = 'block';
this.editorElement.style.zIndex = '10000';
this.editorElement.style.position = 'absolute';
Expand All @@ -99,6 +107,7 @@ export class CellEditor {
this.selectionElement.appendChild(this.editorElement);

this.anchorElement = document.createElement('span');
this.anchorElement.style.boxSizing = 'content-box';
this.anchorElement.style.position = 'absolute';
this.anchorElement.style.right = '0';
this.anchorElement.style.bottom = '0';
Expand Down
Loading