Browse Source

Docs: image handles, rotate, table menu and grid

Pictures: replace the single resize dot with eight handles and a rotate knob. Rotation and flips are baked into the bitmap. fitPicture adds an aspect-ratio so a picture keeps its shape in a narrow column or table cell, and settlePictures commits the shown size when a table column is narrowed. The .docx writer now scales a stated height along when it clamps a picture to the text column, to match the editor; the fidelity test is updated.

Tables: Insert > Table opens Word's grid as a dropdown, with an "Insert table..." dialog for larger sizes. Table editing moves to a context-sensitive right-click menu with Word-style Insert and Delete submenus that act on every selected row or column. Colgroup widths are kept when columns are inserted or deleted. Table commands are removed from the floating text bar.

Context menu: it now shows only the entries that fit the target (picture, table, link, TOC, selected text or caret), with new Edit link and Open link commands. Menu items can use OfficeIcons through the new `svg` field. Adds table and rotate icons, and updates the README and CONTRACT docs.
Toby Chui 3 weeks ago
parent
commit
7b93ab1fb9

+ 2 - 2
src/mod/office/docx/fidelity_test.go

@@ -53,8 +53,8 @@ func TestDocxImageCappedToTextWidth(t *testing.T) {
 	}{
 	}{
 		// no stated height: the editor scales it with the width
 		// no stated height: the editor scales it with the width
 		{"automatic height", `<img src="` + src + `" width="1240">`, emu(textW), emu(textW / 2)},
 		{"automatic height", `<img src="` + src + `" width="1240">`, emu(textW), emu(textW / 2)},
-		// a stated height stays as the editor shows it (max-width only)
-		{"stated height", `<img src="` + src + `" style="width:600pt;height:200pt;">`, emu(textW), emu(200)},
+		// a stated height scales along too: the editor keeps the shape
+		{"stated height", `<img src="` + src + `" style="width:600pt;height:200pt;">`, emu(textW), emu(200 * textW / 600)},
 		{"narrow picture", `<img src="` + src + `" style="width:300pt;height:150pt;">`, emu(300), emu(150)},
 		{"narrow picture", `<img src="` + src + `" style="width:300pt;height:150pt;">`, emu(300), emu(150)},
 	}
 	}
 	for _, tc := range tests {
 	for _, tc := range tests {

+ 4 - 6
src/mod/office/docx/writer.go

@@ -1747,7 +1747,6 @@ func (b *docxBuilder) image(n *html.Node, part *docxPart) string {
 		return 0
 		return 0
 	}
 	}
 	wPt, hPt := dim("width"), dim("height")
 	wPt, hPt := dim("width"), dim("height")
-	fixedH := hPt > 0
 	switch {
 	switch {
 	case wPt > 0 && hPt <= 0:
 	case wPt > 0 && hPt <= 0:
 		if natW > 0 && natH > 0 {
 		if natW > 0 && natH > 0 {
@@ -1770,12 +1769,11 @@ func (b *docxBuilder) image(n *html.Node, part *docxPart) string {
 	}
 	}
 	anchor := hasClass(n, "doc-anchor")
 	anchor := hasClass(n, "doc-anchor")
 	// an inline picture cannot be wider than the text column (the editor's
 	// an inline picture cannot be wider than the text column (the editor's
-	// max-width: 100%) - a stated height stays as the editor shows it, an
-	// automatic one scales along; an anchored picture may bleed past
+	// max-width: 100%), and the editor scales it whole there - a stated
+	// height too (its aspect-ratio, docs.js fitPicture); an anchored
+	// picture may bleed past
 	if !anchor && b.textWPt > 0 && wPt > b.textWPt+0.5 {
 	if !anchor && b.textWPt > 0 && wPt > b.textWPt+0.5 {
-		if !fixedH {
-			hPt = hPt * b.textWPt / wPt
-		}
+		hPt = hPt * b.textWPt / wPt
 		wPt = b.textWPt
 		wPt = b.textWPt
 	}
 	}
 	cx, cy := int64(math.Round(wPt*12700)), int64(math.Round(hPt*12700))
 	cx, cy := int64(math.Round(wPt*12700)), int64(math.Round(hPt*12700))

+ 66 - 0
src/web/Office/README.md

@@ -1344,6 +1344,72 @@ horizontal offset: `text-align` cannot move a block image, so the Home
 align buttons call `alignPicture` while a picture is selected, and a
 align buttons call `alignPicture` while a picture is selected, and a
 centred or right-set picture is placed again whenever its width changes.
 centred or right-set picture is placed again whenever its width changes.
 
 
+- **Handles** (`selectImage`): eight squares and a rotate knob, as in
+  Google Docs. A corner keeps the frame's shape (Shift stretches freely),
+  a side stretches one way; the size is the picture's `width` / `height`.
+- **Turning and flipping is baked into the bitmap** (`turnPicture`), the
+  way the .docx import already bakes a quarter turn (`docx/picture.go`):
+  the editor has no turned pictures, because a CSS transform would not
+  move the text around one. The knob previews with a transform and bakes
+  on release; Picture Format > Rotate and the picture menu turn by 90° and
+  flip. The result is the turned frame (a PNG with see-through corners
+  unless it is a quarter turn of a JPEG, which stays a JPEG), and the crop
+  goes into it. `turnSource` keeps the first bitmap for the session, so a
+  second turn draws from it instead of from a copy of a copy.
+- **A picture keeps its shape in a narrow column.** `max-width: 100%`
+  narrows a picture in a column or table cell narrower than it, and its
+  stated height used to squash it. `fitPicture` gives every picture with a
+  stated size the matching `aspect-ratio`, and docs.css lets the height
+  follow it (`height: auto !important`); it is for show only and
+  `stripLayoutArtifacts` leaves it out of what is saved. When a table
+  column is narrowed (a border drag, an inserted column) `settlePictures`
+  makes the size shown the picture's size, as Google Docs does, so the
+  files get it too. The .docx writer scales a stated height along when it
+  clamps a picture to the text column, to match.
+
+### Docs: tables and the right-click menu
+
+Insert > Table opens Word's grid as a dropdown under the button
+(`openTableGrid` in `docs.js`): move over it to size the table, click to
+insert, or "Insert table..." under the grid for a size past 10 x 8. The
+arrow keys move the size and Enter inserts while it is open.
+
+A table is edited from the **right-click menu only**, as in Word and
+Google Docs: the floating text bar over selected text carries text
+formatting and never table commands (Slides still passes `tableOps` to it
+for its own tables). The menu is built from what is under the pointer and
+what is selected, and leaves out what does not apply:
+
+| Right-click on | Shows |
+|---|---|
+| a table cell, or a block of selected cells | the clipboard, Insert (columns left / right, rows above / below) and Delete (columns, rows, table), then header row, banded rows, theme, borders and cell background. No text formatting, page break or Select all. Insert link and Comment only over text inside one cell |
+| a picture | the picture's commands and the clipboard |
+| a link | Edit link, Open link, Remove link |
+| a table of contents | Update table and its options |
+| selected text | Comment, the clipboard, Insert link (its formatting is on the floating bar) |
+| a caret in running text | Paste, Bold / Italic / Underline / Clear formatting, Insert page break, Select all |
+
+Insert and Delete act on every row or column the selection covers, and
+say how many ("Insert 2 rows above"). The cells are found by
+`cellBlock()`: a caret, Chrome's one range across cells, or Firefox's
+range per cell. A row the page layout cut in two stands for its first
+part (`splitHeadCell`), and `onBlock()` makes the table whole with
+`DocsLayout.unsplitWithin` before it counts rows, then lays the pages out
+again.
+
+**Column widths.** A table never resized has no `<colgroup>`: the
+stylesheet shares 100% out equally, however many columns it has. A table
+with one (every imported table, and one whose borders were dragged) keeps
+its width when columns come or go - `colsInserted` / `colsDeleted` rewrite
+the colgroup in its own unit (pt from .docx, % from .odt, px after a
+drag). Equal columns stay equal. Sized columns keep their proportions on
+an insert (the new one starts as wide as its neighbour), and a deleted
+column's width goes to the column after it (before it at the right edge),
+so the borders the user placed stay put. A border drag converts the
+colgroup to px first (`ensureColgroup`), or an imported table's pt widths
+were read as px and the column jumped. The menu icons are Word's (`tableInsertLeft` ... `tableDelete` in
+`common/icons.js`, a menu item's `svg`).
+
 ### Docs: table of contents
 ### Docs: table of contents
 
 
 References > Table of contents inserts a "Contents" title and one line
 References > Table of contents inserts a "Contents" title and one line

+ 3 - 1
src/web/Office/common/CONTRACT.md

@@ -166,7 +166,9 @@ OfficeApp.init({
 ```
 ```
 
 
 **Menu item shape** (also used by `showContextMenu`):
 **Menu item shape** (also used by `showContextMenu`):
-`{ label, icon /*semantic icon name, e.g. "save"*/, key /*display, e.g. "Ctrl+B"*/,
+`{ label, icon /*semantic icon name, e.g. "save"*/,
+   svg /*or an OfficeIcons name, e.g. "tableInsertAbove", in the same column*/,
+   key /*display, e.g. "Ctrl+B"*/,
    action: fn, enabled: fn->bool, checked: bool|fn /*renders ✓, replaces icon*/,
    action: fn, enabled: fn->bool, checked: bool|fn /*renders ✓, replaces icon*/,
    sub: array|fn->array, sep: true,
    sub: array|fn->array, sep: true,
    html /*trusted markup shown instead of the label (a picture of the choice,
    html /*trusted markup shown instead of the label (a picture of the choice,

+ 12 - 0
src/web/Office/common/icons.js

@@ -126,6 +126,8 @@ var OfficeIcons = (function () {
         sendBack: '<rect class="acc" x="3" y="3" width="11" height="11" rx="1" opacity=".55"/><rect x="8" y="8" width="11" height="11" rx="1"/>',
         sendBack: '<rect class="acc" x="3" y="3" width="11" height="11" rx="1" opacity=".55"/><rect x="8" y="8" width="11" height="11" rx="1"/>',
         crop: '<path d="M6 2.5V18h15.5M2.5 6H18v15.5"/>',
         crop: '<path d="M6 2.5V18h15.5M2.5 6H18v15.5"/>',
         resetPicture: '<rect x="3" y="5" width="18" height="14" rx="1"/><path class="accs" d="M15.5 12.5a3.5 3.5 0 1 1-1-2.5M15 8v2.5h-2.5"/>',
         resetPicture: '<rect x="3" y="5" width="18" height="14" rx="1"/><path class="accs" d="M15.5 12.5a3.5 3.5 0 1 1-1-2.5M15 8v2.5h-2.5"/>',
+        // a picture with a turn arrow over its corner
+        rotate: '<rect x="2.5" y="10" width="11" height="11" rx="1"/><path class="accs" d="M8 5.5a9 9 0 0 1 12.3 7.3"/><path class="accs" d="M17.9 11.2l2.4 2.2 2.2-2.4"/>',
         outline: '<path d="M4 20l1.4-5.2L16 4.2l3.8 3.8L9.2 18.6z"/>',
         outline: '<path d="M4 20l1.4-5.2L16 4.2l3.8 3.8L9.2 18.6z"/>',
         lineWeight: '<path d="M3 5h18" stroke-width="1"/><path d="M3 11h18" stroke-width="2.2"/><path d="M3 18h18" stroke-width="3.6"/>',
         lineWeight: '<path d="M3 5h18" stroke-width="1"/><path d="M3 11h18" stroke-width="2.2"/><path d="M3 18h18" stroke-width="3.6"/>',
         lineDash: '<path d="M3 7h4M10 7h4M17 7h4M3 13h2M8 13h2M13 13h2M18 13h2M3 19h9M15 19h6"/>',
         lineDash: '<path d="M3 7h4M10 7h4M17 7h4M3 13h2M8 13h2M13 13h2M18 13h2M3 19h9M15 19h6"/>',
@@ -134,6 +136,16 @@ var OfficeIcons = (function () {
         link: '<path d="M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4l-1 1"/><path d="M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4l1-1"/>',
         link: '<path d="M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4l-1 1"/><path d="M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4l1-1"/>',
         picture: '<rect x="2.5" y="4" width="19" height="16" rx="1.5"/><circle cx="8" cy="9.5" r="1.8"/><path class="accs" d="M3.5 17.5l5-5 4 4 3-3 5 4.5"/>',
         picture: '<rect x="2.5" y="4" width="19" height="16" rx="1.5"/><circle cx="8" cy="9.5" r="1.8"/><path class="accs" d="M3.5 17.5l5-5 4 4 3-3 5 4.5"/>',
         table: '<rect x="3" y="4" width="18" height="16" rx="1"/><path d="M3 9.5h18M3 15h18M9 4v16M15 4v16"/>',
         table: '<rect x="3" y="4" width="18" height="16" rx="1"/><path d="M3 9.5h18M3 15h18M9 4v16M15 4v16"/>',
+        // Word's row / column commands: what an insert adds is filled with
+        // the accent, an arrow on it pointing where it goes; a delete
+        // shows what goes and a red cross
+        tableInsertLeft: '<path class="acc" d="M3 4h8v16H3z"/><path d="M3 4h18v16H3zM11 4v16M16 4v16M11 9.3h10M11 14.7h10"/><path class="onacc" d="M9.2 12H4.8M7 9.8 4.8 12 7 14.2"/>',
+        tableInsertRight: '<path class="acc" d="M13 4h8v16h-8z"/><path d="M3 4h18v16H3zM13 4v16M8 4v16M3 9.3h10M3 14.7h10"/><path class="onacc" d="M14.8 12h4.4M17 9.8l2.2 2.2-2.2 2.2"/>',
+        tableInsertAbove: '<path class="acc" d="M3 4h18v7H3z"/><path d="M3 4h18v16H3zM3 11h18M3 15.5h18M9 11v9M15 11v9"/><path class="onacc" d="M12 9.6V5.4M9.9 7.5 12 5.4l2.1 2.1"/>',
+        tableInsertBelow: '<path class="acc" d="M3 13h18v7H3z"/><path d="M3 4h18v16H3zM3 13h18M3 8.5h18M9 4v9M15 4v9"/><path class="onacc" d="M12 14.4v4.2M9.9 16.5l2.1 2.1 2.1-2.1"/>',
+        tableDeleteCols: '<path class="acc" d="M8.5 2.5h7v12h-7z" opacity=".3"/><path d="M8.5 2.5h7v12h-7zM8.5 6.5h7M8.5 10.5h7"/><path class="dels" d="M9 16.5l6 5M15 16.5l-6 5"/>',
+        tableDeleteRows: '<path class="acc" d="M2 8.5h12v7H2z" opacity=".3"/><path d="M2 8.5h12v7H2zM6 8.5v7M10 8.5v7"/><path class="dels" d="M16.5 9l5 6M21.5 9l-5 6"/>',
+        tableDelete: '<path d="M2.5 3h14v12.5h-14zM2.5 7.2h14M2.5 11.3h14M7.2 3v12.5M11.8 3v12.5"/><path class="dels" d="M15 15l6 6M21 15l-6 6"/>',
         chart: '<path d="M3.5 20.5h17"/><path d="M6 17V11h3v6zM10.5 17V6h3v11z"/><path class="acc" d="M15 17V9h3v8z"/>',
         chart: '<path d="M3.5 20.5h17"/><path d="M6 17V11h3v6zM10.5 17V6h3v11z"/><path class="acc" d="M15 17V9h3v8z"/>',
         comment: '<path d="M3.5 4.5h17v11h-9l-5 4v-4h-3z"/>',
         comment: '<path d="M3.5 4.5h17v11h-9l-5 4v-4h-3z"/>',
         /* ---- clipboard (Home > Clipboard, the same in all three apps) ---- */
         /* ---- clipboard (Home > Clipboard, the same in all three apps) ---- */

+ 6 - 0
src/web/Office/common/office.css

@@ -713,9 +713,15 @@ body.dark .of-ic .clipb { stroke: #e9a647; }
 .of-ic .accs { stroke: var(--of-accent); }
 .of-ic .accs { stroke: var(--of-accent); }
 .of-ic .acct { fill: var(--of-accent); }
 .of-ic .acct { fill: var(--of-accent); }
 .of-ic .fillc { fill: currentColor; stroke: none; }
 .of-ic .fillc { fill: currentColor; stroke: none; }
+/* a mark drawn on an accent fill (the arrow of a table insert) */
+.of-ic .onacc { stroke: #fff; stroke-width: 1.8; }
+/* a destructive command's cross */
+.of-ic .dels { stroke: var(--of-danger); stroke-width: 2.2; }
 .of-rb-bigicon .of-ic, .of-rb-gbtn > .of-ic { width: 26px; height: 26px; stroke-width: 1.4; }
 .of-rb-bigicon .of-ic, .of-rb-gbtn > .of-ic { width: 26px; height: 26px; stroke-width: 1.4; }
 .of-qbtn .of-ic { width: 15px; height: 15px; }
 .of-qbtn .of-ic { width: 15px; height: 15px; }
 .of-menu-item .of-ic { width: 15px; height: 15px; color: var(--of-fg-soft); }
 .of-menu-item .of-ic { width: 15px; height: 15px; color: var(--of-fg-soft); }
+/* an item's own drawn icon (it.svg) fills the column a font icon takes */
+.of-menu-item .of-ic.of-mi-ic { width: 16px; height: 16px; stroke-width: 1.5; }
 /* the "desktop only" / "phone only" switches on controls */
 /* the "desktop only" / "phone only" switches on controls */
 [data-desktop="hide"] { display: none !important; }
 [data-desktop="hide"] { display: none !important; }
 
 

+ 2 - 0
src/web/Office/common/office.js

@@ -1416,6 +1416,8 @@ var OfficeApp = (function () {
             if (it.checked !== undefined) {
             if (it.checked !== undefined) {
                 var on = (typeof it.checked === "function") ? it.checked() : it.checked;
                 var on = (typeof it.checked === "function") ? it.checked() : it.checked;
                 $it.append('<span class="of-mi-check">' + (on ? "✓" : "") + "</span>");
                 $it.append('<span class="of-mi-check">' + (on ? "✓" : "") + "</span>");
+            } else if (it.svg && window.OfficeIcons && OfficeIcons.has(it.svg)) {
+                $it.append(OfficeIcons.get(it.svg, "of-mi-ic"));
             } else if (it.icon) {
             } else if (it.icon) {
                 $it.append('<i class="' + escapeHtml(it.icon) + ' icon"></i>');
                 $it.append('<i class="' + escapeHtml(it.icon) + ' icon"></i>');
             } else {
             } else {

+ 3 - 14
src/web/Office/common/textedit.js

@@ -21,13 +21,11 @@
                                          // when there is no text selection
                                          // when there is no text selection
             tableOps: [                  // OPTIONAL: table tool section shown
             tableOps: [                  // OPTIONAL: table tool section shown
                 { icon: "angle up",      // under a divider while the host is
                 { icon: "angle up",      // under a divider while the host is
-                  title: "Insert row",   // inside a table
-                  fn: function(btnEl){…},
-                  active: function(){…} }// optional toggle state
+                  title: "Insert row",   // inside a table (a Slides table;
+                  fn: function(btnEl){…},// Docs keeps its table commands on
+                  active: function(){…} }// the context menu)
             ]
             ]
         });
         });
-        OfficeTextEditBar.setTableOps(ops)  // swap/clear the table section
-                                            // while the bar stays open
         OfficeTextEditBar.reposition();  // after the anchor moved/resized
         OfficeTextEditBar.reposition();  // after the anchor moved/resized
         OfficeTextEditBar.hide();
         OfficeTextEditBar.hide();
         OfficeTextEditBar.contains(node) // host focusout checks: focus moved
         OfficeTextEditBar.contains(node) // host focusout checks: focus moved
@@ -463,21 +461,12 @@ var OfficeTextEditBar = (function () {
     }
     }
     function isVisible() { return !!$bar; }
     function isVisible() { return !!$bar; }
 
 
-    // swap or clear the table section while the bar stays open (the Docs
-    // selection bar is reused across selection changes)
-    function setTableOps(ops) {
-        if (!renderTableOpsFn) return;
-        renderTableOpsFn(ops || null);
-        reposition();
-    }
-
     return {
     return {
         show: show,
         show: show,
         hide: hide,
         hide: hide,
         reposition: reposition,
         reposition: reposition,
         contains: contains,
         contains: contains,
         isVisible: isVisible,
         isVisible: isVisible,
-        setTableOps: setTableOps,
         // for a host's own font controls (the Slides ribbon) while editing
         // for a host's own font controls (the Slides ribbon) while editing
         hasTextSelection: hasTextSelection,
         hasTextSelection: hasTextSelection,
         applyFontFamily: applyFontFamily,
         applyFontFamily: applyFontFamily,

+ 94 - 17
src/web/Office/docs/docs.css

@@ -295,6 +295,10 @@ span.doc-tab[data-leader="underscore"]::after { top: 0.44em; border-top: 1px sol
     height: auto;
     height: auto;
     cursor: default;
     cursor: default;
 }
 }
+/* a picture with a stated width and height: when max-width takes its
+   width down (a narrow column or table cell), the height follows the
+   aspect-ratio fitPicture gives it rather than squashing it */
+#editor img[style*="aspect-ratio"] { height: auto !important; }
 /* a picture anchored above/below the text (a full-bleed cover, a banner):
 /* a picture anchored above/below the text (a full-bleed cover, a banner):
    its own box on its own line, allowed past the text column */
    its own box on its own line, allowed past the text column */
 #editor img.doc-anchor {
 #editor img.doc-anchor {
@@ -469,18 +473,56 @@ body.dark .doc-toc-format { background: var(--of-chrome-bg); }
 .doc-picprops-row label { flex: 1; }
 .doc-picprops-row label { flex: 1; }
 .doc-picprops label.doc-picprops-check { flex-direction: row; align-items: center; gap: 6px; }
 .doc-picprops label.doc-picprops-check { flex-direction: row; align-items: center; gap: 6px; }
 .doc-picprops textarea { resize: vertical; }
 .doc-picprops textarea { resize: vertical; }
+/* the selected picture's handles (docs.js selectImage), as Google Docs
+   draws them: a layer the size of the picture with eight squares on its
+   edges and a knob on a stem above the top edge to turn it */
 .of-img-handle {
 .of-img-handle {
     position: fixed;
     position: fixed;
-    width: 13px;
-    height: 13px;
-    background: var(--of-accent);
-    border: 2px solid #fff;
-    border-radius: 50%;
-    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
-    cursor: nwse-resize;
     z-index: 1200;
     z-index: 1200;
+    pointer-events: none;
+}
+.of-img-h, .of-img-rot {
+    position: absolute;
+    box-sizing: border-box;
+    background: var(--of-accent);
+    border: 1px solid #fff;
+    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
+    pointer-events: auto;
     touch-action: none;
     touch-action: none;
 }
 }
+.of-img-h { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; }
+.of-img-h[data-dir="nw"] { left: 0; top: 0; cursor: nwse-resize; }
+.of-img-h[data-dir="n"] { left: 50%; top: 0; cursor: ns-resize; }
+.of-img-h[data-dir="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
+.of-img-h[data-dir="e"] { left: 100%; top: 50%; cursor: ew-resize; }
+.of-img-h[data-dir="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
+.of-img-h[data-dir="s"] { left: 50%; top: 100%; cursor: ns-resize; }
+.of-img-h[data-dir="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
+.of-img-h[data-dir="w"] { left: 0; top: 50%; cursor: ew-resize; }
+.of-img-rot {
+    width: 12px;
+    height: 12px;
+    left: 50%;
+    top: -24px;
+    margin-left: -6px;
+    border-radius: 50%;
+    cursor: grab;
+}
+.of-img-stem {
+    position: absolute;
+    left: 50%;
+    top: -14px;
+    height: 14px;
+    border-left: 1px solid var(--of-accent);
+}
+/* while it turns the squares would point the wrong way */
+.of-img-turning .of-img-h { display: none; }
+.of-img-turning .of-img-rot { cursor: grabbing; }
+@media (pointer: coarse) {
+    .of-img-h { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
+    .of-img-rot { width: 18px; height: 18px; margin-left: -9px; top: -30px; }
+    .of-img-stem { top: -14px; }
+}
 
 
 /* Tables */
 /* Tables */
 #editor table.of-table {
 #editor table.of-table {
@@ -570,34 +612,69 @@ body.dark .doc-toc-format { background: var(--of-chrome-bg); }
     .doc-autobreak { display: none !important; }
     .doc-autobreak { display: none !important; }
 }
 }
 
 
-/* ============ Table grid creator (Insert > Table) ============ */
+/* ============ Table grid dropdown (Insert > Table) ============ */
+.doc-tgrid-pop {
+    position: fixed;
+    z-index: 1600;
+    background: var(--of-chrome-bg);
+    border: 1px solid var(--of-border);
+    border-radius: 6px;
+    box-shadow: 0 4px 16px var(--of-shadow);
+    padding: 8px 8px 4px;
+    user-select: none;
+}
 .doc-tgrid-label {
 .doc-tgrid-label {
-    text-align: center;
     font-size: 13px;
     font-size: 13px;
     font-weight: 600;
     font-weight: 600;
     color: var(--of-fg);
     color: var(--of-fg);
-    margin-bottom: 8px;
+    padding: 0 2px 8px;
 }
 }
 .doc-tgrid {
 .doc-tgrid {
     display: grid;
     display: grid;
-    grid-template-columns: repeat(10, 20px);
+    grid-template-columns: repeat(10, 18px);
     gap: 3px;
     gap: 3px;
-    justify-content: center;
-    touch-action: none;
 }
 }
 .doc-tgrid-cell {
 .doc-tgrid-cell {
-    width: 20px;
-    height: 20px;
+    width: 18px;
+    height: 18px;
     padding: 0;
     padding: 0;
     border: 1px solid var(--of-border);
     border: 1px solid var(--of-border);
-    border-radius: 3px;
-    background: var(--of-chrome-bg2);
+    border-radius: 2px;
+    background: var(--of-chrome-bg);
     cursor: pointer;
     cursor: pointer;
 }
 }
 .doc-tgrid-cell.hot {
 .doc-tgrid-cell.hot {
     background: var(--of-accent-soft);
     background: var(--of-accent-soft);
     border-color: var(--of-accent);
     border-color: var(--of-accent);
 }
 }
+.doc-tgrid-sep {
+    height: 1px;
+    background: var(--of-border);
+    margin: 8px -4px 4px;
+}
+.doc-tgrid-more {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    width: 100%;
+    padding: 6px 6px;
+    border: 0;
+    border-radius: 4px;
+    background: none;
+    color: var(--of-fg);
+    font: inherit;
+    font-size: 13px;
+    text-align: left;
+    cursor: pointer;
+}
+.doc-tgrid-more:hover { background: var(--of-hover); }
+.doc-tgrid-more i.icon {
+    width: 16px;
+    margin: 0;
+    color: var(--of-fg-soft);
+    font-size: 13px;
+    line-height: 1;
+}
 
 
 /* Layout boxes: visualize which regions span all columns (orange) and
 /* Layout boxes: visualize which regions span all columns (orange) and
    which flow inside the columns (blue) - View > Layout boxes */
    which flow inside the columns (blue) - View > Layout boxes */

File diff suppressed because it is too large
+ 711 - 325
src/web/Office/docs/docs.js


Some files were not shown because too many files changed in this diff