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
Merge branch 'main' of https://github.com/TriliumNext/Trilium into feat/text-editor-improvements-6
Adorian Doranf2c65e5f2074
diff --cc packages/ckeditor5/src/plugins/multicolumn/multicolumn_editing.spec.tsindex 025b0258b6,78da8f3f2b..b1592ef71c--- a/packages/ckeditor5/src/plugins/multicolumn/multicolumn_editing.spec.ts+++ b/packages/ckeditor5/src/plugins/multicolumn/multicolumn_editing.spec.ts@@@ -85,16 -87,12 +87,16 @@@ describe("MulticolumnEditing", () =>});describe("placeholder", () => {- /** Whether the first block of each column shows the placeholder. */+ /** The placeholder each column shows in its first block, or `null` for none. */function placeholders() {const root = editor.editing.view.getDomRoot();- const columns = root?.querySelectorAll(".trilium-multicolumn-layout > section") ?? [];+ const columns = root?.querySelectorAll(".trilium-multicolumn-column") ?? [];- return [...columns].map(column =>- column.firstElementChild?.classList.contains("ck-placeholder") ?? false);+ return [...columns].map(column => {+ const block = column.firstElementChild;+ return block?.classList.contains("ck-placeholder")+ ? block.getAttribute("data-placeholder")+ : null;+ });}it("shows in each column holding only an empty block, until text is typed there", () => {diff --cc packages/ckeditor5/src/plugins/multicolumn/multicolumn_editing.tsindex 00134dde0b,6e4060439b..8f3d986613--- a/packages/ckeditor5/src/plugins/multicolumn/multicolumn_editing.ts+++ b/packages/ckeditor5/src/plugins/multicolumn/multicolumn_editing.ts@@@ -106,13 -105,13 +106,13 @@@ export default class MulticolumnEditin});conversion.for("editingDowncast").elementToElement({model: ELEMENTS.column,- view: (column, { writer }) => {- const section: ViewEditableElement & PlaceholderableViewElement =- writer.createEditableElement("section");- section.placeholder = getColumnPlaceholder(t, column.index ?? 0);- view: (_model, { writer }) => {++ view: (model, { writer }) => {+ const column: ViewEditableElement & PlaceholderableViewElement =+ writer.createEditableElement("div", { class: COLUMN_CLASS });- column.placeholder = t("Type content here…");++ column.placeholder = getColumnPlaceholder(t, model.index ?? 0);enableViewPlaceholder({view: editor.editing.view,- element: section,+ element: column,isDirectHost: false,keepOnFocus: true});@@@ -153,28 -152,6 +153,19 @@@}}+/**+ * The placeholder of the column at `index`, which names its position. A layout has at most+ * `MAX_COLUMNS` (four) columns.+ */+function getColumnPlaceholder(t: LocaleTranslate, index: number) {+ switch (index) {+ case 0: return t("Type the content of the first column");+ case 1: return t("Type the content of the second column");+ case 2: return t("Type the content of the third column");+ default: return t("Type the content of the fourth column");+ }+}+- /** Matches a `<section>` directly inside a layout. Columns have no class of their own. */- function matchColumn(element: ViewElement) {- const parent = element.parent;- if (element.name === "section" && parent?.is("element") && parent.hasClass(LAYOUT_CLASS)) {- return { name: true };- }- return null;- }-function collectLayoutsAround(position: ModelPosition, layouts: Set<ModelElement>) {for (const ancestor of position.getAncestors()) {if (ancestor.is("element", ELEMENTS.layout)) {