diff --git a/examples/02-backend/04-rendering-static-documents/src/App.tsx b/examples/02-backend/04-rendering-static-documents/src/App.tsx index b6ffd098a0..3a5db9891b 100644 --- a/examples/02-backend/04-rendering-static-documents/src/App.tsx +++ b/examples/02-backend/04-rendering-static-documents/src/App.tsx @@ -22,17 +22,17 @@ This example has the HTML hard-coded, but shows at least how the document will b export default function App() { // This HTML is generated by the ServerBlockNoteEditor.blocksToFullHTML method const html = `
-
-
-
+
+
+

Heading 2

-
-
-
+
+
+

Paragraph

diff --git a/examples/06-custom-schema/08-non-editable-block/.bnexample.json b/examples/06-custom-schema/08-non-editable-block/.bnexample.json new file mode 100644 index 0000000000..c94d1e9154 --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/.bnexample.json @@ -0,0 +1,6 @@ +{ + "playground": true, + "docs": false, + "author": "matthewlipski", + "tags": ["Intermediate", "Blocks", "Custom Schemas"] +} diff --git a/examples/06-custom-schema/08-non-editable-block/README.md b/examples/06-custom-schema/08-non-editable-block/README.md new file mode 100644 index 0000000000..9c7cce19d1 --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/README.md @@ -0,0 +1,8 @@ +# Non-Editable Block + +In this example, we create a custom block which renders a simple HTML paragraph with placeholder text. The block has no editable content. + +**Relevant Docs:** + +- [Custom Blocks](/docs/features/custom-schemas/custom-blocks) +- [Editor Setup](/docs/getting-started/editor-setup) diff --git a/examples/06-custom-schema/08-non-editable-block/index.html b/examples/06-custom-schema/08-non-editable-block/index.html new file mode 100644 index 0000000000..9b55422066 --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/index.html @@ -0,0 +1,14 @@ + + + + + Non-Editable Block + + + +
+ + + diff --git a/examples/06-custom-schema/08-non-editable-block/main.tsx b/examples/06-custom-schema/08-non-editable-block/main.tsx new file mode 100644 index 0000000000..677c7f7eed --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/main.tsx @@ -0,0 +1,11 @@ +// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY +import React from "react"; +import { createRoot } from "react-dom/client"; +import App from "./src/App.jsx"; + +const root = createRoot(document.getElementById("root")!); +root.render( + + + +); diff --git a/examples/06-custom-schema/08-non-editable-block/package.json b/examples/06-custom-schema/08-non-editable-block/package.json new file mode 100644 index 0000000000..525adc0964 --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/package.json @@ -0,0 +1,31 @@ +{ + "name": "@blocknote/example-custom-schema-non-editable-block", + "description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY", + "type": "module", + "private": true, + "version": "0.12.4", + "scripts": { + "start": "vite", + "dev": "vite", + "build:prod": "tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@blocknote/ariakit": "latest", + "@blocknote/core": "latest", + "@blocknote/mantine": "latest", + "@blocknote/react": "latest", + "@blocknote/shadcn": "latest", + "@mantine/core": "^8.3.11", + "@mantine/hooks": "^8.3.11", + "@mantine/utils": "^6.0.22", + "react": "^19.2.3", + "react-dom": "^19.2.3" + }, + "devDependencies": { + "@types/react": "^19.2.3", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.1", + "vite": "^8.0.8" + } +} \ No newline at end of file diff --git a/examples/06-custom-schema/08-non-editable-block/src/App.tsx b/examples/06-custom-schema/08-non-editable-block/src/App.tsx new file mode 100644 index 0000000000..78a611081f --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/src/App.tsx @@ -0,0 +1,38 @@ +import { BlockNoteSchema } from "@blocknote/core"; +import "@blocknote/core/fonts/inter.css"; +import { BlockNoteView } from "@blocknote/mantine"; +import "@blocknote/mantine/style.css"; +import { useCreateBlockNote } from "@blocknote/react"; + +import { createNonEditableBlock } from "./NonEditableBlock"; + +// Our schema with block specs, which contain the configs and implementations for +// blocks that we want our editor to use. +const schema = BlockNoteSchema.create().extend({ + blockSpecs: { + // Creates an instance of the Non-Editable block and adds it to the schema. + nonEditable: createNonEditableBlock(), + }, +}); + +export default function App() { + // Creates a new editor instance. + const editor = useCreateBlockNote({ + schema, + initialContent: [ + { + type: "paragraph", + content: "Welcome to this demo!", + }, + { + type: "nonEditable", + }, + { + type: "paragraph", + }, + ], + }); + + // Renders the editor instance. + return ; +} diff --git a/examples/06-custom-schema/08-non-editable-block/src/NonEditableBlock.tsx b/examples/06-custom-schema/08-non-editable-block/src/NonEditableBlock.tsx new file mode 100644 index 0000000000..a930c21f74 --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/src/NonEditableBlock.tsx @@ -0,0 +1,13 @@ +import { createReactBlockSpec } from "@blocknote/react"; + +// The Non-Editable block. +export const createNonEditableBlock = createReactBlockSpec( + { + type: "nonEditable", + propSchema: {}, + content: "none", + }, + { + render: () =>

This is a non-editable block.

, + }, +); diff --git a/examples/06-custom-schema/08-non-editable-block/tsconfig.json b/examples/06-custom-schema/08-non-editable-block/tsconfig.json new file mode 100644 index 0000000000..dbe3e6f62d --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/tsconfig.json @@ -0,0 +1,36 @@ +{ + "__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY", + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "lib": [ + "DOM", + "DOM.Iterable", + "ESNext" + ], + "allowJs": false, + "skipLibCheck": true, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "ESNext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + "composite": true + }, + "include": [ + "." + ], + "__ADD_FOR_LOCAL_DEV_references": [ + { + "path": "../../../packages/core/" + }, + { + "path": "../../../packages/react/" + } + ] +} \ No newline at end of file diff --git a/examples/06-custom-schema/08-non-editable-block/vite.config.ts b/examples/06-custom-schema/08-non-editable-block/vite.config.ts new file mode 100644 index 0000000000..f62ab20bc2 --- /dev/null +++ b/examples/06-custom-schema/08-non-editable-block/vite.config.ts @@ -0,0 +1,32 @@ +// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY +import react from "@vitejs/plugin-react"; +import * as fs from "fs"; +import * as path from "path"; +import { defineConfig } from "vite"; +// import eslintPlugin from "vite-plugin-eslint"; +// https://vitejs.dev/config/ +export default defineConfig((conf) => ({ + plugins: [react()], + optimizeDeps: {}, + build: { + sourcemap: true, + }, + resolve: { + alias: + conf.command === "build" || + !fs.existsSync(path.resolve(__dirname, "../../packages/core/src")) + ? {} + : ({ + // Comment out the lines below to load a built version of blocknote + // or, keep as is to load live from sources with live reload working + "@blocknote/core": path.resolve( + __dirname, + "../../packages/core/src/" + ), + "@blocknote/react": path.resolve( + __dirname, + "../../packages/react/src/" + ), + } as any), + }, +})); diff --git a/packages/core/src/blocks/Table/TableExtension.ts b/packages/core/src/blocks/Table/TableExtension.ts index 3660d8c620..1d2cf9d47f 100644 --- a/packages/core/src/blocks/Table/TableExtension.ts +++ b/packages/core/src/blocks/Table/TableExtension.ts @@ -1,5 +1,14 @@ import { callOrReturn, Extension, getExtensionField } from "@tiptap/core"; -import { columnResizing, goToNextCell, tableEditing } from "prosemirror-tables"; +import { TextSelection } from "prosemirror-state"; +import { + columnResizing, + goToNextCell, + isInTable, + moveCellForward, + nextCell, + selectionCell, + tableEditing, +} from "prosemirror-tables"; export const RESIZE_MIN_WIDTH = 35; export const EMPTY_CELL_WIDTH = 120; @@ -24,19 +33,39 @@ export const TableExtension = Extension.create({ addKeyboardShortcuts() { return { - // Makes enter create a new line within the cell. + // Moves the selection to the cell below. Enter: () => { if ( - this.editor.state.selection.empty && - this.editor.state.selection.$head.parent.type.name === - "tableParagraph" + this.editor.state.selection.$head.parent.type.name !== + "tableParagraph" ) { - this.editor.commands.insertContent({ type: "hardBreak" }); - - return true; + return false; } - return false; + return this.editor.commands.command(({ state, dispatch }) => { + if (!isInTable(state)) { + return false; + } + + const $cell = selectionCell(state); + const $nextCell = nextCell($cell, "vert", 1); + + if (!$nextCell) { + return false; + } + + if (dispatch) { + dispatch( + state.tr + .setSelection( + TextSelection.between($nextCell, moveCellForward($nextCell)), + ) + .scrollIntoView(), + ); + } + + return true; + }); }, // Ensures that backspace won't delete the table if the text cursor is at // the start of a cell and the selection is empty. diff --git a/packages/core/src/editor/Block.css b/packages/core/src/editor/Block.css index 6a079f7863..4315c528f5 100644 --- a/packages/core/src/editor/Block.css +++ b/packages/core/src/editor/Block.css @@ -486,12 +486,25 @@ NESTED BLOCKS padding: 12px; } +[data-file-block] .bn-add-file-button:where(.dark, .dark *) { + background-color: rgb(70, 70, 70); + color: rgb(190, 190, 190); +} + .bn-editor[contenteditable="true"] [data-file-block] .bn-add-file-button:hover, [data-file-block] .bn-file-name-with-icon:hover, .ProseMirror-selectednode .bn-file-name-with-icon { background-color: rgb(225, 225, 225); } +.bn-editor[contenteditable="true"] + [data-file-block] + .bn-add-file-button:hover:where(.dark, .dark *), +[data-file-block] .bn-file-name-with-icon:hover:where(.dark, .dark *), +.ProseMirror-selectednode .bn-file-name-with-icon:where(.dark, .dark *) { + background-color: rgb(90, 90, 90); +} + [data-file-block] .bn-add-file-button-icon, [data-file-block] .bn-file-icon { width: 24px; @@ -561,110 +574,92 @@ NESTED BLOCKS /* TEXT COLORS */ [data-style-type="textColor"][data-value="gray"], -[data-text-color="gray"], .bn-block:has(> .bn-block-content[data-text-color="gray"]) { color: #9b9a97; } [data-style-type="textColor"][data-value="brown"], -[data-text-color="brown"], .bn-block:has(> .bn-block-content[data-text-color="brown"]) { color: #64473a; } [data-style-type="textColor"][data-value="red"], -[data-text-color="red"], .bn-block:has(> .bn-block-content[data-text-color="red"]) { color: #e03e3e; } [data-style-type="textColor"][data-value="orange"], -[data-text-color="orange"], .bn-block:has(> .bn-block-content[data-text-color="orange"]) { color: #d9730d; } [data-style-type="textColor"][data-value="yellow"], -[data-text-color="yellow"], .bn-block:has(> .bn-block-content[data-text-color="yellow"]) { color: #dfab01; } [data-style-type="textColor"][data-value="green"], -[data-text-color="green"], .bn-block:has(> .bn-block-content[data-text-color="green"]) { color: #4d6461; } [data-style-type="textColor"][data-value="blue"], -[data-text-color="blue"], .bn-block:has(> .bn-block-content[data-text-color="blue"]) { color: #0b6e99; } [data-style-type="textColor"][data-value="purple"], -[data-text-color="purple"], .bn-block:has(> .bn-block-content[data-text-color="purple"]) { color: #6940a5; } [data-style-type="textColor"][data-value="pink"], -[data-text-color="pink"], .bn-block:has(> .bn-block-content[data-text-color="pink"]) { color: #ad1a72; } /* BACKGROUND COLORS */ [data-style-type="backgroundColor"][data-value="gray"], -[data-background-color="gray"], .bn-block:has(> .bn-block-content[data-background-color="gray"]) { background-color: #ebeced; } [data-style-type="backgroundColor"][data-value="brown"], -[data-background-color="brown"], .bn-block:has(> .bn-block-content[data-background-color="brown"]) { background-color: #e9e5e3; } [data-style-type="backgroundColor"][data-value="red"], -[data-background-color="red"], .bn-block:has(> .bn-block-content[data-background-color="red"]) { background-color: #fbe4e4; } [data-style-type="backgroundColor"][data-value="orange"], -[data-background-color="orange"], .bn-block:has(> .bn-block-content[data-background-color="orange"]) { background-color: #f6e9d9; } [data-style-type="backgroundColor"][data-value="yellow"], -[data-background-color="yellow"], .bn-block:has(> .bn-block-content[data-background-color="yellow"]) { background-color: #fbf3db; } [data-style-type="backgroundColor"][data-value="green"], -[data-background-color="green"], .bn-block:has(> .bn-block-content[data-background-color="green"]) { background-color: #ddedea; } [data-style-type="backgroundColor"][data-value="blue"], -[data-background-color="blue"], .bn-block:has(> .bn-block-content[data-background-color="blue"]) { background-color: #ddebf1; } [data-style-type="backgroundColor"][data-value="purple"], -[data-background-color="purple"], .bn-block:has(> .bn-block-content[data-background-color="purple"]) { background-color: #eae4f2; } [data-style-type="backgroundColor"][data-value="pink"], -[data-background-color="pink"], .bn-block:has(> .bn-block-content[data-background-color="pink"]) { background-color: #f4dfeb; } diff --git a/packages/core/src/i18n/locales/ar.ts b/packages/core/src/i18n/locales/ar.ts index 00574debed..37abc3e30b 100644 --- a/packages/core/src/i18n/locales/ar.ts +++ b/packages/core/src/i18n/locales/ar.ts @@ -214,7 +214,7 @@ export const ar: Dictionary = { text_title: "نص", background_title: "خلفية", colors: { - default: "افتراضي", + default: "تلقائي", gray: "رمادي", brown: "بني", red: "أحمر", @@ -369,9 +369,11 @@ export const ar: Dictionary = { edited: "تم التحرير", save_button_text: "حفظ", cancel_button_text: "إلغاء", + deleted_reference_text: "تم حذف المحتوى الأصلي", actions: { add_reaction: "أضف تفاعلًا", resolve: "حل", + reopen: "إعادة فتح", edit_comment: "تحرير التعليق", delete_comment: "حذف التعليق", more_actions: "المزيد من الإجراءات", diff --git a/packages/core/src/i18n/locales/de.ts b/packages/core/src/i18n/locales/de.ts index cac48dd80a..40944212b3 100644 --- a/packages/core/src/i18n/locales/de.ts +++ b/packages/core/src/i18n/locales/de.ts @@ -249,7 +249,7 @@ export const de: Dictionary = { text_title: "Text", background_title: "Hintergrund", colors: { - default: "Standard", + default: "Automatisch", gray: "Grau", brown: "Braun", red: "Rot", @@ -403,9 +403,11 @@ export const de: Dictionary = { edited: "bearbeitet", save_button_text: "Speichern", cancel_button_text: "Abbrechen", + deleted_reference_text: "Originalinhalt gelöscht", actions: { add_reaction: "Reaktion hinzufügen", resolve: "Lösen", + reopen: "Wieder öffnen", edit_comment: "Kommentar bearbeiten", delete_comment: "Kommentar löschen", more_actions: "Weitere Aktionen", diff --git a/packages/core/src/i18n/locales/en.ts b/packages/core/src/i18n/locales/en.ts index af7927d207..784d130094 100644 --- a/packages/core/src/i18n/locales/en.ts +++ b/packages/core/src/i18n/locales/en.ts @@ -229,7 +229,7 @@ export const en = { text_title: "Text", background_title: "Background", colors: { - default: "Default", + default: "Auto", gray: "Gray", brown: "Brown", red: "Red", @@ -384,9 +384,11 @@ export const en = { edited: "edited", save_button_text: "Save", cancel_button_text: "Cancel", + deleted_reference_text: "Original content deleted", actions: { add_reaction: "Add reaction", resolve: "Resolve", + reopen: "Re-open", edit_comment: "Edit comment", delete_comment: "Delete comment", more_actions: "More actions", diff --git a/packages/core/src/i18n/locales/es.ts b/packages/core/src/i18n/locales/es.ts index 9e830b406b..4757d9784f 100644 --- a/packages/core/src/i18n/locales/es.ts +++ b/packages/core/src/i18n/locales/es.ts @@ -228,7 +228,7 @@ export const es: Dictionary = { text_title: "Texto", background_title: "Fondo", colors: { - default: "Por defecto", + default: "Automático", gray: "Gris", brown: "Marrón", red: "Rojo", @@ -382,9 +382,11 @@ export const es: Dictionary = { edited: "editado", save_button_text: "Guardar", cancel_button_text: "Cancelar", + deleted_reference_text: "Contenido original eliminado", actions: { add_reaction: "Agregar reacción", resolve: "Resolver", + reopen: "Reabrir", edit_comment: "Editar comentario", delete_comment: "Eliminar comentario", more_actions: "Más acciones", diff --git a/packages/core/src/i18n/locales/fa.ts b/packages/core/src/i18n/locales/fa.ts index f72270e04e..dff80beb81 100644 --- a/packages/core/src/i18n/locales/fa.ts +++ b/packages/core/src/i18n/locales/fa.ts @@ -197,7 +197,7 @@ export const fa = { text_title: "متن", background_title: "پس‌زمینه", colors: { - default: "پیش‌فرض", + default: "خودکار", gray: "خاکستری", brown: "قهوه‌ای", red: "قرمز", @@ -352,9 +352,11 @@ export const fa = { edited: "ویرایش شده", save_button_text: "ذخیره", cancel_button_text: "لغو", + deleted_reference_text: "محتوای اصلی حذف شد", actions: { add_reaction: "افزودن واکنش", resolve: "حل کردن", + reopen: "باز کردن مجدد", edit_comment: "ویرایش دیدگاه", delete_comment: "حذف دیدگاه", more_actions: "اقدامات بیشتر", diff --git a/packages/core/src/i18n/locales/fr.ts b/packages/core/src/i18n/locales/fr.ts index b56e6942f6..bfb3350366 100644 --- a/packages/core/src/i18n/locales/fr.ts +++ b/packages/core/src/i18n/locales/fr.ts @@ -275,7 +275,7 @@ export const fr: Dictionary = { text_title: "Texte", background_title: "Fond", colors: { - default: "Défaut", + default: "Auto", gray: "Gris", brown: "Marron", red: "Rouge", @@ -430,9 +430,11 @@ export const fr: Dictionary = { edited: "modifié", save_button_text: "Enregistrer", cancel_button_text: "Annuler", + deleted_reference_text: "Contenu d'origine supprimé", actions: { add_reaction: "Ajouter une réaction", resolve: "Résoudre", + reopen: "Rouvrir", edit_comment: "Modifier le commentaire", delete_comment: "Supprimer le commentaire", more_actions: "Plus d'actions", diff --git a/packages/core/src/i18n/locales/he.ts b/packages/core/src/i18n/locales/he.ts index 553fc42941..59cdc56414 100644 --- a/packages/core/src/i18n/locales/he.ts +++ b/packages/core/src/i18n/locales/he.ts @@ -230,7 +230,7 @@ export const he: Dictionary = { text_title: "טקסט", background_title: "רקע", colors: { - default: "ברירת מחדל", + default: "אוטומטי", gray: "אפור", brown: "חום", red: "אדום", @@ -384,9 +384,11 @@ export const he: Dictionary = { edited: "נערך", save_button_text: "שמור", cancel_button_text: "בטל", + deleted_reference_text: "התוכן המקורי נמחק", actions: { add_reaction: "הוסף תגובה", resolve: "סמן כפתור", + reopen: "פתח מחדש", edit_comment: "ערוך תגובה", delete_comment: "מחק תגובה", more_actions: "פעולות נוספות", diff --git a/packages/core/src/i18n/locales/hr.ts b/packages/core/src/i18n/locales/hr.ts index 31c0b71159..c2081599cc 100644 --- a/packages/core/src/i18n/locales/hr.ts +++ b/packages/core/src/i18n/locales/hr.ts @@ -242,7 +242,7 @@ export const hr: Dictionary = { text_title: "Tekst", background_title: "Pozadina", colors: { - default: "Zadano", + default: "Automatski", gray: "Siva", brown: "Smeđa", red: "Crvena", @@ -397,9 +397,11 @@ export const hr: Dictionary = { edited: "uredio", save_button_text: "Spremi", cancel_button_text: "Odustani", + deleted_reference_text: "Originalni sadržaj je obrisan", actions: { add_reaction: "Dodaj reakciju", resolve: "Riješi", + reopen: "Ponovno otvori", edit_comment: "Uredi komentar", delete_comment: "Obriši komentar", more_actions: "Više radnji", diff --git a/packages/core/src/i18n/locales/is.ts b/packages/core/src/i18n/locales/is.ts index 25060d651f..fcde471e56 100644 --- a/packages/core/src/i18n/locales/is.ts +++ b/packages/core/src/i18n/locales/is.ts @@ -242,7 +242,7 @@ export const is: Dictionary = { text_title: "Texti", background_title: "Bakgrunnur", colors: { - default: "Sjálfgefið", + default: "Sjálfvirkt", gray: "Grár", brown: "Brúnn", red: "Rauður", @@ -397,9 +397,11 @@ export const is: Dictionary = { edited: "breytt", save_button_text: "Vista", cancel_button_text: "Hætta", + deleted_reference_text: "Upprunalegu efni eytt", actions: { add_reaction: "Bæta við viðbrögðum", resolve: "Leysa", + reopen: "Opna aftur", edit_comment: "Breyta athugasemd", delete_comment: "Eyða athugasemd", more_actions: "Fleiri aðgerðir", diff --git a/packages/core/src/i18n/locales/it.ts b/packages/core/src/i18n/locales/it.ts index 45d9dcd277..4053581107 100644 --- a/packages/core/src/i18n/locales/it.ts +++ b/packages/core/src/i18n/locales/it.ts @@ -251,7 +251,7 @@ export const it: Dictionary = { text_title: "Testo", background_title: "Sfondo", colors: { - default: "Predefinito", + default: "Automatico", gray: "Grigio", brown: "Marrone", red: "Rosso", @@ -406,9 +406,11 @@ export const it: Dictionary = { edited: "modificato", save_button_text: "Salva", cancel_button_text: "Annulla", + deleted_reference_text: "Contenuto originale eliminato", actions: { add_reaction: "Aggiungi reazione", resolve: "Risolvi", + reopen: "Riapri", edit_comment: "Modifica commento", delete_comment: "Elimina commento", more_actions: "Altre azioni", diff --git a/packages/core/src/i18n/locales/ja.ts b/packages/core/src/i18n/locales/ja.ts index 236b834443..ce5ba87a77 100644 --- a/packages/core/src/i18n/locales/ja.ts +++ b/packages/core/src/i18n/locales/ja.ts @@ -269,7 +269,7 @@ export const ja: Dictionary = { text_title: "文字色", background_title: "背景色", colors: { - default: "デフォルト", + default: "自動", gray: "グレー", brown: "茶色", red: "赤", @@ -424,9 +424,11 @@ export const ja: Dictionary = { edited: "編集済み", save_button_text: "保存", cancel_button_text: "キャンセル", + deleted_reference_text: "元のコンテンツが削除されました", actions: { add_reaction: "リアクションを追加", resolve: "解決", + reopen: "再開", edit_comment: "コメントを編集", delete_comment: "コメントを削除", more_actions: "その他の操作", diff --git a/packages/core/src/i18n/locales/ko.ts b/packages/core/src/i18n/locales/ko.ts index cce4c8f7c6..53a5def39e 100644 --- a/packages/core/src/i18n/locales/ko.ts +++ b/packages/core/src/i18n/locales/ko.ts @@ -242,7 +242,7 @@ export const ko: Dictionary = { text_title: "텍스트", background_title: "배경", colors: { - default: "기본", + default: "자동", gray: "회색", brown: "갈색", red: "빨간색", @@ -397,9 +397,11 @@ export const ko: Dictionary = { edited: "수정됨", save_button_text: "저장", cancel_button_text: "취소", + deleted_reference_text: "원본 콘텐츠 삭제됨", actions: { add_reaction: "반응 추가", resolve: "해결", + reopen: "다시 열기", edit_comment: "댓글 수정", delete_comment: "댓글 삭제", more_actions: "더 많은 작업", diff --git a/packages/core/src/i18n/locales/nl.ts b/packages/core/src/i18n/locales/nl.ts index 6d1f48cde2..a1bff3fc6b 100644 --- a/packages/core/src/i18n/locales/nl.ts +++ b/packages/core/src/i18n/locales/nl.ts @@ -230,7 +230,7 @@ export const nl: Dictionary = { text_title: "Tekst", background_title: "Achtergrond", colors: { - default: "Standaard", + default: "Automatisch", gray: "Grijs", brown: "Bruin", red: "Rood", @@ -384,9 +384,11 @@ export const nl: Dictionary = { edited: "bewerkt", save_button_text: "Opslaan", cancel_button_text: "Annuleren", + deleted_reference_text: "Originele inhoud verwijderd", actions: { add_reaction: "Reactie toevoegen", resolve: "Oplossen", + reopen: "Heropenen", edit_comment: "Reactie bewerken", delete_comment: "Reactie verwijderen", more_actions: "Meer acties", diff --git a/packages/core/src/i18n/locales/no.ts b/packages/core/src/i18n/locales/no.ts index c28cac2b9f..5d518d116b 100644 --- a/packages/core/src/i18n/locales/no.ts +++ b/packages/core/src/i18n/locales/no.ts @@ -247,7 +247,7 @@ export const no: Dictionary = { text_title: "Tekst", background_title: "Bakgrunn", colors: { - default: "Standard", + default: "Automatisk", gray: "Grå", brown: "Brun", red: "Rød", @@ -401,9 +401,11 @@ export const no: Dictionary = { edited: "redigert", save_button_text: "Lagre", cancel_button_text: "Avbryt", + deleted_reference_text: "Originalt innhold slettet", actions: { add_reaction: "Legg til reaksjon", resolve: "Løs", + reopen: "Gjenåpne", edit_comment: "Rediger kommentar", delete_comment: "Slett kommentar", more_actions: "Flere handlinger", diff --git a/packages/core/src/i18n/locales/pl.ts b/packages/core/src/i18n/locales/pl.ts index 35bf1f255a..614f64e9f2 100644 --- a/packages/core/src/i18n/locales/pl.ts +++ b/packages/core/src/i18n/locales/pl.ts @@ -220,7 +220,7 @@ export const pl: Dictionary = { text_title: "Tekst", background_title: "Tło", colors: { - default: "Domyślny", + default: "Automatyczny", gray: "Szary", brown: "Brązowy", red: "Czerwony", @@ -375,9 +375,11 @@ export const pl: Dictionary = { edited: "edytowany", save_button_text: "Zapisz", cancel_button_text: "Anuluj", + deleted_reference_text: "Oryginalna treść usunięta", actions: { add_reaction: "Dodaj reakcję", resolve: "Rozwiąż", + reopen: "Otwórz ponownie", edit_comment: "Edytuj komentarz", delete_comment: "Usuń komentarz", more_actions: "Więcej akcji", diff --git a/packages/core/src/i18n/locales/pt.ts b/packages/core/src/i18n/locales/pt.ts index 7801cd2d36..c12c94012e 100644 --- a/packages/core/src/i18n/locales/pt.ts +++ b/packages/core/src/i18n/locales/pt.ts @@ -221,7 +221,7 @@ export const pt: Dictionary = { text_title: "Texto", background_title: "Fundo", colors: { - default: "Padrão", + default: "Automático", gray: "Cinza", brown: "Marrom", red: "Vermelho", @@ -376,9 +376,11 @@ export const pt: Dictionary = { edited: "editado", save_button_text: "Salvar", cancel_button_text: "Cancelar", + deleted_reference_text: "Conteúdo original excluído", actions: { add_reaction: "Adicionar reação", resolve: "Resolver", + reopen: "Reabrir", edit_comment: "Editar comentário", delete_comment: "Excluir comentário", more_actions: "Mais ações", diff --git a/packages/core/src/i18n/locales/ru.ts b/packages/core/src/i18n/locales/ru.ts index 0c7537b1bc..2982c8f5f6 100644 --- a/packages/core/src/i18n/locales/ru.ts +++ b/packages/core/src/i18n/locales/ru.ts @@ -272,7 +272,7 @@ export const ru: Dictionary = { text_title: "Текст", background_title: "Задний фон", colors: { - default: "По умолчанию", + default: "Авто", gray: "Серый", brown: "Коричневый", red: "Красный", @@ -427,9 +427,11 @@ export const ru: Dictionary = { edited: "изменен", save_button_text: "Сохранить", cancel_button_text: "Отменить", + deleted_reference_text: "Исходный контент удалён", actions: { add_reaction: "Добавить реакцию", resolve: "Решить", + reopen: "Возобновить", edit_comment: "Редактировать комментарий", delete_comment: "Удалить комментарий", more_actions: "Другие действия", diff --git a/packages/core/src/i18n/locales/sk.ts b/packages/core/src/i18n/locales/sk.ts index cbdd0b706f..c1691e17e7 100644 --- a/packages/core/src/i18n/locales/sk.ts +++ b/packages/core/src/i18n/locales/sk.ts @@ -228,7 +228,7 @@ export const sk = { text_title: "Text", background_title: "Pozadie", colors: { - default: "Predvolená", + default: "Automaticky", gray: "Sivá", brown: "Hnedá", red: "Červená", @@ -382,9 +382,11 @@ export const sk = { edited: "upravený", save_button_text: "Uložiť", cancel_button_text: "Zrušiť", + deleted_reference_text: "Pôvodný obsah odstránený", actions: { add_reaction: "Pridať reakciu", resolve: "Vyriešiť", + reopen: "Znovu otvoriť", edit_comment: "Upraviť komentár", delete_comment: "Vymazať komentár", more_actions: "Ďalšie akcie", diff --git a/packages/core/src/i18n/locales/uk.ts b/packages/core/src/i18n/locales/uk.ts index a99a4259c6..a5d7d8f9af 100644 --- a/packages/core/src/i18n/locales/uk.ts +++ b/packages/core/src/i18n/locales/uk.ts @@ -254,7 +254,7 @@ export const uk: Dictionary = { text_title: "Текст", background_title: "Фон", colors: { - default: "За замовчуванням", + default: "Авто", gray: "Сірий", brown: "Коричневий", red: "Червоний", @@ -408,9 +408,11 @@ export const uk: Dictionary = { edited: "відредаговано", save_button_text: "Зберегти", cancel_button_text: "Скасувати", + deleted_reference_text: "Оригінальний вміст видалено", actions: { add_reaction: "Додати реакцію", resolve: "Вирішити", + reopen: "Відкрити знову", edit_comment: "Редагувати коментар", delete_comment: "Видалити коментар", more_actions: "Більше дій", diff --git a/packages/core/src/i18n/locales/uz.ts b/packages/core/src/i18n/locales/uz.ts index 8330db43b4..ffc8d04ac6 100644 --- a/packages/core/src/i18n/locales/uz.ts +++ b/packages/core/src/i18n/locales/uz.ts @@ -294,7 +294,7 @@ export const uz: Dictionary = { text_title: "Matn", background_title: "Fon", colors: { - default: "Standart", + default: "Avtomatik", gray: "Kulrang", brown: "Jigarrang", red: "Qizil", @@ -417,9 +417,11 @@ export const uz: Dictionary = { edited: "tahrirlangan", save_button_text: "Saqlash", cancel_button_text: "Bekor qilish", + deleted_reference_text: "Asl tarkib o‘chirildi", actions: { add_reaction: "Reaksiya qo‘shish", resolve: "Hal qilish", + reopen: "Qayta ochish", edit_comment: "Izohni tahrirlash", delete_comment: "Izohni o‘chirish", more_actions: "Boshqa amallar", diff --git a/packages/core/src/i18n/locales/vi.ts b/packages/core/src/i18n/locales/vi.ts index b300fdcfd0..cbe0e5e628 100644 --- a/packages/core/src/i18n/locales/vi.ts +++ b/packages/core/src/i18n/locales/vi.ts @@ -228,7 +228,7 @@ export const vi: Dictionary = { text_title: "Văn bản", background_title: "Nền", colors: { - default: "Mặc định", + default: "Tự động", gray: "Xám", brown: "Nâu", red: "Đỏ", @@ -383,9 +383,11 @@ export const vi: Dictionary = { edited: "đã chỉnh sửa", save_button_text: "Lưu", cancel_button_text: "Hủy", + deleted_reference_text: "Nội dung gốc đã bị xóa", actions: { add_reaction: "Thêm phản ứng", resolve: "Giải quyết", + reopen: "Mở lại", edit_comment: "Chỉnh sửa bình luận", delete_comment: "Xóa bình luận", more_actions: "Thêm hành động", diff --git a/packages/core/src/i18n/locales/zh-tw.ts b/packages/core/src/i18n/locales/zh-tw.ts index e9aa1e8ac6..b64912255f 100644 --- a/packages/core/src/i18n/locales/zh-tw.ts +++ b/packages/core/src/i18n/locales/zh-tw.ts @@ -270,7 +270,7 @@ export const zhTW: Dictionary = { text_title: "文字", background_title: "背景色", colors: { - default: "預設", + default: "自動", gray: "灰色", brown: "棕色", red: "紅色", @@ -425,9 +425,11 @@ export const zhTW: Dictionary = { edited: "已編輯", save_button_text: "儲存", cancel_button_text: "取消", + deleted_reference_text: "原始內容已刪除", actions: { add_reaction: "新增回應", resolve: "解決", + reopen: "重新開啟", edit_comment: "編輯評論", delete_comment: "刪除評論", more_actions: "更多操作", diff --git a/packages/core/src/i18n/locales/zh.ts b/packages/core/src/i18n/locales/zh.ts index b44c81aa36..ba5a2fe73b 100644 --- a/packages/core/src/i18n/locales/zh.ts +++ b/packages/core/src/i18n/locales/zh.ts @@ -270,7 +270,7 @@ export const zh: Dictionary = { text_title: "文本", background_title: "背景色", colors: { - default: "默认", + default: "自动", gray: "灰色", brown: "棕色", red: "红色", @@ -425,9 +425,11 @@ export const zh: Dictionary = { edited: "已编辑", save_button_text: "保存", cancel_button_text: "取消", + deleted_reference_text: "原始内容已删除", actions: { add_reaction: "添加反应", resolve: "解决", + reopen: "重新打开", edit_comment: "编辑评论", delete_comment: "删除评论", more_actions: "更多操作", diff --git a/packages/react/src/components/Comments/Comment.tsx b/packages/react/src/components/Comments/Comment.tsx index 5e65f28ad0..e1dd66871a 100644 --- a/packages/react/src/components/Comments/Comment.tsx +++ b/packages/react/src/components/Comments/Comment.tsx @@ -171,7 +171,7 @@ export const Comment = ({ (thread.resolved ? ( diff --git a/packages/react/src/components/Comments/FloatingComposer.tsx b/packages/react/src/components/Comments/FloatingComposer.tsx index aa3e786dd9..023a8eccf6 100644 --- a/packages/react/src/components/Comments/FloatingComposer.tsx +++ b/packages/react/src/components/Comments/FloatingComposer.tsx @@ -62,7 +62,7 @@ export function FloatingComposer< > { @@ -81,7 +81,7 @@ export function FloatingComposer< editor.focus(); }} > - Save + {dict.comments.save_button_text} )} diff --git a/packages/react/src/components/Comments/ThreadsSidebar.tsx b/packages/react/src/components/Comments/ThreadsSidebar.tsx index a3d282f952..efd26aa2cf 100644 --- a/packages/react/src/components/Comments/ThreadsSidebar.tsx +++ b/packages/react/src/components/Comments/ThreadsSidebar.tsx @@ -135,7 +135,7 @@ export function getReferenceText( ) { return editor.transact((tr) => { if (!threadPosition) { - return "Original content deleted"; + return editor.dictionary.comments.deleted_reference_text; } // TODO: Handles an edge case where the editor is re-rendered and the document diff --git a/packages/react/src/components/SideMenu/DragHandleMenu/DefaultItems/RemoveBlockItem.tsx b/packages/react/src/components/SideMenu/DragHandleMenu/DefaultItems/RemoveBlockItem.tsx index ddcf027534..12ade8b4ae 100644 --- a/packages/react/src/components/SideMenu/DragHandleMenu/DefaultItems/RemoveBlockItem.tsx +++ b/packages/react/src/components/SideMenu/DragHandleMenu/DefaultItems/RemoveBlockItem.tsx @@ -22,7 +22,14 @@ export const RemoveBlockItem = (props: { children: ReactNode }) => { return ( editor.removeBlocks([block])} + onClick={() => { + const selectedBlocks = editor.getSelection()?.blocks; + const blocksToRemove = + selectedBlocks && selectedBlocks.some((b) => b.id === block.id) + ? selectedBlocks + : [block]; + editor.removeBlocks(blocksToRemove); + }} > {props.children} diff --git a/packages/react/src/editor/styles.css b/packages/react/src/editor/styles.css index d659be3671..702116d310 100644 --- a/packages/react/src/editor/styles.css +++ b/packages/react/src/editor/styles.css @@ -141,92 +141,92 @@ /* Highlight color styling */ [data-style-type="textColor"][data-value="gray"], -[data-text-color="gray"] { +.bn-block:has(> .bn-block-content[data-text-color="gray"]) { color: var(--bn-colors-highlights-gray-text); } [data-style-type="textColor"][data-value="brown"], -[data-text-color="brown"] { +.bn-block:has(> .bn-block-content[data-text-color="brown"]) { color: var(--bn-colors-highlights-brown-text); } [data-style-type="textColor"][data-value="red"], -[data-text-color="red"] { +.bn-block:has(> .bn-block-content[data-text-color="red"]) { color: var(--bn-colors-highlights-red-text); } [data-style-type="textColor"][data-value="orange"], -[data-text-color="orange"] { +.bn-block:has(> .bn-block-content[data-text-color="orange"]) { color: var(--bn-colors-highlights-orange-text); } [data-style-type="textColor"][data-value="yellow"], -[data-text-color="yellow"] { +.bn-block:has(> .bn-block-content[data-text-color="yellow"]) { color: var(--bn-colors-highlights-yellow-text); } [data-style-type="textColor"][data-value="green"], -[data-text-color="green"] { +.bn-block:has(> .bn-block-content[data-text-color="green"]) { color: var(--bn-colors-highlights-green-text); } [data-style-type="textColor"][data-value="blue"], -[data-text-color="blue"] { +.bn-block:has(> .bn-block-content[data-text-color="blue"]) { color: var(--bn-colors-highlights-blue-text); } [data-style-type="textColor"][data-value="purple"], -[data-text-color="purple"] { +.bn-block:has(> .bn-block-content[data-text-color="purple"]) { color: var(--bn-colors-highlights-purple-text); } [data-style-type="textColor"][data-value="pink"], -[data-text-color="pink"] { +.bn-block:has(> .bn-block-content[data-text-color="pink"]) { color: var(--bn-colors-highlights-pink-text); } [data-style-type="backgroundColor"][data-value="gray"], -[data-background-color="gray"] { +.bn-block:has(> .bn-block-content[data-background-color="gray"]) { background-color: var(--bn-colors-highlights-gray-background); } [data-style-type="backgroundColor"][data-value="brown"], -[data-background-color="brown"] { +.bn-block:has(> .bn-block-content[data-background-color="brown"]) { background-color: var(--bn-colors-highlights-brown-background); } [data-style-type="backgroundColor"][data-value="red"], -[data-background-color="red"] { +.bn-block:has(> .bn-block-content[data-background-color="red"]) { background-color: var(--bn-colors-highlights-red-background); } [data-style-type="backgroundColor"][data-value="orange"], -[data-background-color="orange"] { +.bn-block:has(> .bn-block-content[data-background-color="orange"]) { background-color: var(--bn-colors-highlights-orange-background); } [data-style-type="backgroundColor"][data-value="yellow"], -[data-background-color="yellow"] { +.bn-block:has(> .bn-block-content[data-background-color="yellow"]) { background-color: var(--bn-colors-highlights-yellow-background); } [data-style-type="backgroundColor"][data-value="green"], -[data-background-color="green"] { +.bn-block:has(> .bn-block-content[data-background-color="green"]) { background-color: var(--bn-colors-highlights-green-background); } [data-style-type="backgroundColor"][data-value="blue"], -[data-background-color="blue"] { +.bn-block:has(> .bn-block-content[data-background-color="blue"]) { background-color: var(--bn-colors-highlights-blue-background); } [data-style-type="backgroundColor"][data-value="purple"], -[data-background-color="purple"] { +.bn-block:has(> .bn-block-content[data-background-color="purple"]) { background-color: var(--bn-colors-highlights-purple-background); } [data-style-type="backgroundColor"][data-value="pink"], -[data-background-color="pink"] { +.bn-block:has(> .bn-block-content[data-background-color="pink"]) { background-color: var(--bn-colors-highlights-pink-background); } diff --git a/playground/src/examples.gen.tsx b/playground/src/examples.gen.tsx index 5f219ff7fa..ae117ce392 100644 --- a/playground/src/examples.gen.tsx +++ b/playground/src/examples.gen.tsx @@ -1414,6 +1414,27 @@ }, "readme": "This example shows how you can configure the editor's default blocks. Specifically, heading blocks are made to only support levels 1-3, and cannot be toggleable.\n\n**Relevant Docs:**\n\n- [Editor Setup](/docs/getting-started/editor-setup)\n- [Default Schema](/docs/foundations/schemas)\n- [Custom Schemas](/docs/features/custom-schemas)" }, + { + "projectSlug": "non-editable-block", + "fullSlug": "custom-schema/non-editable-block", + "pathFromRoot": "examples/06-custom-schema/08-non-editable-block", + "config": { + "playground": true, + "docs": false, + "author": "matthewlipski", + "tags": [ + "Intermediate", + "Blocks", + "Custom Schemas" + ] + }, + "title": "Non-Editable Block", + "group": { + "pathFromRoot": "examples/06-custom-schema", + "slug": "custom-schema" + }, + "readme": "In this example, we create a custom block which renders a simple HTML paragraph with placeholder text. The block has no editable content.\n\n**Relevant Docs:**\n\n- [Custom Blocks](/docs/features/custom-schemas/custom-blocks)\n- [Editor Setup](/docs/getting-started/editor-setup)" + }, { "projectSlug": "draggable-inline-content", "fullSlug": "custom-schema/draggable-inline-content", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 317c09c8b5..46cc6ca3b3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3395,6 +3395,52 @@ importers: specifier: ^8.0.8 version: 8.0.8(@types/node@25.6.0)(esbuild@0.27.5)(jiti@2.6.1)(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.3) + examples/06-custom-schema/08-non-editable-block: + dependencies: + '@blocknote/ariakit': + specifier: latest + version: link:../../../packages/ariakit + '@blocknote/core': + specifier: latest + version: link:../../../packages/core + '@blocknote/mantine': + specifier: latest + version: link:../../../packages/mantine + '@blocknote/react': + specifier: latest + version: link:../../../packages/react + '@blocknote/shadcn': + specifier: latest + version: link:../../../packages/shadcn + '@mantine/core': + specifier: ^8.3.11 + version: 8.3.18(@mantine/hooks@8.3.18(react@19.2.5))(@types/react@19.2.14)(react-dom@19.2.5(react@19.2.5))(react@19.2.5) + '@mantine/hooks': + specifier: ^8.3.11 + version: 8.3.18(react@19.2.5) + '@mantine/utils': + specifier: ^6.0.22 + version: 6.0.22(react@19.2.5) + react: + specifier: ^19.2.3 + version: 19.2.5 + react-dom: + specifier: ^19.2.3 + version: 19.2.5(react@19.2.5) + devDependencies: + '@types/react': + specifier: ^19.2.3 + version: 19.2.14 + '@types/react-dom': + specifier: ^19.2.3 + version: 19.2.3(@types/react@19.2.14) + '@vitejs/plugin-react': + specifier: ^6.0.1 + version: 6.0.1(babel-plugin-react-compiler@1.0.0)(vite@8.0.8(@types/node@25.6.0)(esbuild@0.27.5)(jiti@2.6.1)(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.3)) + vite: + specifier: ^8.0.8 + version: 8.0.8(@types/node@25.6.0)(esbuild@0.27.5)(jiti@2.6.1)(terser@5.46.2)(tsx@4.21.0)(yaml@2.8.3) + examples/06-custom-schema/draggable-inline-content: dependencies: '@blocknote/ariakit': @@ -24027,8 +24073,8 @@ snapshots: '@next/eslint-plugin-next': 16.2.2 eslint: 9.39.4(jiti@2.6.1) eslint-import-resolver-node: 0.3.10 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.4(jiti@2.6.1)) - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)) + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.39.4(jiti@2.6.1)) eslint-plugin-react: 7.37.5(eslint@9.39.4(jiti@2.6.1)) eslint-plugin-react-hooks: 7.0.1(eslint@9.39.4(jiti@2.6.1)) @@ -24077,7 +24123,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.4(jiti@2.6.1)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.3 @@ -24088,7 +24134,7 @@ snapshots: tinyglobby: 0.2.16 unrs-resolver: 1.11.1 optionalDependencies: - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)) + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1)) transitivePeerDependencies: - supports-color @@ -24102,14 +24148,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3) eslint: 9.39.4(jiti@2.6.1) eslint-import-resolver-node: 0.3.10 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.4(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)) transitivePeerDependencies: - supports-color @@ -24150,7 +24196,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)): + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -24161,7 +24207,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.39.4(jiti@2.6.1) eslint-import-resolver-node: 0.3.10 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.10.1)(eslint@9.39.4(jiti@2.6.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.58.0(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)))(eslint@9.39.4(jiti@2.6.1)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 diff --git a/tests/src/end-to-end/copypaste/copypaste.test.ts b/tests/src/end-to-end/copypaste/copypaste.test.ts index aaf36897d6..b0a563c6ef 100644 --- a/tests/src/end-to-end/copypaste/copypaste.test.ts +++ b/tests/src/end-to-end/copypaste/copypaste.test.ts @@ -1,6 +1,10 @@ /* eslint-disable jest/valid-title */ import { test } from "../../setup/setupScript.js"; -import { BASE_URL } from "../../utils/const.js"; +import { + BASE_URL, + NON_EDITABLE_BLOCK_URL, + PARAGRAPH_SELECTOR, +} from "../../utils/const.js"; import { copyPaste, copyPasteAll, @@ -15,11 +19,11 @@ import { executeSlashCommand } from "../../utils/slashmenu.js"; test.describe.configure({ mode: "serial" }); -test.beforeEach(async ({ page }) => { - await page.goto(BASE_URL); -}); - test.describe("Check Copy/Paste Functionality", () => { + test.beforeEach(async ({ page }) => { + await page.goto(BASE_URL); + }); + test("Paragraphs should stay separate", async ({ page, browserName }) => { test.skip( browserName === "firefox" || browserName === "webkit", @@ -188,3 +192,40 @@ test.describe("Check Copy/Paste Functionality", () => { await compareDocToSnapshot(page, "images.json"); }); }); + +test.describe("Check Copy/Paste From Non-Editable Block", () => { + test.beforeEach(async ({ page }) => { + await page.goto(NON_EDITABLE_BLOCK_URL); + }); + + test("Should be able to copy/paste text from a non-editable block", async ({ + page, + browserName, + }) => { + test.skip( + browserName === "firefox" || browserName === "webkit", + "Firefox doesn't yet support the async clipboard API. Webkit copy/paste stopped working after updating to Playwright 1.33.", + ); + + // Click and drag across the non-editable block's text to select part of it. + const p = page.locator('[data-content-type="nonEditable"] p'); + const box = (await p.boundingBox())!; + await page.mouse.move(box.x + 2, box.y + box.height / 2); + await page.mouse.down(); + await page.mouse.move( + box.x + box.width * 0.25, + box.y + box.height / 2, + { steps: 5 }, + ); + await page.mouse.up(); + + await page.keyboard.press("ControlOrMeta+C"); + + // Click the last (empty) paragraph block to focus the editor. + await page.locator(PARAGRAPH_SELECTOR).last().click(); + + await page.keyboard.press("ControlOrMeta+V"); + + await compareDocToSnapshot(page, "nonEditableBlock.json"); + }); +}); diff --git a/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nonEditableBlock-json-chromium-linux.json b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nonEditableBlock-json-chromium-linux.json new file mode 100644 index 0000000000..154f585790 --- /dev/null +++ b/tests/src/end-to-end/copypaste/copypaste.test.ts-snapshots/nonEditableBlock-json-chromium-linux.json @@ -0,0 +1,95 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Welcome to this demo!" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "nonEditable" + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "marks": [ + { + "type": "textColor", + "attrs": { + "stringValue": "rgb(63, 63, 63)" + } + }, + { + "type": "backgroundColor", + "attrs": { + "stringValue": "rgb(255, 255, 255)" + } + } + ], + "text": "This is " + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "4" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts b/tests/src/end-to-end/draghandle/draghandle.test.ts index f77c414d2b..c2e9c3c211 100644 --- a/tests/src/end-to-end/draghandle/draghandle.test.ts +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts @@ -2,6 +2,7 @@ import { expect, Page } from "@playwright/test"; import { test } from "../../setup/setupScript.js"; import { BASE_URL, + BULLET_LIST_SELECTOR, DRAG_HANDLE_ADD_SELECTOR, DRAG_HANDLE_MENU_SELECTOR, DRAG_HANDLE_SELECTOR, @@ -158,6 +159,64 @@ test.describe("Check Draghandle functionality", () => { await compareDocToSnapshot(page, "dragHandleDocStructure"); }); + test("Delete button should delete all blocks in multi-block selection when hovered block is in selection", async () => { + await executeSlashCommand(page, "h1"); + await page.keyboard.type("Heading 1"); + await page.keyboard.press("Enter", { delay: 10 }); + await executeSlashCommand(page, "h2"); + await page.keyboard.type("Heading 2"); + await page.keyboard.press("Enter", { delay: 10 }); + await executeSlashCommand(page, "h3"); + await page.keyboard.type("Heading 3"); + await page.keyboard.press("Enter", { delay: 10 }); + await executeSlashCommand(page, "bullet"); + await page.keyboard.type("Bullet List"); + + await page.keyboard.down("Shift"); + await page.keyboard.press("ArrowUp"); + await page.keyboard.press("ControlOrMeta+ArrowLeft"); + await page.keyboard.up("Shift"); + + await page.hover(H_THREE_BLOCK_SELECTOR); + await page.click(DRAG_HANDLE_SELECTOR); + await page.click("text=Delete"); + await page.waitForSelector(H_ONE_BLOCK_SELECTOR); + await page.waitForSelector(H_TWO_BLOCK_SELECTOR); + await page.waitForSelector(H_THREE_BLOCK_SELECTOR, { state: "detached" }); + await page.waitForSelector(BULLET_LIST_SELECTOR, { state: "detached" }); + + await compareDocToSnapshot(page, "draghandledeletemultiselection"); + }); + + test("Delete button should delete only hovered block when it is outside multi-block selection", async () => { + await executeSlashCommand(page, "h1"); + await page.keyboard.type("Heading 1"); + await page.keyboard.press("Enter", { delay: 10 }); + await executeSlashCommand(page, "h2"); + await page.keyboard.type("Heading 2"); + await page.keyboard.press("Enter", { delay: 10 }); + await executeSlashCommand(page, "h3"); + await page.keyboard.type("Heading 3"); + await page.keyboard.press("Enter", { delay: 10 }); + await executeSlashCommand(page, "bullet"); + await page.keyboard.type("Bullet List"); + + await page.keyboard.down("Shift"); + await page.keyboard.press("ArrowUp"); + await page.keyboard.press("ControlOrMeta+ArrowLeft"); + await page.keyboard.up("Shift"); + + await page.hover(H_ONE_BLOCK_SELECTOR); + await page.click(DRAG_HANDLE_SELECTOR); + await page.click("text=Delete"); + await page.waitForSelector(H_ONE_BLOCK_SELECTOR, { state: "detached" }); + await page.waitForSelector(H_TWO_BLOCK_SELECTOR); + await page.waitForSelector(H_THREE_BLOCK_SELECTOR); + await page.waitForSelector(BULLET_LIST_SELECTOR); + + await compareDocToSnapshot(page, "draghandledeletehoveroutsideselection"); + }); + test("Deleting block with children should delete all children", async () => { await page.goto(BASE_URL, { waitUntil: "networkidle" }); await focusOnEditor(page); diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-chromium-linux.json new file mode 100644 index 0000000000..4a3ca359e4 --- /dev/null +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-chromium-linux.json @@ -0,0 +1,96 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 2, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 2" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "3" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 3, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 3" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "4" + }, + "content": [ + { + "type": "bulletListItem", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Bullet List" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-firefox-linux.json new file mode 100644 index 0000000000..4a3ca359e4 --- /dev/null +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-firefox-linux.json @@ -0,0 +1,96 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 2, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 2" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "3" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 3, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 3" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "4" + }, + "content": [ + { + "type": "bulletListItem", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Bullet List" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-webkit-linux.json new file mode 100644 index 0000000000..4a3ca359e4 --- /dev/null +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletehoveroutsideselection-webkit-linux.json @@ -0,0 +1,96 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 2, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 2" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "3" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 3, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 3" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "4" + }, + "content": [ + { + "type": "bulletListItem", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + }, + "content": [ + { + "type": "text", + "text": "Bullet List" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-chromium-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-chromium-linux.json new file mode 100644 index 0000000000..f95bb590b9 --- /dev/null +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-chromium-linux.json @@ -0,0 +1,74 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 1, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 1" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 2, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 2" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-firefox-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-firefox-linux.json new file mode 100644 index 0000000000..f95bb590b9 --- /dev/null +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-firefox-linux.json @@ -0,0 +1,74 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 1, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 1" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 2, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 2" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-webkit-linux.json b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-webkit-linux.json new file mode 100644 index 0000000000..f95bb590b9 --- /dev/null +++ b/tests/src/end-to-end/draghandle/draghandle.test.ts-snapshots/draghandledeletemultiselection-webkit-linux.json @@ -0,0 +1,74 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 1, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 1" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "2" + }, + "content": [ + { + "type": "heading", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left", + "level": 2, + "isToggleable": false + }, + "content": [ + { + "type": "text", + "text": "Heading 2" + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts b/tests/src/end-to-end/tables/tables.test.ts index 4d11d597e6..2abfc08c30 100644 --- a/tests/src/end-to-end/tables/tables.test.ts +++ b/tests/src/end-to-end/tables/tables.test.ts @@ -49,4 +49,22 @@ test.describe("Check Table interactions", () => { await compareDocToSnapshot(page, "arrowKeyCells.json"); }); + test("Enter should move to cell below", async ({ page }) => { + await focusOnEditor(page); + await executeSlashCommand(page, "table"); + await page.keyboard.type("Top"); + await page.keyboard.press("Enter"); + await page.keyboard.type("Bottom"); + + await compareDocToSnapshot(page, "enterMovesToCellBelow.json"); + }); + test("Shift+Enter should create a new line within cell", async ({ page }) => { + await focusOnEditor(page); + await executeSlashCommand(page, "table"); + await page.keyboard.type("Line 1"); + await page.keyboard.press("Shift+Enter"); + await page.keyboard.type("Line 2"); + + await compareDocToSnapshot(page, "shiftEnterNewLineInCell.json"); + }); }); diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-chromium-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-chromium-linux.json new file mode 100644 index 0000000000..cb17830afd --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-chromium-linux.json @@ -0,0 +1,160 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "table", + "attrs": { + "textColor": "default" + }, + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Top" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Bottom" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-firefox-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-firefox-linux.json new file mode 100644 index 0000000000..cb17830afd --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-firefox-linux.json @@ -0,0 +1,160 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "table", + "attrs": { + "textColor": "default" + }, + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Top" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Bottom" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-webkit-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-webkit-linux.json new file mode 100644 index 0000000000..cb17830afd --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/enterMovesToCellBelow-json-webkit-linux.json @@ -0,0 +1,160 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "table", + "attrs": { + "textColor": "default" + }, + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Top" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Bottom" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-chromium-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-chromium-linux.json new file mode 100644 index 0000000000..2c2cb65b20 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-chromium-linux.json @@ -0,0 +1,161 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "table", + "attrs": { + "textColor": "default" + }, + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Line 1" + }, + { + "type": "hardBreak" + }, + { + "type": "text", + "text": "Line 2" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-firefox-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-firefox-linux.json new file mode 100644 index 0000000000..2c2cb65b20 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-firefox-linux.json @@ -0,0 +1,161 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "table", + "attrs": { + "textColor": "default" + }, + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Line 1" + }, + { + "type": "hardBreak" + }, + { + "type": "text", + "text": "Line 2" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-webkit-linux.json b/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-webkit-linux.json new file mode 100644 index 0000000000..2c2cb65b20 --- /dev/null +++ b/tests/src/end-to-end/tables/tables.test.ts-snapshots/shiftEnterNewLineInCell-json-webkit-linux.json @@ -0,0 +1,161 @@ +{ + "type": "doc", + "content": [ + { + "type": "blockGroup", + "content": [ + { + "type": "blockContainer", + "attrs": { + "id": "0" + }, + "content": [ + { + "type": "table", + "attrs": { + "textColor": "default" + }, + "content": [ + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph", + "content": [ + { + "type": "text", + "text": "Line 1" + }, + { + "type": "hardBreak" + }, + { + "type": "text", + "text": "Line 2" + } + ] + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + }, + { + "type": "tableRow", + "content": [ + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + }, + { + "type": "tableCell", + "attrs": { + "textColor": "default", + "backgroundColor": "default", + "textAlignment": "left", + "colspan": 1, + "rowspan": 1, + "colwidth": null + }, + "content": [ + { + "type": "tableParagraph" + } + ] + } + ] + } + ] + } + ] + }, + { + "type": "blockContainer", + "attrs": { + "id": "1" + }, + "content": [ + { + "type": "paragraph", + "attrs": { + "backgroundColor": "default", + "textColor": "default", + "textAlignment": "left" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png index c362ca41d6..c49a73225c 100644 Binary files a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png and b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-chromium-linux.png differ diff --git a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png index 2ed10917f2..582afb7527 100644 Binary files a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png and b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-firefox-linux.png differ diff --git a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png index 612d4b47bc..311741e890 100644 Binary files a/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png and b/tests/src/end-to-end/theming/theming.test.ts-snapshots/dark-image-toolbar-webkit-linux.png differ diff --git a/tests/src/utils/const.ts b/tests/src/utils/const.ts index b04b77d6a2..7431d2db2a 100644 --- a/tests/src/utils/const.ts +++ b/tests/src/utils/const.ts @@ -43,6 +43,10 @@ export const ALERT_BLOCK_URL = !process.env.RUN_IN_DOCKER ? `http://localhost:${PORT}/custom-schema/alert-block?hideMenu` : `http://host.docker.internal:${PORT}/custom-schema/alert-block?hideMenu`; +export const NON_EDITABLE_BLOCK_URL = !process.env.RUN_IN_DOCKER + ? `http://localhost:${PORT}/custom-schema/non-editable-block?hideMenu` + : `http://host.docker.internal:${PORT}/custom-schema/non-editable-block?hideMenu`; + export const COMMENTS_URL = !process.env.RUN_IN_DOCKER ? `http://localhost:${PORT}/collaboration/comments-testing?hideMenu` : `http://host.docker.internal:${PORT}/collaboration/comments-testing?hideMenu`;