Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/text editor/tables: tweak layout on mobile
Adorian Doranf590fb5f4173
diff --git a/packages/ckeditor5/src/plugins/table_scroll.spec.ts b/packages/ckeditor5/src/plugins/table_scroll.spec.tsindex 976c1a81bf..e44c06f876 100644--- a/packages/ckeditor5/src/plugins/table_scroll.spec.ts+++ b/packages/ckeditor5/src/plugins/table_scroll.spec.ts@@ -207,7 +207,7 @@ describe("a table with content wider than the editable", () => {describe("the controls of a scrolling table", () => {useEditorStylesheet();- it("keeps the caption, the handle and the buttons whole and in view", async () => {+ it("keeps the controls whole and in view, above and below the caption and table", async () => {const editor = await createTestEditor([...PLUGINS, TableCaption]);setEditableWidth(editor, 400);setModelData(editor.model, '<table tableWidth="150%"><tableRow><tableCell>'@@ -232,14 +232,16 @@ describe("the controls of a scrolling table", () => {expect(scrolledLefts[index]).toBeCloseTo(left, 0);}- const [caption, , before] = controls;- const table = figure.querySelector("table");- expect(caption?.getBoundingClientRect().top)- .toBeCloseTo(figure.getBoundingClientRect().top + figure.clientTop, 0);- expect(table?.getBoundingClientRect().top)- .toBeCloseTo(caption?.getBoundingClientRect().bottom ?? 0, 0);- expect(before && getComputedStyle(before).borderBottomLeftRadius)- .toBe(before && getComputedStyle(before).borderTopLeftRadius);+ const [caption, handle, before, after] = controls.map(rectOf);+ const table = rectOf(figure.querySelector("table"));+ expect(handle.top).toBeCloseTo(before.top, 0);+ expect(handle.bottom).toBeLessThanOrEqual(caption.top + 0.5);+ expect(caption.top).toBeCloseTo(before.bottom, 0);+ expect(table.top).toBeCloseTo(caption.bottom, 0);+ expect(after.top).toBeCloseTo(table.bottom, 0);+ const beforeButton = controls[2];+ expect(beforeButton && getComputedStyle(beforeButton).borderBottomLeftRadius)+ .toBe(beforeButton && getComputedStyle(beforeButton).borderTopLeftRadius);});});@@ -349,6 +351,10 @@ function expectInside(figure: HTMLElement, control: Element | null) {return rect?.left ?? NaN;}+function rectOf(element: Element | null) {+ return element?.getBoundingClientRect() ?? new DOMRect(NaN, NaN, NaN, NaN);+}+function setReferenceWidth(width: string) {document.body.style.setProperty(REFERENCE_WIDTH_PROPERTY, width);onTestFinished(() => {diff --git a/packages/ckeditor5/src/theme/table_scroll.css b/packages/ckeditor5/src/theme/table_scroll.cssindex 3246002f4b..e9c2ad95f0 100644--- a/packages/ckeditor5/src/theme/table_scroll.css+++ b/packages/ckeditor5/src/theme/table_scroll.css@@ -81,7 +81,6 @@order: -2;align-self: flex-start;inset-inline-start: var(--button-inset);- margin-block-end: calc(-1 * var(--ck-widget-type-around-button-size));margin-inline-start: var(--button-inset);}@@ -90,7 +89,6 @@align-self: flex-end;inset-inline-start:calc(100% - min(10%, 30px) - var(--ck-widget-type-around-button-size));- margin-block-start: calc(-1 * var(--ck-widget-type-around-button-size));margin-inline-end: min(10%, 30px);}}