@blocknote/core 0.19.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/blocknote.js +2549 -2497
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +5 -1
- package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js +2 -40
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js +4 -0
- package/dist/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js +51 -9
- package/dist/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.js.map +1 -1
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js +2 -2
- package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.js.map +1 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js +1 -1
- package/dist/src/api/clipboard/fromClipboard/acceptedMIMETypes.js.map +1 -1
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js +4 -2
- package/dist/src/api/clipboard/fromClipboard/handleFileInsertion.js.map +1 -1
- package/dist/src/api/getBlockInfoFromPos.js +19 -25
- package/dist/src/api/getBlockInfoFromPos.js.map +1 -1
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js +8 -4
- package/dist/src/blocks/HeadingBlockContent/HeadingBlockContent.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js +5 -3
- package/dist/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js +12 -6
- package/dist/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js +5 -1
- package/dist/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.js.map +1 -1
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js +4 -2
- package/dist/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js.map +1 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js +2 -1
- package/dist/src/blocks/ParagraphBlockContent/ParagraphBlockContent.js.map +1 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js +0 -1
- package/dist/src/blocks/TableBlockContent/TableBlockContent.js.map +1 -1
- package/dist/src/editor/BlockNoteEditor.js +39 -43
- package/dist/src/editor/BlockNoteEditor.js.map +1 -1
- package/dist/src/editor/BlockNoteEditor.test.js +2 -2
- package/dist/src/editor/BlockNoteEditor.test.js.map +1 -1
- package/dist/src/editor/BlockNoteExtensions.js +52 -6
- package/dist/src/editor/BlockNoteExtensions.js.map +1 -1
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +36 -6
- package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -1
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js +35 -32
- package/dist/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js.map +1 -1
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +74 -71
- package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -1
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js +153 -149
- package/dist/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -6
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -5
- package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +0 -8
- package/src/api/blockManipulation/commands/moveBlock/moveBlock.test.ts +7 -3
- package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +439 -2
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.ts +6 -0
- package/src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts +2 -82
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +0 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +96 -20
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -6
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -5
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +0 -490
- package/src/api/clipboard/fromClipboard/acceptedMIMETypes.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +6 -5
- package/src/api/getBlockInfoFromPos.ts +20 -30
- package/src/api/parsers/html/__snapshots__/parse-notion-html.json +1 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +16 -4
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +9 -3
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +22 -6
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +5 -3
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +8 -2
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +4 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +0 -1
- package/src/editor/BlockNoteEditor.test.ts +2 -5
- package/src/editor/BlockNoteEditor.ts +71 -42
- package/src/editor/BlockNoteExtensions.ts +90 -14
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +36 -9
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +94 -90
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +173 -169
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +0 -3
- package/types/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.d.ts +4 -0
- package/types/src/api/blockManipulation/setupTestEnv.d.ts +0 -6
- package/types/src/api/clipboard/fromClipboard/acceptedMIMETypes.d.ts +1 -1
- package/types/src/api/getBlockInfoFromPos.d.ts +9 -34
- package/types/src/api/testUtil/cases/customBlocks.d.ts +0 -6
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +0 -6
- package/types/src/api/testUtil/cases/customStyles.d.ts +0 -6
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +0 -9
- package/types/src/blocks/defaultBlocks.d.ts +0 -12
- package/types/src/editor/BlockNoteEditor.d.ts +19 -2
- package/types/src/editor/BlockNoteExtensions.d.ts +14 -7
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +4 -1
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +4 -1
- package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +4 -5
package/dist/blocknote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocknote.js","sources":["../src/i18n/locales/ar.ts","../src/i18n/locales/de.ts","../src/i18n/locales/en.ts","../src/i18n/locales/es.ts","../src/i18n/locales/fr.ts","../src/i18n/locales/hr.ts","../src/i18n/locales/is.ts","../src/i18n/locales/ja.ts","../src/i18n/locales/ko.ts","../src/i18n/locales/nl.ts","../src/i18n/locales/pl.ts","../src/i18n/locales/pt.ts","../src/i18n/locales/ru.ts","../src/i18n/locales/vi.ts","../src/i18n/locales/zh.ts","../src/util/typescript.ts","../src/extensions/UniqueID/UniqueID.ts","../src/schema/inlineContent/types.ts","../src/api/nodeConversions/blockToNode.ts","../src/api/exporters/html/util/serializeBlocksExternalHTML.ts","../src/api/exporters/html/externalHTMLExporter.ts","../src/api/exporters/html/util/serializeBlocksInternalHTML.ts","../src/api/exporters/html/internalHTMLSerializer.ts","../src/api/getBlockInfoFromPos.ts","../src/api/nodeUtil.ts","../src/util/browser.ts","../src/blocks/defaultBlockHelpers.ts","../src/blocks/defaultProps.ts","../src/util/string.ts","../src/schema/blocks/internal.ts","../src/schema/blocks/createSpec.ts","../src/api/nodeConversions/nodeToBlock.ts","../src/schema/inlineContent/internal.ts","../src/schema/inlineContent/createSpec.ts","../src/schema/styles/internal.ts","../src/schema/styles/createSpec.ts","../src/blocks/FileBlockContent/fileBlockHelpers.ts","../src/blocks/AudioBlockContent/audioBlockHelpers.ts","../src/blocks/AudioBlockContent/AudioBlockContent.ts","../src/blocks/CodeBlockContent/defaultSupportedLanguages.ts","../src/blocks/CodeBlockContent/CodeBlockContent.ts","../src/blocks/FileBlockContent/FileBlockContent.ts","../src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","../src/blocks/ImageBlockContent/imageBlockHelpers.ts","../src/blocks/ImageBlockContent/ImageBlockContent.ts","../src/blocks/TableBlockContent/TableExtension.ts","../src/blocks/VideoBlockContent/videoBlockHelpers.ts","../src/blocks/VideoBlockContent/VideoBlockContent.ts","../src/extensions/BackgroundColor/BackgroundColorMark.ts","../src/extensions/TextColor/TextColorMark.ts","../src/api/blockManipulation/commands/updateBlock/updateBlock.ts","../src/blocks/HeadingBlockContent/HeadingBlockContent.ts","../src/api/blockManipulation/commands/splitBlock/splitBlock.ts","../src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","../src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","../src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","../src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","../src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","../src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","../src/blocks/TableBlockContent/TableBlockContent.ts","../src/blocks/defaultBlocks.ts","../src/blocks/defaultBlockTypeGuards.ts","../src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts","../src/api/blockManipulation/commands/moveBlock/moveBlock.ts","../src/api/blockManipulation/commands/nestBlock/nestBlock.ts","../src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts","../src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts","../src/api/blockManipulation/insertContentAt.ts","../src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts","../src/util/esmDependencies.ts","../src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","../src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","../src/api/exporters/markdown/markdownExporter.ts","../src/api/parsers/html/util/nestedLists.ts","../src/api/parsers/html/parseHTML.ts","../src/api/parsers/markdown/parseMarkdown.ts","../src/util/EventEmitter.ts","../src/extensions/FilePanel/FilePanelPlugin.ts","../src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","../src/extensions/LinkToolbar/LinkToolbarPlugin.ts","../src/extensions/getDraggableBlockFromElement.ts","../src/api/nodeConversions/fragmentToBlocks.ts","../src/extensions/SideMenu/MultipleNodeSelection.ts","../src/extensions/SideMenu/dragging.ts","../src/extensions/SideMenu/SideMenuPlugin.ts","../src/extensions/SuggestionMenu/SuggestionPlugin.ts","../src/extensions/TableHandles/TableHandlesPlugin.ts","../src/api/clipboard/fromClipboard/acceptedMIMETypes.ts","../src/api/clipboard/fromClipboard/handleFileInsertion.ts","../src/api/clipboard/fromClipboard/fileDropExtension.ts","../src/api/clipboard/fromClipboard/handleVSCodePaste.ts","../src/api/clipboard/fromClipboard/pasteExtension.ts","../src/api/clipboard/toClipboard/copyExtension.ts","../src/extensions/BackgroundColor/BackgroundColorExtension.ts","../src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts","../src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts","../src/extensions/TextAlignment/TextAlignmentExtension.ts","../src/extensions/TextColor/TextColorExtension.ts","../src/extensions/TrailingNode/TrailingNodeExtension.ts","../src/pm-nodes/BlockContainer.ts","../src/pm-nodes/BlockGroup.ts","../src/pm-nodes/Doc.ts","../src/editor/BlockNoteExtensions.ts","../src/editor/transformPasted.ts","../src/editor/BlockNoteSchema.ts","../src/editor/BlockNoteTipTapEditor.ts","../src/extensions/Placeholder/PlaceholderPlugin.ts","../src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts","../src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","../src/editor/BlockNoteEditor.ts","../src/editor/defaultColors.ts","../src/exporter/Exporter.ts","../src/exporter/mapping.ts","../src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","../src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","../src/util/combineByGroup.ts","../src/api/testUtil/partialBlockTestUtil.ts"],"sourcesContent":["import type { Dictionary } from \"../dictionary.js\";\n\nexport const ar: Dictionary = {\n slash_menu: {\n heading: {\n title: \"عنوان 1\",\n subtext: \"يستخدم لعناوين المستوى الأعلى\",\n aliases: [\"ع\", \"عنوان1\", \"ع1\"],\n group: \"العناوين\",\n },\n heading_2: {\n title: \"عنوان 2\",\n subtext: \"يستخدم للأقسام الرئيسية\",\n aliases: [\"ع2\", \"عنوان2\", \"عنوان فرعي\"],\n group: \"العناوين\",\n },\n heading_3: {\n title: \"عنوان 3\",\n subtext: \"يستخدم للأقسام الفرعية والعناوين المجموعة\",\n aliases: [\"ع3\", \"عنوان3\", \"عنوان فرعي\"],\n group: \"العناوين\",\n },\n numbered_list: {\n title: \"قائمة مرقمة\",\n subtext: \"تستخدم لعرض قائمة مرقمة\",\n aliases: [\"ق\", \"عناصر قائمة\", \"قائمة\", \"قائمة مرقمة\"],\n group: \"الكتل الأساسية\",\n },\n bullet_list: {\n title: \"قائمة نقطية\",\n subtext: \"تستخدم لعرض قائمة غير مرتبة\",\n aliases: [\"ق\", \"عناصر قائمة\", \"قائمة\", \"قائمة نقطية\"],\n group: \"الكتل الأساسية\",\n },\n check_list: {\n title: \"قائمة تحقق\",\n subtext: \"تستخدم لعرض قائمة بمربعات التحقق\",\n aliases: [\n \"قوائم غير مرتبة\",\n \"عناصر قائمة\",\n \"قائمة\",\n \"قائمة تحقق\",\n \"قائمة التحقق\",\n \"قائمة مشطوبة\",\n \"مربع التحقق\",\n ],\n group: \"الكتل الأساسية\",\n },\n paragraph: {\n title: \"فقرة\",\n subtext: \"تستخدم لنص الوثيقة الأساسي\",\n aliases: [\"ف\", \"فقرة\"],\n group: \"الكتل الأساسية\",\n },\n code_block: {\n title: \"كود\",\n subtext: \"يستخدم لعرض الكود مع تحديد الصيغة\",\n aliases: [\"كود\", \"مسبق\"],\n group: \"الكتل الأساسية\",\n },\n table: {\n title: \"جدول\",\n subtext: \"يستخدم للجداول\",\n aliases: [\"جدول\"],\n group: \"متقدم\",\n },\n image: {\n title: \"صورة\",\n subtext: \"إدراج صورة\",\n aliases: [\"صورة\", \"رفع صورة\", \"تحميل\", \"صورة\", \"صورة\", \"وسائط\", \"رابط\"],\n group: \"وسائط\",\n },\n video: {\n title: \"فيديو\",\n subtext: \"إدراج فيديو\",\n aliases: [\n \"فيديو\",\n \"رفع فيديو\",\n \"تحميل\",\n \"فيديو\",\n \"فيلم\",\n \"وسائط\",\n \"رابط\",\n ],\n group: \"وسائط\",\n },\n audio: {\n title: \"صوت\",\n subtext: \"إدراج صوت\",\n aliases: [\"صوت\", \"رفع صوت\", \"تحميل\", \"صوت\", \"صوت\", \"وسائط\", \"رابط\"],\n group: \"وسائط\",\n },\n file: {\n title: \"ملف\",\n subtext: \"إدراج ملف\",\n aliases: [\"ملف\", \"تحميل\", \"تضمين\", \"وسائط\", \"رابط\"],\n group: \"وسائط\",\n },\n emoji: {\n title: \"الرموز التعبيرية\",\n subtext: \"تُستخدم لإدراج رمز تعبيري\",\n aliases: [\"رمز تعبيري\", \"إيموجي\", \"إيموت\", \"عاطفة\", \"وجه\"],\n group: \"آخرون\",\n },\n },\n placeholders: {\n default: \"أدخل نصًا أو اكتب '/' للأوامر\",\n heading: \"عنوان\",\n bulletListItem: \"قائمة\",\n numberedListItem: \"قائمة\",\n checkListItem: \"قائمة\",\n },\n file_blocks: {\n image: {\n add_button_text: \"إضافة صورة\",\n },\n video: {\n add_button_text: \"إضافة فيديو\",\n },\n audio: {\n add_button_text: \"إضافة صوت\",\n },\n file: {\n add_button_text: \"إضافة ملف\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"إضافة محتوي\",\n drag_handle_label: \"فتح قائمة المحتويات\",\n },\n drag_handle: {\n delete_menuitem: \"حذف\",\n colors_menuitem: \"ألوان\",\n },\n table_handle: {\n delete_column_menuitem: \"حذف عمود\",\n delete_row_menuitem: \"حذف صف\",\n add_left_menuitem: \"إضافة عمود إلى اليسار\",\n add_right_menuitem: \"إضافة عمود إلى اليمين\",\n add_above_menuitem: \"إضافة صف أعلى\",\n add_below_menuitem: \"إضافة صف أسفل\",\n },\n suggestion_menu: {\n no_items_title: \"لم يتم العثور على عناصر\",\n loading: \"جارٍ التحميل…\",\n },\n color_picker: {\n text_title: \"نص\",\n background_title: \"خلفية\",\n colors: {\n default: \"افتراضي\",\n gray: \"رمادي\",\n brown: \"بني\",\n red: \"أحمر\",\n orange: \"برتقالي\",\n yellow: \"أصفر\",\n green: \"أخضر\",\n blue: \"أزرق\",\n purple: \"أرجواني\",\n pink: \"وردي\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"عريض\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"مائل\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"تحته خط\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"مشطوب\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"كود\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"ألوان\",\n },\n link: {\n tooltip: \"إنشاء رابط\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"تحرير التسمية التوضيحية\",\n input_placeholder: \"تحرير التسمية التوضيحية\",\n },\n file_replace: {\n tooltip: {\n image: \"استبدال الصورة\",\n video: \"استبدال الفيديو\",\n audio: \"استبدال الصوت\",\n file: \"استبدال الملف\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"إعادة تسمية الصورة\",\n video: \"إعادة تسمية الفيديو\",\n audio: \"إعادة تسمية الصوت\",\n file: \"إعادة تسمية الملف\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"إعادة تسمية الصورة\",\n video: \"إعادة تسمية الفيديو\",\n audio: \"إعادة تسمية الصوت\",\n file: \"إعادة تسمية الملف\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"تنزيل الصورة\",\n video: \"تنزيل الفيديو\",\n audio: \"تنزيل الصوت\",\n file: \"تنزيل الملف\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"حذف الصورة\",\n video: \"حذف الفيديو\",\n audio: \"حذف الصوت\",\n file: \"حذف الملف\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"تبديل المعاينة\",\n },\n nest: {\n tooltip: \"محتويات متداخلة\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"إلغاء التداخل\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"محاذاة النص إلى اليسار\",\n },\n align_center: {\n tooltip: \"محاذاة النص في المنتصف\",\n },\n align_right: {\n tooltip: \"محاذاة النص إلى اليمين\",\n },\n align_justify: {\n tooltip: \"ضبط النص\",\n },\n },\n file_panel: {\n upload: {\n title: \"تحميل\",\n file_placeholder: {\n image: \"تحميل صورة\",\n video: \"تحميل فيديو\",\n audio: \"تحميل صوت\",\n file: \"تحميل ملف\",\n } as Record<string, string>,\n upload_error: \"خطأ: فشل التحميل\",\n },\n embed: {\n title: \"تضمين\",\n embed_button: {\n image: \"تضمين صورة\",\n video: \"تضمين فيديو\",\n audio: \"تضمين صوت\",\n file: \"تضمين ملف\",\n } as Record<string, string>,\n url_placeholder: \"أدخل الرابط\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"إزالة الرابط\",\n },\n edit: {\n text: \"تحرير الرابط\",\n tooltip: \"تحرير\",\n },\n open: {\n tooltip: \"فتح في تبويب جديد\",\n },\n form: {\n title_placeholder: \"تحرير العنوان\",\n url_placeholder: \"تحرير الرابط\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export const de = {\n slash_menu: {\n heading: {\n title: \"Überschrift 1\",\n subtext: \"Hauptebene Überschrift\",\n aliases: [\"h\", \"überschrift1\", \"h1\"],\n group: \"Überschriften\",\n },\n heading_2: {\n title: \"Überschrift 2\",\n subtext: \"Wichtige Abschnittsüberschrift\",\n aliases: [\"h2\", \"überschrift2\", \"unterüberschrift\"],\n group: \"Überschriften\",\n },\n heading_3: {\n title: \"Überschrift 3\",\n subtext: \"Unterabschnitts- und Gruppenüberschrift\",\n aliases: [\"h3\", \"überschrift3\", \"unterüberschrift\"],\n group: \"Überschriften\",\n },\n numbered_list: {\n title: \"Nummerierte Liste\",\n subtext: \"Liste mit nummerierten Elementen\",\n aliases: [\"ol\", \"li\", \"liste\", \"nummerierteliste\", \"nummerierte liste\"],\n group: \"Grundlegende blöcke\",\n },\n bullet_list: {\n title: \"Aufzählungsliste\",\n subtext: \"Liste mit unnummerierten Elementen\",\n aliases: [\"ul\", \"li\", \"liste\", \"aufzählungsliste\", \"aufzählung liste\"],\n group: \"Grundlegende blöcke\",\n },\n check_list: {\n title: \"Checkliste\",\n subtext: \"Liste mit Kontrollkästchen\",\n aliases: [\n \"ul\",\n \"li\",\n \"liste\",\n \"checkliste\",\n \"check liste\",\n \"geprüfte liste\",\n \"kontrollkästchen\",\n ],\n group: \"Grundlegende blöcke\",\n },\n paragraph: {\n title: \"Absatz\",\n subtext: \"Der Hauptteil Ihres Dokuments\",\n aliases: [\"p\", \"absatz\"],\n group: \"Grundlegende blöcke\",\n },\n code_block: {\n title: \"Codeblock\",\n subtext: \"Codeblock mit Syntaxhervorhebung\",\n aliases: [\"code\", \"pre\"],\n group: \"Grundlegende blöcke\",\n },\n table: {\n title: \"Tabelle\",\n subtext: \"Tabelle mit editierbaren Zellen\",\n aliases: [\"tabelle\"],\n group: \"Erweitert\",\n },\n image: {\n title: \"Bild\",\n subtext: \"Größenveränderbares Bild mit Beschriftung\",\n aliases: [\n \"bild\",\n \"bildhochladen\",\n \"hochladen\",\n \"img\",\n \"bild\",\n \"medien\",\n \"url\",\n ],\n group: \"Medien\",\n },\n video: {\n title: \"Video\",\n subtext: \"Größenveränderbares Video mit Beschriftung\",\n aliases: [\n \"video\",\n \"videoupload\",\n \"hochladen\",\n \"mp4\",\n \"film\",\n \"medien\",\n \"url\",\n ],\n group: \"Medien\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Eingebettetes Audio mit Beschriftung\",\n aliases: [\n \"audio\",\n \"audioupload\",\n \"hochladen\",\n \"mp3\",\n \"ton\",\n \"medien\",\n \"url\",\n ],\n group: \"Medien\",\n },\n file: {\n title: \"Datei\",\n subtext: \"Eingebettete Datei\",\n aliases: [\"datei\", \"hochladen\", \"einbetten\", \"medien\", \"url\"],\n group: \"Medien\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Nach Emoji suchen und einfügen\",\n aliases: [\"emoji\", \"emote\", \"emotion\", \"gesicht\"],\n group: \"Andere\",\n },\n },\n placeholders: {\n default: \"Text eingeben oder '/' für Befehle tippen\",\n heading: \"Überschrift\",\n bulletListItem: \"Liste\",\n numberedListItem: \"Liste\",\n checkListItem: \"Liste\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Bild hinzufügen\",\n },\n video: {\n add_button_text: \"Video hinzufügen\",\n },\n audio: {\n add_button_text: \"Audio hinzufügen\",\n },\n file: {\n add_button_text: \"Datei hinzufügen\",\n },\n },\n side_menu: {\n add_block_label: \"Block hinzufügen\",\n drag_handle_label: \"Blockmenü öffnen\",\n },\n drag_handle: {\n delete_menuitem: \"Löschen\",\n colors_menuitem: \"Farben\",\n },\n table_handle: {\n delete_column_menuitem: \"Spalte löschen\",\n delete_row_menuitem: \"Zeile löschen\",\n add_left_menuitem: \"Spalte links hinzufügen\",\n add_right_menuitem: \"Spalte rechts hinzufügen\",\n add_above_menuitem: \"Zeile oberhalb hinzufügen\",\n add_below_menuitem: \"Zeile unterhalb hinzufügen\",\n },\n suggestion_menu: {\n no_items_title: \"Keine Elemente gefunden\",\n loading: \"Laden…\",\n },\n color_picker: {\n text_title: \"Text\",\n background_title: \"Hintergrund\",\n colors: {\n default: \"Standard\",\n gray: \"Grau\",\n brown: \"Braun\",\n red: \"Rot\",\n orange: \"Orange\",\n yellow: \"Gelb\",\n green: \"Grün\",\n blue: \"Blau\",\n purple: \"Lila\",\n pink: \"Rosa\",\n },\n },\n formatting_toolbar: {\n bold: {\n tooltip: \"Fett\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Kursiv\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Unterstrichen\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Durchgestrichen\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Farben\",\n },\n link: {\n tooltip: \"Link erstellen\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Beschriftung bearbeiten\",\n input_placeholder: \"Beschriftung bearbeiten\",\n },\n file_replace: {\n tooltip: {\n image: \"Bild ersetzen\",\n video: \"Video ersetzen\",\n audio: \"Audio ersetzen\",\n file: \"Datei ersetzen\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Bild umbenennen\",\n video: \"Video umbenennen\",\n audio: \"Audio umbenennen\",\n file: \"Datei umbenennen\",\n },\n input_placeholder: {\n image: \"Bild umbenennen\",\n video: \"Video umbenennen\",\n audio: \"Audio umbenennen\",\n file: \"Datei umbenennen\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Bild herunterladen\",\n video: \"Video herunterladen\",\n audio: \"Audio herunterladen\",\n file: \"Datei herunterladen\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Bild löschen\",\n video: \"Video löschen\",\n audio: \"Audio löschen\",\n file: \"Datei löschen\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Vorschau umschalten\",\n },\n nest: {\n tooltip: \"Block verschachteln\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Block entnesten\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Text linksbündig\",\n },\n align_center: {\n tooltip: \"Text zentrieren\",\n },\n align_right: {\n tooltip: \"Text rechtsbündig\",\n },\n align_justify: {\n tooltip: \"Text Blocksatz\",\n },\n },\n file_panel: {\n upload: {\n title: \"Hochladen\",\n file_placeholder: {\n image: \"Bild hochladen\",\n video: \"Video hochladen\",\n audio: \"Audio hochladen\",\n file: \"Datei hochladen\",\n },\n upload_error: \"Fehler: Hochladen fehlgeschlagen\",\n },\n embed: {\n title: \"Einbetten\",\n embed_button: {\n image: \"Bild einbetten\",\n video: \"Video einbetten\",\n audio: \"Audio einbetten\",\n file: \"Datei einbetten\",\n },\n url_placeholder: \"URL eingeben\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Link entfernen\",\n },\n edit: {\n text: \"Link bearbeiten\",\n tooltip: \"Bearbeiten\",\n },\n open: {\n tooltip: \"In neuem Tab öffnen\",\n },\n form: {\n title_placeholder: \"Titel bearbeiten\",\n url_placeholder: \"URL bearbeiten\",\n },\n },\n generic: {\n ctrl_shortcut: \"Strg\",\n },\n};\n","export const en = {\n slash_menu: {\n heading: {\n title: \"Heading 1\",\n subtext: \"Top-level heading\",\n aliases: [\"h\", \"heading1\", \"h1\"],\n group: \"Headings\",\n },\n heading_2: {\n title: \"Heading 2\",\n subtext: \"Key section heading\",\n aliases: [\"h2\", \"heading2\", \"subheading\"],\n group: \"Headings\",\n },\n heading_3: {\n title: \"Heading 3\",\n subtext: \"Subsection and group heading\",\n aliases: [\"h3\", \"heading3\", \"subheading\"],\n group: \"Headings\",\n },\n numbered_list: {\n title: \"Numbered List\",\n subtext: \"List with ordered items\",\n aliases: [\"ol\", \"li\", \"list\", \"numberedlist\", \"numbered list\"],\n group: \"Basic blocks\",\n },\n bullet_list: {\n title: \"Bullet List\",\n subtext: \"List with unordered items\",\n aliases: [\"ul\", \"li\", \"list\", \"bulletlist\", \"bullet list\"],\n group: \"Basic blocks\",\n },\n check_list: {\n title: \"Check List\",\n subtext: \"List with checkboxes\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"checklist\",\n \"check list\",\n \"checked list\",\n \"checkbox\",\n ],\n group: \"Basic blocks\",\n },\n paragraph: {\n title: \"Paragraph\",\n subtext: \"The body of your document\",\n aliases: [\"p\", \"paragraph\"],\n group: \"Basic blocks\",\n },\n code_block: {\n title: \"Code Block\",\n subtext: \"Code block with syntax highlighting\",\n aliases: [\"code\", \"pre\"],\n group: \"Basic blocks\",\n },\n table: {\n title: \"Table\",\n subtext: \"Table with editable cells\",\n aliases: [\"table\"],\n group: \"Advanced\",\n },\n image: {\n title: \"Image\",\n subtext: \"Resizable image with caption\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n video: {\n title: \"Video\",\n subtext: \"Resizable video with caption\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Embedded audio with caption\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n file: {\n title: \"File\",\n subtext: \"Embedded file\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"url\"],\n group: \"Media\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Search for and insert an emoji\",\n aliases: [\"emoji\", \"emote\", \"emotion\", \"face\"],\n group: \"Others\",\n },\n },\n placeholders: {\n default: \"Enter text or type '/' for commands\",\n heading: \"Heading\",\n bulletListItem: \"List\",\n numberedListItem: \"List\",\n checkListItem: \"List\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Add image\",\n },\n video: {\n add_button_text: \"Add video\",\n },\n audio: {\n add_button_text: \"Add audio\",\n },\n file: {\n add_button_text: \"Add file\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Add block\",\n drag_handle_label: \"Open block menu\",\n },\n drag_handle: {\n delete_menuitem: \"Delete\",\n colors_menuitem: \"Colors\",\n },\n table_handle: {\n delete_column_menuitem: \"Delete column\",\n delete_row_menuitem: \"Delete row\",\n add_left_menuitem: \"Add column left\",\n add_right_menuitem: \"Add column right\",\n add_above_menuitem: \"Add row above\",\n add_below_menuitem: \"Add row below\",\n },\n suggestion_menu: {\n no_items_title: \"No items found\",\n loading: \"Loading…\",\n },\n color_picker: {\n text_title: \"Text\",\n background_title: \"Background\",\n colors: {\n default: \"Default\",\n gray: \"Gray\",\n brown: \"Brown\",\n red: \"Red\",\n orange: \"Orange\",\n yellow: \"Yellow\",\n green: \"Green\",\n blue: \"Blue\",\n purple: \"Purple\",\n pink: \"Pink\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Bold\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Italic\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Underline\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Strike\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Colors\",\n },\n link: {\n tooltip: \"Create link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Edit caption\",\n input_placeholder: \"Edit caption\",\n },\n file_replace: {\n tooltip: {\n image: \"Replace image\",\n video: \"Replace video\",\n audio: \"Replace audio\",\n file: \"Replace file\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"Rename image\",\n video: \"Rename video\",\n audio: \"Rename audio\",\n file: \"Rename file\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"Rename image\",\n video: \"Rename video\",\n audio: \"Rename audio\",\n file: \"Rename file\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"Download image\",\n video: \"Download video\",\n audio: \"Download audio\",\n file: \"Download file\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"Delete image\",\n video: \"Delete video\",\n audio: \"Delete audio\",\n file: \"Delete file\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"Toggle preview\",\n },\n nest: {\n tooltip: \"Nest block\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Unnest block\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Align text left\",\n },\n align_center: {\n tooltip: \"Align text center\",\n },\n align_right: {\n tooltip: \"Align text right\",\n },\n align_justify: {\n tooltip: \"Justify text\",\n },\n },\n file_panel: {\n upload: {\n title: \"Upload\",\n file_placeholder: {\n image: \"Upload image\",\n video: \"Upload video\",\n audio: \"Upload audio\",\n file: \"Upload file\",\n } as Record<string, string>,\n upload_error: \"Error: Upload failed\",\n },\n embed: {\n title: \"Embed\",\n embed_button: {\n image: \"Embed image\",\n video: \"Embed video\",\n audio: \"Embed audio\",\n file: \"Embed file\",\n } as Record<string, string>,\n url_placeholder: \"Enter URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Remove link\",\n },\n edit: {\n text: \"Edit link\",\n tooltip: \"Edit\",\n },\n open: {\n tooltip: \"Open in new tab\",\n },\n form: {\n title_placeholder: \"Edit title\",\n url_placeholder: \"Edit URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export const es = {\n slash_menu: {\n heading: {\n title: \"Encabezado 1\",\n subtext: \"Encabezado de primer nivel\",\n aliases: [\"h\", \"encabezado1\", \"h1\"],\n group: \"Encabezados\",\n },\n heading_2: {\n title: \"Encabezado 2\",\n subtext: \"Encabezado de sección principal\",\n aliases: [\"h2\", \"encabezado2\", \"subencabezado\"],\n group: \"Encabezados\",\n },\n heading_3: {\n title: \"Encabezado 3\",\n subtext: \"Encabezado de subsección y grupo\",\n aliases: [\"h3\", \"encabezado3\", \"subencabezado\"],\n group: \"Encabezados\",\n },\n numbered_list: {\n title: \"Lista Numerada\",\n subtext: \"Lista con elementos ordenados\",\n aliases: [\"ol\", \"li\", \"lista\", \"lista numerada\"],\n group: \"Bloques básicos\",\n },\n bullet_list: {\n title: \"Lista con Viñetas\",\n subtext: \"Lista con elementos no ordenados\",\n aliases: [\"ul\", \"li\", \"lista\", \"lista con viñetas\"],\n group: \"Bloques básicos\",\n },\n check_list: {\n title: \"Lista de Verificación\",\n subtext: \"Lista con casillas de verificación\",\n aliases: [\n \"ul\",\n \"li\",\n \"lista\",\n \"lista de verificación\",\n \"lista de chequeo\",\n \"checkbox\",\n ],\n group: \"Bloques básicos\",\n },\n paragraph: {\n title: \"Párrafo\",\n subtext: \"El cuerpo de tu documento\",\n aliases: [\"p\", \"párrafo\"],\n group: \"Bloques básicos\",\n },\n code_block: {\n title: \"Bloque de Código\",\n subtext: \"Bloque de código con resaltado de sintaxis\",\n aliases: [\"code\", \"pre\"],\n group: \"Bloques básicos\",\n },\n table: {\n title: \"Tabla\",\n subtext: \"Tabla con celdas editables\",\n aliases: [\"tabla\"],\n group: \"Avanzado\",\n },\n image: {\n title: \"Imagen\",\n subtext: \"Imagen redimensionable con leyenda\",\n aliases: [\n \"imagen\",\n \"subir imagen\",\n \"cargar\",\n \"img\",\n \"foto\",\n \"media\",\n \"url\",\n ],\n group: \"Medios\",\n },\n video: {\n title: \"Vídeo\",\n subtext: \"Vídeo redimensionable con leyenda\",\n aliases: [\n \"video\",\n \"subir vídeo\",\n \"cargar\",\n \"mp4\",\n \"película\",\n \"media\",\n \"url\",\n ],\n group: \"Medios\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Audio incrustado con leyenda\",\n aliases: [\n \"audio\",\n \"subir audio\",\n \"cargar\",\n \"mp3\",\n \"sonido\",\n \"media\",\n \"url\",\n ],\n group: \"Medios\",\n },\n file: {\n title: \"Archivo\",\n subtext: \"Archivo incrustado\",\n aliases: [\"archivo\", \"cargar\", \"incrustar\", \"media\", \"url\"],\n group: \"Medios\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Busca e inserta un emoji\",\n aliases: [\"emoji\", \"emoticono\", \"emoción\", \"cara\"],\n group: \"Otros\",\n },\n },\n placeholders: {\n default: \"Escribe o teclea '/' para comandos\",\n heading: \"Encabezado\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Agregar imagen\",\n },\n video: {\n add_button_text: \"Agregar vídeo\",\n },\n audio: {\n add_button_text: \"Agregar audio\",\n },\n file: {\n add_button_text: \"Agregar archivo\",\n },\n },\n side_menu: {\n add_block_label: \"Agregar bloque\",\n drag_handle_label: \"Abrir menú de bloque\",\n },\n drag_handle: {\n delete_menuitem: \"Eliminar\",\n colors_menuitem: \"Colores\",\n },\n table_handle: {\n delete_column_menuitem: \"Eliminar columna\",\n delete_row_menuitem: \"Eliminar fila\",\n add_left_menuitem: \"Agregar columna a la izquierda\",\n add_right_menuitem: \"Agregar columna a la derecha\",\n add_above_menuitem: \"Agregar fila arriba\",\n add_below_menuitem: \"Agregar fila abajo\",\n },\n suggestion_menu: {\n no_items_title: \"No se encontraron elementos\",\n loading: \"Cargando…\",\n },\n color_picker: {\n text_title: \"Texto\",\n background_title: \"Fondo\",\n colors: {\n default: \"Por defecto\",\n gray: \"Gris\",\n brown: \"Marrón\",\n red: \"Rojo\",\n orange: \"Naranja\",\n yellow: \"Amarillo\",\n green: \"Verde\",\n blue: \"Azul\",\n purple: \"Morado\",\n pink: \"Rosa\",\n },\n },\n formatting_toolbar: {\n bold: {\n tooltip: \"Negrita\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Cursiva\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Subrayado\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Tachado\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Código\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Colores\",\n },\n link: {\n tooltip: \"Crear enlace\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Editar leyenda\",\n input_placeholder: \"Editar leyenda\",\n },\n file_replace: {\n tooltip: {\n image: \"Reemplazar imagen\",\n video: \"Reemplazar vídeo\",\n audio: \"Reemplazar audio\",\n file: \"Reemplazar archivo\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"Renombrar imagen\",\n video: \"Renombrar vídeo\",\n audio: \"Renombrar audio\",\n file: \"Renombrar archivo\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"Renombrar imagen\",\n video: \"Renombrar vídeo\",\n audio: \"Renombrar audio\",\n file: \"Renombrar archivo\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"Descargar imagen\",\n video: \"Descargar vídeo\",\n audio: \"Descargar audio\",\n file: \"Descargar archivo\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"Eliminar imagen\",\n video: \"Eliminar vídeo\",\n audio: \"Eliminar audio\",\n file: \"Eliminar archivo\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"Alternar vista previa\",\n },\n nest: {\n tooltip: \"Anidar bloque\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Desanidar bloque\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Alinear texto a la izquierda\",\n },\n align_center: {\n tooltip: \"Alinear texto al centro\",\n },\n align_right: {\n tooltip: \"Alinear texto a la derecha\",\n },\n align_justify: {\n tooltip: \"Justificar texto\",\n },\n },\n file_panel: {\n upload: {\n title: \"Subir\",\n file_placeholder: {\n image: \"Subir imagen\",\n video: \"Subir vídeo\",\n audio: \"Subir audio\",\n file: \"Subir archivo\",\n } as Record<string, string>,\n upload_error: \"Error: Fallo en la subida\",\n },\n embed: {\n title: \"Incrustar\",\n embed_button: {\n image: \"Incrustar imagen\",\n video: \"Incrustar vídeo\",\n audio: \"Incrustar audio\",\n file: \"Incrustar archivo\",\n } as Record<string, string>,\n url_placeholder: \"Introduce la URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Eliminar enlace\",\n },\n edit: {\n text: \"Editar enlace\",\n tooltip: \"Editar\",\n },\n open: {\n tooltip: \"Abrir en nueva pestaña\",\n },\n form: {\n title_placeholder: \"Editar título\",\n url_placeholder: \"Editar URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const fr: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Titre 1\",\n subtext: \"Utilisé pour un titre de premier niveau\",\n aliases: [\"h\", \"titre1\", \"h1\"],\n group: \"Titres\",\n },\n heading_2: {\n title: \"Titre 2\",\n subtext: \"Utilisé pour les sections clés\",\n aliases: [\"h2\", \"titre2\", \"sous-titre\"],\n group: \"Titres\",\n },\n heading_3: {\n title: \"Titre 3\",\n subtext: \"Utilisé pour les sous-sections et les titres de groupe\",\n aliases: [\"h3\", \"titre3\", \"sous-titre\"],\n group: \"Titres\",\n },\n numbered_list: {\n title: \"Liste Numérotée\",\n subtext: \"Utilisé pour afficher une liste numérotée\",\n aliases: [\"ol\", \"li\", \"liste\", \"listenumérotée\", \"liste numérotée\"],\n group: \"Blocs de base\",\n },\n bullet_list: {\n title: \"Liste à Puces\",\n subtext: \"Utilisé pour afficher une liste non ordonnée\",\n aliases: [\"ul\", \"li\", \"liste\", \"listeàpuces\", \"liste à puces\"],\n group: \"Blocs de base\",\n },\n check_list: {\n title: \"Liste de vérification\",\n subtext: \"Utilisé pour afficher une liste avec des cases à cocher\",\n aliases: [\n \"ul\",\n \"li\",\n \"liste\",\n \"liste de vérification\",\n \"liste cochée\",\n \"case à cocher\",\n ],\n group: \"Blocs de base\",\n },\n paragraph: {\n title: \"Paragraphe\",\n subtext: \"Utilisé pour le corps de votre document\",\n aliases: [\"p\", \"paragraphe\"],\n group: \"Blocs de base\",\n },\n code_block: {\n title: \"Bloc de code\",\n subtext: \"Bloc de code avec coloration syntaxique\",\n aliases: [\"code\", \"pre\"],\n group: \"Blocs de base\",\n },\n table: {\n title: \"Tableau\",\n subtext: \"Utilisé pour les tableaux\",\n aliases: [\"tableau\"],\n group: \"Avancé\",\n },\n image: {\n title: \"Image\",\n subtext: \"Insérer une image\",\n aliases: [\n \"image\",\n \"uploadImage\",\n \"télécharger\",\n \"img\",\n \"photo\",\n \"média\",\n \"url\",\n ],\n group: \"Médias\",\n },\n video: {\n title: \"Vidéo\",\n subtext: \"Insérer une vidéo\",\n aliases: [\n \"vidéo\",\n \"téléchargerVidéo\",\n \"téléverser\",\n \"mp4\",\n \"film\",\n \"média\",\n \"url\",\n ],\n group: \"Média\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Insérer un audio\",\n aliases: [\n \"audio\",\n \"téléchargerAudio\",\n \"téléverser\",\n \"mp3\",\n \"son\",\n \"média\",\n \"url\",\n ],\n group: \"Média\",\n },\n file: {\n title: \"Fichier\",\n subtext: \"Insérer un fichier\",\n aliases: [\"fichier\", \"téléverser\", \"intégrer\", \"média\", \"url\"],\n group: \"Média\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Utilisé pour insérer un emoji\",\n aliases: [\"emoji\", \"émoticône\", \"émotion\", \"visage\"],\n group: \"Autres\",\n },\n },\n placeholders: {\n default: \"Entrez du texte ou tapez '/' pour les commandes\",\n heading: \"Titre\",\n bulletListItem: \"Liste\",\n numberedListItem: \"Liste\",\n checkListItem: \"Liste\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Ajouter une image\",\n },\n video: {\n add_button_text: \"Ajouter une vidéo\",\n },\n audio: {\n add_button_text: \"Ajouter un audio\",\n },\n file: {\n add_button_text: \"Ajouter un fichier\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Ajouter un bloc\",\n drag_handle_label: \"Ouvrir le menu du bloc\",\n },\n drag_handle: {\n delete_menuitem: \"Supprimer\",\n colors_menuitem: \"Couleurs\",\n },\n table_handle: {\n delete_column_menuitem: \"Supprimer la colonne\",\n delete_row_menuitem: \"Supprimer la ligne\",\n add_left_menuitem: \"Ajouter une colonne à gauche\",\n add_right_menuitem: \"Ajouter une colonne à droite\",\n add_above_menuitem: \"Ajouter une ligne au-dessus\",\n add_below_menuitem: \"Ajouter une ligne en dessous\",\n },\n suggestion_menu: {\n no_items_title: \"Aucun élément trouvé\",\n loading: \"Chargement…\",\n },\n color_picker: {\n text_title: \"Texte\",\n background_title: \"Fond\",\n colors: {\n default: \"Défaut\",\n gray: \"Gris\",\n brown: \"Marron\",\n red: \"Rouge\",\n orange: \"Orange\",\n yellow: \"Jaune\",\n green: \"Vert\",\n blue: \"Bleu\",\n purple: \"Violet\",\n pink: \"Rose\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Gras\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Italique\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Souligner\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Barré\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Couleurs\",\n },\n link: {\n tooltip: \"Créer un lien\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Modifier la légende\",\n input_placeholder: \"Modifier la légende\",\n },\n file_replace: {\n tooltip: {\n image: \"Remplacer l'image\",\n video: \"Remplacer la vidéo\",\n audio: \"Remplacer l'audio\",\n file: \"Remplacer le fichier\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Renommer l'image\",\n video: \"Renommer la vidéo\",\n audio: \"Renommer l'audio\",\n file: \"Renommer le fichier\",\n },\n input_placeholder: {\n image: \"Renommer l'image\",\n video: \"Renommer la vidéo\",\n audio: \"Renommer l'audio\",\n file: \"Renommer le fichier\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Télécharger l'image\",\n video: \"Télécharger la vidéo\",\n audio: \"Télécharger l'audio\",\n file: \"Télécharger le fichier\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Supprimer l'image\",\n video: \"Supprimer la vidéo\",\n audio: \"Supprimer l'audio\",\n file: \"Supprimer le fichier\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Basculer l'aperçu\",\n },\n nest: {\n tooltip: \"Emboîter le bloc\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Démboîter le bloc\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Aligner le texte à gauche\",\n },\n align_center: {\n tooltip: \"Aligner le texte au centre\",\n },\n align_right: {\n tooltip: \"Aligner le texte à droite\",\n },\n align_justify: {\n tooltip: \"Justifier le texte\",\n },\n },\n file_panel: {\n upload: {\n title: \"Télécharger\",\n file_placeholder: {\n image: \"Télécharger une image\",\n video: \"Télécharger une vidéo\",\n audio: \"Télécharger un fichier audio\",\n file: \"Télécharger un fichier\",\n },\n upload_error: \"Erreur : Échec du téléchargement\",\n },\n embed: {\n title: \"Intégrer\",\n embed_button: {\n image: \"Intégrer une image\",\n video: \"Intégrer une vidéo\",\n audio: \"Intégrer un fichier audio\",\n file: \"Intégrer un fichier\",\n },\n url_placeholder: \"Entrez l'URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Supprimer le lien\",\n },\n edit: {\n text: \"Modifier le lien\",\n tooltip: \"Modifier\",\n },\n open: {\n tooltip: \"Ouvrir dans un nouvel onglet\",\n },\n form: {\n title_placeholder: \"Modifier le titre\",\n url_placeholder: \"Modifier l'URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export const hr = {\n slash_menu: {\n heading: {\n title: \"Naslov 1\",\n subtext: \"Glavni naslov\",\n aliases: [\"h\", \"naslov1\", \"h1\"],\n group: \"Naslovi\",\n },\n heading_2: {\n title: \"Naslov 2\",\n subtext: \"Naslov poglavlja\",\n aliases: [\"h2\", \"naslov2\", \"podnaslov\"],\n group: \"Naslovi\",\n },\n heading_3: {\n title: \"Naslov 3\",\n subtext: \"Naslov podpoglavlja\",\n aliases: [\"h3\", \"naslov3\", \"podnaslov\"],\n group: \"Naslovi\",\n },\n numbered_list: {\n title: \"Numerirani popis\",\n subtext: \"Popis s numeriranim stavkama\",\n aliases: [\"poredaniPopis\", \"stavkaPopisa\", \"popis\", \"numeriraniPopis\", \"numerirani popis\"],\n group: \"Osnovni blokovi\",\n },\n bullet_list: {\n title: \"Popis s oznakama\",\n subtext: \"Popis s grafičkim oznakama\",\n aliases: [\"neporedaniPopis\", \"stavkaPopisa\", \"popis\", \"popisSOznakama\", \"popis s oznakama\"],\n group: \"Osnovni blokovi\",\n },\n check_list: {\n title: \"Check lista\",\n subtext: \"Popis s kućicama za označavanje\",\n aliases: [\n \"neporedaniPopis\",\n \"stavkaPopisa\",\n \"popis\",\n \"popisZaProvjeru\",\n \"check lista\",\n \"označeni popis\",\n \"kućicaZaOznačavanje\",\n ],\n group: \"Osnovni blokovi\",\n },\n paragraph: {\n title: \"Normalan tekst\",\n subtext: \"Tekst paragrafa\",\n aliases: [\"p\", \"paragraf\"],\n group: \"Osnovni blokovi\",\n },\n table: {\n title: \"Tablica\",\n subtext: \"Tablica s podesivim ćelijama\",\n aliases: [\"tablica\"],\n group: \"Napredno\",\n },\n image: {\n title: \"Slika\",\n subtext: \"Slika s podesivom veličinom i natpisom\",\n aliases: [\n \"slika\",\n \"učitavanjeSlike\",\n \"učitaj\",\n \"img\",\n \"fotografija\",\n \"medij\",\n \"url\",\n ],\n group: \"Mediji\",\n },\n video: {\n title: \"Video\",\n subtext: \"Video s podesivom veličinom i natpisom\",\n aliases: [\n \"video\",\n \"učitavanjeVidea\",\n \"učitaj\",\n \"mp4\",\n \"film\",\n \"medij\",\n \"url\",\n ],\n group: \"Mediji\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Audio s natpisom\",\n aliases: [\n \"audio\",\n \"učitavanjeAudija\",\n \"učitaj\",\n \"mp3\",\n \"zvuk\",\n \"medij\",\n \"url\",\n ],\n group: \"Mediji\",\n },\n file: {\n title: \"Datoteka\",\n subtext: \"Ugrađena datoteka\",\n aliases: [\"datoteka\", \"učitaj\", \"ugradi\", \"medij\", \"url\"],\n group: \"Mediji\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Pretraži i umetni emoji\",\n aliases: [\"emoji\", \"emotikon\", \"emocija\", \"lice\"],\n group: \"Ostalo\",\n },\n },\n placeholders: {\n default: \"Unesi tekst ili upiši ‘/’ za naredbe\",\n heading: \"Naslov\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Dodaj sliku\",\n },\n video: {\n add_button_text: \"Dodaj video\",\n },\n audio: {\n add_button_text: \"Dodaj audio\",\n },\n file: {\n add_button_text: \"Dodaj datoteku\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Dodaj blok\",\n drag_handle_label: \"Meni za dodavanje bloka\",\n },\n drag_handle: {\n delete_menuitem: \"Ukloni\",\n colors_menuitem: \"Boje\",\n },\n table_handle: {\n delete_column_menuitem: \"Ukloni stupac\",\n delete_row_menuitem: \"Ukloni redak\",\n add_left_menuitem: \"Dodaj stupac lijevo\",\n add_right_menuitem: \"Dodaj stupac desno\",\n add_above_menuitem: \"Dodaj redak iznad\",\n add_below_menuitem: \"Dodaj redak ispod\",\n },\n suggestion_menu: {\n no_items_title: \"Stavke nisu pronađene\",\n loading: \"Učitavanje…\",\n },\n color_picker: {\n text_title: \"Tekst\",\n background_title: \"Pozadina\",\n colors: {\n default: \"Zadano\",\n gray: \"Siva\",\n brown: \"Smeđa\",\n red: \"Crvena\",\n orange: \"Narančasta\",\n yellow: \"Žuta\",\n green: \"Zelena\",\n blue: \"Plava\",\n purple: \"Ljubičasta\",\n pink: \"Ružičasta\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Podebljano\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Kurziv\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Podcrtano\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Precrtano\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Kod\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Boja\",\n },\n link: {\n tooltip: \"Kreiraj poveznicu\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Uredi natpis\",\n input_placeholder: \"Uredi natpis\",\n },\n file_replace: {\n tooltip: {\n image: \"Zamijeni sliku\",\n video: \"Zamijeni video\",\n audio: \"Zamijeni audio\",\n file: \"Zamijeni datoteku\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"Preimenuj sliku\",\n video: \"Preimenuj video\",\n audio: \"Preimenuj audio\",\n file: \"Preimenuj datoteku\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"Preimenuj sliku\",\n video: \"Preimenuj video\",\n audio: \"Preimenuj audio\",\n file: \"Preimenuj datoteku\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"Preuzmi sliku\",\n video: \"Preuzmi video\",\n audio: \"Preuzmi audio\",\n file: \"Preuzmi datoteku\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"Ukloni sliku\",\n video: \"Ukloni video\",\n audio: \"Ukloni audio\",\n file: \"Ukloni datoteku\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"Prikaži/sakrij pregled\",\n },\n nest: {\n tooltip: \"Ugnijezdi blok\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Razgnijezdi blok\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Poravnaj tekst lijevo\",\n },\n align_center: {\n tooltip: \"Poravnaj tekst po sredini\",\n },\n align_right: {\n tooltip: \"Poravnaj tekst desno\",\n },\n align_justify: {\n tooltip: \"Poravnaj tekst obostrano\",\n },\n },\n file_panel: {\n upload: {\n title: \"Učitaj\",\n file_placeholder: {\n image: \"Učitaj sliku\",\n video: \"Učitaj video\",\n audio: \"Učitaj audio\",\n file: \"Učitaj datoteku\",\n } as Record<string, string>,\n upload_error: \"Pogreška: Učitavanje nije uspjelo\",\n },\n embed: {\n title: \"Ugradi\",\n embed_button: {\n image: \"Ugradi sliku\",\n video: \"Ugradi video\",\n audio: \"Ugradi audio\",\n file: \"Ugradi datoteku\",\n } as Record<string, string>,\n url_placeholder: \"Dodaj URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Ukloni poveznicu\",\n },\n edit: {\n text: \"Uredi poveznicu\",\n tooltip: \"Uredi\",\n },\n open: {\n tooltip: \"Otvori u novoj kartici\",\n },\n form: {\n title_placeholder: \"Uredi naslov\",\n url_placeholder: \"Uredi URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const is: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Fyrirsögn 1\",\n subtext: \"Notað fyrir efstu fyrirsögn\",\n aliases: [\"h\", \"fyrirsogn1\", \"h1\"],\n group: \"Fyrirsagnir\",\n },\n heading_2: {\n title: \"Fyrirsögn 2\",\n subtext: \"Notað fyrir lykilhluta\",\n aliases: [\"h2\", \"fyrirsogn2\", \"undirfyrirsogn\"],\n group: \"Fyrirsagnir\",\n },\n heading_3: {\n title: \"Fyrirsögn 3\",\n subtext: \"Notað fyrir undirhluta og hópfyrirsagnir\",\n aliases: [\"h3\", \"fyrirsogn3\", \"undirfyrirsogn\"],\n group: \"Fyrirsagnir\",\n },\n numbered_list: {\n title: \"Númeruð listi\",\n subtext: \"Notað til að birta númeraðan lista\",\n aliases: [\"ol\", \"li\", \"listi\", \"numeradurlisti\"],\n group: \"Grunnblokkar\",\n },\n bullet_list: {\n title: \"Punktalisti\",\n subtext: \"Notað til að birta óraðaðan lista\",\n aliases: [\"ul\", \"li\", \"listi\", \"punktalisti\"],\n group: \"Grunnblokkar\",\n },\n check_list: {\n title: \"Athugunarlisti\",\n subtext: \"Notað til að sýna lista með gátreitum\",\n aliases: [\"ul\", \"li\", \"listi\", \"athugunarlisti\", \"merktur listi\"],\n group: \"Grunnblokkar\",\n },\n paragraph: {\n title: \"Málsgrein\",\n subtext: \"Notað fyrir meginmál skjalsins\",\n aliases: [\"p\", \"malsgrein\"],\n group: \"Grunnblokkar\",\n },\n code_block: {\n title: \"Kóðablokk\",\n subtext: \"Kóðablokkur með litskiptingu\",\n aliases: [\"kóði\", \"pre\"],\n group: \"Grunnblokkar\",\n },\n table: {\n title: \"Tafla\",\n subtext: \"Notað fyrir töflur\",\n aliases: [\"tafla\"],\n group: \"Ítarlegt\",\n },\n image: {\n title: \"Mynd\",\n subtext: \"Settu inn mynd\",\n aliases: [\n \"mynd\",\n \"myndaupphlaed\",\n \"upphlaed\",\n \"img\",\n \"mynd\",\n \"media\",\n \"url\",\n ],\n group: \"Miðlar\",\n },\n video: {\n title: \"Myndband\",\n subtext: \"Setja inn myndband\",\n aliases: [\n \"myndband\",\n \"videoUpphala\",\n \"hlaða upp\",\n \"mp4\",\n \"kvikmynd\",\n \"miðill\",\n \"url\",\n ],\n group: \"Miðill\",\n },\n audio: {\n title: \"Hljóð\",\n subtext: \"Setja inn hljóð\",\n aliases: [\n \"hljóð\",\n \"audioUpphala\",\n \"hlaða upp\",\n \"mp3\",\n \"hljóð\",\n \"miðill\",\n \"url\",\n ],\n group: \"Miðlar\",\n },\n file: {\n title: \"Skrá\",\n subtext: \"Setja inn skrá\",\n aliases: [\"skrá\", \"hlaða upp\", \"fella inn\", \"miðill\", \"url\"],\n group: \"Miðlar\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Notað til að setja inn smámynd\",\n aliases: [\"emoji\", \"andlitsávísun\", \"tilfinningar\", \"andlit\"],\n group: \"Annað\",\n },\n },\n placeholders: {\n default: \"Sláðu inn texta eða skrifaðu '/' fyrir skipanir\",\n heading: \"Fyrirsögn\",\n bulletListItem: \"Listi\",\n numberedListItem: \"Listi\",\n checkListItem: \"Listi\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Bæta við mynd\",\n },\n video: {\n add_button_text: \"Bæta við myndbandi\",\n },\n audio: {\n add_button_text: \"Bæta við hljóði\",\n },\n file: {\n add_button_text: \"Bæta við skrá\",\n },\n },\n side_menu: {\n add_block_label: \"Bæta við blokki\",\n drag_handle_label: \"Opna blokkarvalmynd\",\n },\n drag_handle: {\n delete_menuitem: \"Eyða\",\n colors_menuitem: \"Litir\",\n },\n table_handle: {\n delete_column_menuitem: \"Eyða dálki\",\n delete_row_menuitem: \"Eyða röð\",\n add_left_menuitem: \"Bæta dálki við til vinstri\",\n add_right_menuitem: \"Bæta dálki við til hægri\",\n add_above_menuitem: \"Bæta röð við fyrir ofan\",\n add_below_menuitem: \"Bæta röð við fyrir neðan\",\n },\n suggestion_menu: {\n no_items_title: \"Engir hlutir fundust\",\n loading: \"Hleður…\",\n },\n color_picker: {\n text_title: \"Texti\",\n background_title: \"Bakgrunnur\",\n colors: {\n default: \"Sjálfgefið\",\n gray: \"Grár\",\n brown: \"Brúnn\",\n red: \"Rauður\",\n orange: \"Appelsínugulur\",\n yellow: \"Gulur\",\n green: \"Grænn\",\n blue: \"Blár\",\n purple: \"Fjólublár\",\n pink: \"Bleikur\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Feitletrað\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Skáletrað\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Undirstrikað\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Yfirstrikað\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Kóði\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Litir\",\n },\n link: {\n tooltip: \"Búa til tengil\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Breyta myndatexta\",\n input_placeholder: \"Breyta myndatexta\",\n },\n file_replace: {\n tooltip: {\n image: \"Skipta um mynd\",\n video: \"Skipta um myndband\",\n audio: \"Skipta um hljóð\",\n file: \"Skipta um skrá\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Endurnefna mynd\",\n video: \"Endurnefna myndband\",\n audio: \"Endurnefna hljóð\",\n file: \"Endurnefna skrá\",\n },\n input_placeholder: {\n image: \"Endurnefna mynd\",\n video: \"Endurnefna myndband\",\n audio: \"Endurnefna hljóð\",\n file: \"Endurnefna skrá\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Sækja mynd\",\n video: \"Sækja myndband\",\n audio: \"Sækja hljóð\",\n file: \"Sækja skrá\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Eyða mynd\",\n video: \"Eyða myndbandi\",\n audio: \"Eyða hljóði\",\n file: \"Eyða skrá\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Skipta um forskoðun\",\n },\n nest: {\n tooltip: \"Fella blokk saman\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Afþýða blokk\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Vinstrijafna texta\",\n },\n align_center: {\n tooltip: \"Miðjustilla texta\",\n },\n align_right: {\n tooltip: \"Hægrijafna texta\",\n },\n align_justify: {\n tooltip: \"Jafna texta\",\n },\n },\n file_panel: {\n upload: {\n title: \"Hlaða upp\",\n file_placeholder: {\n image: \"Hlaða upp mynd\",\n video: \"Hlaða upp myndband\",\n audio: \"Hlaða upp hljóð\",\n file: \"Hlaða upp skrá\",\n },\n upload_error: \"Villa: Upphleðsla mistókst\",\n },\n embed: {\n title: \"Innsetja\",\n embed_button: {\n image: \"Innsetja mynd\",\n video: \"Innsetja myndband\",\n audio: \"Innsetja hljóð\",\n file: \"Innsetja skrá\",\n },\n url_placeholder: \"Sláðu inn URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Fjarlægja tengil\",\n },\n edit: {\n text: \"Breyta tengli\",\n tooltip: \"Breyta\",\n },\n open: {\n tooltip: \"Opna í nýjum flipa\",\n },\n form: {\n title_placeholder: \"Breyta titli\",\n url_placeholder: \"Breyta URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const ja: Dictionary = {\n slash_menu: {\n heading: {\n title: \"見出し1\",\n subtext: \"トップレベルの見出しに使用\",\n aliases: [\"h\", \"見出し1\", \"h1\", \"大見出し\"],\n group: \"見出し\",\n },\n heading_2: {\n title: \"見出し2\",\n subtext: \"重要なセクションに使用\",\n aliases: [\"h2\", \"見出し2\", \"subheading\", \"中見出し\"],\n group: \"見出し\",\n },\n heading_3: {\n title: \"見出し3\",\n subtext: \"セクションやグループの見出しに使用\",\n aliases: [\"h3\", \"見出し3\", \"subheading\", \"小見出し\"],\n group: \"見出し\",\n },\n numbered_list: {\n title: \"番号付リスト\",\n subtext: \"番号付リストを表示するために使用\",\n aliases: [\n \"ol\",\n \"li\",\n \"numberedlist\",\n \"numbered list\",\n \"リスト\",\n \"番号付リスト\",\n \"番号 リスト\",\n ],\n group: \"基本ブロック\",\n },\n bullet_list: {\n title: \"箇条書き\",\n subtext: \"箇条書きを表示するために使用\",\n aliases: [\n \"ul\",\n \"li\",\n \"bulletlist\",\n \"bullet list\",\n \"リスト\",\n \"箇条書きリスト\",\n ],\n group: \"基本ブロック\",\n },\n check_list: {\n title: \"チェックリスト\",\n subtext: \"チェックボックス付きリストを表示するために使用されます\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"checklist\",\n \"checked list\",\n \"リスト\",\n \"チェックリスト\",\n \"チェックされたリスト\",\n ],\n group: \"基本ブロック\",\n },\n paragraph: {\n title: \"標準テキスト\",\n subtext: \"本文に使用\",\n aliases: [\"p\", \"paragraph\", \"標準テキスト\"],\n group: \"基本ブロック\",\n },\n code_block: {\n title: \"コードブロック\",\n subtext: \"シンタックスハイライト付きのコードブロック\",\n aliases: [\"code\", \"pre\", \"コード\", \"コードブロック\"],\n group: \"基本ブロック\",\n },\n table: {\n title: \"表\",\n subtext: \"表に使用\",\n aliases: [\"table\", \"表\", \"テーブル\"],\n group: \"高度なブロック\",\n },\n image: {\n title: \"画像\",\n subtext: \"画像を挿入\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"url\",\n \"画像\",\n ],\n group: \"メディア\",\n },\n video: {\n title: \"ビデオ\",\n subtext: \"ビデオを挿入\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n \"ビデオ\",\n ],\n group: \"メディア\",\n },\n audio: {\n title: \"オーディオ\",\n subtext: \"オーディオを挿入\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"url\",\n \"オーディオ\",\n ],\n group: \"メディア\",\n },\n file: {\n title: \"ファイル\",\n subtext: \"ファイルを挿入\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"url\", \"ファイル\"],\n group: \"メディア\",\n },\n emoji: {\n title: \"絵文字\",\n subtext: \"絵文字を挿入するために使用します\",\n aliases: [\"絵文字\", \"顔文字\", \"感情表現\", \"顔\"],\n group: \"その他\",\n },\n },\n placeholders: {\n default: \"テキストを入力するか'/' を入力してコマンド選択\",\n heading: \"見出し\",\n bulletListItem: \"リストを追加\",\n numberedListItem: \"リストを追加\",\n checkListItem: \"リストを追加\",\n },\n file_blocks: {\n image: {\n add_button_text: \"画像を追加\",\n },\n video: {\n add_button_text: \"ビデオを追加\",\n },\n audio: {\n add_button_text: \"オーディオを追加\",\n },\n file: {\n add_button_text: \"ファイルを追加\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"ブロックを追加\",\n drag_handle_label: \"ブロックメニュー\",\n },\n drag_handle: {\n delete_menuitem: \"削除\",\n colors_menuitem: \"色を変更\",\n },\n table_handle: {\n delete_column_menuitem: \"列を削除\",\n delete_row_menuitem: \"行を削除\",\n add_left_menuitem: \"左に列を追加\",\n add_right_menuitem: \"右に列を追加\",\n add_above_menuitem: \"上に行を追加\",\n add_below_menuitem: \"下に行を追加\",\n },\n suggestion_menu: {\n no_items_title: \"アイテムが見つかりません\",\n loading: \"読込中…\",\n },\n color_picker: {\n text_title: \"文字色\",\n background_title: \"背景色\",\n colors: {\n default: \"デフォルト\",\n gray: \"グレー\",\n brown: \"茶色\",\n red: \"赤\",\n orange: \"オレンジ\",\n yellow: \"黄色\",\n green: \"緑\",\n blue: \"青\",\n purple: \"紫\",\n pink: \"ピンク\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"太字\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"斜体\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"下線\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"打ち消し\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"コード\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"色\",\n },\n link: {\n tooltip: \"リンク\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"キャプションを編集\",\n input_placeholder: \"キャプションを編集\",\n },\n file_replace: {\n tooltip: {\n image: \"画像を置換\",\n video: \"ビデオを置換\",\n audio: \"オーディオを置換\",\n file: \"ファイルを置換\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"画像の名前を変更\",\n video: \"ビデオの名前を変更\",\n audio: \"オーディオの名前を変更\",\n file: \"ファイルの名前を変更\",\n },\n input_placeholder: {\n image: \"画像の名前を変更\",\n video: \"ビデオの名前を変更\",\n audio: \"オーディオの名前を変更\",\n file: \"ファイルの名前を変更\",\n },\n },\n file_download: {\n tooltip: {\n image: \"画像をダウンロード\",\n video: \"ビデオをダウンロード\",\n audio: \"オーディオをダウンロード\",\n file: \"ファイルをダウンロード\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"画像を削除\",\n video: \"ビデオを削除\",\n audio: \"オーディオを削除\",\n file: \"ファイルを削除\",\n },\n },\n file_preview_toggle: {\n tooltip: \"プレビューの切り替え\",\n },\n nest: {\n tooltip: \"インデント増\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"インデント減\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"左揃え\",\n },\n align_center: {\n tooltip: \"中央揃え\",\n },\n align_right: {\n tooltip: \"右揃え\",\n },\n align_justify: {\n tooltip: \"両端揃え\",\n },\n },\n file_panel: {\n upload: {\n title: \"アップロード\",\n file_placeholder: {\n image: \"画像をアップロード\",\n video: \"ビデオをアップロード\",\n audio: \"オーディオをアップロード\",\n file: \"ファイルをアップロード\",\n },\n upload_error: \"エラー: アップロードが失敗しました\",\n },\n embed: {\n title: \"埋め込み\",\n embed_button: {\n image: \"画像を埋め込む\",\n video: \"ビデオを埋め込む\",\n audio: \"オーディオを埋め込む\",\n file: \"ファイルを埋め込む\",\n },\n url_placeholder: \"URLを入力\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"リンクを解除\",\n },\n edit: {\n text: \"リンクを編集\",\n tooltip: \"編集\",\n },\n open: {\n tooltip: \"新しいタブでリンクを開く\",\n },\n form: {\n title_placeholder: \"タイトルを編集\",\n url_placeholder: \"URLを編集\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const ko: Dictionary = {\n slash_menu: {\n heading: {\n title: \"제목1\",\n subtext: \"섹션 제목(대)\",\n aliases: [\"h\", \"제목1\", \"h1\", \"대제목\"],\n group: \"제목\",\n },\n heading_2: {\n title: \"제목2\",\n subtext: \"섹션 제목(중)\",\n aliases: [\"h2\", \"제목2\", \"중제목\"],\n group: \"제목\",\n },\n heading_3: {\n title: \"제목3\",\n subtext: \"섹션 제목(소)\",\n aliases: [\"h3\", \"제목3\", \"subheading\"],\n group: \"제목\",\n },\n numbered_list: {\n title: \"번호 매기기 목록\",\n subtext: \"번호가 매겨진 목록을 추가합니다.\",\n aliases: [\"ol\", \"li\", \"목록\", \"번호 매기기 목록\", \"번호 목록\"],\n group: \"기본 블록\",\n },\n bullet_list: {\n title: \"글머리 기호 목록\",\n subtext: \"간단한 글머리 기호를 추가합니다.\",\n aliases: [\"ul\", \"li\", \"목록\", \"글머리 기호 목록\", \"글머리 목록\"],\n group: \"기본 블록\",\n },\n check_list: {\n title: \"체크리스트\",\n subtext: \"체크박스가 있는 목록을 표시하는 데 사용\",\n aliases: [\n \"ul\",\n \"li\",\n \"목록\",\n \"체크리스트\",\n \"체크 리스트\",\n \"체크된 목록\",\n \"체크박스\",\n ],\n group: \"기본 블록\",\n },\n paragraph: {\n title: \"본문\",\n subtext: \"일반 텍스트\",\n aliases: [\"p\", \"paragraph\", \"본문\"],\n group: \"기본 블록\",\n },\n code_block: {\n title: \"코드 블록\",\n subtext: \"구문 강조가 있는 코드 블록\",\n aliases: [\"code\", \"pre\"],\n group: \"기본 블록\",\n },\n table: {\n title: \"표\",\n subtext: \"간단한 표를 추가합니다.\",\n aliases: [\"표\"],\n group: \"고급\",\n },\n image: {\n title: \"이미지\",\n subtext: \"이미지 파일을 업로드합니다.\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"이미지\",\n \"url\",\n ],\n group: \"미디어\",\n },\n video: {\n title: \"비디오\",\n subtext: \"비디오 삽입\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"동영상\",\n \"url\",\n ],\n group: \"미디어\",\n },\n audio: {\n title: \"오디오\",\n subtext: \"오디오 삽입\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"오디오\",\n \"url\",\n ],\n group: \"미디어\",\n },\n file: {\n title: \"파일\",\n subtext: \"파일 삽입\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"파일\", \"url\"],\n group: \"미디어\",\n },\n emoji: {\n title: \"이모지\",\n subtext: \"이모지 삽입용으로 사용됩니다\",\n aliases: [\n \"이모지\",\n \"emoji\",\n \"감정 표현\",\n \"emotion expression\",\n \"표정\",\n \"face expression\",\n \"얼굴\",\n \"face\",\n ],\n group: \"기타\",\n },\n },\n placeholders: {\n default: \"텍스트를 입력하거나 /를 입력하여 명령을 입력하세요.\",\n heading: \"제목\",\n bulletListItem: \"목록\",\n numberedListItem: \"목록\",\n checkListItem: \"목록\",\n },\n file_blocks: {\n image: {\n add_button_text: \"이미지 추가\",\n },\n video: {\n add_button_text: \"비디오 추가\",\n },\n audio: {\n add_button_text: \"오디오 추가\",\n },\n file: {\n add_button_text: \"파일 추가\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"블록 추가\",\n drag_handle_label: \"블록 메뉴 열기\",\n },\n drag_handle: {\n delete_menuitem: \"삭제\",\n colors_menuitem: \"색깔\",\n },\n table_handle: {\n delete_column_menuitem: \"열 1개 삭제\",\n delete_row_menuitem: \"행 삭제\",\n add_left_menuitem: \"왼쪽에 열 1개 추가\",\n add_right_menuitem: \"오른쪽에 열 1개 추가\",\n add_above_menuitem: \"위에 행 1개 추가\",\n add_below_menuitem: \"아래에 행 1개 추가\",\n },\n suggestion_menu: {\n no_items_title: \"항목을 찾을 수 없음\",\n loading: \"로딩 중…\",\n },\n color_picker: {\n text_title: \"텍스트\",\n background_title: \"배경\",\n colors: {\n default: \"기본\",\n gray: \"회색\",\n brown: \"갈색\",\n red: \"빨간색\",\n orange: \"주황색\",\n yellow: \"노란색\",\n green: \"녹색\",\n blue: \"파란색\",\n purple: \"보라색\",\n pink: \"분홍색\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"진하게\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"기울임\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"밑줄\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"취소선\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"코드\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"색깔\",\n },\n link: {\n tooltip: \"링크 만들기\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"이미지 캡션 수정\",\n input_placeholder: \"이미지 캡션 수정\",\n },\n file_replace: {\n tooltip: {\n image: \"이미지 교체\",\n video: \"비디오 교체\",\n audio: \"오디오 교체\",\n file: \"파일 교체\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"이미지 이름 변경\",\n video: \"비디오 이름 변경\",\n audio: \"오디오 이름 변경\",\n file: \"파일 이름 변경\",\n },\n input_placeholder: {\n image: \"이미지 이름 변경\",\n video: \"비디오 이름 변경\",\n audio: \"오디오 이름 변경\",\n file: \"파일 이름 변경\",\n },\n },\n file_download: {\n tooltip: {\n image: \"이미지 다운로드\",\n video: \"비디오 다운로드\",\n audio: \"오디오 다운로드\",\n file: \"파일 다운로드\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"이미지 삭제\",\n video: \"비디오 삭제\",\n audio: \"오디오 삭제\",\n file: \"파일 삭제\",\n },\n },\n file_preview_toggle: {\n tooltip: \"미리보기 전환\",\n },\n nest: {\n tooltip: \"중첩 블록\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"비중첩 블록\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"텍스트 왼쪽 맞춤\",\n },\n align_center: {\n tooltip: \"텍스트 가운데 맞춤\",\n },\n align_right: {\n tooltip: \"텍스트 오른쪽 맞춤\",\n },\n align_justify: {\n tooltip: \"텍스트 양쪽 맞춤\",\n },\n },\n file_panel: {\n upload: {\n title: \"업로드\",\n file_placeholder: {\n image: \"이미지 업로드\",\n video: \"비디오 업로드\",\n audio: \"오디오 업로드\",\n file: \"파일 업로드\",\n },\n upload_error: \"오류: 업로드 실패\",\n },\n embed: {\n title: \"임베드\",\n embed_button: {\n image: \"이미지 삽입\",\n video: \"비디오 삽입\",\n audio: \"오디오 삽입\",\n file: \"파일 삽입\",\n },\n url_placeholder: \"URL을 입력하세요.\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"링크 삭제\",\n },\n edit: {\n text: \"링크 수정\",\n tooltip: \"수정\",\n },\n open: {\n tooltip: \"새 탭으로 열기\",\n },\n form: {\n title_placeholder: \"제목 수정\",\n url_placeholder: \"URL 수정\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const nl: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Kop 1\",\n subtext: \"Gebruikt voor een hoofdkop\",\n aliases: [\"h\", \"kop1\", \"h1\"],\n group: \"Koppen\",\n },\n heading_2: {\n title: \"Kop 2\",\n subtext: \"Gebruikt voor belangrijke secties\",\n aliases: [\"h2\", \"kop2\", \"subkop\"],\n group: \"Koppen\",\n },\n heading_3: {\n title: \"Kop 3\",\n subtext: \"Gebruikt voor subsecties en groepskoppen\",\n aliases: [\"h3\", \"kop3\", \"subkop\"],\n group: \"Koppen\",\n },\n numbered_list: {\n title: \"Genummerde Lijst\",\n subtext: \"Gebruikt om een genummerde lijst weer te geven\",\n aliases: [\"ol\", \"li\", \"lijst\", \"genummerdelijst\", \"genummerde lijst\"],\n group: \"Basisblokken\",\n },\n bullet_list: {\n title: \"Puntenlijst\",\n subtext: \"Gebruikt om een ongeordende lijst weer te geven\",\n aliases: [\"ul\", \"li\", \"lijst\", \"puntenlijst\", \"punten lijst\"],\n group: \"Basisblokken\",\n },\n check_list: {\n title: \"Controlelijst\",\n subtext: \"Gebruikt om een lijst met selectievakjes weer te geven\",\n aliases: [\"ul\", \"li\", \"lijst\", \"aangevinkte lijst\", \"selectievakje\"],\n group: \"Basisblokken\",\n },\n paragraph: {\n title: \"Paragraaf\",\n subtext: \"Gebruikt voor de hoofdtekst van uw document\",\n aliases: [\"p\", \"paragraaf\"],\n group: \"Basisblokken\",\n },\n code_block: {\n title: \"Codeblok\",\n subtext: \"Codeblok met syntax highlighting\",\n aliases: [\"code\", \"pre\"],\n group: \"Basisblokken\",\n },\n table: {\n title: \"Tabel\",\n subtext: \"Gebruikt voor tabellen\",\n aliases: [\"tabel\"],\n group: \"Geavanceerd\",\n },\n image: {\n title: \"Afbeelding\",\n subtext: \"Voeg een afbeelding in\",\n aliases: [\n \"afbeelding\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"foto\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n video: {\n title: \"Video\",\n subtext: \"Voeg een video in\",\n aliases: [\n \"video\",\n \"videoUploaden\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n \"drive\",\n \"dropbox\",\n ],\n group: \"Media\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Voeg audio in\",\n aliases: [\n \"audio\",\n \"audioUploaden\",\n \"upload\",\n \"mp3\",\n \"geluid\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n file: {\n title: \"Bestand\",\n subtext: \"Voeg een bestand in\",\n aliases: [\"bestand\", \"upload\", \"insluiten\", \"media\", \"url\"],\n group: \"Media\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Gebruikt voor het invoegen van een emoji\",\n aliases: [\n \"emoji\",\n \"emotie-uitdrukking\",\n \"gezichtsuitdrukking\",\n \"gezicht\",\n ],\n group: \"Overig\",\n },\n },\n placeholders: {\n default: \"Voer tekst in of type '/' voor commando's\",\n heading: \"Kop\",\n bulletListItem: \"Lijst\",\n numberedListItem: \"Lijst\",\n checkListItem: \"Lijst\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Afbeelding toevoegen\",\n },\n video: {\n add_button_text: \"Video toevoegen\",\n },\n audio: {\n add_button_text: \"Audio toevoegen\",\n },\n file: {\n add_button_text: \"Bestand toevoegen\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Nieuw blok\",\n drag_handle_label: \"Open blok menu\",\n },\n drag_handle: {\n delete_menuitem: \"Verwijder\",\n colors_menuitem: \"Kleuren\",\n },\n table_handle: {\n delete_column_menuitem: \"Verwijder kolom\",\n delete_row_menuitem: \"Verwijder rij\",\n add_left_menuitem: \"Voeg kolom links toe\",\n add_right_menuitem: \"Voeg kolom rechts toe\",\n add_above_menuitem: \"Voeg rij boven toe\",\n add_below_menuitem: \"Voeg rij onder toe\",\n },\n suggestion_menu: {\n no_items_title: \"Geen items gevonden\",\n loading: \"Laden…\",\n },\n color_picker: {\n text_title: \"Tekst\",\n background_title: \"Achtergrond\",\n colors: {\n default: \"Standaard\",\n gray: \"Grijs\",\n brown: \"Bruin\",\n red: \"Rood\",\n orange: \"Oranje\",\n yellow: \"Geel\",\n green: \"Groen\",\n blue: \"Blauw\",\n purple: \"Paars\",\n pink: \"Roze\",\n },\n },\n formatting_toolbar: {\n bold: {\n tooltip: \"Vet\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Cursief\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Onderstrepen\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Doorstrepen\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Kleuren\",\n },\n link: {\n tooltip: \"Maak link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Bewerk onderschrift\",\n input_placeholder: \"Bewerk onderschrift\",\n },\n file_replace: {\n tooltip: {\n image: \"Afbeelding vervangen\",\n video: \"Video vervangen\",\n audio: \"Audio vervangen\",\n file: \"Bestand vervangen\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Afbeelding hernoemen\",\n video: \"Video hernoemen\",\n audio: \"Audio hernoemen\",\n file: \"Bestand hernoemen\",\n },\n input_placeholder: {\n image: \"Afbeelding hernoemen\",\n video: \"Video hernoemen\",\n audio: \"Audio hernoemen\",\n file: \"Bestand hernoemen\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Afbeelding downloaden\",\n video: \"Video downloaden\",\n audio: \"Audio downloaden\",\n file: \"Bestand downloaden\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Afbeelding verwijderen\",\n video: \"Video verwijderen\",\n audio: \"Audio verwijderen\",\n file: \"Bestand verwijderen\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Voorbeeldschakelaar\",\n },\n nest: {\n tooltip: \"Nest blok\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Ontnest blok\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Tekst links uitlijnen\",\n },\n align_center: {\n tooltip: \"Tekst centreren\",\n },\n align_right: {\n tooltip: \"Tekst rechts uitlijnen\",\n },\n align_justify: {\n tooltip: \"Tekst uitvullen\",\n },\n },\n file_panel: {\n upload: {\n title: \"Upload\",\n file_placeholder: {\n image: \"Afbeelding uploaden\",\n video: \"Video uploaden\",\n audio: \"Audio uploaden\",\n file: \"Bestand uploaden\",\n },\n upload_error: \"Fout: Upload mislukt\",\n },\n embed: {\n title: \"Insluiten\",\n embed_button: {\n image: \"Afbeelding insluiten\",\n video: \"Video insluiten\",\n audio: \"Audio insluiten\",\n file: \"Bestand insluiten\",\n },\n url_placeholder: \"Voer URL in\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Verwijder link\",\n },\n edit: {\n text: \"Bewerk link\",\n tooltip: \"Bewerk\",\n },\n open: {\n tooltip: \"Open in nieuw tabblad\",\n },\n form: {\n title_placeholder: \"Bewerk titel\",\n url_placeholder: \"Bewerk URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const pl: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Nagłówek 1\",\n subtext: \"Używany dla nagłówka najwyższego poziomu\",\n aliases: [\"h\", \"naglowek1\", \"h1\"],\n group: \"Nagłówki\",\n },\n heading_2: {\n title: \"Nagłówek 2\",\n subtext: \"Używany dla kluczowych sekcji\",\n aliases: [\"h2\", \"naglowek2\", \"podnaglowek\"],\n group: \"Nagłówki\",\n },\n heading_3: {\n title: \"Nagłówek 3\",\n subtext: \"Używany dla podsekcji i grup nagłówków\",\n aliases: [\"h3\", \"naglowek3\", \"podnaglowek\"],\n group: \"Nagłówki\",\n },\n numbered_list: {\n title: \"Lista numerowana\",\n subtext: \"Używana do wyświetlania listy numerowanej\",\n aliases: [\"ol\", \"li\", \"lista\", \"numerowana lista\"],\n group: \"Podstawowe bloki\",\n },\n bullet_list: {\n title: \"Lista punktowana\",\n subtext: \"Używana do wyświetlania listy bez numeracji\",\n aliases: [\"ul\", \"li\", \"lista\", \"punktowana lista\"],\n group: \"Podstawowe bloki\",\n },\n check_list: {\n title: \"Lista z polami wyboru\",\n subtext: \"Używana do wyświetlania listy z polami wyboru\",\n aliases: [\"ul\", \"li\", \"lista\", \"lista z polami wyboru\", \"pole wyboru\"],\n group: \"Podstawowe bloki\",\n },\n paragraph: {\n title: \"Akapit\",\n subtext: \"Używany dla treści dokumentu\",\n aliases: [\"p\", \"akapit\"],\n group: \"Podstawowe bloki\",\n },\n code_block: {\n title: \"Blok kodu\",\n subtext: \"Blok kodu z podświetleniem składni\",\n aliases: [\"kod\", \"pre\"],\n group: \"Podstawowe bloki\",\n },\n table: {\n title: \"Tabela\",\n subtext: \"Używana do tworzenia tabel\",\n aliases: [\"tabela\"],\n group: \"Zaawansowane\",\n },\n image: {\n title: \"Zdjęcie\",\n subtext: \"Wstaw zdjęcie\",\n aliases: [\n \"obraz\",\n \"wrzućZdjęcie\",\n \"wrzuć\",\n \"img\",\n \"zdjęcie\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n video: {\n title: \"Wideo\",\n subtext: \"Wstaw wideo\",\n aliases: [\"wideo\", \"wrzućWideo\", \"wrzuć\", \"mp4\", \"film\", \"media\", \"url\"],\n group: \"Media\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Wstaw audio\",\n aliases: [\n \"audio\",\n \"wrzućAudio\",\n \"wrzuć\",\n \"mp3\",\n \"dźwięk\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n file: {\n title: \"Plik\",\n subtext: \"Wstaw plik\",\n aliases: [\"plik\", \"wrzuć\", \"wstaw\", \"media\", \"url\"],\n group: \"Media\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Używane do wstawiania emoji\",\n aliases: [\"emoji\", \"emotka\", \"wyrażenie emocji\", \"twarz\"],\n group: \"Inne\",\n },\n },\n placeholders: {\n default: \"Wprowadź tekst lub wpisz '/' aby użyć poleceń\",\n heading: \"Nagłówek\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Dodaj zdjęcie\",\n },\n video: {\n add_button_text: \"Dodaj wideo\",\n },\n audio: {\n add_button_text: \"Dodaj audio\",\n },\n file: {\n add_button_text: \"Dodaj plik\",\n },\n },\n side_menu: {\n add_block_label: \"Dodaj blok\",\n drag_handle_label: \"Otwórz menu bloków\",\n },\n drag_handle: {\n delete_menuitem: \"Usuń\",\n colors_menuitem: \"Kolory\",\n },\n table_handle: {\n delete_column_menuitem: \"Usuń kolumnę\",\n delete_row_menuitem: \"Usuń wiersz\",\n add_left_menuitem: \"Dodaj kolumnę po lewej\",\n add_right_menuitem: \"Dodaj kolumnę po prawej\",\n add_above_menuitem: \"Dodaj wiersz powyżej\",\n add_below_menuitem: \"Dodaj wiersz poniżej\",\n },\n suggestion_menu: {\n no_items_title: \"Nie znaleziono elementów\",\n loading: \"Ładowanie…\",\n },\n color_picker: {\n text_title: \"Tekst\",\n background_title: \"Tło\",\n colors: {\n default: \"Domyślny\",\n gray: \"Szary\",\n brown: \"Brązowy\",\n red: \"Czerwony\",\n orange: \"Pomarańczowy\",\n yellow: \"Żółty\",\n green: \"Zielony\",\n blue: \"Niebieski\",\n purple: \"Fioletowy\",\n pink: \"Różowy\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Pogrubienie\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Kursywa\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Podkreślenie\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Przekreślenie\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Kod\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Kolory\",\n },\n link: {\n tooltip: \"Utwórz link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Zmień podpis\",\n input_placeholder: \"Zmień podpis\",\n },\n file_replace: {\n tooltip: {\n image: \"Zmień obraz\",\n video: \"Zmień wideo\",\n audio: \"Zmień audio\",\n file: \"Zmień plik\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Zmień nazwę zdjęcia\",\n video: \"Zmień nazwę wideo\",\n audio: \"Zmień nazwę audio\",\n file: \"Zmień nazwę pliku\",\n },\n input_placeholder: {\n image: \"Zmień nazwę zdjęcia\",\n video: \"Zmień nazwę wideo\",\n audio: \"Zmień nazwę audio\",\n file: \"Zmień nazwę pliku\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Pobierz zdjęcie\",\n video: \"Pobierz wideo\",\n audio: \"Pobierz audio\",\n file: \"Pobierz plik\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Usuń zdjęcie\",\n video: \"Usuń wideo\",\n audio: \"Usuń audio\",\n file: \"Usuń plik\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Przełącz podgląd\",\n },\n nest: {\n tooltip: \"Zagnieźdź blok\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Odgagnieźdź blok\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Wyrównaj tekst do lewej\",\n },\n align_center: {\n tooltip: \"Wyśrodkuj tekst\",\n },\n align_right: {\n tooltip: \"Wyrównaj tekst do prawej\",\n },\n align_justify: {\n tooltip: \"Wyjustuj tekst\",\n },\n },\n file_panel: {\n upload: {\n title: \"Wrzuć\",\n file_placeholder: {\n image: \"Wrzuć zdjęcie\",\n video: \"Wrzuć wideo\",\n audio: \"Wrzuć audio\",\n file: \"Wrzuć plik\",\n },\n upload_error: \"Błąd: Przesyłanie nie powiodło się\",\n },\n embed: {\n title: \"Wstaw\",\n embed_button: {\n image: \"Wstaw zdjęice\",\n video: \"Wstaw wideo\",\n audio: \"Wstaw audio\",\n file: \"Wstaw plik\",\n },\n url_placeholder: \"Wprowadź URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Usuń link\",\n },\n edit: {\n text: \"Edytuj link\",\n tooltip: \"Edytuj\",\n },\n open: {\n tooltip: \"Otwórz w nowej karcie\",\n },\n form: {\n title_placeholder: \"Edytuj tytuł\",\n url_placeholder: \"Edytuj URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const pt: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Título\",\n subtext: \"Usado para um título de nível superior\",\n aliases: [\"h\", \"titulo1\", \"h1\"],\n group: \"Títulos\",\n },\n heading_2: {\n title: \"Título 2\",\n subtext: \"Usado para seções principais\",\n aliases: [\"h2\", \"titulo2\", \"subtitulo\"],\n group: \"Títulos\",\n },\n heading_3: {\n title: \"Título 3\",\n subtext: \"Usado para subseções e títulos de grupo\",\n aliases: [\"h3\", \"titulo3\", \"subtitulo\"],\n group: \"Títulos\",\n },\n numbered_list: {\n title: \"Lista Numerada\",\n subtext: \"Usado para exibir uma lista numerada\",\n aliases: [\"ol\", \"li\", \"lista\", \"listanumerada\", \"lista numerada\"],\n group: \"Blocos básicos\",\n },\n bullet_list: {\n title: \"Lista com Marcadores\",\n subtext: \"Usado para exibir uma lista não ordenada\",\n aliases: [\"ul\", \"li\", \"lista\", \"listamarcadores\", \"lista com marcadores\"],\n group: \"Blocos básicos\",\n },\n check_list: {\n title: \"Lista de verificação\",\n subtext: \"Usado para exibir uma lista com caixas de seleção\",\n aliases: [\n \"ul\",\n \"li\",\n \"lista\",\n \"lista de verificação\",\n \"lista marcada\",\n \"caixa de seleção\",\n ],\n group: \"Blocos básicos\",\n },\n paragraph: {\n title: \"Parágrafo\",\n subtext: \"Usado para o corpo do seu documento\",\n aliases: [\"p\", \"paragrafo\"],\n group: \"Blocos básicos\",\n },\n code_block: {\n title: \"Bloco de Código\",\n subtext: \"Usado para exibir código com destaque de sintaxe\",\n aliases: [\"codigo\", \"pre\"],\n group: \"Blocos básicos\",\n },\n table: {\n title: \"Tabela\",\n subtext: \"Usado para tabelas\",\n aliases: [\"tabela\"],\n group: \"Avançado\",\n },\n image: {\n title: \"Imagem\",\n subtext: \"Inserir uma imagem\",\n aliases: [\n \"imagem\",\n \"uploadImagem\",\n \"upload\",\n \"img\",\n \"foto\",\n \"media\",\n \"url\",\n ],\n group: \"Mídia\",\n },\n video: {\n title: \"Vídeo\",\n subtext: \"Inserir um vídeo\",\n aliases: [\n \"vídeo\",\n \"uploadVídeo\",\n \"upload\",\n \"mp4\",\n \"filme\",\n \"mídia\",\n \"url\",\n ],\n group: \"Mídia\",\n },\n audio: {\n title: \"Áudio\",\n subtext: \"Inserir um áudio\",\n aliases: [\"áudio\", \"uploadÁudio\", \"upload\", \"mp3\", \"som\", \"mídia\", \"url\"],\n group: \"Mídia\",\n },\n file: {\n title: \"Arquivo\",\n subtext: \"Inserir um arquivo\",\n aliases: [\"arquivo\", \"upload\", \"incorporar\", \"mídia\", \"url\"],\n group: \"Mídia\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Usado para inserir um emoji\",\n aliases: [\"emoji\", \"emoticon\", \"expressão emocional\", \"rosto\"],\n group: \"Outros\",\n },\n },\n placeholders: {\n default: \"Digite texto ou use '/' para comandos\",\n heading: \"Título\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Adicionar imagem\",\n },\n video: {\n add_button_text: \"Adicionar vídeo\",\n },\n audio: {\n add_button_text: \"Adicionar áudio\",\n },\n file: {\n add_button_text: \"Adicionar arquivo\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Adicionar bloco\",\n drag_handle_label: \"Abrir menu do bloco\",\n },\n drag_handle: {\n delete_menuitem: \"Excluir\",\n colors_menuitem: \"Cores\",\n },\n table_handle: {\n delete_column_menuitem: \"Excluir coluna\",\n delete_row_menuitem: \"Excluir linha\",\n add_left_menuitem: \"Adicionar coluna à esquerda\",\n add_right_menuitem: \"Adicionar coluna à direita\",\n add_above_menuitem: \"Adicionar linha acima\",\n add_below_menuitem: \"Adicionar linha abaixo\",\n },\n suggestion_menu: {\n no_items_title: \"Nenhum item encontrado\",\n loading: \"Carregando…\",\n },\n color_picker: {\n text_title: \"Texto\",\n background_title: \"Fundo\",\n colors: {\n default: \"Padrão\",\n gray: \"Cinza\",\n brown: \"Marrom\",\n red: \"Vermelho\",\n orange: \"Laranja\",\n yellow: \"Amarelo\",\n green: \"Verde\",\n blue: \"Azul\",\n purple: \"Roxo\",\n pink: \"Rosa\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Negrito\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Itálico\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Sublinhado\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Riscado\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Código\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Cores\",\n },\n link: {\n tooltip: \"Criar link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Editar legenda\",\n input_placeholder: \"Editar legenda\",\n },\n file_replace: {\n tooltip: {\n image: \"Substituir imagem\",\n video: \"Substituir vídeo\",\n audio: \"Substituir áudio\",\n file: \"Substituir arquivo\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Renomear imagem\",\n video: \"Renomear vídeo\",\n audio: \"Renomear áudio\",\n file: \"Renomear arquivo\",\n },\n input_placeholder: {\n image: \"Renomear imagem\",\n video: \"Renomear vídeo\",\n audio: \"Renomear áudio\",\n file: \"Renomear arquivo\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Baixar imagem\",\n video: \"Baixar vídeo\",\n audio: \"Baixar áudio\",\n file: \"Baixar arquivo\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Excluir imagem\",\n video: \"Excluir vídeo\",\n audio: \"Excluir áudio\",\n file: \"Excluir arquivo\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Alternar visualização\",\n },\n nest: {\n tooltip: \"Aninhar bloco\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Desaninhar bloco\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Alinhar à esquerda\",\n },\n align_center: {\n tooltip: \"Alinhar ao centro\",\n },\n align_right: {\n tooltip: \"Alinhar à direita\",\n },\n align_justify: {\n tooltip: \"Justificar texto\",\n },\n },\n file_panel: {\n upload: {\n title: \"Upload\",\n file_placeholder: {\n image: \"Upload de imagem\",\n video: \"Upload de vídeo\",\n audio: \"Upload de áudio\",\n file: \"Upload de arquivo\",\n },\n upload_error: \"Erro: Falha no upload\",\n },\n embed: {\n title: \"Incorporar\",\n embed_button: {\n image: \"Incorporar imagem\",\n video: \"Incorporar vídeo\",\n audio: \"Incorporar áudio\",\n file: \"Incorporar arquivo\",\n },\n url_placeholder: \"Insira a URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Remover link\",\n },\n edit: {\n text: \"Editar link\",\n tooltip: \"Editar\",\n },\n open: {\n tooltip: \"Abrir em nova aba\",\n },\n form: {\n title_placeholder: \"Editar título\",\n url_placeholder: \"Editar URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const ru: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Заголовок 1 уровня\",\n subtext: \"Используется для заголовка верхнего уровня\",\n aliases: [\"h\", \"heading1\", \"h1\", \"заголовок1\"],\n group: \"Заголовки\",\n },\n heading_2: {\n title: \"Заголовок 2 уровня\",\n subtext: \"Используется для ключевых разделов\",\n aliases: [\"h2\", \"heading2\", \"subheading\", \"заголовок2\", \"подзаголовок\"],\n group: \"Заголовки\",\n },\n heading_3: {\n title: \"Заголовок 3 уровня\",\n subtext: \"Используется для подразделов и групп\",\n aliases: [\"h3\", \"heading3\", \"subheading\", \"заголовок3\", \"подзаголовок\"],\n group: \"Заголовки\",\n },\n numbered_list: {\n title: \"Нумерованный список\",\n subtext: \"Используется для отображения нумерованного списка\",\n aliases: [\n \"ol\",\n \"li\",\n \"list\",\n \"numberedlist\",\n \"numbered list\",\n \"список\",\n \"нумерованный список\",\n ],\n group: \"Базовые блоки\",\n },\n bullet_list: {\n title: \"Маркированный список\",\n subtext: \"Для отображения неупорядоченного списка.\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"bulletlist\",\n \"bullet list\",\n \"список\",\n \"маркированный список\",\n ],\n group: \"Базовые блоки\",\n },\n check_list: {\n title: \"Контрольный список\",\n subtext: \"Для отображения списка с флажками\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"checklist\",\n \"check list\",\n \"checked list\",\n \"checkbox\",\n \"список\",\n ],\n group: \"Базовые блоки\",\n },\n paragraph: {\n title: \"Параграф\",\n subtext: \"Основной текст\",\n aliases: [\"p\", \"paragraph\", \"параграф\"],\n group: \"Базовые блоки\",\n },\n code_block: {\n title: \"Блок кода\",\n subtext: \"Блок кода с подсветкой синтаксиса\",\n aliases: [\"code\", \"pre\", \"блок кода\"],\n group: \"Базовые блоки\",\n },\n table: {\n title: \"Таблица\",\n subtext: \"Используется для таблиц\",\n aliases: [\"table\", \"таблица\"],\n group: \"Продвинутый\",\n },\n image: {\n title: \"Картинка\",\n subtext: \"Вставить изображение\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"url\",\n \"загрузка\",\n \"картинка\",\n \"рисунок\",\n ],\n group: \"Медиа\",\n },\n video: {\n title: \"Видео\",\n subtext: \"Вставить видео\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n \"загрузка\",\n \"видео\",\n ],\n group: \"Медиа\",\n },\n audio: {\n title: \"Аудио\",\n subtext: \"Вставить аудио\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"url\",\n \"загрузка\",\n \"аудио\",\n \"звук\",\n \"музыка\",\n ],\n group: \"Медиа\",\n },\n file: {\n title: \"Файл\",\n subtext: \"Вставить файл\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"url\", \"загрузка\", \"файл\"],\n group: \"Медиа\",\n },\n emoji: {\n title: \"Эмодзи\",\n subtext: \"Используется для вставки эмодзи\",\n aliases: [\"эмодзи\", \"смайлик\", \"выражение эмоций\", \"лицо\"],\n group: \"Прочее\",\n },\n },\n placeholders: {\n default: \"Ведите текст или введите «/» для команд\",\n heading: \"Заголовок\",\n bulletListItem: \"Список\",\n numberedListItem: \"Список\",\n checkListItem: \"Список\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Добавить изображение\",\n },\n video: {\n add_button_text: \"Добавить видео\",\n },\n audio: {\n add_button_text: \"Добавить аудио\",\n },\n file: {\n add_button_text: \"Добавить файл\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Добавить блок\",\n drag_handle_label: \"Открыть меню блока\",\n },\n drag_handle: {\n delete_menuitem: \"Удалить\",\n colors_menuitem: \"Цвета\",\n },\n table_handle: {\n delete_column_menuitem: \"Удалить столбец\",\n delete_row_menuitem: \"Удалить строку\",\n add_left_menuitem: \"Добавить столбец слева\",\n add_right_menuitem: \"Добавить столбец справа\",\n add_above_menuitem: \"Добавить строку выше\",\n add_below_menuitem: \"Добавить строку ниже\",\n },\n suggestion_menu: {\n no_items_title: \"ничего не найдено\",\n loading: \"Загрузка…\",\n },\n color_picker: {\n text_title: \"Текст\",\n background_title: \"Задний фон\",\n colors: {\n default: \"По умолчинию\",\n gray: \"Серый\",\n brown: \"Коричневый\",\n red: \"Красный\",\n orange: \"Оранжевый\",\n yellow: \"Жёлтый\",\n green: \"Зелёный\",\n blue: \"Голубой\",\n purple: \"Фиолетовый\",\n pink: \"Розовый\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Жирный\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Курсив\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Подчёркнутый\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Зачёркнутый\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Код\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Цвета\",\n },\n link: {\n tooltip: \"Создать ссылку\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Изменить подпись\",\n input_placeholder: \"Изменить подпись\",\n },\n file_replace: {\n tooltip: {\n image: \"Заменить изображение\",\n video: \"Заменить видео\",\n audio: \"Заменить аудио\",\n file: \"Заменить файл\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Переименовать изображение\",\n video: \"Переименовать видео\",\n audio: \"Переименовать аудио\",\n file: \"Переименовать файл\",\n },\n input_placeholder: {\n image: \"Переименовать изображение\",\n video: \"Переименовать видео\",\n audio: \"Переименовать аудио\",\n file: \"Переименовать файл\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Скачать картинку\",\n video: \"Скачать видео\",\n audio: \"Скачать аудио\",\n file: \"Скачать файл\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Удалить картинку\",\n video: \"Удалить видео\",\n audio: \"Удалить аудио\",\n file: \"Скачать файл\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Переключить предварительный просмотр\",\n },\n nest: {\n tooltip: \"Сдвинуть вправо\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Сдвинуть влево\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Текст по левому краю\",\n },\n align_center: {\n tooltip: \"Текст по середине\",\n },\n align_right: {\n tooltip: \"Текст по правому краю\",\n },\n align_justify: {\n tooltip: \"По середине текст\",\n },\n },\n file_panel: {\n upload: {\n title: \"Загрузить\",\n file_placeholder: {\n image: \"Загрузить картинки\",\n video: \"Загрузить видео\",\n audio: \"Загрузить аудио\",\n file: \"Загрузить файл\",\n },\n upload_error: \"Ошибка: не удалось загрузить\",\n },\n embed: {\n title: \"Вставить\",\n embed_button: {\n image: \"Вставить картинку\",\n video: \"Вставить видео\",\n audio: \"Вставить аудио\",\n file: \"Вставить файл\",\n },\n url_placeholder: \"Введите URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Удалить ссылку\",\n },\n edit: {\n text: \"Изменить ссылку\",\n tooltip: \"Редактировать\",\n },\n open: {\n tooltip: \"Открыть в новой вкладке\",\n },\n form: {\n title_placeholder: \"Изменить заголовок\",\n url_placeholder: \"Изменить URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const vi: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Tiêu đề H1\",\n subtext: \"Sử dụng cho tiêu đề cấp cao nhất\",\n aliases: [\"h\", \"tieude1\", \"dd1\"],\n group: \"Tiêu đề\",\n },\n heading_2: {\n title: \"Tiêu đề H2\",\n subtext: \"Sử dụng cho các phần chính\",\n aliases: [\"h2\", \"tieude2\", \"tieudephu\"],\n group: \"Tiêu đề\",\n },\n heading_3: {\n title: \"Tiêu đề H3\",\n subtext: \"Sử dụng cho phụ đề và tiêu đề nhóm\",\n aliases: [\"h3\", \"tieude3\", \"tieudephu\"],\n group: \"Tiêu đề\",\n },\n numbered_list: {\n title: \"Danh sách đánh số\",\n subtext: \"Sử dụng để hiển thị danh sách có đánh số\",\n aliases: [\"ol\", \"li\", \"ds\", \"danhsachdso\", \"danh sach danh so\"],\n group: \"Khối cơ bản\",\n },\n bullet_list: {\n title: \"Danh sách\",\n subtext: \"Sử dụng để hiển thị danh sách không đánh số\",\n aliases: [\"ul\", \"li\", \"ds\", \"danhsach\", \"danh sach\"],\n group: \"Khối cơ bản\",\n },\n check_list: {\n title: \"Danh sách kiểm tra\",\n subtext: \"Dùng để hiển thị danh sách có hộp kiểm\",\n aliases: [\n \"ul\",\n \"li\",\n \"danh sach\",\n \"danh sach kiem tra\",\n \"danh sach da kiem tra\",\n \"hop kiem\",\n ],\n group: \"Khối cơ bản\",\n },\n paragraph: {\n title: \"Đoạn văn\",\n subtext: \"Sử dụng cho nội dung chính của tài liệu\",\n aliases: [\"p\", \"doanvan\"],\n group: \"Khối cơ bản\",\n },\n code_block: {\n title: \"Mã\",\n subtext: \"Sử dụng để hiển thị mã với cú pháp\",\n aliases: [\"code\", \"pre\"],\n group: \"Khối cơ bản\",\n },\n table: {\n title: \"Bảng\",\n subtext: \"Sử dụng để tạo bảng\",\n aliases: [\"bang\"],\n group: \"Nâng cao\",\n },\n image: {\n title: \"Hình ảnh\",\n subtext: \"Chèn hình ảnh\",\n aliases: [\"anh\", \"tai-len-anh\", \"tai-len\", \"img\", \"hinh\", \"media\", \"url\"],\n group: \"Phương tiện\",\n },\n video: {\n title: \"Video\",\n subtext: \"Chèn video\",\n aliases: [\n \"video\",\n \"tai-len-video\",\n \"tai-len\",\n \"mp4\",\n \"phim\",\n \"media\",\n \"url\",\n ],\n group: \"Phương tiện\",\n },\n audio: {\n title: \"Âm thanh\",\n subtext: \"Chèn âm thanh\",\n aliases: [\n \"âm thanh\",\n \"tai-len-am-thanh\",\n \"tai-len\",\n \"mp3\",\n \"am thanh\",\n \"media\",\n \"url\",\n ],\n group: \"Phương tiện\",\n },\n file: {\n title: \"Tệp\",\n subtext: \"Chèn tệp\",\n aliases: [\"tep\", \"tai-len\", \"nhung\", \"media\", \"url\"],\n group: \"Phương tiện\",\n },\n emoji: {\n title: \"Biểu tượng cảm xúc\",\n subtext: \"Dùng để chèn biểu tượng cảm xúc\",\n aliases: [\n \"biểu tượng cảm xúc\",\n \"emoji\",\n \"emoticon\",\n \"cảm xúc expression\",\n \"khuôn mặt\",\n \"face\",\n ],\n group: \"Khác\",\n },\n },\n placeholders: {\n default: \"Nhập văn bản hoặc gõ '/' để thêm định dạng\",\n heading: \"Tiêu đề\",\n bulletListItem: \"Danh sách\",\n numberedListItem: \"Danh sách\",\n checkListItem: \"Danh sách\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Thêm ảnh\",\n },\n video: {\n add_button_text: \"Thêm video\",\n },\n audio: {\n add_button_text: \"Thêm âm thanh\",\n },\n file: {\n add_button_text: \"Thêm tệp\",\n },\n },\n // từ gói phản ứng:\n side_menu: {\n add_block_label: \"Thêm khối\",\n drag_handle_label: \"Mở trình đơn khối\",\n },\n drag_handle: {\n delete_menuitem: \"Xóa\",\n colors_menuitem: \"Màu sắc\",\n },\n table_handle: {\n delete_column_menuitem: \"Xóa cột\",\n delete_row_menuitem: \"Xóa hàng\",\n add_left_menuitem: \"Thêm cột bên trái\",\n add_right_menuitem: \"Thêm cột bên phải\",\n add_above_menuitem: \"Thêm hàng phía trên\",\n add_below_menuitem: \"Thêm hàng phía dưới\",\n },\n suggestion_menu: {\n no_items_title: \"Không tìm thấy mục nào\",\n loading: \"Đang tải...\",\n },\n color_picker: {\n text_title: \"Văn bản\",\n background_title: \"Nền\",\n colors: {\n default: \"Mặc định\",\n gray: \"Xám\",\n brown: \"Nâu\",\n red: \"Đỏ\",\n orange: \"Cam\",\n yellow: \"Vàng\",\n green: \"Xanh lá\",\n blue: \"Xanh dương\",\n purple: \"Tím\",\n pink: \"Hồng\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"In đậm\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"In nghiêng\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Gạch dưới\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Gạch ngang\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Màu sắc\",\n },\n link: {\n tooltip: \"Tạo liên kết\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Chỉnh sửa chú thích\",\n input_placeholder: \"Chỉnh sửa chú thích\",\n },\n file_replace: {\n tooltip: {\n image: \"Thay thế hình ảnh\",\n video: \"Thay thế video\",\n audio: \"Thay thế âm thanh\",\n file: \"Thay thế tệp\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Đổi tên hình ảnh\",\n video: \"Đổi tên video\",\n audio: \"Đổi tên âm thanh\",\n file: \"Đổi tên tệp\",\n },\n input_placeholder: {\n image: \"Đổi tên hình ảnh\",\n video: \"Đổi tên video\",\n audio: \"Đổi tên âm thanh\",\n file: \"Đổi tên tệp\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Tải xuống hình ảnh\",\n video: \"Tải xuống video\",\n audio: \"Tải xuống âm thanh\",\n file: \"Tải xuống tệp\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Xóa hình ảnh\",\n video: \"Xóa video\",\n audio: \"Xóa âm thanh\",\n file: \"Xóa tệp\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Chuyển đổi xem trước\",\n },\n nest: {\n tooltip: \"Lồng khối\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Bỏ lồng khối\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Căn trái văn bản\",\n },\n align_center: {\n tooltip: \"Căn giữa văn bản\",\n },\n align_right: {\n tooltip: \"Căn phải văn bản\",\n },\n align_justify: {\n tooltip: \"Căn đều văn bản\",\n },\n },\n file_panel: {\n upload: {\n title: \"Tải lên\",\n file_placeholder: {\n image: \"Tải lên hình ảnh\",\n video: \"Tải lên video\",\n audio: \"Tải lên âm thanh\",\n file: \"Tải lên tệp\",\n },\n upload_error: \"Lỗi: Tải lên thất bại\",\n },\n embed: {\n title: \"Nhúng\",\n embed_button: {\n image: \"Nhúng hình ảnh\",\n video: \"Nhúng video\",\n audio: \"Nhúng âm thanh\",\n file: \"Nhúng tệp\",\n },\n url_placeholder: \"Nhập URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Xóa liên kết\",\n },\n edit: {\n text: \"Chỉnh sửa liên kết\",\n tooltip: \"Chỉnh sửa\",\n },\n open: {\n tooltip: \"Mở trong tab mới\",\n },\n form: {\n title_placeholder: \"Chỉnh sửa tiêu đề\",\n url_placeholder: \"Chỉnh sửa URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const zh: Dictionary = {\n slash_menu: {\n heading: {\n title: \"一级标题\",\n subtext: \"用于顶级标题\",\n aliases: [\"h\", \"heading1\", \"h1\", \"标题\", \"一级标题\"],\n group: \"标题\",\n },\n heading_2: {\n title: \"二级标题\",\n subtext: \"用于关键部分\",\n aliases: [\"h2\", \"heading2\", \"subheading\", \"标题\", \"二级标题\", \"副标题\"],\n group: \"标题\",\n },\n heading_3: {\n title: \"三级标题\",\n subtext: \"用于小节和分组标题\",\n aliases: [\"h3\", \"heading3\", \"subheading\", \"标题\", \"三级标题\"],\n group: \"标题\",\n },\n numbered_list: {\n title: \"有序列表\",\n subtext: \"用于显示有序列表\",\n aliases: [\n \"ol\",\n \"li\",\n \"list\",\n \"numberedlist\",\n \"numbered list\",\n \"列表\",\n \"有序列表\",\n ],\n group: \"基础\",\n },\n bullet_list: {\n title: \"无序列表\",\n subtext: \"用于显示无序列表\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"bulletlist\",\n \"bullet list\",\n \"列表\",\n \"无序列表\",\n ],\n group: \"基础\",\n },\n check_list: {\n title: \"检查清单\",\n subtext: \"用于显示带有复选框的列表\",\n aliases: [\n \"ul\",\n \"li\",\n \"checklist\",\n \"checked list\",\n \"列表\",\n \"检查清单\",\n \"勾选列表\",\n \"复选框\",\n ],\n group: \"基础\",\n },\n paragraph: {\n title: \"段落\",\n subtext: \"用于文档正文\",\n aliases: [\"p\", \"paragraph\", \"text\", \"正文\"],\n group: \"基础\",\n },\n code_block: {\n title: \"代码块\",\n subtext: \"用于显示带有语法高亮的代码块\",\n aliases: [\"code\", \"pre\", \"代码\", \"预格式\"],\n group: \"基础\",\n },\n table: {\n title: \"表格\",\n subtext: \"使用表格\",\n aliases: [\"table\", \"表格\"],\n group: \"高级功能\",\n },\n image: {\n title: \"图片\",\n subtext: \"插入图片\",\n aliases: [\n \"图片\",\n \"上传图片\",\n \"上传\",\n \"image\",\n \"img\",\n \"相册\",\n \"媒体\",\n \"url\",\n ],\n group: \"媒体\",\n },\n video: {\n title: \"视频\",\n subtext: \"插入视频\",\n aliases: [\n \"视频\",\n \"视频上传\",\n \"上传\",\n \"video\",\n \"mp4\",\n \"电影\",\n \"媒体\",\n \"url\",\n \"驱动\",\n \"dropbox\",\n ],\n group: \"媒体\",\n },\n audio: {\n title: \"音频\",\n subtext: \"插入音频\",\n aliases: [\n \"音频\",\n \"音频上传\",\n \"上传\",\n \"audio\",\n \"mp3\",\n \"声音\",\n \"媒体\",\n \"url\",\n \"驱动\",\n \"dropbox\",\n ],\n group: \"媒体\",\n },\n file: {\n title: \"文件\",\n subtext: \"插入文件\",\n aliases: [\"文件\", \"上传\", \"file\", \"嵌入\", \"媒体\", \"url\"],\n group: \"媒体\",\n },\n emoji: {\n title: \"表情符号\",\n subtext: \"用于插入表情符号\",\n aliases: [\n \"表情符号\",\n \"emoji\",\n \"face\",\n \"emote\",\n \"表情\",\n \"表情表达\",\n \"表情\",\n ],\n group: \"其他\",\n },\n },\n placeholders: {\n default: \"输入 '/' 以使用命令\",\n heading: \"标题\",\n bulletListItem: \"列表\",\n numberedListItem: \"列表\",\n checkListItem: \"列表\",\n },\n file_blocks: {\n image: {\n add_button_text: \"添加图片\",\n },\n video: {\n add_button_text: \"添加视频\",\n },\n audio: {\n add_button_text: \"添加音频\",\n },\n file: {\n add_button_text: \"添加文件\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"添加块\",\n drag_handle_label: \"打开菜单\",\n },\n drag_handle: {\n delete_menuitem: \"删除\",\n colors_menuitem: \"颜色\",\n },\n table_handle: {\n delete_column_menuitem: \"删除列\",\n delete_row_menuitem: \"删除行\",\n add_left_menuitem: \"左侧添加列\",\n add_right_menuitem: \"右侧添加列\",\n add_above_menuitem: \"上方添加行\",\n add_below_menuitem: \"下方添加行\",\n },\n suggestion_menu: {\n no_items_title: \"无匹配项\",\n loading: \"加载中…\",\n },\n color_picker: {\n text_title: \"文本\",\n background_title: \"背景色\",\n colors: {\n default: \"默认\",\n gray: \"灰色\",\n brown: \"棕色\",\n red: \"红色\",\n orange: \"橙色\",\n yellow: \"黄色\",\n green: \"绿色\",\n blue: \"蓝色\",\n purple: \"紫色\",\n pink: \"粉色\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"加粗\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"斜体\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"下划线\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"删除线\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"代码标记\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"颜色\",\n },\n link: {\n tooltip: \"添加链接\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"编辑标题\",\n input_placeholder: \"编辑标题\",\n },\n file_replace: {\n tooltip: {\n image: \"替换图片\",\n video: \"替换视频\",\n audio: \"替换音频\",\n file: \"替换文件\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"重命名图片\",\n video: \"重命名视频\",\n audio: \"重命名音频\",\n file: \"重命名文件\",\n },\n input_placeholder: {\n image: \"重命名图片\",\n video: \"重命名视频\",\n audio: \"重命名音频\",\n file: \"重命名文件\",\n },\n },\n file_download: {\n tooltip: {\n image: \"下载图片\",\n video: \"下载视频\",\n audio: \"下载音频\",\n file: \"下载文件\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"删除图片\",\n video: \"删除视频\",\n audio: \"删除音频\",\n file: \"删除文件\",\n },\n },\n file_preview_toggle: {\n tooltip: \"切换预览\",\n },\n nest: {\n tooltip: \"嵌套\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"取消嵌套\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"左对齐\",\n },\n align_center: {\n tooltip: \"居中\",\n },\n align_right: {\n tooltip: \"右对齐\",\n },\n align_justify: {\n tooltip: \"文本对齐\",\n },\n },\n file_panel: {\n upload: {\n title: \"上传\",\n file_placeholder: {\n image: \"上传图片\",\n video: \"上传视频\",\n audio: \"上传音频\",\n file: \"上传文件\",\n },\n upload_error: \"Error:上传失败\",\n },\n embed: {\n title: \"嵌入\",\n embed_button: {\n image: \"嵌入图片\",\n video: \"嵌入视频\",\n audio: \"嵌入音频\",\n file: \"嵌入文件\",\n },\n url_placeholder: \"输入图片地址\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"清除链接\",\n },\n edit: {\n text: \"编辑链接\",\n tooltip: \"编辑\",\n },\n open: {\n tooltip: \"新窗口打开\",\n },\n form: {\n title_placeholder: \"编辑标题\",\n url_placeholder: \"编辑链接地址\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export class UnreachableCaseError extends Error {\n constructor(val: never) {\n super(`Unreachable case: ${val}`);\n }\n}\n\nexport function assertEmpty(obj: Record<string, never>, throwError = true) {\n const { \"data-test\": dataTest, ...rest } = obj; // exclude data-test\n\n if (Object.keys(rest).length > 0 && throwError) {\n throw new Error(\"Object must be empty \" + JSON.stringify(obj));\n }\n}\n\n// TODO: change for built-in version of typescript 5.4 after upgrade\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n","import {\n combineTransactionSteps,\n Extension,\n findChildrenInRange,\n getChangedRanges,\n} from \"@tiptap/core\";\nimport { Fragment, Slice } from \"prosemirror-model\";\nimport { Plugin, PluginKey } from \"prosemirror-state\";\nimport { v4 } from \"uuid\";\n\n/**\n * Code from Tiptap UniqueID extension (https://tiptap.dev/api/extensions/unique-id)\n * This extension is licensed under MIT (even though it's part of Tiptap pro).\n *\n * If you're a user of BlockNote, we still recommend to support their awesome work and become a sponsor!\n * https://tiptap.dev/pro\n */\n\n/**\n * Removes duplicated values within an array.\n * Supports numbers, strings and objects.\n */\nfunction removeDuplicates(array: any, by = JSON.stringify) {\n const seen: any = {};\n return array.filter((item: any) => {\n const key = by(item);\n return Object.prototype.hasOwnProperty.call(seen, key)\n ? false\n : (seen[key] = true);\n });\n}\n\n/**\n * Returns a list of duplicated items within an array.\n */\nfunction findDuplicates(items: any) {\n const filtered = items.filter(\n (el: any, index: number) => items.indexOf(el) !== index\n );\n const duplicates = removeDuplicates(filtered);\n return duplicates;\n}\n\nconst UniqueID = Extension.create({\n name: \"uniqueID\",\n // we’ll set a very high priority to make sure this runs first\n // and is compatible with `appendTransaction` hooks of other extensions\n priority: 10000,\n addOptions() {\n return {\n attributeName: \"id\",\n types: [],\n setIdAttribute: false,\n generateID: () => {\n // Use mock ID if tests are running.\n if (typeof window !== \"undefined\" && (window as any).__TEST_OPTIONS) {\n const testOptions = (window as any).__TEST_OPTIONS;\n if (testOptions.mockID === undefined) {\n testOptions.mockID = 0;\n } else {\n testOptions.mockID++;\n }\n\n return testOptions.mockID.toString() as string;\n }\n\n return v4();\n },\n filterTransaction: null,\n };\n },\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n [this.options.attributeName]: {\n default: null,\n parseHTML: (element) =>\n element.getAttribute(`data-${this.options.attributeName}`),\n renderHTML: (attributes) => {\n const defaultIdAttributes = {\n [`data-${this.options.attributeName}`]:\n attributes[this.options.attributeName],\n };\n if (this.options.setIdAttribute) {\n return {\n ...defaultIdAttributes,\n id: attributes[this.options.attributeName],\n };\n } else {\n return defaultIdAttributes;\n }\n },\n },\n },\n },\n ];\n },\n // check initial content for missing ids\n // onCreate() {\n // // Don’t do this when the collaboration extension is active\n // // because this may update the content, so Y.js tries to merge these changes.\n // // This leads to empty block nodes.\n // // See: https://github.com/ueberdosis/tiptap/issues/2400\n // if (\n // this.editor.extensionManager.extensions.find(\n // (extension) => extension.name === \"collaboration\"\n // )\n // ) {\n // return;\n // }\n // const { view, state } = this.editor;\n // const { tr, doc } = state;\n // const { types, attributeName, generateID } = this.options;\n // const nodesWithoutId = findChildren(doc, (node) => {\n // return (\n // types.includes(node.type.name) && node.attrs[attributeName] === null\n // );\n // });\n // nodesWithoutId.forEach(({ node, pos }) => {\n // tr.setNodeMarkup(pos, undefined, {\n // ...node.attrs,\n // [attributeName]: generateID(),\n // });\n // });\n // tr.setMeta(\"addToHistory\", false);\n // view.dispatch(tr);\n // },\n addProseMirrorPlugins() {\n let dragSourceElement: any = null;\n let transformPasted = false;\n return [\n new Plugin({\n key: new PluginKey(\"uniqueID\"),\n appendTransaction: (transactions, oldState, newState) => {\n // console.log(\"appendTransaction\");\n const docChanges =\n transactions.some((transaction) => transaction.docChanged) &&\n !oldState.doc.eq(newState.doc);\n const filterTransactions =\n this.options.filterTransaction &&\n transactions.some((tr) => {\n let _a, _b;\n return !((_b = (_a = this.options).filterTransaction) === null ||\n _b === void 0\n ? void 0\n : _b.call(_a, tr));\n });\n if (!docChanges || filterTransactions) {\n return;\n }\n const { tr } = newState;\n const { types, attributeName, generateID } = this.options;\n const transform = combineTransactionSteps(\n oldState.doc,\n transactions as any\n );\n const { mapping } = transform;\n // get changed ranges based on the old state\n const changes = getChangedRanges(transform);\n\n changes.forEach(({ newRange }) => {\n const newNodes = findChildrenInRange(\n newState.doc,\n newRange,\n (node) => {\n return types.includes(node.type.name);\n }\n );\n const newIds = newNodes\n .map(({ node }) => node.attrs[attributeName])\n .filter((id) => id !== null);\n const duplicatedNewIds = findDuplicates(newIds);\n newNodes.forEach(({ node, pos }) => {\n let _a;\n // instead of checking `node.attrs[attributeName]` directly\n // we look at the current state of the node within `tr.doc`.\n // this helps to prevent adding new ids to the same node\n // if the node changed multiple times within one transaction\n const id =\n (_a = tr.doc.nodeAt(pos)) === null || _a === void 0\n ? void 0\n : _a.attrs[attributeName];\n if (id === null) {\n // edge case, when using collaboration, yjs will set the id to null in `_forceRerender`\n // when loading the editor\n // this checks for this case and keeps it at initialBlockId so there will be no change\n const initialDoc = oldState.doc.type.createAndFill()!.content;\n const wasInitial =\n oldState.doc.content.findDiffStart(initialDoc) === null;\n\n if (wasInitial) {\n // the old state was the \"initial content\"\n const jsonNode = JSON.parse(\n JSON.stringify(newState.doc.toJSON())\n );\n jsonNode.content[0].content[0].attrs.id = \"initialBlockId\";\n // would the new state with the fix also be the \"initial content\"?\n if (\n JSON.stringify(jsonNode.content) ===\n JSON.stringify(initialDoc.toJSON())\n ) {\n // yes, apply the fix\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: \"initialBlockId\",\n });\n return;\n }\n }\n\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n });\n return;\n }\n // check if the node doesn’t exist in the old state\n const { deleted } = mapping.invert().mapResult(pos);\n const newNode = deleted && duplicatedNewIds.includes(id);\n if (newNode) {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n });\n }\n });\n });\n if (!tr.steps.length) {\n return;\n }\n return tr;\n },\n // we register a global drag handler to track the current drag source element\n view(view) {\n const handleDragstart = (event: any) => {\n let _a;\n dragSourceElement = (\n (_a = view.dom.parentElement) === null || _a === void 0\n ? void 0\n : _a.contains(event.target)\n )\n ? view.dom.parentElement\n : null;\n };\n window.addEventListener(\"dragstart\", handleDragstart);\n return {\n destroy() {\n window.removeEventListener(\"dragstart\", handleDragstart);\n },\n };\n },\n props: {\n // `handleDOMEvents` is called before `transformPasted`\n // so we can do some checks before\n handleDOMEvents: {\n // only create new ids for dropped content while holding `alt`\n // or content is dragged from another editor\n drop: (view, event: any) => {\n let _a;\n if (\n dragSourceElement !== view.dom.parentElement ||\n ((_a = event.dataTransfer) === null || _a === void 0\n ? void 0\n : _a.effectAllowed) === \"copy\"\n ) {\n dragSourceElement = null;\n transformPasted = true;\n }\n return false;\n },\n // always create new ids on pasted content\n paste: () => {\n transformPasted = true;\n return false;\n },\n },\n // we’ll remove ids for every pasted node\n // so we can create a new one within `appendTransaction`\n transformPasted: (slice) => {\n if (!transformPasted) {\n return slice;\n }\n const { types, attributeName } = this.options;\n const removeId = (fragment: any) => {\n const list: any[] = [];\n fragment.forEach((node: any) => {\n // don’t touch text nodes\n if (node.isText) {\n list.push(node);\n return;\n }\n // check for any other child nodes\n if (!types.includes(node.type.name)) {\n list.push(node.copy(removeId(node.content)));\n return;\n }\n // remove id\n const nodeWithoutId = node.type.create(\n {\n ...node.attrs,\n [attributeName]: null,\n },\n removeId(node.content),\n node.marks\n );\n list.push(nodeWithoutId);\n });\n return Fragment.from(list);\n };\n // reset check\n transformPasted = false;\n return new Slice(\n removeId(slice.content),\n slice.openStart,\n slice.openEnd\n );\n },\n },\n }),\n ];\n },\n});\n\nexport { UniqueID as default, UniqueID };\n","import { Node } from \"@tiptap/core\";\nimport { PropSchema, Props } from \"../propTypes.js\";\nimport { StyleSchema, Styles } from \"../styles/types.js\";\n\nexport type CustomInlineContentConfig = {\n type: string;\n content: \"styled\" | \"none\"; // | \"plain\"\n readonly propSchema: PropSchema;\n // content: \"inline\" | \"none\" | \"table\";\n};\n// InlineContentConfig contains the \"schema\" info about an InlineContent type\n// i.e. what props it supports, what content it supports, etc.\nexport type InlineContentConfig = CustomInlineContentConfig | \"text\" | \"link\";\n\n// InlineContentImplementation contains the \"implementation\" info about an InlineContent element\n// such as the functions / Nodes required to render and / or serialize it\n// @ts-ignore\nexport type InlineContentImplementation<T extends InlineContentConfig> =\n T extends \"link\" | \"text\"\n ? undefined\n : {\n node: Node;\n };\n\n// Container for both the config and implementation of InlineContent,\n// and the type of `implementation` is based on that of the config\nexport type InlineContentSpec<T extends InlineContentConfig> = {\n config: T;\n implementation: InlineContentImplementation<T>;\n};\n\n// A Schema contains all the types (Configs) supported in an editor\n// The keys are the \"type\" of InlineContent elements\nexport type InlineContentSchema = Record<string, InlineContentConfig>;\n\nexport type InlineContentSpecs = {\n text: { config: \"text\"; implementation: undefined };\n link: { config: \"link\"; implementation: undefined };\n} & Record<string, InlineContentSpec<InlineContentConfig>>;\n\nexport type InlineContentSchemaFromSpecs<T extends InlineContentSpecs> = {\n [K in keyof T]: T[K][\"config\"];\n};\n\nexport type CustomInlineContentFromConfig<\n I extends CustomInlineContentConfig,\n S extends StyleSchema\n> = {\n type: I[\"type\"];\n props: Props<I[\"propSchema\"]>;\n content: I[\"content\"] extends \"styled\"\n ? StyledText<S>[]\n : I[\"content\"] extends \"plain\"\n ? string\n : I[\"content\"] extends \"none\"\n ? undefined\n : never;\n};\n\nexport type InlineContentFromConfig<\n I extends InlineContentConfig,\n S extends StyleSchema\n> = I extends \"text\"\n ? StyledText<S>\n : I extends \"link\"\n ? Link<S>\n : I extends CustomInlineContentConfig\n ? CustomInlineContentFromConfig<I, S>\n : never;\n\nexport type PartialCustomInlineContentFromConfig<\n I extends CustomInlineContentConfig,\n S extends StyleSchema\n> = {\n type: I[\"type\"];\n props?: Props<I[\"propSchema\"]>;\n content?: I[\"content\"] extends \"styled\"\n ? StyledText<S>[] | string\n : I[\"content\"] extends \"plain\"\n ? string\n : I[\"content\"] extends \"none\"\n ? undefined\n : never;\n};\n\nexport type PartialInlineContentFromConfig<\n I extends InlineContentConfig,\n S extends StyleSchema\n> = I extends \"text\"\n ? string | StyledText<S>\n : I extends \"link\"\n ? PartialLink<S>\n : I extends CustomInlineContentConfig\n ? PartialCustomInlineContentFromConfig<I, S>\n : never;\n\nexport type StyledText<T extends StyleSchema> = {\n type: \"text\";\n text: string;\n styles: Styles<T>;\n};\n\nexport type Link<T extends StyleSchema> = {\n type: \"link\";\n href: string;\n content: StyledText<T>[];\n};\n\nexport type PartialLink<T extends StyleSchema> = Omit<Link<T>, \"content\"> & {\n content: string | Link<T>[\"content\"];\n};\n\nexport type InlineContent<\n I extends InlineContentSchema,\n T extends StyleSchema\n> = InlineContentFromConfig<I[keyof I], T>;\n\ntype PartialInlineContentElement<\n I extends InlineContentSchema,\n T extends StyleSchema\n> = PartialInlineContentFromConfig<I[keyof I], T>;\n\nexport type PartialInlineContent<\n I extends InlineContentSchema,\n T extends StyleSchema\n> = PartialInlineContentElement<I, T>[] | string;\n\nexport function isLinkInlineContent<T extends StyleSchema>(\n content: InlineContent<any, T>\n): content is Link<T> {\n return content.type === \"link\";\n}\n\nexport function isPartialLinkInlineContent<T extends StyleSchema>(\n content: PartialInlineContentElement<any, T>\n): content is PartialLink<T> {\n return typeof content !== \"string\" && content.type === \"link\";\n}\n\nexport function isStyledTextInlineContent<T extends StyleSchema>(\n content: PartialInlineContentElement<any, T>\n): content is StyledText<T> {\n return typeof content !== \"string\" && content.type === \"text\";\n}\n","import { Mark, Node, Schema } from \"@tiptap/pm/model\";\n\nimport UniqueID from \"../../extensions/UniqueID/UniqueID.js\";\nimport type {\n InlineContentSchema,\n PartialCustomInlineContentFromConfig,\n PartialInlineContent,\n PartialLink,\n PartialTableContent,\n StyleSchema,\n StyledText,\n} from \"../../schema\";\n\nimport type { PartialBlock } from \"../../blocks/defaultBlocks\";\nimport {\n isPartialLinkInlineContent,\n isStyledTextInlineContent,\n} from \"../../schema/inlineContent/types.js\";\nimport { UnreachableCaseError } from \"../../util/typescript.js\";\n\n/**\n * Convert a StyledText inline element to a\n * prosemirror text node with the appropriate marks\n */\nfunction styledTextToNodes<T extends StyleSchema>(\n styledText: StyledText<T>,\n schema: Schema,\n styleSchema: T\n): Node[] {\n const marks: Mark[] = [];\n\n for (const [style, value] of Object.entries(styledText.styles)) {\n const config = styleSchema[style];\n if (!config) {\n throw new Error(`style ${style} not found in styleSchema`);\n }\n\n if (config.propSchema === \"boolean\") {\n marks.push(schema.mark(style));\n } else if (config.propSchema === \"string\") {\n marks.push(schema.mark(style, { stringValue: value }));\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n\n return (\n styledText.text\n // Splits text & line breaks.\n .split(/(\\n)/g)\n // If the content ends with a line break, an empty string is added to the\n // end, which this removes.\n .filter((text) => text.length > 0)\n // Converts text & line breaks to nodes.\n .map((text) => {\n if (text === \"\\n\") {\n return schema.nodes[\"hardBreak\"].createChecked();\n } else {\n return schema.text(text, marks);\n }\n })\n );\n}\n\n/**\n * Converts a Link inline content element to\n * prosemirror text nodes with the appropriate marks\n */\nfunction linkToNodes(\n link: PartialLink<StyleSchema>,\n schema: Schema,\n styleSchema: StyleSchema\n): Node[] {\n const linkMark = schema.marks.link.create({\n href: link.href,\n });\n\n return styledTextArrayToNodes(link.content, schema, styleSchema).map(\n (node) => {\n if (node.type.name === \"text\") {\n return node.mark([...node.marks, linkMark]);\n }\n\n if (node.type.name === \"hardBreak\") {\n return node;\n }\n throw new Error(\"unexpected node type\");\n }\n );\n}\n\n/**\n * Converts an array of StyledText inline content elements to\n * prosemirror text nodes with the appropriate marks\n */\nfunction styledTextArrayToNodes<S extends StyleSchema>(\n content: string | StyledText<S>[],\n schema: Schema,\n styleSchema: S\n): Node[] {\n const nodes: Node[] = [];\n\n if (typeof content === \"string\") {\n nodes.push(\n ...styledTextToNodes(\n { type: \"text\", text: content, styles: {} },\n schema,\n styleSchema\n )\n );\n return nodes;\n }\n\n for (const styledText of content) {\n nodes.push(...styledTextToNodes(styledText, schema, styleSchema));\n }\n return nodes;\n}\n\n/**\n * converts an array of inline content elements to prosemirror nodes\n */\nexport function inlineContentToNodes<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockContent: PartialInlineContent<I, S>,\n schema: Schema,\n styleSchema: S\n): Node[] {\n const nodes: Node[] = [];\n\n for (const content of blockContent) {\n if (typeof content === \"string\") {\n nodes.push(...styledTextArrayToNodes(content, schema, styleSchema));\n } else if (isPartialLinkInlineContent(content)) {\n nodes.push(...linkToNodes(content, schema, styleSchema));\n } else if (isStyledTextInlineContent(content)) {\n nodes.push(...styledTextArrayToNodes([content], schema, styleSchema));\n } else {\n nodes.push(\n blockOrInlineContentToContentNode(content, schema, styleSchema)\n );\n }\n }\n return nodes;\n}\n\n/**\n * converts an array of inline content elements to prosemirror nodes\n */\nexport function tableContentToNodes<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n tableContent: PartialTableContent<I, S>,\n schema: Schema,\n styleSchema: StyleSchema\n): Node[] {\n const rowNodes: Node[] = [];\n\n for (const row of tableContent.rows) {\n const columnNodes: Node[] = [];\n for (let i = 0; i < row.cells.length; i++) {\n const cell = row.cells[i];\n let pNode: Node;\n if (!cell) {\n pNode = schema.nodes[\"tableParagraph\"].createChecked({});\n } else if (typeof cell === \"string\") {\n pNode = schema.nodes[\"tableParagraph\"].createChecked(\n {},\n schema.text(cell)\n );\n } else {\n const textNodes = inlineContentToNodes(cell, schema, styleSchema);\n pNode = schema.nodes[\"tableParagraph\"].createChecked({}, textNodes);\n }\n\n const cellNode = schema.nodes[\"tableCell\"].createChecked(\n {\n // The colwidth array should have multiple values when the colspan of\n // a cell is greater than 1. However, this is not yet implemented so\n // we can always assume a length of 1.\n colwidth: tableContent.columnWidths?.[i]\n ? [tableContent.columnWidths[i]]\n : null,\n },\n pNode\n );\n columnNodes.push(cellNode);\n }\n const rowNode = schema.nodes[\"tableRow\"].createChecked({}, columnNodes);\n rowNodes.push(rowNode);\n }\n return rowNodes;\n}\n\nfunction blockOrInlineContentToContentNode(\n block:\n | PartialBlock<any, any, any>\n | PartialCustomInlineContentFromConfig<any, any>,\n schema: Schema,\n styleSchema: StyleSchema\n) {\n let contentNode: Node;\n let type = block.type;\n\n // TODO: needed? came from previous code\n if (type === undefined) {\n type = \"paragraph\";\n }\n\n if (!schema.nodes[type]) {\n throw new Error(`node type ${type} not found in schema`);\n }\n\n if (!block.content) {\n contentNode = schema.nodes[type].createChecked(block.props);\n } else if (typeof block.content === \"string\") {\n const nodes = inlineContentToNodes([block.content], schema, styleSchema);\n contentNode = schema.nodes[type].createChecked(block.props, nodes);\n } else if (Array.isArray(block.content)) {\n const nodes = inlineContentToNodes(block.content, schema, styleSchema);\n contentNode = schema.nodes[type].createChecked(block.props, nodes);\n } else if (block.content.type === \"tableContent\") {\n const nodes = tableContentToNodes(block.content, schema, styleSchema);\n contentNode = schema.nodes[type].createChecked(block.props, nodes);\n } else {\n throw new UnreachableCaseError(block.content.type);\n }\n return contentNode;\n}\n\n/**\n * Converts a BlockNote block to a Prosemirror node.\n */\nexport function blockToNode(\n block: PartialBlock<any, any, any>,\n schema: Schema,\n styleSchema: StyleSchema\n) {\n let id = block.id;\n\n if (id === undefined) {\n id = UniqueID.options.generateID();\n }\n\n const children: Node[] = [];\n\n if (block.children) {\n for (const child of block.children) {\n children.push(blockToNode(child, schema, styleSchema));\n }\n }\n\n const nodeTypeCorrespondingToBlock = schema.nodes[block.type];\n\n if (nodeTypeCorrespondingToBlock.isInGroup(\"blockContent\")) {\n // Blocks with a type that matches \"blockContent\" group always need to be wrapped in a blockContainer\n\n const contentNode = blockOrInlineContentToContentNode(\n block,\n schema,\n styleSchema\n );\n\n const groupNode =\n children.length > 0\n ? schema.nodes[\"blockGroup\"].createChecked({}, children)\n : undefined;\n\n return schema.nodes[\"blockContainer\"].createChecked(\n {\n id: id,\n ...block.props,\n },\n groupNode ? [contentNode, groupNode] : contentNode\n );\n } else if (nodeTypeCorrespondingToBlock.isInGroup(\"bnBlock\")) {\n // this is a bnBlock node like Column or ColumnList that directly translates to a prosemirror node\n return schema.nodes[block.type].createChecked(\n {\n id: id,\n ...block.props,\n },\n children\n );\n } else {\n throw new Error(\n `block type ${block.type} doesn't match blockContent or bnBlock group`\n );\n }\n}\n","import { DOMSerializer, Fragment } from \"prosemirror-model\";\n\nimport { PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n inlineContentToNodes,\n tableContentToNodes,\n} from \"../../../nodeConversions/blockToNode.js\";\n\nfunction addAttributesAndRemoveClasses(element: HTMLElement) {\n // Removes all BlockNote specific class names.\n const className =\n [...element.classList].filter(\n (className) => !className.startsWith(\"bn-\")\n ) || [];\n\n if (className.length > 0) {\n element.className = className.join(\" \");\n } else {\n element.removeAttribute(\"class\");\n }\n}\n\nexport function serializeInlineContentExternalHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<any, I, S>,\n blockContent: PartialBlock<BSchema, I, S>[\"content\"],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) {\n let nodes: any;\n\n // TODO: reuse function from nodeconversions?\n if (!blockContent) {\n throw new Error(\"blockContent is required\");\n } else if (typeof blockContent === \"string\") {\n nodes = inlineContentToNodes(\n [blockContent],\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (Array.isArray(blockContent)) {\n nodes = inlineContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (blockContent.type === \"tableContent\") {\n nodes = tableContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else {\n throw new UnreachableCaseError(blockContent.type);\n }\n\n // We call the prosemirror serializer here because it handles Marks and Inline Content nodes nicely.\n // If we'd want to support custom serialization or externalHTML for Inline Content, we'd have to implement\n // a custom serializer here.\n const dom = serializer.serializeFragment(Fragment.from(nodes), options);\n\n if (dom.nodeType === 1 /* Node.ELEMENT_NODE */) {\n addAttributesAndRemoveClasses(dom as HTMLElement);\n }\n\n return dom;\n}\n\n/**\n * TODO: there's still quite some logic that handles getting and filtering properties,\n * we should make sure the `toExternalHTML` methods of default blocks actually handle this,\n * instead of the serializer.\n */\nfunction serializeBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n fragment: DocumentFragment,\n editor: BlockNoteEditor<BSchema, I, S>,\n block: PartialBlock<BSchema, I, S>,\n serializer: DOMSerializer,\n orderedListItemBlockTypes: Set<string>,\n unorderedListItemBlockTypes: Set<string>,\n options?: { document?: Document }\n) {\n const doc = options?.document ?? document;\n const BC_NODE = editor.pmSchema.nodes[\"blockContainer\"];\n\n let props = block.props;\n // set default props in case we were passed a partial block\n if (!block.props) {\n props = {};\n for (const [name, spec] of Object.entries(\n editor.schema.blockSchema[block.type as any].propSchema\n )) {\n (props as any)[name] = spec.default;\n }\n }\n\n const bc = BC_NODE.spec?.toDOM?.(\n BC_NODE.create({\n id: block.id,\n ...props,\n })\n ) as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n // the container node is just used as a workaround to get some block-level attributes.\n // we should change toExternalHTML so that this is not necessary\n const attrs = [...bc.dom.attributes];\n\n const ret = editor.blockImplementations[\n block.type as any\n ].implementation.toExternalHTML({ ...block, props } as any, editor as any);\n\n const elementFragment = doc.createDocumentFragment();\n if (ret.dom.classList.contains(\"bn-block-content\")) {\n const blockContentDataAttributes = [...attrs, ...ret.dom.attributes].filter(\n (attr) =>\n attr.name.startsWith(\"data\") &&\n attr.name !== \"data-content-type\" &&\n attr.name !== \"data-file-block\" &&\n attr.name !== \"data-node-view-wrapper\" &&\n attr.name !== \"data-node-type\" &&\n attr.name !== \"data-id\" &&\n attr.name !== \"data-index\" &&\n attr.name !== \"data-editable\"\n );\n\n // ret.dom = ret.dom.firstChild! as any;\n for (const attr of blockContentDataAttributes) {\n (ret.dom.firstChild! as HTMLElement).setAttribute(attr.name, attr.value);\n }\n\n addAttributesAndRemoveClasses(ret.dom.firstChild! as HTMLElement);\n elementFragment.append(...ret.dom.childNodes);\n } else {\n elementFragment.append(ret.dom);\n }\n\n if (ret.contentDOM && block.content) {\n const ic = serializeInlineContentExternalHTML(\n editor,\n block.content as any, // TODO\n serializer,\n options\n );\n\n ret.contentDOM.appendChild(ic);\n }\n\n let listType = undefined;\n if (orderedListItemBlockTypes.has(block.type!)) {\n listType = \"OL\";\n } else if (unorderedListItemBlockTypes.has(block.type!)) {\n listType = \"UL\";\n }\n\n if (listType) {\n if (fragment.lastChild?.nodeName !== listType) {\n const list = doc.createElement(listType);\n fragment.append(list);\n }\n const li = doc.createElement(\"li\");\n li.append(elementFragment);\n fragment.lastChild!.appendChild(li);\n } else {\n fragment.append(elementFragment);\n }\n\n if (block.children && block.children.length > 0) {\n const childFragment = doc.createDocumentFragment();\n serializeBlocksToFragment(\n childFragment,\n editor,\n block.children,\n serializer,\n orderedListItemBlockTypes,\n unorderedListItemBlockTypes,\n options\n );\n if (\n fragment.lastChild?.nodeName === \"UL\" ||\n fragment.lastChild?.nodeName === \"OL\"\n ) {\n // add nested lists to the last list item\n while (\n childFragment.firstChild?.nodeName === \"UL\" ||\n childFragment.firstChild?.nodeName === \"OL\"\n ) {\n fragment.lastChild!.lastChild!.appendChild(childFragment.firstChild!);\n }\n }\n\n if (editor.pmSchema.nodes[block.type as any].isInGroup(\"blockContent\")) {\n // default \"blockContainer\" style blocks are flattened (no \"nested block\" support) for externalHTML, so append the child fragment to the outer fragment\n fragment.append(childFragment);\n } else {\n // for columns / column lists, do use nesting\n ret.contentDOM?.append(childFragment);\n }\n }\n}\n\nconst serializeBlocksToFragment = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n fragment: DocumentFragment,\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n orderedListItemBlockTypes: Set<string>,\n unorderedListItemBlockTypes: Set<string>,\n options?: { document?: Document }\n) => {\n for (const block of blocks) {\n serializeBlock(\n fragment,\n editor,\n block,\n serializer,\n orderedListItemBlockTypes,\n unorderedListItemBlockTypes,\n options\n );\n }\n};\n\nexport const serializeBlocksExternalHTML = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n orderedListItemBlockTypes: Set<string>,\n unorderedListItemBlockTypes: Set<string>,\n options?: { document?: Document }\n) => {\n const doc = options?.document ?? document;\n const fragment = doc.createDocumentFragment();\n\n serializeBlocksToFragment(\n fragment,\n editor,\n blocks,\n serializer,\n orderedListItemBlockTypes,\n unorderedListItemBlockTypes,\n options\n );\n return fragment;\n};\n","import { DOMSerializer, Schema } from \"prosemirror-model\";\n\nimport { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContent,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport {\n serializeBlocksExternalHTML,\n serializeInlineContentExternalHTML,\n} from \"./util/serializeBlocksExternalHTML.js\";\n\n// Used to export BlockNote blocks and ProseMirror nodes to HTML for use outside\n// the editor. Blocks are exported using the `toExternalHTML` method in their\n// `blockSpec`, or `toInternalHTML` if `toExternalHTML` is not defined.\n//\n// The HTML created by this serializer is different to what's rendered by the\n// editor to the DOM. This also means that data is likely to be lost when\n// converting back to original blocks. The differences in the output HTML are:\n// 1. It doesn't include the `blockGroup` and `blockContainer` wrappers meaning\n// that nesting is not preserved for non-list-item blocks.\n// 2. `li` items in the output HTML are wrapped in `ul` or `ol` elements.\n// 3. While nesting for list items is preserved, other types of blocks nested\n// inside a list are un-nested and a new list is created after them.\n// 4. The HTML is wrapped in a single `div` element.\n\n// Needs to be sync because it's used in drag handler event (SideMenuPlugin)\n// Ideally, call `await initializeESMDependencies()` before calling this function\nexport const createExternalHTMLExporter = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: Schema,\n editor: BlockNoteEditor<BSchema, I, S>\n) => {\n const serializer = DOMSerializer.fromSchema(schema);\n\n return {\n exportBlocks: (\n blocks: PartialBlock<BSchema, I, S>[],\n options: { document?: Document }\n ) => {\n const html = serializeBlocksExternalHTML(\n editor,\n blocks,\n serializer,\n new Set<string>([\"numberedListItem\"]),\n new Set<string>([\"bulletListItem\", \"checkListItem\"]),\n options\n );\n const div = document.createElement(\"div\");\n div.append(html);\n return div.innerHTML;\n },\n\n exportInlineContent: (\n inlineContent: InlineContent<I, S>[],\n options: { document?: Document }\n ) => {\n const domFragment = serializeInlineContentExternalHTML(\n editor,\n inlineContent as any,\n serializer,\n options\n );\n\n const parent = document.createElement(\"div\");\n parent.append(domFragment.cloneNode(true));\n\n return parent.innerHTML;\n },\n };\n};\n","import { DOMSerializer, Fragment } from \"prosemirror-model\";\n\nimport { PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n inlineContentToNodes,\n tableContentToNodes,\n} from \"../../../nodeConversions/blockToNode.js\";\n\nexport function serializeInlineContentInternalHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<any, I, S>,\n blockContent: PartialBlock<BSchema, I, S>[\"content\"],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) {\n let nodes: any;\n\n // TODO: reuse function from nodeconversions?\n if (!blockContent) {\n throw new Error(\"blockContent is required\");\n } else if (typeof blockContent === \"string\") {\n nodes = inlineContentToNodes(\n [blockContent],\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (Array.isArray(blockContent)) {\n nodes = inlineContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (blockContent.type === \"tableContent\") {\n nodes = tableContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else {\n throw new UnreachableCaseError(blockContent.type);\n }\n\n // We call the prosemirror serializer here because it handles Marks and Inline Content nodes nicely.\n // If we'd want to support custom serialization or externalHTML for Inline Content, we'd have to implement\n // a custom serializer here.\n const dom = serializer.serializeFragment(Fragment.from(nodes), options);\n\n return dom;\n}\n\nfunction serializeBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n block: PartialBlock<BSchema, I, S>,\n serializer: DOMSerializer,\n listIndex: number,\n options?: { document?: Document }\n) {\n const BC_NODE = editor.pmSchema.nodes[\"blockContainer\"];\n\n let props = block.props;\n // set default props in case we were passed a partial block\n if (!block.props) {\n props = {};\n for (const [name, spec] of Object.entries(\n editor.schema.blockSchema[block.type as any].propSchema\n )) {\n (props as any)[name] = spec.default;\n }\n }\n\n const impl = editor.blockImplementations[block.type as any].implementation;\n const ret = impl.toInternalHTML({ ...block, props } as any, editor as any);\n\n if (block.type === \"numberedListItem\") {\n // This is a workaround to make sure there's a list index set.\n // Normally, this is set on the internal prosemirror nodes by the NumberedListIndexingPlugin,\n // but:\n // - (a) this information is not available on the Blocks passed to the serializer. (we only have access to BlockNote Blocks)\n // - (b) the NumberedListIndexingPlugin might not even have run, because we can manually call blocksToFullHTML\n // with blocks that are not part of the active document\n ret.dom.setAttribute(\"data-index\", listIndex.toString());\n }\n\n if (ret.contentDOM && block.content) {\n const ic = serializeInlineContentInternalHTML(\n editor,\n block.content as any, // TODO\n serializer,\n options\n );\n ret.contentDOM.appendChild(ic);\n }\n\n const pmType = editor.pmSchema.nodes[block.type as any];\n\n if (pmType.isInGroup(\"bnBlock\")) {\n if (block.children && block.children.length > 0) {\n const fragment = serializeBlocks(\n editor,\n block.children,\n serializer,\n options\n );\n\n ret.contentDOM?.append(fragment);\n }\n return ret.dom;\n }\n\n // wrap the block in a blockContainer\n const bc = BC_NODE.spec?.toDOM?.(\n BC_NODE.create({\n id: block.id,\n ...props,\n })\n ) as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n bc.contentDOM?.appendChild(ret.dom);\n\n if (block.children && block.children.length > 0) {\n bc.contentDOM?.appendChild(\n serializeBlocksInternalHTML(editor, block.children, serializer, options)\n );\n }\n return bc.dom;\n}\n\nfunction serializeBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) {\n const doc = options?.document ?? document;\n const fragment = doc.createDocumentFragment();\n\n let listIndex = 0;\n for (const block of blocks) {\n if (block.type === \"numberedListItem\") {\n listIndex++;\n } else {\n listIndex = 0;\n }\n const blockDOM = serializeBlock(\n editor,\n block,\n serializer,\n listIndex,\n options\n );\n fragment.appendChild(blockDOM);\n }\n\n return fragment;\n}\n\nexport const serializeBlocksInternalHTML = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) => {\n const BG_NODE = editor.pmSchema.nodes[\"blockGroup\"];\n\n const bg = BG_NODE.spec!.toDOM!(BG_NODE.create({})) as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n const fragment = serializeBlocks(editor, blocks, serializer, options);\n\n bg.contentDOM?.appendChild(fragment);\n\n return bg.dom;\n};\n","import { DOMSerializer, Schema } from \"prosemirror-model\";\nimport { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { serializeBlocksInternalHTML } from \"./util/serializeBlocksInternalHTML.js\";\n// Used to serialize BlockNote blocks and ProseMirror nodes to HTML without\n// losing data. Blocks are exported using the `toInternalHTML` method in their\n// `blockSpec`.\n//\n// The HTML created by this serializer is the same as what's rendered by the\n// editor to the DOM. This means that it retains the same structure as the\n// editor, including the `blockGroup` and `blockContainer` wrappers. This also\n// means that it can be converted back to the original blocks without any data\n// loss.\nexport const createInternalHTMLSerializer = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: Schema,\n editor: BlockNoteEditor<BSchema, I, S>\n) => {\n const serializer = DOMSerializer.fromSchema(schema);\n\n return {\n serializeBlocks: (\n blocks: PartialBlock<BSchema, I, S>[],\n options: { document?: Document }\n ) => {\n return serializeBlocksInternalHTML(editor, blocks, serializer, options)\n .outerHTML;\n },\n };\n};\n","import { Node, ResolvedPos } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\n\ntype SingleBlockInfo = {\n node: Node;\n beforePos: number;\n afterPos: number;\n};\n\nexport type BlockInfo = {\n /**\n * The outer node that represents a BlockNote block. This is the node that has the ID.\n * Most of the time, this will be a blockContainer node, but it could also be a Column or ColumnList\n */\n bnBlock: SingleBlockInfo;\n /**\n * The type of BlockNote block that this node represents.\n * When dealing with a blockContainer, this is retrieved from the blockContent node, otherwise it's retrieved from the bnBlock node.\n */\n blockNoteType: string;\n} & (\n | {\n // In case we're not dealing with a BlockContainer, we're dealing with a \"wrapper node\" (like a Column or ColumnList), so it will always have children\n\n /**\n * The Prosemirror node that holds block.children. For non-blockContainer, this node will be the same as bnBlock.\n */\n childContainer: SingleBlockInfo;\n isBlockContainer: false;\n }\n | {\n /**\n * The Prosemirror node that holds block.children. For blockContainers, this is the blockGroup node, if it exists.\n */\n childContainer?: SingleBlockInfo;\n /**\n * The Prosemirror node that wraps block.content and has most of the props\n */\n blockContent: SingleBlockInfo;\n /**\n * Whether bnBlock is a blockContainer node\n */\n isBlockContainer: true;\n }\n);\n\n/**\n * Retrieves the position just before the nearest blockContainer node in a\n * ProseMirror doc, relative to a position. If the position is within a\n * blockContainer node or its descendants, the position just before it is\n * returned. If the position is not within a blockContainer node or its\n * descendants, the position just before the next closest blockContainer node\n * is returned. If the position is beyond the last blockContainer, the position\n * just before the last blockContainer is returned.\n * @param doc The ProseMirror doc.\n * @param pos An integer position in the document.\n * @returns The position just before the nearest blockContainer node.\n */\nexport function getNearestBlockContainerPos(doc: Node, pos: number) {\n const $pos = doc.resolve(pos);\n\n // Checks if the position provided is already just before a blockContainer\n // node, in which case we return the position.\n if ($pos.nodeAfter && $pos.nodeAfter.type.isInGroup(\"bnBlock\")) {\n return {\n posBeforeNode: $pos.pos,\n node: $pos.nodeAfter,\n };\n }\n\n // Checks the node containing the position and its ancestors until a\n // blockContainer node is found and returned.\n let depth = $pos.depth;\n let node = $pos.node(depth);\n while (depth > 0) {\n if (node.type.isInGroup(\"bnBlock\")) {\n return {\n posBeforeNode: $pos.before(depth),\n node: node,\n };\n }\n\n depth--;\n node = $pos.node(depth);\n }\n\n // If the position doesn't lie within a blockContainer node, we instead find\n // the position of the next closest one. If the position is beyond the last\n // blockContainer, we return the position of the last blockContainer. While\n // running `doc.descendants` is expensive, this case should be very rarely\n // triggered. However, it's possible for the position to sometimes be beyond\n // the last blockContainer node. This is a problem specifically when using the\n // collaboration plugin.\n const allBlockContainerPositions: number[] = [];\n doc.descendants((node, pos) => {\n if (node.type.isInGroup(\"bnBlock\")) {\n allBlockContainerPositions.push(pos);\n }\n });\n\n // eslint-disable-next-line no-console\n console.warn(`Position ${pos} is not within a blockContainer node.`);\n\n const resolvedPos = doc.resolve(\n allBlockContainerPositions.find((position) => position >= pos) ||\n allBlockContainerPositions[allBlockContainerPositions.length - 1]\n );\n return {\n posBeforeNode: resolvedPos.pos,\n node: resolvedPos.nodeAfter!,\n };\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block in a\n * BlockNote document. This includes the main `blockContainer` node, the\n * `blockContent` node with the block's main body, and the optional `blockGroup`\n * node which contains the block's children. As well as the nodes, also returns\n * the ProseMirror positions just before & after each node.\n * @param node The main `blockContainer` node that the block information should\n * be retrieved from,\n * @param blockContainerBeforePosOffset the position just before the\n * `blockContainer` node in the document.\n */\nexport function getBlockInfoWithManualOffset(\n node: Node,\n bnBlockBeforePosOffset: number\n): BlockInfo {\n if (!node.type.isInGroup(\"bnBlock\")) {\n throw new Error(\n `Attempted to get bnBlock node at position but found node of different type ${node.type}`\n );\n }\n\n const bnBlockNode = node;\n const bnBlockBeforePos = bnBlockBeforePosOffset;\n const bnBlockAfterPos = bnBlockBeforePos + bnBlockNode.nodeSize;\n\n const bnBlock: SingleBlockInfo = {\n node: bnBlockNode,\n beforePos: bnBlockBeforePos,\n afterPos: bnBlockAfterPos,\n };\n\n if (bnBlockNode.type.name === \"blockContainer\") {\n let blockContent: SingleBlockInfo | undefined;\n let blockGroup: SingleBlockInfo | undefined;\n\n bnBlockNode.forEach((node, offset) => {\n if (node.type.spec.group === \"blockContent\") {\n // console.log(beforePos, offset);\n const blockContentNode = node;\n const blockContentBeforePos = bnBlockBeforePos + offset + 1;\n const blockContentAfterPos = blockContentBeforePos + node.nodeSize;\n\n blockContent = {\n node: blockContentNode,\n beforePos: blockContentBeforePos,\n afterPos: blockContentAfterPos,\n };\n } else if (node.type.name === \"blockGroup\") {\n const blockGroupNode = node;\n const blockGroupBeforePos = bnBlockBeforePos + offset + 1;\n const blockGroupAfterPos = blockGroupBeforePos + node.nodeSize;\n\n blockGroup = {\n node: blockGroupNode,\n beforePos: blockGroupBeforePos,\n afterPos: blockGroupAfterPos,\n };\n }\n });\n\n if (!blockContent) {\n throw new Error(\n `blockContainer node does not contain a blockContent node in its children: ${bnBlockNode}`\n );\n }\n\n return {\n isBlockContainer: true,\n bnBlock,\n blockContent,\n childContainer: blockGroup,\n blockNoteType: blockContent.node.type.name,\n };\n } else {\n if (!bnBlock.node.type.isInGroup(\"childContainer\")) {\n throw new Error(\n `bnBlock node is not in the childContainer group: ${bnBlock.node}`\n );\n }\n\n return {\n isBlockContainer: false,\n bnBlock: bnBlock,\n childContainer: bnBlock,\n blockNoteType: bnBlock.node.type.name,\n };\n }\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block in a\n * BlockNote document. This includes the main `blockContainer` node, the\n * `blockContent` node with the block's main body, and the optional `blockGroup`\n * node which contains the block's children. As well as the nodes, also returns\n * the ProseMirror positions just before & after each node.\n * @param posInfo An object with the main `blockContainer` node that the block\n * information should be retrieved from, and the position just before it in the\n * document.\n */\nexport function getBlockInfo(posInfo: { posBeforeNode: number; node: Node }) {\n return getBlockInfoWithManualOffset(posInfo.node, posInfo.posBeforeNode);\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block from a\n * resolved position just before the `blockContainer` node in the document that\n * corresponds to it.\n * @param resolvedPos The resolved position just before the `blockContainer`\n * node.\n */\nexport function getBlockInfoFromResolvedPos(resolvedPos: ResolvedPos) {\n if (!resolvedPos.nodeAfter) {\n throw new Error(\n `Attempted to get blockContainer node at position ${resolvedPos.pos} but a node at this position does not exist`\n );\n }\n return getBlockInfoWithManualOffset(resolvedPos.nodeAfter, resolvedPos.pos);\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block. The\n * block chosen is the one currently containing the current ProseMirror\n * selection.\n * @param state The ProseMirror editor state.\n */\nexport function getBlockInfoFromSelection(state: EditorState) {\n const posInfo = getNearestBlockContainerPos(\n state.doc,\n state.selection.anchor\n );\n const ret = getBlockInfo(posInfo);\n if (!ret.isBlockContainer) {\n throw new Error(\n `selection always expected to return blockContainer ${state.selection.anchor}`\n );\n }\n return ret;\n}\n","import { Node } from \"prosemirror-model\";\n\n/**\n * Get a TipTap node by id\n */\nexport function getNodeById(\n id: string,\n doc: Node\n): { node: Node; posBeforeNode: number } {\n let targetNode: Node | undefined = undefined;\n let posBeforeNode: number | undefined = undefined;\n\n doc.firstChild!.descendants((node, pos) => {\n // Skips traversing nodes after node with target ID has been found.\n if (targetNode) {\n return false;\n }\n\n // Keeps traversing nodes if block with target ID has not been found.\n if (!node.type.isInGroup(\"bnBlock\") || node.attrs.id !== id) {\n return true;\n }\n\n targetNode = node;\n posBeforeNode = pos + 1;\n\n return false;\n });\n\n if (targetNode === undefined || posBeforeNode === undefined) {\n throw Error(\"Could not find block in the editor with matching ID.\");\n }\n\n return {\n node: targetNode,\n posBeforeNode: posBeforeNode,\n };\n}\n","export const isAppleOS = () =>\n typeof navigator !== \"undefined\" &&\n (/Mac/.test(navigator.platform) ||\n (/AppleWebKit/.test(navigator.userAgent) &&\n /Mobile\\/\\w+/.test(navigator.userAgent)));\n\nexport function formatKeyboardShortcut(shortcut: string, ctrlText = \"Ctrl\") {\n if (isAppleOS()) {\n return shortcut.replace(\"Mod\", \"⌘\");\n } else {\n return shortcut.replace(\"Mod\", ctrlText);\n }\n}\n\nexport function mergeCSSClasses(...classes: string[]) {\n return classes.filter((c) => c).join(\" \");\n}\n\nexport const isSafari = () =>\n /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n","import { blockToNode } from \"../api/nodeConversions/blockToNode.js\";\nimport type { BlockNoteEditor } from \"../editor/BlockNoteEditor.js\";\nimport type {\n BlockNoDefaults,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\n\n// Function that creates a ProseMirror `DOMOutputSpec` for a default block.\n// Since all default blocks have the same structure (`blockContent` div with a\n// `inlineContent` element inside), this function only needs the block's name\n// for the `data-content-type` attribute of the `blockContent` element and the\n// HTML tag of the `inlineContent` element, as well as any HTML attributes to\n// add to those.\nexport function createDefaultBlockDOMOutputSpec(\n blockName: string,\n htmlTag: string,\n blockContentHTMLAttributes: Record<string, string>,\n inlineContentHTMLAttributes: Record<string, string>\n) {\n const blockContent = document.createElement(\"div\");\n blockContent.className = mergeCSSClasses(\n \"bn-block-content\",\n blockContentHTMLAttributes.class\n );\n blockContent.setAttribute(\"data-content-type\", blockName);\n for (const [attribute, value] of Object.entries(blockContentHTMLAttributes)) {\n if (attribute !== \"class\") {\n blockContent.setAttribute(attribute, value);\n }\n }\n\n const inlineContent = document.createElement(htmlTag);\n inlineContent.className = mergeCSSClasses(\n \"bn-inline-content\",\n inlineContentHTMLAttributes.class\n );\n for (const [attribute, value] of Object.entries(\n inlineContentHTMLAttributes\n )) {\n if (attribute !== \"class\") {\n inlineContent.setAttribute(attribute, value);\n }\n }\n\n blockContent.appendChild(inlineContent);\n\n return {\n dom: blockContent,\n contentDOM: inlineContent,\n };\n}\n\n// Function used to convert default blocks to HTML. It uses the corresponding\n// node's `renderHTML` method to do the conversion by using a default\n// `DOMSerializer`.\nexport const defaultBlockToHTML = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: BlockNoDefaults<BSchema, I, S>,\n editor: BlockNoteEditor<BSchema, I, S>\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n} => {\n let node = blockToNode(block, editor.pmSchema, editor.schema.styleSchema);\n\n if (node.type.name === \"blockContainer\") {\n // for regular blocks, get the toDOM spec from the blockContent node\n node = node.firstChild!;\n }\n\n const toDOM = editor.pmSchema.nodes[node.type.name].spec.toDOM;\n\n if (toDOM === undefined) {\n throw new Error(\n \"This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.\"\n );\n }\n\n const renderSpec = toDOM(node);\n\n if (typeof renderSpec !== \"object\" || !(\"dom\" in renderSpec)) {\n throw new Error(\n \"Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.\"\n );\n }\n\n return renderSpec as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n};\n","import type { Props, PropSchema } from \"../schema/index.js\";\n\n// TODO: this system should probably be moved / refactored.\n// The dependency from schema on this file doesn't make sense\n\nexport const defaultProps = {\n backgroundColor: {\n default: \"default\" as const,\n },\n textColor: {\n default: \"default\" as const,\n },\n textAlignment: {\n default: \"left\" as const,\n values: [\"left\", \"center\", \"right\", \"justify\"] as const,\n },\n} satisfies PropSchema;\n\nexport type DefaultProps = Props<typeof defaultProps>;\n\n// Default props which are set on `blockContainer` nodes rather than\n// `blockContent` nodes. Ensures that they are not redundantly added to\n// a custom block's TipTap node attributes.\nexport const inheritedProps = [\"backgroundColor\", \"textColor\"];\n","export function camelToDataKebab(str: string): string {\n return \"data-\" + str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\nexport function filenameFromURL(url: string): string {\n const parts = url.split(\"/\");\n if (\n !parts.length || // invalid?\n parts[parts.length - 1] === \"\" // for example, URL ends in a directory-like trailing slash\n ) {\n // in this case just return the original url\n return url;\n }\n return parts[parts.length - 1];\n}\n","import {\n Attribute,\n Attributes,\n Editor,\n Extension,\n Node,\n NodeConfig,\n} from \"@tiptap/core\";\nimport { defaultBlockToHTML } from \"../../blocks/defaultBlockHelpers.js\";\nimport { inheritedProps } from \"../../blocks/defaultProps.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { mergeCSSClasses } from \"../../util/browser.js\";\nimport { camelToDataKebab } from \"../../util/string.js\";\nimport { InlineContentSchema } from \"../inlineContent/types.js\";\nimport { PropSchema, Props } from \"../propTypes.js\";\nimport { StyleSchema } from \"../styles/types.js\";\nimport {\n BlockConfig,\n BlockSchemaFromSpecs,\n BlockSchemaWithBlock,\n BlockSpec,\n BlockSpecs,\n SpecificBlock,\n TiptapBlockImplementation,\n} from \"./types.js\";\n\n// Function that uses the 'propSchema' of a blockConfig to create a TipTap\n// node's `addAttributes` property.\n// TODO: extract function\nexport function propsToAttributes(propSchema: PropSchema): Attributes {\n const tiptapAttributes: Record<string, Attribute> = {};\n\n Object.entries(propSchema)\n .filter(([name, _spec]) => !inheritedProps.includes(name))\n .forEach(([name, spec]) => {\n tiptapAttributes[name] = {\n default: spec.default,\n keepOnSplit: true,\n // Props are displayed in kebab-case as HTML attributes. If a prop's\n // value is the same as its default, we don't display an HTML\n // attribute for it.\n parseHTML: (element) => {\n const value = element.getAttribute(camelToDataKebab(name));\n\n if (value === null) {\n return null;\n }\n\n if (typeof spec.default === \"boolean\") {\n if (value === \"true\") {\n return true;\n }\n\n if (value === \"false\") {\n return false;\n }\n\n return null;\n }\n\n if (typeof spec.default === \"number\") {\n const asNumber = parseFloat(value);\n const isNumeric =\n !Number.isNaN(asNumber) && Number.isFinite(asNumber);\n\n if (isNumeric) {\n return asNumber;\n }\n\n return null;\n }\n\n return value;\n },\n renderHTML: (attributes) =>\n attributes[name] !== spec.default\n ? {\n [camelToDataKebab(name)]: attributes[name],\n }\n : {},\n };\n });\n\n return tiptapAttributes;\n}\n\n// Used to figure out which block should be rendered. This block is then used to\n// create the node view.\nexport function getBlockFromPos<\n BType extends string,\n Config extends BlockConfig,\n BSchema extends BlockSchemaWithBlock<BType, Config>,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n getPos: (() => number) | boolean,\n editor: BlockNoteEditor<BSchema, I, S>,\n tipTapEditor: Editor,\n type: BType\n) {\n // Gets position of the node\n if (typeof getPos === \"boolean\") {\n throw new Error(\n \"Cannot find node position as getPos is a boolean, not a function.\"\n );\n }\n const pos = getPos();\n // Gets parent blockContainer node\n const blockContainer = tipTapEditor.state.doc.resolve(pos!).node();\n // Gets block identifier\n const blockIdentifier = blockContainer.attrs.id;\n\n if (!blockIdentifier) {\n throw new Error(\"Block doesn't have id\");\n }\n\n // Gets the block\n const block = editor.getBlock(blockIdentifier)! as SpecificBlock<\n BSchema,\n BType,\n I,\n S\n >;\n if (block.type !== type) {\n throw new Error(\"Block type does not match\");\n }\n\n return block;\n}\n\n// Function that wraps the `dom` element returned from 'blockConfig.render' in a\n// `blockContent` div, which contains the block type and props as HTML\n// attributes. If `blockConfig.render` also returns a `contentDOM`, it also adds\n// an `inlineContent` class to it.\nexport function wrapInBlockStructure<\n BType extends string,\n PSchema extends PropSchema\n>(\n element: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n destroy?: () => void;\n },\n blockType: BType,\n blockProps: Props<PSchema>,\n propSchema: PSchema,\n isFileBlock = false,\n domAttributes?: Record<string, string>\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n destroy?: () => void;\n} {\n // Creates `blockContent` element\n const blockContent = document.createElement(\"div\");\n\n // Adds custom HTML attributes\n if (domAttributes !== undefined) {\n for (const [attr, value] of Object.entries(domAttributes)) {\n if (attr !== \"class\") {\n blockContent.setAttribute(attr, value);\n }\n }\n }\n // Sets blockContent class\n blockContent.className = mergeCSSClasses(\n \"bn-block-content\",\n domAttributes?.class || \"\"\n );\n // Sets content type attribute\n blockContent.setAttribute(\"data-content-type\", blockType);\n // Adds props as HTML attributes in kebab-case with \"data-\" prefix. Skips props\n // which are already added as HTML attributes to the parent `blockContent`\n // element (inheritedProps) and props set to their default values.\n for (const [prop, value] of Object.entries(blockProps)) {\n if (!inheritedProps.includes(prop) && value !== propSchema[prop].default) {\n blockContent.setAttribute(camelToDataKebab(prop), value);\n }\n }\n // Adds file block attribute\n if (isFileBlock) {\n blockContent.setAttribute(\"data-file-block\", \"\");\n }\n\n blockContent.appendChild(element.dom);\n\n if (element.contentDOM !== undefined) {\n element.contentDOM.className = mergeCSSClasses(\n \"bn-inline-content\",\n element.contentDOM.className\n );\n element.contentDOM.setAttribute(\"data-editable\", \"\");\n }\n\n return {\n ...element,\n dom: blockContent,\n };\n}\n\n// Helper type to keep track of the `name` and `content` properties after calling Node.create.\ntype StronglyTypedTipTapNode<\n Name extends string,\n Content extends\n | \"inline*\"\n | \"tableRow+\"\n | \"blockContainer+\"\n | \"column column+\"\n | \"\"\n> = Node & { name: Name; config: { content: Content } };\n\nexport function createStronglyTypedTiptapNode<\n Name extends string,\n Content extends\n | \"inline*\"\n | \"tableRow+\"\n | \"blockContainer+\"\n | \"column column+\"\n | \"\"\n>(config: NodeConfig & { name: Name; content: Content }) {\n return Node.create(config) as StronglyTypedTipTapNode<Name, Content>; // force re-typing (should be safe as it's type-checked from the config)\n}\n\n// This helper function helps to instantiate a blockspec with a\n// config and implementation that conform to the type of Config\nexport function createInternalBlockSpec<T extends BlockConfig>(\n config: T,\n implementation: TiptapBlockImplementation<\n T,\n any,\n InlineContentSchema,\n StyleSchema\n >\n) {\n return {\n config,\n implementation,\n } satisfies BlockSpec<T, any, InlineContentSchema, StyleSchema>;\n}\n\nexport function createBlockSpecFromStronglyTypedTiptapNode<\n T extends Node,\n P extends PropSchema\n>(node: T, propSchema: P, requiredExtensions?: Array<Extension | Node>) {\n return createInternalBlockSpec(\n {\n type: node.name as T[\"name\"],\n content: (node.config.content === \"inline*\"\n ? \"inline\"\n : node.config.content === \"tableRow+\"\n ? \"table\"\n : \"none\") as T[\"config\"][\"content\"] extends \"inline*\"\n ? \"inline\"\n : T[\"config\"][\"content\"] extends \"tableRow+\"\n ? \"table\"\n : \"none\",\n propSchema,\n },\n {\n node,\n requiredExtensions,\n toInternalHTML: defaultBlockToHTML,\n toExternalHTML: defaultBlockToHTML,\n // parse: () => undefined, // parse rules are in node already\n }\n );\n}\n\nexport function getBlockSchemaFromSpecs<T extends BlockSpecs>(specs: T) {\n return Object.fromEntries(\n Object.entries(specs).map(([key, value]) => [key, value.config])\n ) as BlockSchemaFromSpecs<T>;\n}\n","import { Editor } from \"@tiptap/core\";\nimport { TagParseRule } from \"@tiptap/pm/model\";\nimport { NodeView } from \"@tiptap/pm/view\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { InlineContentSchema } from \"../inlineContent/types.js\";\nimport { StyleSchema } from \"../styles/types.js\";\nimport {\n createInternalBlockSpec,\n createStronglyTypedTiptapNode,\n getBlockFromPos,\n propsToAttributes,\n wrapInBlockStructure,\n} from \"./internal.js\";\nimport {\n BlockConfig,\n BlockFromConfig,\n BlockSchemaWithBlock,\n PartialBlockFromConfig,\n} from \"./types.js\";\n\n// restrict content to \"inline\" and \"none\" only\nexport type CustomBlockConfig = BlockConfig & {\n content: \"inline\" | \"none\";\n};\n\nexport type CustomBlockImplementation<\n T extends CustomBlockConfig,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n render: (\n /**\n * The custom block to render\n */\n block: BlockFromConfig<T, I, S>,\n /**\n * The BlockNote editor instance\n * This is typed generically. If you want an editor with your custom schema, you need to\n * cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`\n */\n editor: BlockNoteEditor<BlockSchemaWithBlock<T[\"type\"], T>, I, S>\n // (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations\n // or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics\n ) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n destroy?: () => void;\n };\n // Exports block to external HTML. If not defined, the output will be the same\n // as `render(...).dom`. Used to create clipboard data when pasting outside\n // BlockNote.\n // TODO: Maybe can return undefined to ignore when serializing?\n toExternalHTML?: (\n block: BlockFromConfig<T, I, S>,\n editor: BlockNoteEditor<BlockSchemaWithBlock<T[\"type\"], T>, I, S>\n ) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n parse?: (\n el: HTMLElement\n ) => PartialBlockFromConfig<T, I, S>[\"props\"] | undefined;\n};\n\n// Function that causes events within non-selectable blocks to be handled by the\n// browser instead of the editor.\nexport function applyNonSelectableBlockFix(nodeView: NodeView, editor: Editor) {\n nodeView.stopEvent = (event) => {\n // Blurs the editor on mouse down as the block is non-selectable. This is\n // mainly done to prevent UI elements like the formatting toolbar from being\n // visible while content within a non-selectable block is selected.\n if (event.type === \"mousedown\") {\n setTimeout(() => {\n editor.view.dom.blur();\n }, 10);\n }\n\n return true;\n };\n}\n\n// Function that uses the 'parse' function of a blockConfig to create a\n// TipTap node's `parseHTML` property. This is only used for parsing content\n// from the clipboard.\nexport function getParseRules(\n config: BlockConfig,\n customParseFunction: CustomBlockImplementation<any, any, any>[\"parse\"]\n) {\n const rules: TagParseRule[] = [\n {\n tag: \"[data-content-type=\" + config.type + \"]\",\n contentElement: \"[data-editable]\",\n },\n ];\n\n if (customParseFunction) {\n rules.push({\n tag: \"*\",\n getAttrs(node: string | HTMLElement) {\n if (typeof node === \"string\") {\n return false;\n }\n\n const props = customParseFunction?.(node);\n\n if (props === undefined) {\n return false;\n }\n\n return props;\n },\n });\n }\n // getContent(node, schema) {\n // const block = blockConfig.parse?.(node as HTMLElement);\n //\n // if (block !== undefined && block.content !== undefined) {\n // return Fragment.from(\n // typeof block.content === \"string\"\n // ? schema.text(block.content)\n // : inlineContentToNodes(block.content, schema)\n // );\n // }\n //\n // return Fragment.empty;\n // },\n // });\n // }\n\n return rules;\n}\n\n// A function to create custom block for API consumers\n// we want to hide the tiptap node from API consumers and provide a simpler API surface instead\nexport function createBlockSpec<\n T extends CustomBlockConfig,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockConfig: T,\n blockImplementation: CustomBlockImplementation<NoInfer<T>, I, S>\n) {\n const node = createStronglyTypedTiptapNode({\n name: blockConfig.type as T[\"type\"],\n content: (blockConfig.content === \"inline\"\n ? \"inline*\"\n : \"\") as T[\"content\"] extends \"inline\" ? \"inline*\" : \"\",\n group: \"blockContent\",\n selectable: blockConfig.isSelectable ?? true,\n\n addAttributes() {\n return propsToAttributes(blockConfig.propSchema);\n },\n\n parseHTML() {\n return getParseRules(blockConfig, blockImplementation.parse);\n },\n\n renderHTML({ HTMLAttributes }) {\n // renderHTML is used for copy/pasting content from the editor back into\n // the editor, so we need to make sure the `blockContent` element is\n // structured correctly as this is what's used for parsing blocks. We\n // just render a placeholder div inside as the `blockContent` element\n // already has all the information needed for proper parsing.\n const div = document.createElement(\"div\");\n return wrapInBlockStructure(\n {\n dom: div,\n contentDOM: blockConfig.content === \"inline\" ? div : undefined,\n },\n blockConfig.type,\n {},\n blockConfig.propSchema,\n blockConfig.isFileBlock,\n HTMLAttributes\n );\n },\n\n addNodeView() {\n return ({ getPos }) => {\n // Gets the BlockNote editor instance\n const editor = this.options.editor;\n // Gets the block\n const block = getBlockFromPos(\n getPos,\n editor,\n this.editor,\n blockConfig.type\n );\n // Gets the custom HTML attributes for `blockContent` nodes\n const blockContentDOMAttributes =\n this.options.domAttributes?.blockContent || {};\n\n const output = blockImplementation.render(block as any, editor);\n\n const nodeView: NodeView = wrapInBlockStructure(\n output,\n block.type,\n block.props,\n blockConfig.propSchema,\n blockContentDOMAttributes\n );\n\n if (blockConfig.isSelectable === false) {\n applyNonSelectableBlockFix(nodeView, this.editor);\n }\n\n return nodeView;\n };\n },\n });\n\n if (node.name !== blockConfig.type) {\n throw new Error(\n \"Node name does not match block type. This is a bug in BlockNote.\"\n );\n }\n\n return createInternalBlockSpec(blockConfig, {\n node,\n toInternalHTML: (block, editor) => {\n const blockContentDOMAttributes =\n node.options.domAttributes?.blockContent || {};\n\n const output = blockImplementation.render(block as any, editor as any);\n\n return wrapInBlockStructure(\n output,\n block.type,\n block.props,\n blockConfig.propSchema,\n blockConfig.isFileBlock,\n blockContentDOMAttributes\n );\n },\n // TODO: this should not have wrapInBlockStructure and generally be a lot simpler\n // post-processing in externalHTMLExporter should not be necessary\n toExternalHTML: (block, editor) => {\n const blockContentDOMAttributes =\n node.options.domAttributes?.blockContent || {};\n\n let output = blockImplementation.toExternalHTML?.(\n block as any,\n editor as any\n );\n if (output === undefined) {\n output = blockImplementation.render(block as any, editor as any);\n }\n return wrapInBlockStructure(\n output,\n block.type,\n block.props,\n blockConfig.propSchema,\n blockContentDOMAttributes\n );\n },\n });\n}\n","import { Mark, Node } from \"@tiptap/pm/model\";\n\nimport UniqueID from \"../../extensions/UniqueID/UniqueID.js\";\nimport type {\n BlockSchema,\n CustomInlineContentConfig,\n CustomInlineContentFromConfig,\n InlineContent,\n InlineContentFromConfig,\n InlineContentSchema,\n StyleSchema,\n Styles,\n TableContent,\n} from \"../../schema/index.js\";\nimport { getBlockInfoWithManualOffset } from \"../getBlockInfoFromPos.js\";\n\nimport type { Block } from \"../../blocks/defaultBlocks.js\";\nimport {\n isLinkInlineContent,\n isStyledTextInlineContent,\n} from \"../../schema/inlineContent/types.js\";\nimport { UnreachableCaseError } from \"../../util/typescript.js\";\n\n/**\n * Converts an internal (prosemirror) table node contentto a BlockNote Tablecontent\n */\nexport function contentNodeToTableContent<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(contentNode: Node, inlineContentSchema: I, styleSchema: S) {\n const ret: TableContent<I, S> = {\n type: \"tableContent\",\n columnWidths: [],\n rows: [],\n };\n\n contentNode.content.forEach((rowNode, _offset, index) => {\n const row: TableContent<I, S>[\"rows\"][0] = {\n cells: [],\n };\n\n if (index === 0) {\n rowNode.content.forEach((cellNode) => {\n // The colwidth array should have multiple values when the colspan of a\n // cell is greater than 1. However, this is not yet implemented so we\n // can always assume a length of 1.\n ret.columnWidths.push(cellNode.attrs.colwidth?.[0] || undefined);\n });\n }\n\n rowNode.content.forEach((cellNode) => {\n row.cells.push(\n contentNodeToInlineContent(\n cellNode.firstChild!,\n inlineContentSchema,\n styleSchema\n )\n );\n });\n\n ret.rows.push(row);\n });\n\n return ret;\n}\n\n/**\n * Converts an internal (prosemirror) content node to a BlockNote InlineContent array.\n */\nexport function contentNodeToInlineContent<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(contentNode: Node, inlineContentSchema: I, styleSchema: S) {\n const content: InlineContent<any, S>[] = [];\n let currentContent: InlineContent<any, S> | undefined = undefined;\n\n // Most of the logic below is for handling links because in ProseMirror links are marks\n // while in BlockNote links are a type of inline content\n contentNode.content.forEach((node) => {\n // hardBreak nodes do not have an InlineContent equivalent, instead we\n // add a newline to the previous node.\n if (node.type.name === \"hardBreak\") {\n if (currentContent) {\n // Current content exists.\n if (isStyledTextInlineContent(currentContent)) {\n // Current content is text.\n currentContent.text += \"\\n\";\n } else if (isLinkInlineContent(currentContent)) {\n // Current content is a link.\n currentContent.content[currentContent.content.length - 1].text +=\n \"\\n\";\n } else {\n throw new Error(\"unexpected\");\n }\n } else {\n // Current content does not exist.\n currentContent = {\n type: \"text\",\n text: \"\\n\",\n styles: {},\n };\n }\n\n return;\n }\n\n if (\n node.type.name !== \"link\" &&\n node.type.name !== \"text\" &&\n inlineContentSchema[node.type.name]\n ) {\n if (currentContent) {\n content.push(currentContent);\n currentContent = undefined;\n }\n\n content.push(\n nodeToCustomInlineContent(node, inlineContentSchema, styleSchema)\n );\n\n return;\n }\n\n const styles: Styles<S> = {};\n let linkMark: Mark | undefined;\n\n for (const mark of node.marks) {\n if (mark.type.name === \"link\") {\n linkMark = mark;\n } else {\n const config = styleSchema[mark.type.name];\n if (!config) {\n throw new Error(`style ${mark.type.name} not found in styleSchema`);\n }\n if (config.propSchema === \"boolean\") {\n (styles as any)[config.type] = true;\n } else if (config.propSchema === \"string\") {\n (styles as any)[config.type] = mark.attrs.stringValue;\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n }\n\n // Parsing links and text.\n // Current content exists.\n if (currentContent) {\n // Current content is text.\n if (isStyledTextInlineContent(currentContent)) {\n if (!linkMark) {\n // Node is text (same type as current content).\n if (\n JSON.stringify(currentContent.styles) === JSON.stringify(styles)\n ) {\n // Styles are the same.\n currentContent.text += node.textContent;\n } else {\n // Styles are different.\n content.push(currentContent);\n currentContent = {\n type: \"text\",\n text: node.textContent,\n styles,\n };\n }\n } else {\n // Node is a link (different type to current content).\n content.push(currentContent);\n currentContent = {\n type: \"link\",\n href: linkMark.attrs.href,\n content: [\n {\n type: \"text\",\n text: node.textContent,\n styles,\n },\n ],\n };\n }\n } else if (isLinkInlineContent(currentContent)) {\n // Current content is a link.\n if (linkMark) {\n // Node is a link (same type as current content).\n // Link URLs are the same.\n if (currentContent.href === linkMark.attrs.href) {\n // Styles are the same.\n if (\n JSON.stringify(\n currentContent.content[currentContent.content.length - 1].styles\n ) === JSON.stringify(styles)\n ) {\n currentContent.content[currentContent.content.length - 1].text +=\n node.textContent;\n } else {\n // Styles are different.\n currentContent.content.push({\n type: \"text\",\n text: node.textContent,\n styles,\n });\n }\n } else {\n // Link URLs are different.\n content.push(currentContent);\n currentContent = {\n type: \"link\",\n href: linkMark.attrs.href,\n content: [\n {\n type: \"text\",\n text: node.textContent,\n styles,\n },\n ],\n };\n }\n } else {\n // Node is text (different type to current content).\n content.push(currentContent);\n currentContent = {\n type: \"text\",\n text: node.textContent,\n styles,\n };\n }\n } else {\n // TODO\n }\n }\n // Current content does not exist.\n else {\n // Node is text.\n if (!linkMark) {\n currentContent = {\n type: \"text\",\n text: node.textContent,\n styles,\n };\n }\n // Node is a link.\n else {\n currentContent = {\n type: \"link\",\n href: linkMark.attrs.href,\n content: [\n {\n type: \"text\",\n text: node.textContent,\n styles,\n },\n ],\n };\n }\n }\n });\n\n if (currentContent) {\n content.push(currentContent);\n }\n\n return content as InlineContent<I, S>[];\n}\n\nexport function nodeToCustomInlineContent<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(node: Node, inlineContentSchema: I, styleSchema: S): InlineContent<I, S> {\n if (node.type.name === \"text\" || node.type.name === \"link\") {\n throw new Error(\"unexpected\");\n }\n const props: any = {};\n const icConfig = inlineContentSchema[\n node.type.name\n ] as CustomInlineContentConfig;\n for (const [attr, value] of Object.entries(node.attrs)) {\n if (!icConfig) {\n throw Error(\"ic node is of an unrecognized type: \" + node.type.name);\n }\n\n const propSchema = icConfig.propSchema;\n\n if (attr in propSchema) {\n props[attr] = value;\n }\n }\n\n let content: CustomInlineContentFromConfig<any, any>[\"content\"];\n\n if (icConfig.content === \"styled\") {\n content = contentNodeToInlineContent(\n node,\n inlineContentSchema,\n styleSchema\n ) as any; // TODO: is this safe? could we have Links here that are undesired?\n } else {\n content = undefined;\n }\n\n const ic = {\n type: node.type.name,\n props,\n content,\n } as InlineContentFromConfig<I[keyof I], S>;\n return ic;\n}\n\n/**\n * Convert a Prosemirror node to a BlockNote block.\n *\n * TODO: test changes\n */\nexport function nodeToBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n node: Node,\n blockSchema: BSchema,\n inlineContentSchema: I,\n styleSchema: S,\n blockCache?: WeakMap<Node, Block<BSchema, I, S>>\n): Block<BSchema, I, S> {\n if (!node.type.isInGroup(\"bnBlock\")) {\n throw Error(\n \"Node must be in bnBlock group, but is of type\" + node.type.name\n );\n }\n\n const cachedBlock = blockCache?.get(node);\n\n if (cachedBlock) {\n return cachedBlock;\n }\n\n const blockInfo = getBlockInfoWithManualOffset(node, 0);\n\n let id = blockInfo.bnBlock.node.attrs.id;\n\n // Only used for blocks converted from other formats.\n if (id === null) {\n id = UniqueID.options.generateID();\n }\n\n const blockSpec = blockSchema[blockInfo.blockNoteType];\n\n if (!blockSpec) {\n throw Error(\"Block is of an unrecognized type: \" + blockInfo.blockNoteType);\n }\n\n const props: any = {};\n for (const [attr, value] of Object.entries({\n ...node.attrs,\n ...(blockInfo.isBlockContainer ? blockInfo.blockContent.node.attrs : {}),\n })) {\n const propSchema = blockSpec.propSchema;\n\n if (attr in propSchema) {\n props[attr] = value;\n }\n }\n\n const blockConfig = blockSchema[blockInfo.blockNoteType];\n\n const children: Block<BSchema, I, S>[] = [];\n blockInfo.childContainer?.node.forEach((child) => {\n children.push(\n nodeToBlock(\n child,\n blockSchema,\n inlineContentSchema,\n styleSchema,\n blockCache\n )\n );\n });\n\n let content: Block<any, any, any>[\"content\"];\n\n if (blockConfig.content === \"inline\") {\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n content = contentNodeToInlineContent(\n blockInfo.blockContent.node,\n inlineContentSchema,\n styleSchema\n );\n } else if (blockConfig.content === \"table\") {\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n content = contentNodeToTableContent(\n blockInfo.blockContent.node,\n inlineContentSchema,\n styleSchema\n );\n } else if (blockConfig.content === \"none\") {\n content = undefined;\n } else {\n throw new UnreachableCaseError(blockConfig.content);\n }\n\n const block = {\n id,\n type: blockConfig.type,\n props,\n content,\n children,\n } as Block<BSchema, I, S>;\n\n blockCache?.set(node, block);\n\n return block;\n}\n","import { KeyboardShortcutCommand, Node } from \"@tiptap/core\";\n\nimport { camelToDataKebab } from \"../../util/string.js\";\nimport { PropSchema, Props } from \"../propTypes.js\";\nimport {\n CustomInlineContentConfig,\n InlineContentConfig,\n InlineContentImplementation,\n InlineContentSchemaFromSpecs,\n InlineContentSpec,\n InlineContentSpecs,\n} from \"./types.js\";\n\n// Function that adds necessary classes and attributes to the `dom` element\n// returned from a custom inline content's 'render' function, to ensure no data\n// is lost on internal copy & paste.\nexport function addInlineContentAttributes<\n IType extends string,\n PSchema extends PropSchema\n>(\n element: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n },\n inlineContentType: IType,\n inlineContentProps: Props<PSchema>,\n propSchema: PSchema\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n} {\n // Sets content type attribute\n element.dom.setAttribute(\"data-inline-content-type\", inlineContentType);\n // Adds props as HTML attributes in kebab-case with \"data-\" prefix. Skips props\n // set to their default values.\n Object.entries(inlineContentProps)\n .filter(([prop, value]) => value !== propSchema[prop].default)\n .map(([prop, value]) => {\n return [camelToDataKebab(prop), value];\n })\n .forEach(([prop, value]) => element.dom.setAttribute(prop, value));\n\n if (element.contentDOM !== undefined) {\n element.contentDOM.setAttribute(\"data-editable\", \"\");\n }\n\n return element;\n}\n\n// see https://github.com/TypeCellOS/BlockNote/pull/435\nexport function addInlineContentKeyboardShortcuts<\n T extends CustomInlineContentConfig\n>(\n config: T\n): {\n [p: string]: KeyboardShortcutCommand;\n} {\n return {\n Backspace: ({ editor }) => {\n const resolvedPos = editor.state.selection.$from;\n\n return (\n editor.state.selection.empty &&\n resolvedPos.node().type.name === config.type &&\n resolvedPos.parentOffset === 0\n );\n },\n };\n}\n\n// This helper function helps to instantiate a InlineContentSpec with a\n// config and implementation that conform to the type of Config\nexport function createInternalInlineContentSpec<T extends InlineContentConfig>(\n config: T,\n implementation: InlineContentImplementation<T>\n) {\n return {\n config,\n implementation,\n } satisfies InlineContentSpec<T>;\n}\n\nexport function createInlineContentSpecFromTipTapNode<\n T extends Node,\n P extends PropSchema\n>(node: T, propSchema: P) {\n return createInternalInlineContentSpec(\n {\n type: node.name as T[\"name\"],\n propSchema,\n content: node.config.content === \"inline*\" ? \"styled\" : \"none\",\n },\n {\n node,\n }\n );\n}\n\nexport function getInlineContentSchemaFromSpecs<T extends InlineContentSpecs>(\n specs: T\n) {\n return Object.fromEntries(\n Object.entries(specs).map(([key, value]) => [key, value.config])\n ) as InlineContentSchemaFromSpecs<T>;\n}\n","import { Node } from \"@tiptap/core\";\n\nimport { TagParseRule } from \"@tiptap/pm/model\";\nimport { inlineContentToNodes } from \"../../api/nodeConversions/blockToNode.js\";\nimport { nodeToCustomInlineContent } from \"../../api/nodeConversions/nodeToBlock.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { propsToAttributes } from \"../blocks/internal.js\";\nimport { Props } from \"../propTypes.js\";\nimport { StyleSchema } from \"../styles/types.js\";\nimport {\n addInlineContentAttributes,\n addInlineContentKeyboardShortcuts,\n createInlineContentSpecFromTipTapNode,\n} from \"./internal.js\";\nimport {\n CustomInlineContentConfig,\n InlineContentFromConfig,\n InlineContentSpec,\n PartialCustomInlineContentFromConfig,\n} from \"./types.js\";\n\n// TODO: support serialization\n\nexport type CustomInlineContentImplementation<\n T extends CustomInlineContentConfig,\n // B extends BlockSchema,\n // I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n render: (\n /**\n * The custom inline content to render\n */\n inlineContent: InlineContentFromConfig<T, S>,\n updateInlineContent: (\n update: PartialCustomInlineContentFromConfig<T, S>\n ) => void,\n /**\n * The BlockNote editor instance\n * This is typed generically. If you want an editor with your custom schema, you need to\n * cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`\n */\n editor: BlockNoteEditor<any, any, S>\n // (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations\n // or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics\n ) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n // destroy?: () => void;\n };\n};\n\nexport function getInlineContentParseRules(\n config: CustomInlineContentConfig\n): TagParseRule[] {\n return [\n {\n tag: `[data-inline-content-type=\"${config.type}\"]`,\n contentElement: (element) => {\n const htmlElement = element as HTMLElement;\n\n if (htmlElement.matches(\"[data-editable]\")) {\n return htmlElement;\n }\n\n return htmlElement.querySelector(\"[data-editable]\") || htmlElement;\n },\n },\n ];\n}\n\nexport function createInlineContentSpec<\n T extends CustomInlineContentConfig,\n S extends StyleSchema\n>(\n inlineContentConfig: T,\n inlineContentImplementation: CustomInlineContentImplementation<T, S>\n): InlineContentSpec<T> {\n const node = Node.create({\n name: inlineContentConfig.type,\n inline: true,\n group: \"inline\",\n selectable: inlineContentConfig.content === \"styled\",\n atom: inlineContentConfig.content === \"none\",\n content: (inlineContentConfig.content === \"styled\"\n ? \"inline*\"\n : \"\") as T[\"content\"] extends \"styled\" ? \"inline*\" : \"\",\n\n addAttributes() {\n return propsToAttributes(inlineContentConfig.propSchema);\n },\n\n addKeyboardShortcuts() {\n return addInlineContentKeyboardShortcuts(inlineContentConfig);\n },\n\n parseHTML() {\n return getInlineContentParseRules(inlineContentConfig);\n },\n\n renderHTML({ node }) {\n const editor = this.options.editor;\n\n const output = inlineContentImplementation.render(\n nodeToCustomInlineContent(\n node,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n ) as any as InlineContentFromConfig<T, S>, // TODO: fix cast\n () => {\n // No-op\n },\n editor\n );\n\n return addInlineContentAttributes(\n output,\n inlineContentConfig.type,\n node.attrs as Props<T[\"propSchema\"]>,\n inlineContentConfig.propSchema\n );\n },\n\n addNodeView() {\n return ({ node, getPos }) => {\n const editor = this.options.editor;\n\n const output = inlineContentImplementation.render(\n nodeToCustomInlineContent(\n node,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n ) as any as InlineContentFromConfig<T, S>, // TODO: fix cast\n (update) => {\n if (typeof getPos === \"boolean\") {\n return;\n }\n\n const content = inlineContentToNodes(\n [update],\n editor._tiptapEditor.schema,\n editor.schema.styleSchema\n );\n\n editor._tiptapEditor.view.dispatch(\n editor._tiptapEditor.view.state.tr.replaceWith(\n getPos(),\n getPos() + node.nodeSize,\n content\n )\n );\n },\n editor\n );\n\n return addInlineContentAttributes(\n output,\n inlineContentConfig.type,\n node.attrs as Props<T[\"propSchema\"]>,\n inlineContentConfig.propSchema\n );\n };\n },\n });\n\n return createInlineContentSpecFromTipTapNode(\n node,\n inlineContentConfig.propSchema\n ) as InlineContentSpec<T>; // TODO: fix cast\n}\n","import { Attributes, Mark } from \"@tiptap/core\";\nimport {\n StyleConfig,\n StyleImplementation,\n StylePropSchema,\n StyleSchemaFromSpecs,\n StyleSpec,\n StyleSpecs,\n} from \"./types.js\";\n\nexport function stylePropsToAttributes(\n propSchema: StylePropSchema\n): Attributes {\n if (propSchema === \"boolean\") {\n return {};\n }\n return {\n stringValue: {\n default: undefined,\n keepOnSplit: true,\n parseHTML: (element) => element.getAttribute(\"data-value\"),\n renderHTML: (attributes) =>\n attributes.stringValue !== undefined\n ? {\n \"data-value\": attributes.stringValue,\n }\n : {},\n },\n };\n}\n\n// Function that adds necessary classes and attributes to the `dom` element\n// returned from a custom style's 'render' function, to ensure no data is lost\n// on internal copy & paste.\nexport function addStyleAttributes<\n SType extends string,\n PSchema extends StylePropSchema\n>(\n element: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n },\n styleType: SType,\n styleValue: PSchema extends \"boolean\" ? undefined : string,\n propSchema: PSchema\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n} {\n // Sets content type attribute\n element.dom.setAttribute(\"data-style-type\", styleType);\n // Adds style value as an HTML attribute in kebab-case with \"data-\" prefix, if\n // the style takes a string value.\n if (propSchema === \"string\") {\n element.dom.setAttribute(\"data-value\", styleValue as string);\n }\n\n if (element.contentDOM !== undefined) {\n element.contentDOM.setAttribute(\"data-editable\", \"\");\n }\n\n return element;\n}\n\n// This helper function helps to instantiate a stylespec with a\n// config and implementation that conform to the type of Config\nexport function createInternalStyleSpec<T extends StyleConfig>(\n config: T,\n implementation: StyleImplementation\n) {\n return {\n config,\n implementation,\n } satisfies StyleSpec<T>;\n}\n\nexport function createStyleSpecFromTipTapMark<\n T extends Mark,\n P extends StylePropSchema\n>(mark: T, propSchema: P) {\n return createInternalStyleSpec(\n {\n type: mark.name as T[\"name\"],\n propSchema,\n },\n {\n mark,\n }\n );\n}\n\nexport function getStyleSchemaFromSpecs<T extends StyleSpecs>(specs: T) {\n return Object.fromEntries(\n Object.entries(specs).map(([key, value]) => [key, value.config])\n ) as StyleSchemaFromSpecs<T>;\n}\n","import { Mark } from \"@tiptap/core\";\n\nimport { ParseRule } from \"@tiptap/pm/model\";\nimport { UnreachableCaseError } from \"../../util/typescript.js\";\nimport {\n addStyleAttributes,\n createInternalStyleSpec,\n stylePropsToAttributes,\n} from \"./internal.js\";\nimport { StyleConfig, StyleSpec } from \"./types.js\";\n\nexport type CustomStyleImplementation<T extends StyleConfig> = {\n render: T[\"propSchema\"] extends \"boolean\"\n ? () => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n }\n : (value: string) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n};\n\n// TODO: support serialization\n\nexport function getStyleParseRules(config: StyleConfig): ParseRule[] {\n return [\n {\n tag: `[data-style-type=\"${config.type}\"]`,\n contentElement: (element) => {\n const htmlElement = element as HTMLElement;\n\n if (htmlElement.matches(\"[data-editable]\")) {\n return htmlElement;\n }\n\n return htmlElement.querySelector(\"[data-editable]\") || htmlElement;\n },\n },\n ];\n}\n\nexport function createStyleSpec<T extends StyleConfig>(\n styleConfig: T,\n styleImplementation: CustomStyleImplementation<T>\n): StyleSpec<T> {\n const mark = Mark.create({\n name: styleConfig.type,\n\n addAttributes() {\n return stylePropsToAttributes(styleConfig.propSchema);\n },\n\n parseHTML() {\n return getStyleParseRules(styleConfig);\n },\n\n renderHTML({ mark }) {\n let renderResult: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n if (styleConfig.propSchema === \"boolean\") {\n // @ts-ignore not sure why this is complaining\n renderResult = styleImplementation.render();\n } else if (styleConfig.propSchema === \"string\") {\n renderResult = styleImplementation.render(mark.attrs.stringValue);\n } else {\n throw new UnreachableCaseError(styleConfig.propSchema);\n }\n\n // const renderResult = styleImplementation.render();\n return addStyleAttributes(\n renderResult,\n styleConfig.type,\n mark.attrs.stringValue,\n styleConfig.propSchema\n );\n },\n });\n\n return createInternalStyleSpec(styleConfig, {\n mark,\n });\n}\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n BlockSchemaWithBlock,\n FileBlockConfig,\n} from \"../../schema/index.js\";\n\nexport const FILE_ICON_SVG = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>`;\nexport const createFileBlockWrapper = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n editor: BlockNoteEditor<\n BlockSchemaWithBlock<FileBlockConfig[\"type\"], FileBlockConfig>,\n any,\n any\n >,\n // TODO: Maybe make optional for default preview\n element: { dom: HTMLElement; destroy?: () => void },\n buttonText?: string,\n buttonIcon?: HTMLElement\n) => {\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"bn-file-block-content-wrapper\";\n\n if (block.props.url === \"\") {\n const addFileButton = createAddFileButton(\n block,\n editor,\n buttonText,\n buttonIcon\n );\n wrapper.appendChild(addFileButton.dom);\n\n const loading = document.createElement(\"div\");\n loading.className = \"bn-file-loading-preview\";\n loading.textContent = \"Loading...\";\n\n const destroyUploadStartHandler = editor.onUploadStart((blockId) => {\n if (blockId === block.id) {\n wrapper.removeChild(addFileButton.dom);\n wrapper.appendChild(loading);\n }\n });\n const destroyUploadEndHandler = editor.onUploadEnd((blockId) => {\n if (blockId === block.id) {\n wrapper.removeChild(loading);\n wrapper.appendChild(addFileButton.dom);\n }\n });\n\n return {\n dom: wrapper,\n destroy: () => {\n addFileButton.destroy?.();\n destroyUploadStartHandler();\n destroyUploadEndHandler();\n },\n };\n } else if (block.props.showPreview === false) {\n // TODO: Not using the wrapper element here?\n const file = createDefaultFilePreview(block).dom;\n const element = createFileAndCaptionWrapper(block, file);\n\n return {\n dom: element.dom,\n };\n } else {\n wrapper.appendChild(element.dom);\n\n return {\n dom: wrapper,\n destroy: element.destroy,\n };\n }\n};\n\n// Default file preview, displaying a file icon and file name.\nexport const createDefaultFilePreview = (\n block: BlockFromConfig<FileBlockConfig, any, any>\n): { dom: HTMLElement; destroy?: () => void } => {\n const file = document.createElement(\"div\");\n file.className = \"bn-file-default-preview\";\n\n const icon = document.createElement(\"div\");\n icon.className = \"bn-file-default-preview-icon\";\n icon.innerHTML = FILE_ICON_SVG;\n\n const fileName = document.createElement(\"p\");\n fileName.className = \"bn-file-default-preview-name\";\n fileName.textContent = block.props.name || \"\";\n\n file.appendChild(icon);\n file.appendChild(fileName);\n\n return {\n dom: file,\n };\n};\n\n// Wrapper element containing file preview and caption.\nexport const createFileAndCaptionWrapper = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n file: HTMLElement\n) => {\n const fileAndCaptionWrapper = document.createElement(\"div\");\n fileAndCaptionWrapper.className = \"bn-file-and-caption-wrapper\";\n\n const caption = document.createElement(\"p\");\n caption.className = \"bn-file-caption\";\n caption.textContent = block.props.caption;\n\n if (\n typeof block.props.previewWidth === \"number\" &&\n block.props.previewWidth > 0 &&\n block.props.caption !== undefined\n ) {\n caption.style.width = `${block.props.previewWidth}px`;\n }\n\n fileAndCaptionWrapper.appendChild(file);\n fileAndCaptionWrapper.appendChild(caption);\n\n return {\n dom: fileAndCaptionWrapper,\n };\n};\n\n// Button element that acts as a placeholder for files with no src.\nexport const createAddFileButton = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>,\n buttonText?: string,\n buttonIcon?: HTMLElement\n) => {\n const addFileButton = document.createElement(\"div\");\n addFileButton.className = \"bn-add-file-button\";\n\n const addFileButtonIcon = document.createElement(\"div\");\n addFileButtonIcon.className = \"bn-add-file-button-icon\";\n if (buttonIcon) {\n addFileButtonIcon.appendChild(buttonIcon);\n } else {\n addFileButtonIcon.innerHTML =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>';\n }\n\n const addFileButtonText = document.createElement(\"p\");\n addFileButtonText.className = \"bn-add-file-button-text\";\n addFileButtonText.innerHTML =\n buttonText || editor.dictionary.file_blocks.file.add_button_text;\n\n // Prevents focus from moving to the button.\n const addFileButtonMouseDownHandler = (event: MouseEvent) => {\n event.preventDefault();\n };\n // Opens the file toolbar.\n const addFileButtonClickHandler = () => {\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: block,\n })\n );\n };\n\n addFileButton.appendChild(addFileButtonIcon);\n addFileButton.appendChild(addFileButtonText);\n\n addFileButton.addEventListener(\n \"mousedown\",\n addFileButtonMouseDownHandler,\n true\n );\n addFileButton.addEventListener(\"click\", addFileButtonClickHandler, true);\n\n return {\n dom: addFileButton,\n destroy: () => {\n addFileButton.removeEventListener(\n \"mousedown\",\n addFileButtonMouseDownHandler,\n true\n );\n addFileButton.removeEventListener(\n \"click\",\n addFileButtonClickHandler,\n true\n );\n },\n };\n};\n\nexport const parseEmbedElement = (embedElement: HTMLEmbedElement) => {\n const url = embedElement.src || undefined;\n\n return { url };\n};\n\nexport const parseFigureElement = (\n figureElement: HTMLElement,\n targetTag: string\n) => {\n const targetElement = figureElement.querySelector(\n targetTag\n ) as HTMLElement | null;\n if (!targetElement) {\n return undefined;\n }\n\n const captionElement = figureElement.querySelector(\"figcaption\");\n const caption = captionElement?.textContent ?? undefined;\n\n return { targetElement, caption };\n};\n\n// Wrapper figure element to display file link with caption. Used for external\n// HTML\nexport const createLinkWithCaption = (\n element: HTMLElement,\n caption: string\n) => {\n const wrapper = document.createElement(\"div\");\n const fileCaption = document.createElement(\"p\");\n fileCaption.textContent = caption;\n\n wrapper.appendChild(element);\n wrapper.appendChild(fileCaption);\n\n return {\n dom: wrapper,\n };\n};\n\n// Wrapper figure element to display file preview with caption. Used for\n// external HTML.\nexport const createFigureWithCaption = (\n element: HTMLElement,\n caption: string\n) => {\n const figure = document.createElement(\"figure\");\n const captionElement = document.createElement(\"figcaption\");\n captionElement.textContent = caption;\n\n figure.appendChild(element);\n figure.appendChild(captionElement);\n\n return { dom: figure };\n};\n\n// Wrapper element which adds resize handles & logic for visual media file\n// previews.\nexport const createResizeHandlesWrapper = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>,\n element: HTMLElement,\n getWidth: () => number,\n setWidth: (width: number) => void\n): { dom: HTMLElement; destroy: () => void } => {\n if (!block.props.previewWidth) {\n throw new Error(\"Block must have a `previewWidth` prop.\");\n }\n\n // Wrapper element for rendered element and resize handles.\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"bn-visual-media-wrapper\";\n\n // Resize handle elements.\n const leftResizeHandle = document.createElement(\"div\");\n leftResizeHandle.className = \"bn-visual-media-resize-handle\";\n leftResizeHandle.style.left = \"4px\";\n const rightResizeHandle = document.createElement(\"div\");\n rightResizeHandle.className = \"bn-visual-media-resize-handle\";\n rightResizeHandle.style.right = \"4px\";\n\n // Temporary parameters set when the user begins resizing the element, used to\n // calculate the new width of the element.\n let resizeParams:\n | {\n handleUsed: \"left\" | \"right\";\n initialWidth: number;\n initialClientX: number;\n }\n | undefined;\n\n // Updates the element width with an updated width depending on the cursor X\n // offset from when the resize began, and which resize handle is being used.\n const windowMouseMoveHandler = (event: MouseEvent) => {\n if (!resizeParams) {\n if (\n !editor.isEditable &&\n wrapper.contains(leftResizeHandle) &&\n wrapper.contains(rightResizeHandle)\n ) {\n wrapper.removeChild(leftResizeHandle);\n wrapper.removeChild(rightResizeHandle);\n }\n\n return;\n }\n\n let newWidth: number;\n\n if (block.props.textAlignment === \"center\") {\n if (resizeParams.handleUsed === \"left\") {\n newWidth =\n resizeParams.initialWidth +\n (resizeParams.initialClientX - event.clientX) * 2;\n } else {\n newWidth =\n resizeParams.initialWidth +\n (event.clientX - resizeParams.initialClientX) * 2;\n }\n } else {\n if (resizeParams.handleUsed === \"left\") {\n newWidth =\n resizeParams.initialWidth +\n resizeParams.initialClientX -\n event.clientX;\n } else {\n newWidth =\n resizeParams.initialWidth +\n event.clientX -\n resizeParams.initialClientX;\n }\n }\n\n // Min element width in px.\n const minWidth = 64;\n\n // Ensures the element is not wider than the editor and not smaller than a\n // predetermined minimum width.\n if (newWidth < minWidth) {\n setWidth(minWidth);\n } else if (newWidth > editor.domElement.firstElementChild!.clientWidth) {\n setWidth(editor.domElement.firstElementChild!.clientWidth);\n } else {\n setWidth(newWidth);\n }\n };\n // Stops mouse movements from resizing the element and updates the block's\n // `width` prop to the new value.\n const windowMouseUpHandler = (event: MouseEvent) => {\n // Hides the drag handles if the cursor is no longer over the element.\n if (\n (!event.target ||\n !wrapper.contains(event.target as Node) ||\n !editor.isEditable) &&\n wrapper.contains(leftResizeHandle) &&\n wrapper.contains(rightResizeHandle)\n ) {\n wrapper.removeChild(leftResizeHandle);\n wrapper.removeChild(rightResizeHandle);\n }\n\n if (!resizeParams) {\n return;\n }\n\n resizeParams = undefined;\n\n editor.updateBlock(block, {\n props: {\n previewWidth: getWidth(),\n },\n });\n };\n\n // Shows the resize handles when hovering over the element with the cursor.\n const elementMouseEnterHandler = () => {\n if (editor.isEditable) {\n wrapper.appendChild(leftResizeHandle);\n wrapper.appendChild(rightResizeHandle);\n }\n };\n // Hides the resize handles when the cursor leaves the element, unless the\n // cursor moves to one of the resize handles.\n const elementMouseLeaveHandler = (event: MouseEvent) => {\n if (\n event.relatedTarget === leftResizeHandle ||\n event.relatedTarget === rightResizeHandle\n ) {\n return;\n }\n\n if (resizeParams) {\n return;\n }\n\n if (\n editor.isEditable &&\n wrapper.contains(leftResizeHandle) &&\n wrapper.contains(rightResizeHandle)\n ) {\n wrapper.removeChild(leftResizeHandle);\n wrapper.removeChild(rightResizeHandle);\n }\n };\n\n // Sets the resize params, allowing the user to begin resizing the element by\n // moving the cursor left or right.\n const leftResizeHandleMouseDownHandler = (event: MouseEvent) => {\n event.preventDefault();\n\n wrapper.appendChild(leftResizeHandle);\n wrapper.appendChild(rightResizeHandle);\n\n resizeParams = {\n handleUsed: \"left\",\n initialWidth: block.props.previewWidth!,\n initialClientX: event.clientX,\n };\n };\n const rightResizeHandleMouseDownHandler = (event: MouseEvent) => {\n event.preventDefault();\n\n wrapper.appendChild(leftResizeHandle);\n wrapper.appendChild(rightResizeHandle);\n\n resizeParams = {\n handleUsed: \"right\",\n initialWidth: block.props.previewWidth!,\n initialClientX: event.clientX,\n };\n };\n\n wrapper.appendChild(element);\n\n window.addEventListener(\"mousemove\", windowMouseMoveHandler);\n window.addEventListener(\"mouseup\", windowMouseUpHandler);\n element.addEventListener(\"mouseenter\", elementMouseEnterHandler);\n element.addEventListener(\"mouseleave\", elementMouseLeaveHandler);\n leftResizeHandle.addEventListener(\n \"mousedown\",\n leftResizeHandleMouseDownHandler\n );\n rightResizeHandle.addEventListener(\n \"mousedown\",\n rightResizeHandleMouseDownHandler\n );\n\n return {\n dom: wrapper,\n destroy: () => {\n window.removeEventListener(\"mousemove\", windowMouseMoveHandler);\n window.removeEventListener(\"mouseup\", windowMouseUpHandler);\n element.removeEventListener(\"mouseenter\", elementMouseEnterHandler);\n element.removeEventListener(\"mouseleave\", elementMouseLeaveHandler);\n leftResizeHandle.removeEventListener(\n \"mousedown\",\n leftResizeHandleMouseDownHandler\n );\n rightResizeHandle.removeEventListener(\n \"mousedown\",\n rightResizeHandleMouseDownHandler\n );\n },\n };\n};\n","export const parseAudioElement = (audioElement: HTMLAudioElement) => {\n const url = audioElement.src || undefined;\n\n return { url };\n};\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n createBlockSpec,\n FileBlockConfig,\n Props,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nimport {\n createFigureWithCaption,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n parseFigureElement,\n} from \"../FileBlockContent/fileBlockHelpers.js\";\nimport { parseAudioElement } from \"./audioBlockHelpers.js\";\n\nexport const FILE_AUDIO_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>';\n\nexport const audioPropSchema = {\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n\n showPreview: {\n default: true,\n },\n} satisfies PropSchema;\n\nexport const audioBlockConfig = {\n type: \"audio\" as const,\n propSchema: audioPropSchema,\n content: \"none\",\n isFileBlock: true,\n fileBlockAccept: [\"audio/*\"],\n} satisfies FileBlockConfig;\n\nexport const audioRender = (\n block: BlockFromConfig<typeof audioBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const icon = document.createElement(\"div\");\n icon.innerHTML = FILE_AUDIO_ICON_SVG;\n\n const audio = document.createElement(\"audio\");\n audio.className = \"bn-audio\";\n editor.resolveFileUrl(block.props.url).then((downloadUrl) => {\n audio.src = downloadUrl;\n });\n audio.controls = true;\n audio.contentEditable = \"false\";\n audio.draggable = false;\n\n const element = createFileAndCaptionWrapper(block, audio);\n\n return createFileBlockWrapper(\n block,\n editor,\n element,\n editor.dictionary.file_blocks.audio.add_button_text,\n icon.firstElementChild as HTMLElement\n );\n};\n\nexport const audioParse = (\n element: HTMLElement\n): Partial<Props<typeof audioBlockConfig.propSchema>> | undefined => {\n if (element.tagName === \"AUDIO\") {\n return parseAudioElement(element as HTMLAudioElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"audio\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseAudioElement(targetElement as HTMLAudioElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const audioToExternalHTML = (\n block: BlockFromConfig<typeof audioBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add audio\";\n\n return {\n dom: div,\n };\n }\n\n let audio;\n if (block.props.showPreview) {\n audio = document.createElement(\"audio\");\n audio.src = block.props.url;\n } else {\n audio = document.createElement(\"a\");\n audio.href = block.props.url;\n audio.textContent = block.props.name || block.props.url;\n }\n\n if (block.props.caption) {\n if (block.props.showPreview) {\n return createFigureWithCaption(audio, block.props.caption);\n } else {\n return createLinkWithCaption(audio, block.props.caption);\n }\n }\n\n return {\n dom: audio,\n };\n};\n\nexport const AudioBlock = createBlockSpec(audioBlockConfig, {\n render: audioRender,\n parse: audioParse,\n toExternalHTML: audioToExternalHTML,\n});\n","import { bundledLanguagesInfo } from \"shiki/bundle/web\";\n\nexport type SupportedLanguageConfig = {\n id: string;\n name: string;\n match: string[];\n};\n\nexport const defaultSupportedLanguages: SupportedLanguageConfig[] = [\n {\n id: \"text\",\n name: \"Plain Text\",\n match: [\"text\", \"txt\", \"plain\"],\n },\n ...bundledLanguagesInfo\n .filter((lang) => {\n return ![\n \"angular-html\",\n \"angular-ts\",\n \"astro\",\n \"blade\",\n \"coffee\",\n \"handlebars\",\n \"html-derivative\",\n \"http\",\n \"imba\",\n \"jinja\",\n \"jison\",\n \"json5\",\n \"marko\",\n \"mdc\",\n \"stylus\",\n \"ts-tags\",\n ].includes(lang.id);\n })\n .map((lang) => ({\n match: [lang.id, ...(lang.aliases || [])],\n id: lang.id,\n name: lang.name,\n })),\n {\n id: \"haskell\",\n name: \"Haskell\",\n match: [\"haskell\", \"hs\"],\n },\n {\n id: \"csharp\",\n name: \"C#\",\n match: [\"c#\", \"csharp\", \"cs\"],\n },\n {\n id: \"latex\",\n name: \"LaTeX\",\n match: [\"latex\"],\n },\n {\n id: \"lua\",\n name: \"Lua\",\n match: [\"lua\"],\n },\n {\n id: \"mermaid\",\n name: \"Mermaid\",\n match: [\"mermaid\", \"mmd\"],\n },\n {\n id: \"ruby\",\n name: \"Ruby\",\n match: [\"ruby\", \"rb\"],\n },\n {\n id: \"rust\",\n name: \"Rust\",\n match: [\"rust\", \"rs\"],\n },\n {\n id: \"scala\",\n name: \"Scala\",\n match: [\"scala\"],\n },\n {\n id: \"swift\",\n name: \"Swift\",\n match: [\"swift\"],\n },\n {\n id: \"kotlin\",\n name: \"Kotlin\",\n match: [\"kotlin\", \"kt\", \"kts\"],\n },\n {\n id: \"objective-c\",\n name: \"Objective C\",\n match: [\"objective-c\", \"objc\"],\n },\n];\n","import { InputRule, isTextSelection } from \"@tiptap/core\";\nimport { TextSelection } from \"@tiptap/pm/state\";\nimport { createHighlightPlugin, Parser } from \"prosemirror-highlight\";\nimport { createParser } from \"prosemirror-highlight/shiki\";\nimport {\n BundledLanguage,\n bundledLanguagesInfo,\n createHighlighter,\n Highlighter,\n} from \"shiki\";\nimport {\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport {\n defaultSupportedLanguages,\n SupportedLanguageConfig,\n} from \"./defaultSupportedLanguages.js\";\n\ninterface CodeBlockOptions {\n defaultLanguage: string;\n indentLineWithTab: boolean;\n supportedLanguages: SupportedLanguageConfig[];\n}\n\nexport const defaultCodeBlockPropSchema = {\n language: {\n default: \"javascript\",\n values: [...defaultSupportedLanguages.map((lang) => lang.id)],\n },\n} satisfies PropSchema;\n\nconst CodeBlockContent = createStronglyTypedTiptapNode({\n name: \"codeBlock\",\n content: \"inline*\",\n group: \"blockContent\",\n marks: \"\",\n code: true,\n defining: true,\n addOptions() {\n return {\n defaultLanguage: \"javascript\",\n indentLineWithTab: true,\n supportedLanguages: defaultSupportedLanguages,\n };\n },\n addAttributes() {\n return {\n language: {\n default: this.options.defaultLanguage,\n parseHTML: (inputElement) => {\n let element = inputElement as HTMLElement | null;\n\n if (\n element?.tagName === \"DIV\" &&\n element?.dataset.contentType === \"codeBlock\"\n ) {\n element = element.children[0] as HTMLElement | null;\n }\n\n if (element?.tagName === \"PRE\") {\n element = element?.children[0] as HTMLElement | null;\n }\n\n const dataLanguage = element?.getAttribute(\"data-language\");\n\n if (dataLanguage) {\n return dataLanguage.toLowerCase();\n }\n\n const classNames = [...(element?.className.split(\" \") || [])];\n const languages = classNames\n .filter((className) => className.startsWith(\"language-\"))\n .map((className) => className.replace(\"language-\", \"\"));\n const [language] = languages;\n\n if (!language) {\n return null;\n }\n\n return language.toLowerCase();\n },\n renderHTML: (attributes) => {\n return attributes.language && attributes.language !== \"text\"\n ? {\n class: `language-${attributes.language}`,\n }\n : {};\n },\n },\n };\n },\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\",\n },\n {\n tag: \"pre\",\n preserveWhitespace: \"full\",\n },\n ];\n },\n renderHTML({ HTMLAttributes }) {\n const pre = document.createElement(\"pre\");\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"code\",\n this.options.domAttributes?.blockContent || {},\n {\n ...(this.options.domAttributes?.inlineContent || {}),\n ...HTMLAttributes,\n }\n );\n\n dom.removeChild(contentDOM);\n dom.appendChild(pre);\n pre.appendChild(contentDOM);\n\n return {\n dom,\n contentDOM,\n };\n },\n addNodeView() {\n const supportedLanguages = this.options\n .supportedLanguages as SupportedLanguageConfig[];\n\n return ({ editor, node, getPos, HTMLAttributes }) => {\n const pre = document.createElement(\"pre\");\n const select = document.createElement(\"select\");\n const selectWrapper = document.createElement(\"div\");\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"code\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n const handleLanguageChange = (event: Event) => {\n const language = (event.target as HTMLSelectElement).value;\n\n editor.commands.command(({ tr }) => {\n tr.setNodeAttribute(getPos(), \"language\", language);\n\n return true;\n });\n };\n\n supportedLanguages.forEach(({ id, name }) => {\n const option = document.createElement(\"option\");\n\n option.value = id;\n option.text = name;\n select.appendChild(option);\n });\n\n selectWrapper.contentEditable = \"false\";\n select.value = node.attrs.language || this.options.defaultLanguage;\n dom.removeChild(contentDOM);\n dom.appendChild(selectWrapper);\n dom.appendChild(pre);\n pre.appendChild(contentDOM);\n selectWrapper.appendChild(select);\n select.addEventListener(\"change\", handleLanguageChange);\n\n return {\n dom,\n contentDOM,\n update: (newNode) => {\n if (newNode.type !== this.type) {\n return false;\n }\n\n return true;\n },\n destroy: () => {\n select.removeEventListener(\"change\", handleLanguageChange);\n },\n };\n };\n },\n addProseMirrorPlugins() {\n let highlighter: Highlighter | undefined;\n let parser: Parser | undefined;\n\n const supportedLanguages = this.options\n .supportedLanguages as SupportedLanguageConfig[];\n const lazyParser: Parser = (options) => {\n if (!highlighter) {\n return createHighlighter({\n themes: [\"github-dark\"],\n langs: [],\n }).then((createdHighlighter) => {\n highlighter = createdHighlighter;\n });\n }\n\n const language = options.language;\n\n if (\n language &&\n language !== \"text\" &&\n !highlighter.getLoadedLanguages().includes(language) &&\n supportedLanguages.find(({ id }) => id === language) &&\n bundledLanguagesInfo.find(({ id }) => id === language)\n ) {\n return highlighter.loadLanguage(language as BundledLanguage);\n }\n\n if (!parser) {\n parser = createParser(highlighter);\n }\n\n return parser(options);\n };\n\n const shikiLazyPlugin = createHighlightPlugin({\n parser: lazyParser,\n languageExtractor: (node) => node.attrs.language,\n nodeTypes: [this.name],\n });\n\n return [shikiLazyPlugin];\n },\n addInputRules() {\n const supportedLanguages = this.options\n .supportedLanguages as SupportedLanguageConfig[];\n\n return [\n new InputRule({\n find: /^```(.*?)\\s$/,\n handler: ({ state, range, match }) => {\n const $start = state.doc.resolve(range.from);\n const languageName = match[1].trim();\n const attributes = {\n language:\n supportedLanguages.find(({ match }) => {\n return match.includes(languageName);\n })?.id || this.options.defaultLanguage,\n };\n\n if (\n !$start\n .node(-1)\n .canReplaceWith(\n $start.index(-1),\n $start.indexAfter(-1),\n this.type\n )\n ) {\n return null;\n }\n\n state.tr\n .delete(range.from, range.to)\n .setBlockType(range.from, range.from, this.type, attributes)\n .setSelection(TextSelection.create(state.tr.doc, range.from));\n\n return;\n },\n }),\n ];\n },\n addKeyboardShortcuts() {\n return {\n Delete: ({ editor }) => {\n const { selection } = editor.state;\n const { $from } = selection;\n\n // When inside empty codeblock, on `DELETE` key press, delete the codeblock\n if (\n editor.isActive(this.name) &&\n !$from.parent.textContent &&\n isTextSelection(selection)\n ) {\n // Get the start position of the codeblock for node selection\n const from = $from.pos - $from.parentOffset - 2;\n\n editor.chain().setNodeSelection(from).deleteSelection().run();\n\n return true;\n }\n\n return false;\n },\n Tab: ({ editor }) => {\n if (!this.options.indentLineWithTab) {\n return false;\n }\n if (editor.isActive(this.name)) {\n editor.commands.insertContent(\" \");\n return true;\n }\n\n return false;\n },\n Enter: ({ editor }) => {\n const { $from } = editor.state.selection;\n\n if (!editor.isActive(this.name)) {\n return false;\n }\n\n const isAtEnd = $from.parentOffset === $from.parent.nodeSize - 2;\n const endsWithDoubleNewline = $from.parent.textContent.endsWith(\"\\n\\n\");\n\n if (!isAtEnd || !endsWithDoubleNewline) {\n editor.commands.insertContent(\"\\n\");\n return true;\n }\n\n return editor\n .chain()\n .command(({ tr }) => {\n tr.delete($from.pos - 2, $from.pos);\n\n return true;\n })\n .exitCode()\n .run();\n },\n \"Shift-Enter\": ({ editor }) => {\n const { $from } = editor.state.selection;\n\n if (!editor.isActive(this.name)) {\n return false;\n }\n\n editor\n .chain()\n .insertContentAt(\n $from.pos - $from.parentOffset + $from.parent.nodeSize,\n {\n type: \"paragraph\",\n }\n )\n .run();\n\n return true;\n },\n };\n },\n});\n\nexport const CodeBlock = createBlockSpecFromStronglyTypedTiptapNode(\n CodeBlockContent,\n defaultCodeBlockPropSchema\n);\n\nexport function customizeCodeBlock(options: Partial<CodeBlockOptions>) {\n return createBlockSpecFromStronglyTypedTiptapNode(\n CodeBlockContent.configure(options),\n {\n language: {\n default:\n options.defaultLanguage ||\n defaultCodeBlockPropSchema.language.default,\n values:\n options.supportedLanguages?.map((lang) => lang.id) ||\n defaultCodeBlockPropSchema.language.values,\n },\n }\n );\n}\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n FileBlockConfig,\n PropSchema,\n createBlockSpec,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\nimport {\n createDefaultFilePreview,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n parseEmbedElement,\n parseFigureElement,\n} from \"./fileBlockHelpers.js\";\n\nexport const filePropSchema = {\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n} satisfies PropSchema;\n\nexport const fileBlockConfig = {\n type: \"file\" as const,\n propSchema: filePropSchema,\n content: \"none\",\n isFileBlock: true,\n} satisfies FileBlockConfig;\n\nexport const fileRender = (\n block: BlockFromConfig<typeof fileBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const file = createDefaultFilePreview(block).dom;\n const element = createFileAndCaptionWrapper(block, file);\n\n return createFileBlockWrapper(block, editor, element);\n};\n\nexport const fileParse = (element: HTMLElement) => {\n if (element.tagName === \"EMBED\") {\n return parseEmbedElement(element as HTMLEmbedElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"embed\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseEmbedElement(targetElement as HTMLEmbedElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const fileToExternalHTML = (\n block: BlockFromConfig<typeof fileBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add file\";\n\n return {\n dom: div,\n };\n }\n\n const fileSrcLink = document.createElement(\"a\");\n fileSrcLink.href = block.props.url;\n fileSrcLink.textContent = block.props.name || block.props.url;\n\n if (block.props.caption) {\n return createLinkWithCaption(fileSrcLink, block.props.caption);\n }\n\n return {\n dom: fileSrcLink,\n };\n};\n\nexport const FileBlock = createBlockSpec(fileBlockConfig, {\n render: fileRender,\n parse: fileParse,\n toExternalHTML: fileToExternalHTML,\n});\n","/**\n * Uploads a file to tmpfiles.org and returns the URL to the uploaded file.\n *\n * @warning This function should only be used for development purposes, replace with your own backend!\n */\nexport const uploadToTmpFilesDotOrg_DEV_ONLY = async (\n file: File\n): Promise<string> => {\n const body = new FormData();\n body.append(\"file\", file);\n\n const ret = await fetch(\"https://tmpfiles.org/api/v1/upload\", {\n method: \"POST\",\n body: body,\n });\n return (await ret.json()).data.url.replace(\n \"tmpfiles.org/\",\n \"tmpfiles.org/dl/\"\n );\n};\n","export const parseImageElement = (imageElement: HTMLImageElement) => {\n const url = imageElement.src || undefined;\n const previewWidth = imageElement.width || undefined;\n\n return { url, previewWidth };\n};\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n createBlockSpec,\n FileBlockConfig,\n Props,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\nimport {\n createFigureWithCaption,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n createResizeHandlesWrapper,\n parseFigureElement,\n} from \"../FileBlockContent/fileBlockHelpers.js\";\nimport { parseImageElement } from \"./imageBlockHelpers.js\";\n\nexport const FILE_IMAGE_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>';\n\nexport const imagePropSchema = {\n textAlignment: defaultProps.textAlignment,\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n\n showPreview: {\n default: true,\n },\n // File preview width in px.\n previewWidth: {\n default: 512,\n },\n} satisfies PropSchema;\n\nexport const imageBlockConfig = {\n type: \"image\" as const,\n propSchema: imagePropSchema,\n content: \"none\",\n isFileBlock: true,\n fileBlockAccept: [\"image/*\"],\n} satisfies FileBlockConfig;\n\nexport const imageRender = (\n block: BlockFromConfig<typeof imageBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const icon = document.createElement(\"div\");\n icon.innerHTML = FILE_IMAGE_ICON_SVG;\n\n const image = document.createElement(\"img\");\n image.className = \"bn-visual-media\";\n editor.resolveFileUrl(block.props.url).then((downloadUrl) => {\n image.src = downloadUrl;\n });\n image.alt = block.props.name || block.props.caption || \"BlockNote image\";\n image.contentEditable = \"false\";\n image.draggable = false;\n image.width = Math.min(\n block.props.previewWidth,\n editor.domElement.firstElementChild!.clientWidth\n );\n\n const file = createResizeHandlesWrapper(\n block,\n editor,\n image,\n () => image.width,\n (width) => (image.width = width)\n );\n\n const element = createFileAndCaptionWrapper(block, file.dom);\n\n return createFileBlockWrapper(\n block,\n editor,\n element,\n editor.dictionary.file_blocks.image.add_button_text,\n icon.firstElementChild as HTMLElement\n );\n};\n\nexport const imageParse = (\n element: HTMLElement\n): Partial<Props<typeof imageBlockConfig.propSchema>> | undefined => {\n if (element.tagName === \"IMG\") {\n return parseImageElement(element as HTMLImageElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"img\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseImageElement(targetElement as HTMLImageElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const imageToExternalHTML = (\n block: BlockFromConfig<typeof imageBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add image\";\n\n return {\n dom: div,\n };\n }\n\n let image;\n if (block.props.showPreview) {\n image = document.createElement(\"img\");\n image.src = block.props.url;\n image.alt = block.props.name || block.props.caption || \"BlockNote image\";\n image.width = block.props.previewWidth;\n } else {\n image = document.createElement(\"a\");\n image.href = block.props.url;\n image.textContent = block.props.name || block.props.url;\n }\n\n if (block.props.caption) {\n if (block.props.showPreview) {\n return createFigureWithCaption(image, block.props.caption);\n } else {\n return createLinkWithCaption(image, block.props.caption);\n }\n }\n\n return {\n dom: image,\n };\n};\n\nexport const ImageBlock = createBlockSpec(imageBlockConfig, {\n render: imageRender,\n parse: imageParse,\n toExternalHTML: imageToExternalHTML,\n});\n","import { callOrReturn, Extension, getExtensionField } from \"@tiptap/core\";\nimport { columnResizing, tableEditing } from \"prosemirror-tables\";\n\nexport const RESIZE_MIN_WIDTH = 35;\nexport const EMPTY_CELL_WIDTH = 120;\nexport const EMPTY_CELL_HEIGHT = 31;\n\nexport const TableExtension = Extension.create({\n name: \"BlockNoteTableExtension\",\n\n addProseMirrorPlugins: () => {\n return [\n columnResizing({\n cellMinWidth: RESIZE_MIN_WIDTH,\n defaultCellMinWidth: EMPTY_CELL_WIDTH,\n // We set this to null as we implement our own node view in the table\n // block content. This node view is the same as what's used by default,\n // but is wrapped in a `blockContent` HTML element.\n View: null,\n }),\n tableEditing(),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n // Makes enter create a new line within the cell.\n Enter: () => {\n if (\n this.editor.state.selection.empty &&\n this.editor.state.selection.$head.parent.type.name ===\n \"tableParagraph\"\n ) {\n this.editor.commands.setHardBreak();\n\n return true;\n }\n\n return false;\n },\n // Ensures that backspace won't delete the table if the text cursor is at\n // the start of a cell and the selection is empty.\n Backspace: () => {\n const selection = this.editor.state.selection;\n const selectionIsEmpty = selection.empty;\n const selectionIsAtStartOfNode = selection.$head.parentOffset === 0;\n const selectionIsInTableParagraphNode =\n selection.$head.node().type.name === \"tableParagraph\";\n\n return (\n selectionIsEmpty &&\n selectionIsAtStartOfNode &&\n selectionIsInTableParagraphNode\n );\n },\n };\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n };\n\n return {\n tableRole: callOrReturn(\n getExtensionField(extension, \"tableRole\", context)\n ),\n };\n },\n});\n","export const parseVideoElement = (videoElement: HTMLVideoElement) => {\n const url = videoElement.src || undefined;\n const previewWidth = videoElement.width || undefined;\n\n return { url, previewWidth };\n};\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n createBlockSpec,\n FileBlockConfig,\n Props,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nimport {\n createFigureWithCaption,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n createResizeHandlesWrapper,\n parseFigureElement,\n} from \"../FileBlockContent/fileBlockHelpers.js\";\nimport { parseVideoElement } from \"./videoBlockHelpers.js\";\n\nexport const FILE_VIDEO_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>';\n\nexport const videoPropSchema = {\n textAlignment: defaultProps.textAlignment,\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n\n showPreview: {\n default: true,\n },\n // File preview width in px.\n previewWidth: {\n default: 512,\n },\n} satisfies PropSchema;\n\nexport const videoBlockConfig = {\n type: \"video\" as const,\n propSchema: videoPropSchema,\n content: \"none\",\n isFileBlock: true,\n fileBlockAccept: [\"video/*\"],\n} satisfies FileBlockConfig;\n\nexport const videoRender = (\n block: BlockFromConfig<typeof videoBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const icon = document.createElement(\"div\");\n icon.innerHTML = FILE_VIDEO_ICON_SVG;\n\n const video = document.createElement(\"video\");\n video.className = \"bn-visual-media\";\n video.src = block.props.url;\n video.controls = true;\n video.contentEditable = \"false\";\n video.draggable = false;\n video.width = Math.min(\n block.props.previewWidth,\n editor.domElement.firstElementChild!.clientWidth\n );\n\n const file = createResizeHandlesWrapper(\n block,\n editor,\n video,\n () => video.width,\n (width) => (video.width = width)\n );\n\n const element = createFileAndCaptionWrapper(block, file.dom);\n\n return createFileBlockWrapper(\n block,\n editor,\n element,\n editor.dictionary.file_blocks.video.add_button_text,\n icon.firstElementChild as HTMLElement\n );\n};\n\nexport const videoParse = (\n element: HTMLElement\n): Partial<Props<typeof videoBlockConfig.propSchema>> | undefined => {\n if (element.tagName === \"VIDEO\") {\n return parseVideoElement(element as HTMLVideoElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"video\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseVideoElement(targetElement as HTMLVideoElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const videoToExternalHTML = (\n block: BlockFromConfig<typeof videoBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add video\";\n\n return {\n dom: div,\n };\n }\n\n let video;\n if (block.props.showPreview) {\n video = document.createElement(\"video\");\n video.src = block.props.url;\n video.width = block.props.previewWidth;\n } else {\n video = document.createElement(\"a\");\n video.href = block.props.url;\n video.textContent = block.props.name || block.props.url;\n }\n\n if (block.props.caption) {\n if (block.props.showPreview) {\n return createFigureWithCaption(video, block.props.caption);\n } else {\n return createLinkWithCaption(video, block.props.caption);\n }\n }\n\n return {\n dom: video,\n };\n};\n\nexport const VideoBlock = createBlockSpec(videoBlockConfig, {\n render: videoRender,\n parse: videoParse,\n toExternalHTML: videoToExternalHTML,\n});\n","import { Mark } from \"@tiptap/core\";\nimport { createStyleSpecFromTipTapMark } from \"../../schema/index.js\";\n\nconst BackgroundColorMark = Mark.create({\n name: \"backgroundColor\",\n\n addAttributes() {\n return {\n stringValue: {\n default: undefined,\n parseHTML: (element) => element.getAttribute(\"data-background-color\"),\n renderHTML: (attributes) => ({\n \"data-background-color\": attributes.stringValue,\n }),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if (element.hasAttribute(\"data-background-color\")) {\n return {\n stringValue: element.getAttribute(\"data-background-color\"),\n };\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"span\", HTMLAttributes, 0];\n },\n});\n\nexport const BackgroundColor = createStyleSpecFromTipTapMark(\n BackgroundColorMark,\n \"string\"\n);\n","import { Mark } from \"@tiptap/core\";\nimport { createStyleSpecFromTipTapMark } from \"../../schema/index.js\";\n\nconst TextColorMark = Mark.create({\n name: \"textColor\",\n\n addAttributes() {\n return {\n stringValue: {\n default: undefined,\n parseHTML: (element) => element.getAttribute(\"data-text-color\"),\n renderHTML: (attributes) => ({\n \"data-text-color\": attributes.stringValue,\n }),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if (element.hasAttribute(\"data-text-color\")) {\n return { stringValue: element.getAttribute(\"data-text-color\") };\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"span\", HTMLAttributes, 0];\n },\n});\n\nexport const TextColor = createStyleSpecFromTipTapMark(TextColorMark, \"string\");\n","import { Fragment, NodeType, Node as PMNode, Slice } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\n\nimport { ReplaceStep } from \"prosemirror-transform\";\nimport { Block, PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport {\n BlockIdentifier,\n BlockSchema,\n} from \"../../../../schema/blocks/types.js\";\nimport { InlineContentSchema } from \"../../../../schema/inlineContent/types.js\";\nimport { StyleSchema } from \"../../../../schema/styles/types.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n BlockInfo,\n getBlockInfoFromResolvedPos,\n} from \"../../../getBlockInfoFromPos.js\";\nimport {\n blockToNode,\n inlineContentToNodes,\n tableContentToNodes,\n} from \"../../../nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\nexport const updateBlockCommand =\n <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n >(\n editor: BlockNoteEditor<BSchema, I, S>,\n posBeforeBlock: number,\n block: PartialBlock<BSchema, I, S>\n ) =>\n ({\n state,\n dispatch,\n }: {\n state: EditorState;\n dispatch: ((args?: any) => any) | undefined;\n }) => {\n const blockInfo = getBlockInfoFromResolvedPos(\n state.doc.resolve(posBeforeBlock)\n );\n\n if (dispatch) {\n // Adds blockGroup node with child blocks if necessary.\n\n const oldNodeType = state.schema.nodes[blockInfo.blockNoteType];\n const newNodeType =\n state.schema.nodes[block.type || blockInfo.blockNoteType];\n const newBnBlockNodeType = newNodeType.isInGroup(\"bnBlock\")\n ? newNodeType\n : state.schema.nodes[\"blockContainer\"];\n\n if (blockInfo.isBlockContainer && newNodeType.isInGroup(\"blockContent\")) {\n updateChildren(block, state, editor, blockInfo);\n // The code below determines the new content of the block.\n // or \"keep\" to keep as-is\n updateBlockContentNode(\n block,\n state,\n editor,\n oldNodeType,\n newNodeType,\n blockInfo\n );\n } else if (\n !blockInfo.isBlockContainer &&\n newNodeType.isInGroup(\"bnBlock\")\n ) {\n updateChildren(block, state, editor, blockInfo);\n // old node was a bnBlock type (like column or columnList) and new block as well\n // No op, we just update the bnBlock below (at end of function) and have already updated the children\n } else {\n // switching from blockContainer to non-blockContainer or v.v.\n // currently breaking for column slash menu items converting empty block\n // to column.\n\n // currently, we calculate the new node and replace the entire node with the desired new node.\n // for this, we do a nodeToBlock on the existing block to get the children.\n // it would be cleaner to use a ReplaceAroundStep, but this is a bit simpler and it's quite an edge case\n const existingBlock = nodeToBlock(\n blockInfo.bnBlock.node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n );\n state.tr.replaceWith(\n blockInfo.bnBlock.beforePos,\n blockInfo.bnBlock.afterPos,\n blockToNode(\n {\n children: existingBlock.children, // if no children are passed in, use existing children\n ...block,\n },\n state.schema,\n editor.schema.styleSchema\n )\n );\n\n return true;\n }\n\n // Adds all provided props as attributes to the parent blockContainer node too, and also preserves existing\n // attributes.\n state.tr.setNodeMarkup(blockInfo.bnBlock.beforePos, newBnBlockNodeType, {\n ...blockInfo.bnBlock.node.attrs,\n ...block.props,\n });\n }\n\n return true;\n };\n\nfunction updateBlockContentNode<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: PartialBlock<BSchema, I, S>,\n state: EditorState,\n editor: BlockNoteEditor<BSchema, I, S>,\n oldNodeType: NodeType,\n newNodeType: NodeType,\n blockInfo: {\n childContainer?:\n | { node: PMNode; beforePos: number; afterPos: number }\n | undefined;\n blockContent: { node: PMNode; beforePos: number; afterPos: number };\n }\n) {\n let content: PMNode[] | \"keep\" = \"keep\";\n\n // Has there been any custom content provided?\n if (block.content) {\n if (typeof block.content === \"string\") {\n // Adds a single text node with no marks to the content.\n content = inlineContentToNodes(\n [block.content],\n state.schema,\n editor.schema.styleSchema\n );\n } else if (Array.isArray(block.content)) {\n // Adds a text node with the provided styles converted into marks to the content,\n // for each InlineContent object.\n content = inlineContentToNodes(\n block.content,\n state.schema,\n editor.schema.styleSchema\n );\n } else if (block.content.type === \"tableContent\") {\n content = tableContentToNodes(\n block.content,\n state.schema,\n editor.schema.styleSchema\n );\n } else {\n throw new UnreachableCaseError(block.content.type);\n }\n } else {\n // no custom content has been provided, use existing content IF possible\n // Since some block types contain inline content and others don't,\n // we either need to call setNodeMarkup to just update type &\n // attributes, or replaceWith to replace the whole blockContent.\n if (oldNodeType.spec.content === \"\") {\n // keep old content, because it's empty anyway and should be compatible with\n // any newContentType\n } else if (newNodeType.spec.content !== oldNodeType.spec.content) {\n // the content type changed, replace the previous content\n content = [];\n } else {\n // keep old content, because the content type is the same and should be compatible\n }\n }\n\n // Now, changes the blockContent node type and adds the provided props\n // as attributes. Also preserves all existing attributes that are\n // compatible with the new type.\n //\n // Use either setNodeMarkup or replaceWith depending on whether the\n // content is being replaced or not.\n if (content === \"keep\") {\n // use setNodeMarkup to only update the type and attributes\n state.tr.setNodeMarkup(\n blockInfo.blockContent.beforePos,\n block.type === undefined ? undefined : state.schema.nodes[block.type],\n {\n ...blockInfo.blockContent.node.attrs,\n ...block.props,\n }\n );\n } else {\n // use replaceWith to replace the content and the block itself\n // also reset the selection since replacing the block content\n // sets it to the next block.\n state.tr.replaceWith(\n blockInfo.blockContent.beforePos,\n blockInfo.blockContent.afterPos,\n newNodeType.createChecked(\n {\n ...blockInfo.blockContent.node.attrs,\n ...block.props,\n },\n content\n )\n );\n }\n}\n\nfunction updateChildren<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: PartialBlock<BSchema, I, S>,\n state: EditorState,\n editor: BlockNoteEditor<BSchema, I, S>,\n blockInfo: BlockInfo\n) {\n if (block.children !== undefined) {\n const childNodes = block.children.map((child) => {\n return blockToNode(child, state.schema, editor.schema.styleSchema);\n });\n\n // Checks if a blockGroup node already exists.\n if (blockInfo.childContainer) {\n // Replaces all child nodes in the existing blockGroup with the ones created earlier.\n\n // use a replacestep to avoid the fitting algorithm\n state.tr.step(\n new ReplaceStep(\n blockInfo.childContainer.beforePos + 1,\n blockInfo.childContainer.afterPos - 1,\n new Slice(Fragment.from(childNodes), 0, 0)\n )\n );\n } else {\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n // Inserts a new blockGroup containing the child nodes created earlier.\n state.tr.insert(\n blockInfo.blockContent.afterPos,\n state.schema.nodes[\"blockGroup\"].createChecked({}, childNodes)\n );\n }\n }\n}\n\nexport function updateBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blockToUpdate: BlockIdentifier,\n update: PartialBlock<BSchema, I, S>\n): Block<BSchema, I, S> {\n const ttEditor = editor._tiptapEditor;\n\n const id =\n typeof blockToUpdate === \"string\" ? blockToUpdate : blockToUpdate.id;\n const { posBeforeNode } = getNodeById(id, ttEditor.state.doc);\n\n ttEditor.commands.command(({ state, dispatch }) => {\n updateBlockCommand(editor, posBeforeNode, update)({ state, dispatch });\n return true;\n });\n\n const blockContainerNode = ttEditor.state.doc\n .resolve(posBeforeNode + 1) // TODO: clean?\n .node();\n\n return nodeToBlock(\n blockContainerNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n );\n}\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nexport const headingPropSchema = {\n ...defaultProps,\n level: { default: 1, values: [1, 2, 3] as const },\n} satisfies PropSchema;\n\nconst HeadingBlockContent = createStronglyTypedTiptapNode({\n name: \"heading\",\n content: \"inline*\",\n group: \"blockContent\",\n addAttributes() {\n return {\n level: {\n default: 1,\n // instead of \"level\" attributes, use \"data-level\"\n parseHTML: (element) => {\n const attr = element.getAttribute(\"data-level\")!;\n const parsed = parseInt(attr);\n if (isFinite(parsed)) {\n return parsed;\n }\n return undefined;\n },\n renderHTML: (attributes) => {\n return {\n \"data-level\": (attributes.level as number).toString(),\n };\n },\n },\n };\n },\n\n addInputRules() {\n return [\n ...[1, 2, 3].map((level) => {\n // Creates a heading of appropriate level when starting with \"#\", \"##\", or \"###\".\n return new InputRule({\n find: new RegExp(`^(#{${level}})\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"heading\",\n props: {\n level: level as any,\n },\n }\n )\n )\n // Removes the \"#\" character(s) used to set the heading.\n .deleteRange({ from: range.from, to: range.to })\n .run();\n },\n });\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n \"Mod-Alt-1\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n // call updateBlockCommand\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"heading\",\n props: {\n level: 1 as any,\n },\n })\n );\n },\n \"Mod-Alt-2\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"heading\",\n props: {\n level: 2 as any,\n },\n })\n );\n },\n \"Mod-Alt-3\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"heading\",\n props: {\n level: 3 as any,\n },\n })\n );\n },\n };\n },\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n return {\n level: element.getAttribute(\"data-level\"),\n };\n },\n },\n {\n tag: \"h1\",\n attrs: { level: 1 },\n node: \"heading\",\n },\n {\n tag: \"h2\",\n attrs: { level: 2 },\n node: \"heading\",\n },\n {\n tag: \"h3\",\n attrs: { level: 3 },\n node: \"heading\",\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n `h${node.attrs.level}`,\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const Heading = createBlockSpecFromStronglyTypedTiptapNode(\n HeadingBlockContent,\n headingPropSchema\n);\n","import { EditorState } from \"prosemirror-state\";\n\nimport {\n getBlockInfo,\n getNearestBlockContainerPos,\n} from \"../../../getBlockInfoFromPos.js\";\n\nexport const splitBlockCommand = (\n posInBlock: number,\n keepType?: boolean,\n keepProps?: boolean\n) => {\n return ({\n state,\n dispatch,\n }: {\n state: EditorState;\n dispatch: ((args?: any) => any) | undefined;\n }) => {\n const nearestBlockContainerPos = getNearestBlockContainerPos(\n state.doc,\n posInBlock\n );\n\n const info = getBlockInfo(nearestBlockContainerPos);\n\n if (!info.isBlockContainer) {\n throw new Error(\n `BlockContainer expected when calling splitBlock, position ${posInBlock}`\n );\n }\n\n const types = [\n {\n type: info.bnBlock.node.type, // always keep blockcontainer type\n attrs: keepProps ? { ...info.bnBlock.node.attrs, id: undefined } : {},\n },\n {\n type: keepType\n ? info.blockContent.node.type\n : state.schema.nodes[\"paragraph\"],\n attrs: keepProps ? { ...info.blockContent.node.attrs } : {},\n },\n ];\n\n if (dispatch) {\n state.tr.split(posInBlock, 2, types);\n }\n\n return true;\n };\n};\n","import { splitBlockCommand } from \"../../api/blockManipulation/commands/splitBlock/splitBlock.js\";\nimport { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nexport const handleEnter = (editor: BlockNoteEditor<any, any, any>) => {\n const ttEditor = editor._tiptapEditor;\n const { blockContent, bnBlock: blockContainer } = getBlockInfoFromSelection(\n ttEditor.state\n );\n\n const selectionEmpty =\n ttEditor.state.selection.anchor === ttEditor.state.selection.head;\n\n if (\n !(\n blockContent.node.type.name === \"bulletListItem\" ||\n blockContent.node.type.name === \"numberedListItem\" ||\n blockContent.node.type.name === \"checkListItem\"\n ) ||\n !selectionEmpty\n ) {\n return false;\n }\n\n return ttEditor.commands.first(({ state, chain, commands }) => [\n () =>\n // Changes list item block to a paragraph block if the content is empty.\n commands.command(() => {\n if (blockContent.node.childCount === 0) {\n return commands.command(\n updateBlockCommand(editor, blockContainer.beforePos, {\n type: \"paragraph\",\n props: {},\n })\n );\n }\n\n return false;\n }),\n\n () =>\n // Splits the current block, moving content inside that's after the cursor\n // to a new block of the same type below.\n commands.command(() => {\n if (blockContent.node.childCount > 0) {\n chain()\n .deleteSelection()\n .command(splitBlockCommand(state.selection.from, true))\n .run();\n\n return true;\n }\n\n return false;\n }),\n ]);\n};\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../../defaultProps.js\";\nimport { handleEnter } from \"../ListItemKeyboardShortcuts.js\";\n\nexport const bulletListItemPropSchema = {\n ...defaultProps,\n} satisfies PropSchema;\n\nconst BulletListItemBlockContent = createStronglyTypedTiptapNode({\n name: \"bulletListItem\",\n content: \"inline*\",\n group: \"blockContent\",\n // This is to make sure that check list parse rules run before, since they\n // both parse `li` elements but check lists are more specific.\n priority: 90,\n addInputRules() {\n return [\n // Creates an unordered list when starting with \"-\", \"+\", or \"*\".\n new InputRule({\n find: new RegExp(`^[-+*]\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"bulletListItem\",\n props: {},\n }\n )\n )\n // Removes the \"-\", \"+\", or \"*\" character used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => handleEnter(this.options.editor),\n \"Mod-Shift-8\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n return this.options.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"bulletListItem\",\n props: {},\n })\n );\n },\n };\n },\n\n parseHTML() {\n return [\n // Case for regular HTML list structure.\n {\n tag: \"div[data-content-type=\" + this.name + \"]\", // TODO: remove if we can't come up with test case that needs this\n },\n {\n tag: \"li\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (\n parent.tagName === \"UL\" ||\n (parent.tagName === \"DIV\" && parent.parentElement!.tagName === \"UL\")\n ) {\n return {};\n }\n\n return false;\n },\n node: \"bulletListItem\",\n },\n // Case for BlockNote list structure.\n {\n tag: \"p\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (parent.getAttribute(\"data-content-type\") === \"bulletListItem\") {\n return {};\n }\n\n return false;\n },\n priority: 300,\n node: \"bulletListItem\",\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n // We use a <p> tag, because for <li> tags we'd need a <ul> element to put\n // them in to be semantically correct, which we can't have due to the\n // schema.\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const BulletListItem = createBlockSpecFromStronglyTypedTiptapNode(\n BulletListItemBlockContent,\n bulletListItemPropSchema\n);\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport {\n getBlockInfoFromSelection,\n getNearestBlockContainerPos,\n} from \"../../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../../defaultProps.js\";\nimport { handleEnter } from \"../ListItemKeyboardShortcuts.js\";\n\nexport const checkListItemPropSchema = {\n ...defaultProps,\n checked: {\n default: false,\n },\n} satisfies PropSchema;\n\nconst checkListItemBlockContent = createStronglyTypedTiptapNode({\n name: \"checkListItem\",\n content: \"inline*\",\n group: \"blockContent\",\n addAttributes() {\n return {\n checked: {\n default: false,\n // instead of \"checked\" attributes, use \"data-checked\"\n parseHTML: (element) =>\n element.getAttribute(\"data-checked\") === \"true\" || undefined,\n renderHTML: (attributes) => {\n return attributes.checked\n ? {\n \"data-checked\": (attributes.checked as boolean).toString(),\n }\n : {};\n },\n },\n };\n },\n\n addInputRules() {\n return [\n // Creates a checklist when starting with \"[]\" or \"[X]\".\n new InputRule({\n find: new RegExp(`\\\\[\\\\s*\\\\]\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"checkListItem\",\n props: {\n checked: false as any,\n },\n }\n )\n )\n // Removes the characters used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n new InputRule({\n find: new RegExp(`\\\\[[Xx]\\\\]\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"checkListItem\",\n props: {\n checked: true as any,\n },\n }\n )\n )\n // Removes the characters used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => handleEnter(this.options.editor),\n \"Mod-Shift-9\": () => {\n const blockInfo = getBlockInfoFromSelection(this.options.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"checkListItem\",\n props: {},\n })\n );\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\", // TODO: remove if we can't come up with test case that needs this\n },\n // Checkbox only.\n {\n tag: \"input\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if ((element as HTMLInputElement).type === \"checkbox\") {\n return { checked: (element as HTMLInputElement).checked };\n }\n\n return false;\n },\n node: \"checkListItem\",\n },\n // Container element for checkbox + label.\n {\n tag: \"li\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (\n parent.tagName === \"UL\" ||\n (parent.tagName === \"DIV\" && parent.parentElement!.tagName === \"UL\")\n ) {\n const checkbox =\n (element.querySelector(\n \"input[type=checkbox]\"\n ) as HTMLInputElement) || null;\n\n if (checkbox === null) {\n return false;\n }\n\n return { checked: checkbox.checked };\n }\n\n return false;\n },\n node: \"checkListItem\",\n },\n ];\n },\n\n // Since there is no HTML checklist element, there isn't really any\n // standardization for what checklists should look like in the DOM. GDocs'\n // and Notion's aren't cross compatible, for example. This implementation\n // has a semantically correct DOM structure (though missing a label for the\n // checkbox) which is also converted correctly to Markdown by remark.\n renderHTML({ node, HTMLAttributes }) {\n const checkbox = document.createElement(\"input\");\n checkbox.type = \"checkbox\";\n checkbox.checked = node.attrs.checked;\n if (node.attrs.checked) {\n checkbox.setAttribute(\"checked\", \"\");\n }\n\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n\n dom.insertBefore(checkbox, contentDOM);\n\n return { dom, contentDOM };\n },\n\n // Need to render node view since the checkbox needs to be able to update the\n // node. This is only possible with a node view as it exposes `getPos`.\n addNodeView() {\n return ({ node, getPos, editor, HTMLAttributes }) => {\n // Need to wrap certain elements in a div or keyboard navigation gets\n // confused.\n const wrapper = document.createElement(\"div\");\n const checkboxWrapper = document.createElement(\"div\");\n checkboxWrapper.contentEditable = \"false\";\n\n const checkbox = document.createElement(\"input\");\n checkbox.type = \"checkbox\";\n checkbox.checked = node.attrs.checked;\n if (node.attrs.checked) {\n checkbox.setAttribute(\"checked\", \"\");\n }\n\n const changeHandler = () => {\n if (!editor.isEditable) {\n // This seems like the most effective way of blocking the checkbox\n // from being toggled, as event.preventDefault() does not stop it for\n // \"click\" or \"change\" events.\n checkbox.checked = !checkbox.checked;\n return;\n }\n\n // TODO: test\n if (typeof getPos !== \"boolean\") {\n const beforeBlockContainerPos = getNearestBlockContainerPos(\n editor.state.doc,\n getPos()\n );\n this.editor.commands.command(\n updateBlockCommand(\n this.options.editor,\n beforeBlockContainerPos.posBeforeNode,\n {\n type: \"checkListItem\",\n props: {\n checked: checkbox.checked as any,\n },\n }\n )\n );\n }\n };\n checkbox.addEventListener(\"change\", changeHandler);\n\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n\n if (typeof getPos !== \"boolean\") {\n // Since `node` is a blockContent node, we have to get the block ID from\n // the parent blockContainer node. This means we can't add the label in\n // `renderHTML` as we can't use `getPos` and therefore can't get the\n // parent blockContainer node.\n const blockID = this.editor.state.doc.resolve(getPos()).node().attrs.id;\n const label = \"label-\" + blockID;\n checkbox.setAttribute(\"aria-labelledby\", label);\n contentDOM.id = label;\n }\n\n dom.removeChild(contentDOM);\n dom.appendChild(wrapper);\n wrapper.appendChild(checkboxWrapper);\n wrapper.appendChild(contentDOM);\n checkboxWrapper.appendChild(checkbox);\n\n return {\n dom,\n contentDOM,\n destroy: () => {\n checkbox.removeEventListener(\"change\", changeHandler);\n },\n };\n };\n },\n});\n\nexport const CheckListItem = createBlockSpecFromStronglyTypedTiptapNode(\n checkListItemBlockContent,\n checkListItemPropSchema\n);\n","import { Plugin, PluginKey } from \"prosemirror-state\";\nimport { getBlockInfo } from \"../../../api/getBlockInfoFromPos.js\";\n\n// ProseMirror Plugin which automatically assigns indices to ordered list items per nesting level.\nconst PLUGIN_KEY = new PluginKey(`numbered-list-indexing`);\nexport const NumberedListIndexingPlugin = () => {\n return new Plugin({\n key: PLUGIN_KEY,\n appendTransaction: (_transactions, _oldState, newState) => {\n const tr = newState.tr;\n tr.setMeta(\"numberedListIndexing\", true);\n\n let modified = false;\n\n // Traverses each node the doc using DFS, so blocks which are on the same nesting level will be traversed in the\n // same order they appear. This means the index of each list item block can be calculated by incrementing the\n // index of the previous list item block.\n newState.doc.descendants((node, pos) => {\n if (\n node.type.name === \"blockContainer\" &&\n node.firstChild!.type.name === \"numberedListItem\"\n ) {\n let newIndex = \"1\";\n\n const blockInfo = getBlockInfo({\n posBeforeNode: pos,\n node,\n });\n\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n\n // Checks if this block is the start of a new ordered list, i.e. if it's the first block in the document, the\n // first block in its nesting level, or the previous block is not an ordered list item.\n\n const prevBlock = tr.doc.resolve(\n blockInfo.bnBlock.beforePos\n ).nodeBefore;\n\n if (prevBlock) {\n const prevBlockInfo = getBlockInfo({\n posBeforeNode: blockInfo.bnBlock.beforePos - prevBlock.nodeSize,\n node: prevBlock,\n });\n\n const isPrevBlockOrderedListItem =\n prevBlockInfo.blockNoteType === \"numberedListItem\";\n\n if (isPrevBlockOrderedListItem) {\n if (!prevBlockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n const prevBlockIndex =\n prevBlockInfo.blockContent.node.attrs[\"index\"];\n\n newIndex = (parseInt(prevBlockIndex) + 1).toString();\n }\n }\n\n const contentNode = blockInfo.blockContent.node;\n const index = contentNode.attrs[\"index\"];\n\n if (index !== newIndex) {\n modified = true;\n\n tr.setNodeMarkup(blockInfo.blockContent.beforePos, undefined, {\n ...contentNode.attrs,\n index: newIndex,\n });\n }\n }\n });\n\n return modified ? tr : null;\n },\n });\n};\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../../defaultProps.js\";\nimport { handleEnter } from \"../ListItemKeyboardShortcuts.js\";\nimport { NumberedListIndexingPlugin } from \"./NumberedListIndexingPlugin.js\";\n\nexport const numberedListItemPropSchema = {\n ...defaultProps,\n} satisfies PropSchema;\n\nconst NumberedListItemBlockContent = createStronglyTypedTiptapNode({\n name: \"numberedListItem\",\n content: \"inline*\",\n group: \"blockContent\",\n priority: 90,\n addAttributes() {\n return {\n index: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"data-index\"),\n renderHTML: (attributes) => {\n return {\n \"data-index\": attributes.index,\n };\n },\n },\n };\n },\n\n addInputRules() {\n return [\n // Creates an ordered list when starting with \"1.\".\n new InputRule({\n find: new RegExp(`^1\\\\.\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"numberedListItem\",\n props: {},\n }\n )\n )\n // Removes the \"1.\" characters used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => handleEnter(this.options.editor),\n \"Mod-Shift-7\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"numberedListItem\",\n props: {},\n })\n );\n },\n };\n },\n\n addProseMirrorPlugins() {\n return [NumberedListIndexingPlugin()];\n },\n\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\", // TODO: remove if we can't come up with test case that needs this\n },\n // Case for regular HTML list structure.\n // (e.g.: when pasting from other apps)\n {\n tag: \"li\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (\n parent.tagName === \"OL\" ||\n (parent.tagName === \"DIV\" && parent.parentElement!.tagName === \"OL\")\n ) {\n return {};\n }\n\n return false;\n },\n node: \"numberedListItem\",\n },\n // Case for BlockNote list structure.\n // (e.g.: when pasting from blocknote)\n {\n tag: \"p\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (parent.getAttribute(\"data-content-type\") === \"numberedListItem\") {\n return {};\n }\n\n return false;\n },\n priority: 300,\n node: \"numberedListItem\",\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n // We use a <p> tag, because for <li> tags we'd need an <ol> element to\n // put them in to be semantically correct, which we can't have due to the\n // schema.\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const NumberedListItem = createBlockSpecFromStronglyTypedTiptapNode(\n NumberedListItemBlockContent,\n numberedListItemPropSchema\n);\n","import { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport {\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nexport const paragraphPropSchema = {\n ...defaultProps,\n};\n\nexport const ParagraphBlockContent = createStronglyTypedTiptapNode({\n name: \"paragraph\",\n content: \"inline*\",\n group: \"blockContent\",\n\n addKeyboardShortcuts() {\n return {\n \"Mod-Alt-0\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (blockInfo.blockContent.node.type.spec.content !== \"inline*\") {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"paragraph\",\n props: {},\n })\n );\n },\n };\n },\n\n parseHTML() {\n return [\n { tag: \"div[data-content-type=\" + this.name + \"]\" },\n {\n tag: \"p\",\n priority: 200,\n getAttrs: (element) => {\n if (typeof element === \"string\" || !element.textContent?.trim()) {\n return false;\n }\n\n return {};\n },\n node: \"paragraph\",\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const Paragraph = createBlockSpecFromStronglyTypedTiptapNode(\n ParagraphBlockContent,\n paragraphPropSchema\n);\n","import { Node } from \"@tiptap/core\";\nimport { TableCell } from \"@tiptap/extension-table-cell\";\nimport { TableHeader } from \"@tiptap/extension-table-header\";\nimport { TableRow } from \"@tiptap/extension-table-row\";\nimport { Node as PMNode } from \"prosemirror-model\";\nimport { TableView } from \"prosemirror-tables\";\n\nimport {\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../schema/index.js\";\nimport { mergeCSSClasses } from \"../../util/browser.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../defaultProps.js\";\nimport { EMPTY_CELL_WIDTH, TableExtension } from \"./TableExtension.js\";\n\nexport const tablePropSchema = {\n backgroundColor: defaultProps.backgroundColor,\n textColor: defaultProps.textColor,\n};\n\nexport const TableBlockContent = createStronglyTypedTiptapNode({\n name: \"table\",\n content: \"tableRow+\",\n group: \"blockContent\",\n tableRole: \"table\",\n\n isolating: true,\n\n parseHTML() {\n return [{ tag: \"table\" }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n \"table\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n\n // This node view is needed for the `columnResizing` plugin. By default, the\n // plugin adds its own node view, which overrides how the node is rendered vs\n // `renderHTML`. This means that the wrapping `blockContent` HTML element is\n // no longer rendered. The `columnResizing` plugin uses the `TableView` as its\n // default node view. `BlockNoteTableView` extends it by wrapping it in a\n // `blockContent` element, so the DOM structure is consistent with other block\n // types.\n addNodeView() {\n return ({ node, HTMLAttributes }) => {\n class BlockNoteTableView extends TableView {\n constructor(\n public node: PMNode,\n public cellMinWidth: number,\n public blockContentHTMLAttributes: Record<string, string>\n ) {\n super(node, cellMinWidth);\n\n const blockContent = document.createElement(\"div\");\n blockContent.className = mergeCSSClasses(\n \"bn-block-content\",\n blockContentHTMLAttributes.class\n );\n blockContent.setAttribute(\"data-content-type\", \"table\");\n for (const [attribute, value] of Object.entries(\n blockContentHTMLAttributes\n )) {\n if (attribute !== \"class\") {\n blockContent.setAttribute(attribute, value);\n }\n }\n\n const tableWrapper = this.dom;\n\n const tableWrapperInner = document.createElement(\"div\");\n tableWrapperInner.className = \"tableWrapper-inner\";\n tableWrapperInner.appendChild(tableWrapper.firstChild!);\n\n tableWrapper.appendChild(tableWrapperInner);\n\n blockContent.appendChild(tableWrapper);\n const floatingContainer = document.createElement(\"div\");\n floatingContainer.className = \"table-widgets-container\";\n floatingContainer.style.position = \"relative\";\n tableWrapper.appendChild(floatingContainer);\n\n this.dom = blockContent;\n }\n\n ignoreMutation(record: MutationRecord): boolean {\n return (\n !(record.target as HTMLElement).closest(\".tableWrapper-inner\") ||\n super.ignoreMutation(record)\n );\n }\n }\n\n return new BlockNoteTableView(node, EMPTY_CELL_WIDTH, {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n });\n };\n },\n});\n\nconst TableParagraph = Node.create({\n name: \"tableParagraph\",\n group: \"tableContent\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n preserveWhitespace: \"full\",\n // set this rule as high priority so it takes precedence over the default paragraph rule,\n // but only if we're in the tableContent context\n priority: 210,\n context: \"tableContent\",\n tag: \"p\",\n getAttrs: (_element) => {\n return {};\n },\n },\n {\n tag: \"p\",\n getAttrs: (element) => {\n if (typeof element === \"string\" || !element.textContent) {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (parent.tagName === \"TD\") {\n return {};\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"p\", HTMLAttributes, 0];\n },\n});\n\nexport const Table = createBlockSpecFromStronglyTypedTiptapNode(\n TableBlockContent,\n tablePropSchema,\n [\n TableExtension,\n TableParagraph,\n TableHeader.extend({\n content: \"tableContent\",\n }),\n TableCell.extend({\n content: \"tableContent\",\n }),\n TableRow,\n ]\n);\n","import Bold from \"@tiptap/extension-bold\";\nimport Code from \"@tiptap/extension-code\";\nimport Italic from \"@tiptap/extension-italic\";\nimport Strike from \"@tiptap/extension-strike\";\nimport Underline from \"@tiptap/extension-underline\";\nimport { BackgroundColor } from \"../extensions/BackgroundColor/BackgroundColorMark.js\";\nimport { TextColor } from \"../extensions/TextColor/TextColorMark.js\";\nimport {\n BlockNoDefaults,\n BlockSchema,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSpecs,\n PartialBlockNoDefaults,\n StyleSchema,\n StyleSpecs,\n createStyleSpecFromTipTapMark,\n getBlockSchemaFromSpecs,\n getInlineContentSchemaFromSpecs,\n getStyleSchemaFromSpecs,\n} from \"../schema/index.js\";\n\nimport { AudioBlock } from \"./AudioBlockContent/AudioBlockContent.js\";\nimport { CodeBlock } from \"./CodeBlockContent/CodeBlockContent.js\";\nimport { FileBlock } from \"./FileBlockContent/FileBlockContent.js\";\nimport { Heading } from \"./HeadingBlockContent/HeadingBlockContent.js\";\nimport { ImageBlock } from \"./ImageBlockContent/ImageBlockContent.js\";\nimport { BulletListItem } from \"./ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js\";\nimport { CheckListItem } from \"./ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js\";\nimport { NumberedListItem } from \"./ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js\";\nimport { Paragraph } from \"./ParagraphBlockContent/ParagraphBlockContent.js\";\nimport { Table } from \"./TableBlockContent/TableBlockContent.js\";\nimport { VideoBlock } from \"./VideoBlockContent/VideoBlockContent.js\";\n\nexport { customizeCodeBlock } from \"./CodeBlockContent/CodeBlockContent.js\";\n\nexport const defaultBlockSpecs = {\n paragraph: Paragraph,\n heading: Heading,\n codeBlock: CodeBlock,\n bulletListItem: BulletListItem,\n numberedListItem: NumberedListItem,\n checkListItem: CheckListItem,\n table: Table,\n file: FileBlock,\n image: ImageBlock,\n video: VideoBlock,\n audio: AudioBlock,\n} satisfies BlockSpecs;\n\nexport const defaultBlockSchema = getBlockSchemaFromSpecs(defaultBlockSpecs);\n\n// underscore is used that in case a user overrides DefaultBlockSchema,\n// they can still access the original default block schema\nexport type _DefaultBlockSchema = typeof defaultBlockSchema;\nexport type DefaultBlockSchema = _DefaultBlockSchema;\n\nexport const defaultStyleSpecs = {\n bold: createStyleSpecFromTipTapMark(Bold, \"boolean\"),\n italic: createStyleSpecFromTipTapMark(Italic, \"boolean\"),\n underline: createStyleSpecFromTipTapMark(Underline, \"boolean\"),\n strike: createStyleSpecFromTipTapMark(Strike, \"boolean\"),\n code: createStyleSpecFromTipTapMark(Code, \"boolean\"),\n textColor: TextColor,\n backgroundColor: BackgroundColor,\n} satisfies StyleSpecs;\n\nexport const defaultStyleSchema = getStyleSchemaFromSpecs(defaultStyleSpecs);\n\n// underscore is used that in case a user overrides DefaultStyleSchema,\n// they can still access the original default style schema\nexport type _DefaultStyleSchema = typeof defaultStyleSchema;\nexport type DefaultStyleSchema = _DefaultStyleSchema;\n\nexport const defaultInlineContentSpecs = {\n text: { config: \"text\", implementation: {} as any },\n link: { config: \"link\", implementation: {} as any },\n} satisfies InlineContentSpecs;\n\nexport const defaultInlineContentSchema = getInlineContentSchemaFromSpecs(\n defaultInlineContentSpecs\n);\n\n// underscore is used that in case a user overrides DefaultInlineContentSchema,\n// they can still access the original default inline content schema\nexport type _DefaultInlineContentSchema = typeof defaultInlineContentSchema;\nexport type DefaultInlineContentSchema = _DefaultInlineContentSchema;\n\nexport type PartialBlock<\n BSchema extends BlockSchema = DefaultBlockSchema,\n I extends InlineContentSchema = DefaultInlineContentSchema,\n S extends StyleSchema = DefaultStyleSchema\n> = PartialBlockNoDefaults<BSchema, I, S>;\n\nexport type Block<\n BSchema extends BlockSchema = DefaultBlockSchema,\n I extends InlineContentSchema = DefaultInlineContentSchema,\n S extends StyleSchema = DefaultStyleSchema\n> = BlockNoDefaults<BSchema, I, S>;\n","import type { BlockNoteEditor } from \"../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n BlockSchema,\n FileBlockConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"../schema/index.js\";\nimport {\n Block,\n DefaultBlockSchema,\n DefaultInlineContentSchema,\n defaultBlockSchema,\n defaultInlineContentSchema,\n} from \"./defaultBlocks.js\";\nimport { defaultProps } from \"./defaultProps.js\";\n\nexport function checkDefaultBlockTypeInSchema<\n BlockType extends keyof DefaultBlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockType: BlockType,\n editor: BlockNoteEditor<any, I, S>\n): editor is BlockNoteEditor<{ Type: DefaultBlockSchema[BlockType] }, I, S> {\n return (\n blockType in editor.schema.blockSchema &&\n editor.schema.blockSchema[blockType] === defaultBlockSchema[blockType]\n );\n}\n\nexport function checkDefaultInlineContentTypeInSchema<\n InlineContentType extends keyof DefaultInlineContentSchema,\n B extends BlockSchema,\n S extends StyleSchema\n>(\n inlineContentType: InlineContentType,\n editor: BlockNoteEditor<B, any, S>\n): editor is BlockNoteEditor<\n B,\n { Type: DefaultInlineContentSchema[InlineContentType] },\n S\n> {\n return (\n inlineContentType in editor.schema.inlineContentSchema &&\n editor.schema.inlineContentSchema[inlineContentType] ===\n defaultInlineContentSchema[inlineContentType]\n );\n}\n\nexport function checkBlockIsDefaultType<\n BlockType extends keyof DefaultBlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockType: BlockType,\n block: Block<any, I, S>,\n editor: BlockNoteEditor<any, I, S>\n): block is BlockFromConfig<DefaultBlockSchema[BlockType], I, S> {\n return (\n block.type === blockType &&\n block.type in editor.schema.blockSchema &&\n checkDefaultBlockTypeInSchema(block.type, editor)\n );\n}\n\nexport function checkBlockIsFileBlock<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: Block<any, I, S>,\n editor: BlockNoteEditor<B, I, S>\n): block is BlockFromConfig<FileBlockConfig, I, S> {\n return (\n (block.type in editor.schema.blockSchema &&\n editor.schema.blockSchema[block.type].isFileBlock) ||\n false\n );\n}\n\nexport function checkBlockIsFileBlockWithPreview<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: Block<any, I, S>,\n editor: BlockNoteEditor<B, I, S>\n): block is BlockFromConfig<\n FileBlockConfig & {\n propSchema: Required<FileBlockConfig[\"propSchema\"]>;\n },\n I,\n S\n> {\n return (\n (block.type in editor.schema.blockSchema &&\n editor.schema.blockSchema[block.type].isFileBlock &&\n \"showPreview\" in editor.schema.blockSchema[block.type].propSchema) ||\n false\n );\n}\n\nexport function checkBlockIsFileBlockWithPlaceholder<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(block: Block<B, I, S>, editor: BlockNoteEditor<B, I, S>) {\n const config = editor.schema.blockSchema[block.type];\n return config.isFileBlock && !block.props.url;\n}\n\nexport function checkBlockTypeHasDefaultProp<\n Prop extends keyof typeof defaultProps,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n prop: Prop,\n blockType: string,\n editor: BlockNoteEditor<any, I, S>\n): editor is BlockNoteEditor<\n {\n [BT in string]: {\n type: BT;\n propSchema: {\n [P in Prop]: (typeof defaultProps)[P];\n };\n content: \"table\" | \"inline\" | \"none\";\n };\n },\n I,\n S\n> {\n return (\n blockType in editor.schema.blockSchema &&\n prop in editor.schema.blockSchema[blockType].propSchema &&\n editor.schema.blockSchema[blockType].propSchema[prop] === defaultProps[prop]\n );\n}\n\nexport function checkBlockHasDefaultProp<\n Prop extends keyof typeof defaultProps,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n prop: Prop,\n block: Block<any, I, S>,\n editor: BlockNoteEditor<any, I, S>\n): block is BlockFromConfig<\n {\n type: string;\n propSchema: {\n [P in Prop]: (typeof defaultProps)[P];\n };\n content: \"table\" | \"inline\" | \"none\";\n },\n I,\n S\n> {\n return checkBlockTypeHasDefaultProp(prop, block.type, editor);\n}\n","import { Node } from \"prosemirror-model\";\n\nimport { Block, PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { blockToNode } from \"../../../nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\nexport function insertBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToInsert: PartialBlock<BSchema, I, S>[],\n referenceBlock: BlockIdentifier,\n placement: \"before\" | \"after\" = \"before\"\n): Block<BSchema, I, S>[] {\n const id =\n typeof referenceBlock === \"string\" ? referenceBlock : referenceBlock.id;\n\n const nodesToInsert: Node[] = [];\n for (const blockSpec of blocksToInsert) {\n nodesToInsert.push(\n blockToNode(blockSpec, editor.pmSchema, editor.schema.styleSchema)\n );\n }\n\n const { node, posBeforeNode } = getNodeById(\n id,\n editor._tiptapEditor.state.doc\n );\n\n // TODO: we might want to use the ReplaceStep directly here instead of insert,\n // because the fitting algorithm should not be necessary and might even cause unexpected behavior\n if (placement === \"before\") {\n editor.dispatch(\n editor._tiptapEditor.state.tr.insert(posBeforeNode, nodesToInsert)\n );\n }\n\n if (placement === \"after\") {\n editor.dispatch(\n editor._tiptapEditor.state.tr.insert(\n posBeforeNode + node.nodeSize,\n nodesToInsert\n )\n );\n }\n\n // Now that the `PartialBlock`s have been converted to nodes, we can\n // re-convert them into full `Block`s.\n const insertedBlocks: Block<BSchema, I, S>[] = [];\n for (const node of nodesToInsert) {\n insertedBlocks.push(\n nodeToBlock(\n node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n )\n );\n }\n\n return insertedBlocks;\n}\n","import { NodeSelection, Selection, TextSelection } from \"prosemirror-state\";\nimport { CellSelection } from \"prosemirror-tables\";\n\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport { BlockIdentifier } from \"../../../../schema/index.js\";\nimport { getBlockInfoFromSelection } from \"../../../getBlockInfoFromPos.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\ntype BlockSelectionData = (\n | {\n type: \"text\";\n anchor: number;\n head: number;\n }\n | {\n type: \"node\";\n from: number;\n }\n | {\n type: \"cell\";\n anchorCell: number;\n headCell: number;\n }\n) & {\n blockId: string;\n blockPos: number;\n};\n\n// `getBlockSelectionData` and `updateBlockSelectionFromData` are used to save\n// and restore the selection within a block, when the block is moved.\nfunction getBlockSelectionData(\n editor: BlockNoteEditor<any, any, any>\n): BlockSelectionData {\n const { bnBlock } = getBlockInfoFromSelection(editor._tiptapEditor.state);\n\n const selectionData = {\n blockId: bnBlock.node.attrs.id,\n blockPos: bnBlock.beforePos,\n };\n\n if (editor._tiptapEditor.state.selection instanceof CellSelection) {\n return {\n ...selectionData,\n type: \"cell\" as const,\n anchorCell: (editor._tiptapEditor.state.selection as CellSelection)\n .$anchorCell.pos,\n headCell: (editor._tiptapEditor.state.selection as CellSelection)\n .$headCell.pos,\n };\n } else if (editor._tiptapEditor.state.selection instanceof NodeSelection) {\n return {\n ...selectionData,\n type: \"node\" as const,\n from: editor._tiptapEditor.state.selection.from,\n };\n } else {\n return {\n ...selectionData,\n type: \"text\" as const,\n anchor: editor._tiptapEditor.state.selection.anchor,\n head: editor._tiptapEditor.state.selection.head,\n };\n }\n}\n\nfunction updateBlockSelectionFromData(\n editor: BlockNoteEditor<any, any, any>,\n data: BlockSelectionData\n) {\n const blockPos = getNodeById(\n data.blockId,\n editor._tiptapEditor.state.doc\n ).posBeforeNode;\n\n let selection: Selection;\n if (data.type === \"cell\") {\n selection = CellSelection.create(\n editor._tiptapEditor.state.doc,\n data.anchorCell + (blockPos - data.blockPos),\n data.headCell + (blockPos - data.blockPos)\n );\n } else if (data.type === \"node\") {\n selection = NodeSelection.create(\n editor._tiptapEditor.state.doc,\n data.from + (blockPos - data.blockPos)\n );\n } else {\n selection = TextSelection.create(\n editor._tiptapEditor.state.doc,\n data.anchor + (blockPos - data.blockPos),\n data.head + (blockPos - data.blockPos)\n );\n }\n\n editor._tiptapEditor.view.dispatch(\n editor._tiptapEditor.state.tr.setSelection(selection)\n );\n}\n\nexport function moveSelectedBlockAndSelection(\n editor: BlockNoteEditor<any, any, any>,\n referenceBlock: BlockIdentifier,\n placement: \"before\" | \"after\"\n) {\n const { block } = editor.getTextCursorPosition();\n const selectionData = getBlockSelectionData(editor);\n\n editor.removeBlocks([block]);\n editor.insertBlocks([block], referenceBlock, placement);\n\n updateBlockSelectionFromData(editor, selectionData);\n}\n\nexport function moveBlockUp(editor: BlockNoteEditor<any, any, any>) {\n // This function currently only supports moving a single block.\n const editorSelection = editor.getSelection();\n if (editorSelection && editorSelection.blocks.length > 1) {\n return;\n }\n\n const { prevBlock, parentBlock } = editor.getTextCursorPosition();\n\n let referenceBlockId: string | undefined;\n let placement: \"before\" | \"after\" | undefined;\n\n if (!prevBlock) {\n if (parentBlock) {\n referenceBlockId = parentBlock.id;\n placement = \"before\";\n }\n } else if (prevBlock.children.length > 0) {\n referenceBlockId = prevBlock.children[prevBlock.children.length - 1].id;\n placement = \"after\";\n } else {\n referenceBlockId = prevBlock.id;\n placement = \"before\";\n }\n\n if (!referenceBlockId || !placement) {\n return;\n }\n\n moveSelectedBlockAndSelection(editor, referenceBlockId, placement);\n}\n\nexport function moveBlockDown(editor: BlockNoteEditor<any, any, any>) {\n // This function currently only supports moving a single block.\n const editorSelection = editor.getSelection();\n if (editorSelection && editorSelection.blocks.length > 1) {\n return;\n }\n\n const { nextBlock, parentBlock } = editor.getTextCursorPosition();\n\n let referenceBlockId: string | undefined;\n let placement: \"before\" | \"after\" | undefined;\n\n if (!nextBlock) {\n if (parentBlock) {\n referenceBlockId = parentBlock.id;\n placement = \"after\";\n }\n } else if (nextBlock.children.length > 0) {\n referenceBlockId = nextBlock.children[0].id;\n placement = \"before\";\n } else {\n referenceBlockId = nextBlock.id;\n placement = \"after\";\n }\n\n if (!referenceBlockId || !placement) {\n return;\n }\n\n moveSelectedBlockAndSelection(editor, referenceBlockId, placement);\n}\n","import { Fragment, NodeType, Slice } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\nimport { ReplaceAroundStep } from \"prosemirror-transform\";\n\nimport { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport { getBlockInfoFromSelection } from \"../../../getBlockInfoFromPos.js\";\n\n// TODO: Unit tests\n/**\n * This is a modified version of https://github.com/ProseMirror/prosemirror-schema-list/blob/569c2770cbb8092d8f11ea53ecf78cb7a4e8f15a/src/schema-list.ts#L232\n *\n * The original function derives too many information from the parentnode and itemtype\n */\nfunction sinkListItem(itemType: NodeType, groupType: NodeType) {\n return function ({ state, dispatch }: { state: EditorState; dispatch: any }) {\n const { $from, $to } = state.selection;\n const range = $from.blockRange(\n $to,\n (node) =>\n node.childCount > 0 &&\n (node.type.name === \"blockGroup\" || node.type.name === \"column\") // change necessary to not look at first item child type\n );\n if (!range) {\n return false;\n }\n const startIndex = range.startIndex;\n if (startIndex === 0) {\n return false;\n }\n const parent = range.parent;\n const nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type !== itemType) {\n return false;\n }\n if (dispatch) {\n const nestedBefore =\n nodeBefore.lastChild && nodeBefore.lastChild.type === groupType; // change necessary to check groupType instead of parent.type\n const inner = Fragment.from(nestedBefore ? itemType.create() : null);\n const slice = new Slice(\n Fragment.from(\n itemType.create(null, Fragment.from(groupType.create(null, inner))) // change necessary to create \"groupType\" instead of parent.type\n ),\n nestedBefore ? 3 : 1,\n 0\n );\n\n const before = range.start;\n const after = range.end;\n dispatch(\n state.tr\n .step(\n new ReplaceAroundStep(\n before - (nestedBefore ? 3 : 1),\n after,\n before,\n after,\n slice,\n 1,\n true\n )\n )\n .scrollIntoView()\n );\n }\n return true;\n };\n}\n\nexport function nestBlock(editor: BlockNoteEditor<any, any, any>) {\n return editor._tiptapEditor.commands.command(\n sinkListItem(\n editor._tiptapEditor.schema.nodes[\"blockContainer\"],\n editor._tiptapEditor.schema.nodes[\"blockGroup\"]\n )\n );\n}\n\nexport function unnestBlock(editor: BlockNoteEditor<any, any, any>) {\n editor._tiptapEditor.commands.liftListItem(\"blockContainer\");\n}\n\nexport function canNestBlock(editor: BlockNoteEditor<any, any, any>) {\n const { bnBlock: blockContainer } = getBlockInfoFromSelection(\n editor._tiptapEditor.state\n );\n\n return (\n editor._tiptapEditor.state.doc.resolve(blockContainer.beforePos)\n .nodeBefore !== null\n );\n}\nexport function canUnnestBlock(editor: BlockNoteEditor<any, any, any>) {\n const { bnBlock: blockContainer } = getBlockInfoFromSelection(\n editor._tiptapEditor.state\n );\n\n return (\n editor._tiptapEditor.state.doc.resolve(blockContainer.beforePos).depth > 1\n );\n}\n","import { Node } from \"prosemirror-model\";\nimport { Transaction } from \"prosemirror-state\";\n\nimport { Block } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\n\nexport function removeBlocksWithCallback<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToRemove: BlockIdentifier[],\n // Should return new removedSize.\n callback?: (\n node: Node,\n pos: number,\n tr: Transaction,\n removedSize: number\n ) => number\n): Block<BSchema, I, S>[] {\n const ttEditor = editor._tiptapEditor;\n const tr = ttEditor.state.tr;\n\n const idsOfBlocksToRemove = new Set<string>(\n blocksToRemove.map((block) =>\n typeof block === \"string\" ? block : block.id\n )\n );\n const removedBlocks: Block<BSchema, I, S>[] = [];\n let removedSize = 0;\n\n ttEditor.state.doc.descendants((node, pos) => {\n // Skips traversing nodes after all target blocks have been removed.\n if (idsOfBlocksToRemove.size === 0) {\n return false;\n }\n\n // Keeps traversing nodes if block with target ID has not been found.\n if (\n !node.type.isInGroup(\"bnBlock\") ||\n !idsOfBlocksToRemove.has(node.attrs.id)\n ) {\n return true;\n }\n\n // Saves the block that is being deleted.\n removedBlocks.push(\n nodeToBlock(\n node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n )\n );\n idsOfBlocksToRemove.delete(node.attrs.id);\n\n // Removes the block and calculates the change in document size.\n removedSize = callback?.(node, pos, tr, removedSize) || removedSize;\n const oldDocSize = tr.doc.nodeSize;\n tr.delete(pos - removedSize - 1, pos - removedSize + node.nodeSize + 1);\n const newDocSize = tr.doc.nodeSize;\n removedSize += oldDocSize - newDocSize;\n\n return false;\n });\n\n // Throws an error if now all blocks could be found.\n if (idsOfBlocksToRemove.size > 0) {\n const notFoundIds = [...idsOfBlocksToRemove].join(\"\\n\");\n\n throw Error(\n \"Blocks with the following IDs could not be found in the editor: \" +\n notFoundIds\n );\n }\n\n editor.dispatch(tr);\n\n return removedBlocks;\n}\n\nexport function removeBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToRemove: BlockIdentifier[]\n): Block<BSchema, I, S>[] {\n return removeBlocksWithCallback(editor, blocksToRemove);\n}\n","import { Node } from \"prosemirror-model\";\n\nimport { Block, PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { blockToNode } from \"../../../nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { removeBlocksWithCallback } from \"../removeBlocks/removeBlocks.js\";\n\nexport function replaceBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToRemove: BlockIdentifier[],\n blocksToInsert: PartialBlock<BSchema, I, S>[]\n): {\n insertedBlocks: Block<BSchema, I, S>[];\n removedBlocks: Block<BSchema, I, S>[];\n} {\n const nodesToInsert: Node[] = [];\n for (const block of blocksToInsert) {\n nodesToInsert.push(\n blockToNode(block, editor.pmSchema, editor.schema.styleSchema)\n );\n }\n\n const idOfFirstBlock =\n typeof blocksToRemove[0] === \"string\"\n ? blocksToRemove[0]\n : blocksToRemove[0].id;\n const removedBlocks = removeBlocksWithCallback(\n editor,\n blocksToRemove,\n (node, pos, tr, removedSize) => {\n if (node.attrs.id === idOfFirstBlock) {\n const oldDocSize = tr.doc.nodeSize;\n tr.insert(pos, nodesToInsert);\n const newDocSize = tr.doc.nodeSize;\n\n return removedSize + oldDocSize - newDocSize;\n }\n\n return removedSize;\n }\n );\n\n // Now that the `PartialBlock`s have been converted to nodes, we can\n // re-convert them into full `Block`s.\n const insertedBlocks: Block<BSchema, I, S>[] = [];\n for (const node of nodesToInsert) {\n insertedBlocks.push(\n nodeToBlock(\n node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n )\n );\n }\n\n return { insertedBlocks, removedBlocks };\n}\n","import { selectionToInsertionEnd } from \"@tiptap/core\";\nimport { Node } from \"prosemirror-model\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\n\n// similar to tiptap insertContentAt\nexport function insertContentAt<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n position: any,\n nodes: Node[],\n editor: BlockNoteEditor<BSchema, I, S>,\n options: {\n updateSelection: boolean;\n } = { updateSelection: true }\n) {\n const tr = editor._tiptapEditor.state.tr;\n\n // don’t dispatch an empty fragment because this can lead to strange errors\n // if (content.toString() === \"<>\") {\n // return true;\n // }\n\n let { from, to } =\n typeof position === \"number\"\n ? { from: position, to: position }\n : { from: position.from, to: position.to };\n\n let isOnlyTextContent = true;\n let isOnlyBlockContent = true;\n // const nodes = isFragment(content) ? content : [content];\n\n let text = \"\";\n\n nodes.forEach((node) => {\n // check if added node is valid\n node.check();\n\n if (isOnlyTextContent && node.isText && node.marks.length === 0) {\n text += node.text;\n } else {\n isOnlyTextContent = false;\n }\n\n isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n });\n\n // check if we can replace the wrapping node by\n // the newly inserted content\n // example:\n // replace an empty paragraph by an inserted image\n // instead of inserting the image below the paragraph\n if (from === to && isOnlyBlockContent) {\n const { parent } = tr.doc.resolve(from);\n const isEmptyTextBlock =\n parent.isTextblock && !parent.type.spec.code && !parent.childCount;\n\n if (isEmptyTextBlock) {\n from -= 1;\n to += 1;\n }\n }\n\n // if there is only plain text we have to use `insertText`\n // because this will keep the current marks\n if (isOnlyTextContent) {\n // if value is string, we can use it directly\n // otherwise if it is an array, we have to join it\n // if (Array.isArray(value)) {\n // tr.insertText(value.map((v) => v.text || \"\").join(\"\"), from, to);\n // } else if (typeof value === \"object\" && !!value && !!value.text) {\n // tr.insertText(value.text, from, to);\n // } else {\n // tr.insertText(value as string, from, to);\n // }\n tr.insertText(text, from, to);\n } else {\n tr.replaceWith(from, to, nodes);\n }\n\n // set cursor at end of inserted content\n if (options.updateSelection) {\n selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n }\n\n editor.dispatch(tr);\n\n return true;\n}\n","import { Node } from \"prosemirror-model\";\n\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport { TextCursorPosition } from \"../../../../editor/cursorPositionTypes.js\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n getBlockInfo,\n getBlockInfoFromSelection,\n} from \"../../../getBlockInfoFromPos.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\nexport function getTextCursorPosition<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>): TextCursorPosition<BSchema, I, S> {\n const { bnBlock } = getBlockInfoFromSelection(editor._tiptapEditor.state);\n\n const resolvedPos = editor._tiptapEditor.state.doc.resolve(bnBlock.beforePos);\n // Gets previous blockContainer node at the same nesting level, if the current node isn't the first child.\n const prevNode = resolvedPos.nodeBefore;\n\n // Gets next blockContainer node at the same nesting level, if the current node isn't the last child.\n const nextNode = editor._tiptapEditor.state.doc.resolve(\n bnBlock.afterPos\n ).nodeAfter;\n\n // Gets parent blockContainer node, if the current node is nested.\n let parentNode: Node | undefined = undefined;\n if (resolvedPos.depth > 1) {\n // for nodes nested in bnBlocks\n parentNode = resolvedPos.node();\n if (!parentNode.type.isInGroup(\"bnBlock\")) {\n // for blockGroups, we need to go one level up\n parentNode = resolvedPos.node(resolvedPos.depth - 1);\n }\n }\n\n return {\n block: nodeToBlock(\n bnBlock.node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n prevBlock:\n prevNode === null\n ? undefined\n : nodeToBlock(\n prevNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n nextBlock:\n nextNode === null\n ? undefined\n : nodeToBlock(\n nextNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n parentBlock:\n parentNode === undefined\n ? undefined\n : nodeToBlock(\n parentNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n };\n}\n\nexport function setTextCursorPosition<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n targetBlock: BlockIdentifier,\n placement: \"start\" | \"end\" = \"start\"\n) {\n const id = typeof targetBlock === \"string\" ? targetBlock : targetBlock.id;\n\n const posInfo = getNodeById(id, editor._tiptapEditor.state.doc);\n const info = getBlockInfo(posInfo);\n\n const contentType: \"none\" | \"inline\" | \"table\" =\n editor.schema.blockSchema[info.blockNoteType]!.content;\n\n if (info.isBlockContainer) {\n const blockContent = info.blockContent;\n if (contentType === \"none\") {\n editor._tiptapEditor.commands.setNodeSelection(blockContent.beforePos);\n return;\n }\n\n if (contentType === \"inline\") {\n if (placement === \"start\") {\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.beforePos + 1\n );\n } else {\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.afterPos - 1\n );\n }\n } else if (contentType === \"table\") {\n if (placement === \"start\") {\n // Need to offset the position as we have to get through the `tableRow`\n // and `tableCell` nodes to get to the `tableParagraph` node we want to\n // set the selection in.\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.beforePos + 4\n );\n } else {\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.afterPos - 4\n );\n }\n } else {\n throw new UnreachableCaseError(contentType);\n }\n } else {\n const child =\n placement === \"start\"\n ? info.childContainer.node.firstChild!\n : info.childContainer.node.lastChild!;\n\n setTextCursorPosition(editor, child.attrs.id, placement);\n }\n}\n","// some dependencies only export as ESM modules. This makes them incompatible with Node CJS.\n// To work around this, we load these dependencies as dynamic imports in a function that initializes them.\n\n// (to reproduce this issue, run ts-node on a file that users server-util)\nexport let esmDependencies:\n | undefined\n | {\n rehypeParse: typeof import(\"rehype-parse\");\n rehypeStringify: typeof import(\"rehype-stringify\");\n unified: typeof import(\"unified\");\n hastUtilFromDom: typeof import(\"hast-util-from-dom\");\n rehypeRemark: typeof import(\"rehype-remark\");\n remarkGfm: typeof import(\"remark-gfm\");\n remarkStringify: typeof import(\"remark-stringify\");\n remarkParse: typeof import(\"remark-parse\");\n remarkRehype: typeof import(\"remark-rehype\");\n rehypeFormat: typeof import(\"rehype-format\");\n };\n\nexport async function initializeESMDependencies() {\n if (esmDependencies) {\n return esmDependencies;\n }\n const vals = await Promise.all([\n import(\"rehype-parse\"),\n import(\"rehype-stringify\"),\n import(\"unified\"),\n import(\"hast-util-from-dom\"),\n import(\"rehype-remark\"),\n import(\"remark-gfm\"),\n import(\"remark-stringify\"),\n import(\"remark-parse\"),\n import(\"remark-rehype\"),\n import(\"rehype-format\"),\n ]);\n\n esmDependencies = {\n rehypeParse: vals[0],\n rehypeStringify: vals[1],\n unified: vals[2],\n hastUtilFromDom: vals[3],\n rehypeRemark: vals[4],\n remarkGfm: vals[5],\n remarkStringify: vals[6],\n remarkParse: vals[7],\n remarkRehype: vals[8],\n rehypeFormat: vals[9],\n };\n\n return esmDependencies;\n}\n","import { Element as HASTElement, Parent as HASTParent } from \"hast\";\n\n/**\n * Rehype plugin which removes <u> tags. Used to remove underlines before converting HTML to markdown, as Markdown\n * doesn't support underlines.\n */\nexport function removeUnderlines() {\n const removeUnderlinesHelper = (tree: HASTParent) => {\n let numChildElements = tree.children.length;\n\n for (let i = 0; i < numChildElements; i++) {\n const node = tree.children[i];\n\n if (node.type === \"element\") {\n // Recursively removes underlines from child elements.\n removeUnderlinesHelper(node);\n\n if ((node as HASTElement).tagName === \"u\") {\n // Lifts child nodes outside underline element, deletes the underline element, and updates current index &\n // the number of child elements.\n if (node.children.length > 0) {\n tree.children.splice(i, 1, ...node.children);\n\n const numElementsAdded = node.children.length - 1;\n numChildElements += numElementsAdded;\n i += numElementsAdded;\n } else {\n tree.children.splice(i, 1);\n\n numChildElements--;\n i--;\n }\n }\n }\n }\n };\n\n return removeUnderlinesHelper;\n}\n","import { Element as HASTElement, Parent as HASTParent } from \"hast\";\nimport { esmDependencies } from \"../../../../util/esmDependencies.js\";\n\n/**\n * Rehype plugin which adds a space after each checkbox input element. This is\n * because remark doesn't add any spaces between the checkbox input and the text\n * itself, but these are needed for correct Markdown syntax.\n */\nexport function addSpacesToCheckboxes() {\n const deps = esmDependencies;\n\n if (!deps) {\n throw new Error(\n \"addSpacesToCheckboxes requires ESM dependencies to be initialized\"\n );\n }\n\n const helper = (tree: HASTParent) => {\n if (tree.children && \"length\" in tree.children && tree.children.length) {\n for (let i = tree.children.length - 1; i >= 0; i--) {\n const child = tree.children[i];\n const nextChild =\n i + 1 < tree.children.length ? tree.children[i + 1] : undefined;\n\n // Checks for paragraph element after checkbox input element.\n if (\n child.type === \"element\" &&\n child.tagName === \"input\" &&\n child.properties?.type === \"checkbox\" &&\n nextChild?.type === \"element\" &&\n nextChild.tagName === \"p\"\n ) {\n // Converts paragraph to span, otherwise remark will think it needs to\n // be on a new line.\n nextChild.tagName = \"span\";\n // Adds a space after the checkbox input element.\n nextChild.children.splice(\n 0,\n 0,\n deps.hastUtilFromDom.fromDom(\n document.createTextNode(\" \")\n ) as HASTElement\n );\n } else {\n helper(child as HASTParent);\n }\n }\n }\n };\n\n return helper;\n}\n","import { Schema } from \"prosemirror-model\";\nimport { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport {\n esmDependencies,\n initializeESMDependencies,\n} from \"../../../util/esmDependencies.js\";\nimport { createExternalHTMLExporter } from \"../html/externalHTMLExporter.js\";\nimport { removeUnderlines } from \"./removeUnderlinesRehypePlugin.js\";\nimport { addSpacesToCheckboxes } from \"./util/addSpacesToCheckboxesRehypePlugin.js\";\n\n// Needs to be sync because it's used in drag handler event (SideMenuPlugin)\n// Ideally, call `await initializeESMDependencies()` before calling this function\nexport function cleanHTMLToMarkdown(cleanHTMLString: string) {\n const deps = esmDependencies;\n\n if (!deps) {\n throw new Error(\n \"cleanHTMLToMarkdown requires ESM dependencies to be initialized\"\n );\n }\n\n const markdownString = deps.unified\n .unified()\n .use(deps.rehypeParse.default, { fragment: true })\n .use(removeUnderlines)\n .use(addSpacesToCheckboxes)\n .use(deps.rehypeRemark.default)\n .use(deps.remarkGfm.default)\n .use(deps.remarkStringify.default, {\n handlers: { text: (node) => node.value },\n })\n .processSync(cleanHTMLString);\n\n return markdownString.value as string;\n}\n\nexport async function blocksToMarkdown<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blocks: PartialBlock<BSchema, I, S>[],\n schema: Schema,\n editor: BlockNoteEditor<BSchema, I, S>,\n options: { document?: Document }\n): Promise<string> {\n await initializeESMDependencies();\n const exporter = createExternalHTMLExporter(schema, editor);\n const externalHTML = exporter.exportBlocks(blocks, options);\n\n return cleanHTMLToMarkdown(externalHTML);\n}\n","function getChildIndex(node: Element) {\n return Array.prototype.indexOf.call(node.parentElement!.childNodes, node);\n}\n\nfunction isWhitespaceNode(node: Node) {\n return node.nodeType === 3 && !/\\S/.test(node.nodeValue || \"\");\n}\n\n/**\n * Step 1, Turns:\n *\n * <ul>\n * <li>item</li>\n * <li>\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n * </li>\n *\n * Into:\n * <ul>\n * <li>item</li>\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n * </ul>\n *\n */\nfunction liftNestedListsToParent(element: HTMLElement) {\n element.querySelectorAll(\"li > ul, li > ol\").forEach((list) => {\n const index = getChildIndex(list);\n const parentListItem = list.parentElement!;\n const siblingsAfter = Array.from(parentListItem.childNodes).slice(\n index + 1\n );\n list.remove();\n siblingsAfter.forEach((sibling) => {\n sibling.remove();\n });\n\n parentListItem.insertAdjacentElement(\"afterend\", list);\n\n siblingsAfter.reverse().forEach((sibling) => {\n if (isWhitespaceNode(sibling)) {\n return;\n }\n const siblingContainer = document.createElement(\"li\");\n siblingContainer.append(sibling);\n list.insertAdjacentElement(\"afterend\", siblingContainer);\n });\n if (parentListItem.childNodes.length === 0) {\n parentListItem.remove();\n }\n });\n}\n\n/**\n * Step 2, Turns (output of liftNestedListsToParent):\n *\n * <li>item</li>\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n *\n * Into:\n * <div>\n * <li>item</li>\n * <div data-node-type=\"blockGroup\">\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n * </div>\n * </div>\n *\n * This resulting format is parsed\n */\nfunction createGroups(element: HTMLElement) {\n element.querySelectorAll(\"li + ul, li + ol\").forEach((list) => {\n const listItem = list.previousElementSibling as HTMLElement;\n const blockContainer = document.createElement(\"div\");\n\n listItem.insertAdjacentElement(\"afterend\", blockContainer);\n blockContainer.append(listItem);\n\n const blockGroup = document.createElement(\"div\");\n blockGroup.setAttribute(\"data-node-type\", \"blockGroup\");\n blockContainer.append(blockGroup);\n\n while (\n blockContainer.nextElementSibling?.nodeName === \"UL\" ||\n blockContainer.nextElementSibling?.nodeName === \"OL\"\n ) {\n blockGroup.append(blockContainer.nextElementSibling);\n }\n });\n}\n\n// prevent XSS, similar to https://github.com/ProseMirror/prosemirror-view/blob/1251b2b412656a2a06263e4187574beb43651273/src/clipboard.ts#L204\n// https://github.com/TypeCellOS/BlockNote/issues/601\nlet _detachedDoc: Document | null = null;\nfunction detachedDoc() {\n return (\n _detachedDoc ||\n (_detachedDoc = document.implementation.createHTMLDocument(\"title\"))\n );\n}\n\nexport function nestedListsToBlockNoteStructure(\n elementOrHTML: HTMLElement | string\n) {\n if (typeof elementOrHTML === \"string\") {\n const element = detachedDoc().createElement(\"div\");\n element.innerHTML = elementOrHTML;\n elementOrHTML = element;\n }\n liftNestedListsToParent(elementOrHTML);\n createGroups(elementOrHTML);\n return elementOrHTML;\n}\n","import { DOMParser, Schema } from \"prosemirror-model\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\n\nimport { Block } from \"../../../blocks/defaultBlocks.js\";\nimport { nodeToBlock } from \"../../nodeConversions/nodeToBlock.js\";\nimport { nestedListsToBlockNoteStructure } from \"./util/nestedLists.js\";\nexport async function HTMLToBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n html: string,\n blockSchema: BSchema,\n icSchema: I,\n styleSchema: S,\n pmSchema: Schema\n): Promise<Block<BSchema, I, S>[]> {\n const htmlNode = nestedListsToBlockNoteStructure(html);\n const parser = DOMParser.fromSchema(pmSchema);\n\n // Other approach might be to use\n // const doc = pmSchema.nodes[\"doc\"].createAndFill()!;\n // and context: doc.resolve(3),\n\n const parentNode = parser.parse(htmlNode, {\n topNode: pmSchema.nodes[\"blockGroup\"].create(),\n });\n\n const blocks: Block<BSchema, I, S>[] = [];\n\n for (let i = 0; i < parentNode.childCount; i++) {\n blocks.push(\n nodeToBlock(parentNode.child(i), blockSchema, icSchema, styleSchema)\n );\n }\n\n return blocks;\n}\n","import { Schema } from \"prosemirror-model\";\n\nimport { Block } from \"../../../blocks/defaultBlocks.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { initializeESMDependencies } from \"../../../util/esmDependencies.js\";\nimport { HTMLToBlocks } from \"../html/parseHTML.js\";\n\n// modified version of https://github.com/syntax-tree/mdast-util-to-hast/blob/main/lib/handlers/code.js\n// that outputs a data-language attribute instead of a CSS class (e.g.: language-typescript)\nfunction code(state: any, node: any) {\n const value = node.value ? node.value : \"\";\n /** @type {Properties} */\n const properties: any = {};\n\n if (node.lang) {\n // changed line\n properties[\"data-language\"] = node.lang;\n }\n\n // Create `<code>`.\n /** @type {Element} */\n let result: any = {\n type: \"element\",\n tagName: \"code\",\n properties,\n children: [{ type: \"text\", value }],\n };\n\n if (node.meta) {\n result.data = { meta: node.meta };\n }\n\n state.patch(node, result);\n result = state.applyData(node, result);\n\n // Create `<pre>`.\n result = {\n type: \"element\",\n tagName: \"pre\",\n properties: {},\n children: [result],\n };\n state.patch(node, result);\n return result;\n}\n\nexport async function markdownToBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n markdown: string,\n blockSchema: BSchema,\n icSchema: I,\n styleSchema: S,\n pmSchema: Schema\n): Promise<Block<BSchema, I, S>[]> {\n const deps = await initializeESMDependencies();\n const htmlString = deps.unified\n .unified()\n .use(deps.remarkParse.default)\n .use(deps.remarkGfm.default)\n .use(deps.remarkRehype.default, {\n handlers: {\n ...(deps.remarkRehype.defaultHandlers as any),\n code,\n },\n })\n .use(deps.rehypeStringify.default)\n .processSync(markdown);\n\n return HTMLToBlocks(\n htmlString.value as string,\n blockSchema,\n icSchema,\n styleSchema,\n pmSchema\n );\n}\n","// from https://raw.githubusercontent.com/ueberdosis/tiptap/develop/packages/core/src/EventEmitter.ts (MIT)\n\ntype StringKeyOf<T> = Extract<keyof T, string>;\ntype CallbackType<\n T extends Record<string, any>,\n EventName extends StringKeyOf<T>\n> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];\ntype CallbackFunction<\n T extends Record<string, any>,\n EventName extends StringKeyOf<T>\n> = (...props: CallbackType<T, EventName>) => any;\n\nexport class EventEmitter<T extends Record<string, any>> {\n // eslint-disable-next-line @typescript-eslint/ban-types\n private callbacks: { [key: string]: Function[] } = {};\n\n public on<EventName extends StringKeyOf<T>>(\n event: EventName,\n fn: CallbackFunction<T, EventName>\n ) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n\n this.callbacks[event].push(fn);\n\n return () => this.off(event, fn);\n }\n\n protected emit<EventName extends StringKeyOf<T>>(\n event: EventName,\n ...args: CallbackType<T, EventName>\n ) {\n const callbacks = this.callbacks[event];\n\n if (callbacks) {\n callbacks.forEach((callback) => callback.apply(this, args));\n }\n }\n\n public off<EventName extends StringKeyOf<T>>(\n event: EventName,\n fn?: CallbackFunction<T, EventName>\n ) {\n const callbacks = this.callbacks[event];\n\n if (callbacks) {\n if (fn) {\n this.callbacks[event] = callbacks.filter((callback) => callback !== fn);\n } else {\n delete this.callbacks[event];\n }\n }\n }\n\n protected removeAllListeners(): void {\n this.callbacks = {};\n }\n}\n","import { EditorState, Plugin, PluginKey, PluginView } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport type {\n BlockFromConfig,\n FileBlockConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nexport type FilePanelState<\n I extends InlineContentSchema,\n S extends StyleSchema\n> = UiElementPosition & {\n // TODO: This typing is not quite right (children should be from BSchema)\n block: BlockFromConfig<FileBlockConfig, I, S>;\n};\n\nexport class FilePanelView<I extends InlineContentSchema, S extends StyleSchema>\n implements PluginView\n{\n public state?: FilePanelState<I, S>;\n public emitUpdate: () => void;\n\n constructor(\n private readonly editor: BlockNoteEditor<\n Record<string, FileBlockConfig>,\n I,\n S\n >,\n private readonly pluginKey: PluginKey,\n private readonly pmView: EditorView,\n emitUpdate: (state: FilePanelState<I, S>) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized file panel\");\n }\n\n emitUpdate(this.state);\n };\n\n pmView.dom.addEventListener(\"mousedown\", this.mouseDownHandler);\n pmView.dom.addEventListener(\"dragstart\", this.dragstartHandler);\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n pmView.root.addEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n mouseDownHandler = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n // For dragging the whole editor.\n dragstartHandler = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n scrollHandler = () => {\n if (this.state?.show) {\n const blockElement = this.pmView.root.querySelector(\n `[data-node-type=\"blockContainer\"][data-id=\"${this.state.block.id}\"]`\n );\n if (!blockElement) {\n return;\n }\n this.state.referencePos = blockElement.getBoundingClientRect();\n this.emitUpdate();\n }\n };\n\n update(view: EditorView, prevState: EditorState) {\n const pluginState: {\n block: BlockFromConfig<FileBlockConfig, I, S>;\n } = this.pluginKey.getState(view.state);\n\n if (!this.state?.show && pluginState.block && this.editor.isEditable) {\n const blockElement = this.pmView.root.querySelector(\n `[data-node-type=\"blockContainer\"][data-id=\"${pluginState.block.id}\"]`\n );\n if (!blockElement) {\n return;\n }\n this.state = {\n show: true,\n referencePos: blockElement.getBoundingClientRect(),\n block: pluginState.block,\n };\n\n this.emitUpdate();\n\n return;\n }\n\n if (\n !view.state.selection.eq(prevState.selection) ||\n !view.state.doc.eq(prevState.doc) ||\n !this.editor.isEditable\n ) {\n if (this.state?.show) {\n this.state.show = false;\n\n this.emitUpdate();\n }\n }\n }\n\n closeMenu = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mousedown\", this.mouseDownHandler);\n\n this.pmView.dom.removeEventListener(\"dragstart\", this.dragstartHandler);\n\n this.pmView.root.removeEventListener(\"scroll\", this.scrollHandler, true);\n }\n}\n\nconst filePanelPluginKey = new PluginKey(\"FilePanelPlugin\");\n\nexport class FilePanelProsemirrorPlugin<\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: FilePanelView<I, S> | undefined;\n public readonly plugin: Plugin;\n\n constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>) {\n super();\n this.plugin = new Plugin<{\n block: BlockFromConfig<FileBlockConfig, I, S> | undefined;\n }>({\n key: filePanelPluginKey,\n view: (editorView) => {\n this.view = new FilePanelView<I, S>(\n editor,\n filePanelPluginKey,\n editorView,\n (state) => {\n this.emit(\"update\", state);\n }\n );\n return this.view;\n },\n props: {\n handleKeyDown: (_view, event: KeyboardEvent) => {\n if (event.key === \"Escape\" && this.shown) {\n this.view?.closeMenu();\n return true;\n }\n return false;\n },\n },\n state: {\n init: () => {\n return {\n block: undefined,\n };\n },\n apply: (transaction) => {\n const block: BlockFromConfig<FileBlockConfig, I, S> | undefined =\n transaction.getMeta(filePanelPluginKey)?.block;\n\n return {\n block,\n };\n },\n },\n });\n }\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n\n public onUpdate(callback: (state: FilePanelState<I, S>) => void) {\n return this.on(\"update\", callback);\n }\n\n public closeMenu = () => this.view?.closeMenu();\n}\n","import { isNodeSelection, isTextSelection, posToDOMRect } from \"@tiptap/core\";\nimport { EditorState, Plugin, PluginKey, PluginView } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nexport type FormattingToolbarState = UiElementPosition;\n\nexport class FormattingToolbarView implements PluginView {\n public state?: FormattingToolbarState;\n public emitUpdate: () => void;\n\n public preventHide = false;\n public preventShow = false;\n\n public shouldShow: (props: {\n view: EditorView;\n state: EditorState;\n from: number;\n to: number;\n }) => boolean = ({ state, from, to, view }) => {\n const { doc, selection } = state;\n const { empty } = selection;\n\n // Sometime check for `empty` is not enough.\n // Doubleclick an empty paragraph returns a node size of 2.\n // So we check also for an empty text size.\n const isEmptyTextBlock =\n !doc.textBetween(from, to).length && isTextSelection(state.selection);\n\n // Don't show toolbar inside code blocks\n if (\n selection.$from.parent.type.spec.code ||\n (isNodeSelection(selection) && selection.node.type.spec.code)\n ) {\n return false;\n }\n\n // check view.hasFocus so that the toolbar doesn't show up when the editor is not focused or when for example a code block is focused\n return !(!view.hasFocus() || empty || isEmptyTextBlock);\n };\n\n constructor(\n private readonly editor: BlockNoteEditor<\n BlockSchema,\n InlineContentSchema,\n StyleSchema\n >,\n private readonly pmView: EditorView,\n emitUpdate: (state: FormattingToolbarState) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\n \"Attempting to update uninitialized formatting toolbar\"\n );\n }\n\n emitUpdate(this.state);\n };\n\n pmView.dom.addEventListener(\"mousedown\", this.viewMousedownHandler);\n pmView.dom.addEventListener(\"mouseup\", this.viewMouseupHandler);\n pmView.dom.addEventListener(\"dragstart\", this.dragHandler);\n pmView.dom.addEventListener(\"dragover\", this.dragHandler);\n pmView.dom.addEventListener(\"blur\", this.blurHandler);\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n pmView.root.addEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n blurHandler = (event: FocusEvent) => {\n if (this.preventHide) {\n this.preventHide = false;\n\n return;\n }\n\n const editorWrapper = this.pmView.dom.parentElement!;\n\n // Checks if the focus is moving to an element outside the editor. If it is,\n // the toolbar is hidden.\n if (\n // An element is clicked.\n event &&\n event.relatedTarget &&\n // Element is inside the editor.\n (editorWrapper === (event.relatedTarget as Node) ||\n editorWrapper.contains(event.relatedTarget as Node) ||\n (event.relatedTarget as HTMLElement).matches(\n \".bn-ui-container, .bn-ui-container *\"\n ))\n ) {\n return;\n }\n\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n viewMousedownHandler = () => {\n this.preventShow = true;\n };\n\n viewMouseupHandler = () => {\n this.preventShow = false;\n setTimeout(() => this.update(this.pmView));\n };\n\n // For dragging the whole editor.\n dragHandler = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n scrollHandler = () => {\n if (this.state?.show) {\n this.state.referencePos = this.getSelectionBoundingBox();\n this.emitUpdate();\n }\n };\n\n update(view: EditorView, oldState?: EditorState) {\n // Delays the update to handle edge case with drag and drop, where the view\n // is blurred asynchronously and happens only after the state update.\n // Wrapping in a setTimeout gives enough time to wait for the blur event to\n // occur before updating the toolbar.\n const { state, composing } = view;\n const { doc, selection } = state;\n const isSame =\n oldState && oldState.doc.eq(doc) && oldState.selection.eq(selection);\n\n if (composing || isSame) {\n return;\n }\n\n // support for CellSelections\n const { ranges } = selection;\n const from = Math.min(...ranges.map((range) => range.$from.pos));\n const to = Math.max(...ranges.map((range) => range.$to.pos));\n\n const shouldShow = this.shouldShow?.({\n view,\n state,\n from,\n to,\n });\n\n // Checks if menu should be shown/updated.\n if (!this.preventShow && (shouldShow || this.preventHide)) {\n // Unlike other UI elements, we don't prevent the formatting toolbar from\n // showing when the editor is not editable. This is because some buttons,\n // e.g. the download file button, should still be accessible. Therefore,\n // logic for hiding when the editor is non-editable is handled\n // individually in each button.\n this.state = {\n show: true,\n referencePos: this.getSelectionBoundingBox(),\n };\n\n this.emitUpdate();\n\n return;\n }\n\n // Checks if menu should be hidden.\n if (\n this.state?.show &&\n !this.preventHide &&\n (!shouldShow || this.preventShow || !this.editor.isEditable)\n ) {\n this.state.show = false;\n this.emitUpdate();\n\n return;\n }\n }\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mousedown\", this.viewMousedownHandler);\n this.pmView.dom.removeEventListener(\"mouseup\", this.viewMouseupHandler);\n this.pmView.dom.removeEventListener(\"dragstart\", this.dragHandler);\n this.pmView.dom.removeEventListener(\"dragover\", this.dragHandler);\n this.pmView.dom.removeEventListener(\"blur\", this.blurHandler);\n\n this.pmView.root.removeEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n closeMenu = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n getSelectionBoundingBox() {\n const { state } = this.pmView;\n const { selection } = state;\n\n // support for CellSelections\n const { ranges } = selection;\n const from = Math.min(...ranges.map((range) => range.$from.pos));\n const to = Math.max(...ranges.map((range) => range.$to.pos));\n\n if (isNodeSelection(selection)) {\n const node = this.pmView.nodeDOM(from) as HTMLElement;\n if (node) {\n return node.getBoundingClientRect();\n }\n }\n\n return posToDOMRect(this.pmView, from, to);\n }\n}\n\nexport const formattingToolbarPluginKey = new PluginKey(\n \"FormattingToolbarPlugin\"\n);\n\nexport class FormattingToolbarProsemirrorPlugin extends EventEmitter<any> {\n private view: FormattingToolbarView | undefined;\n public readonly plugin: Plugin;\n\n constructor(editor: BlockNoteEditor<any, any, any>) {\n super();\n this.plugin = new Plugin({\n key: formattingToolbarPluginKey,\n view: (editorView) => {\n this.view = new FormattingToolbarView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n props: {\n handleKeyDown: (_view, event: KeyboardEvent) => {\n if (event.key === \"Escape\" && this.shown) {\n this.view!.closeMenu();\n return true;\n }\n return false;\n },\n },\n });\n }\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n\n public onUpdate(callback: (state: FormattingToolbarState) => void) {\n return this.on(\"update\", callback);\n }\n\n public closeMenu = () => this.view!.closeMenu();\n}\n","import { getMarkRange, posToDOMRect, Range } from \"@tiptap/core\";\n\nimport { EditorView } from \"@tiptap/pm/view\";\nimport { Mark } from \"prosemirror-model\";\nimport { Plugin, PluginKey, PluginView } from \"prosemirror-state\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nexport type LinkToolbarState = UiElementPosition & {\n // The hovered link's URL, and the text it's displayed with in the\n // editor.\n url: string;\n text: string;\n};\n\nclass LinkToolbarView implements PluginView {\n public state?: LinkToolbarState;\n public emitUpdate: () => void;\n\n menuUpdateTimer: ReturnType<typeof setTimeout> | undefined;\n startMenuUpdateTimer: () => void;\n stopMenuUpdateTimer: () => void;\n\n mouseHoveredLinkMark: Mark | undefined;\n mouseHoveredLinkMarkRange: Range | undefined;\n\n keyboardHoveredLinkMark: Mark | undefined;\n keyboardHoveredLinkMarkRange: Range | undefined;\n\n linkMark: Mark | undefined;\n linkMarkRange: Range | undefined;\n\n constructor(\n private readonly editor: BlockNoteEditor<any, any, any>,\n private readonly pmView: EditorView,\n emitUpdate: (state: LinkToolbarState) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized link toolbar\");\n }\n\n emitUpdate(this.state);\n };\n\n this.startMenuUpdateTimer = () => {\n this.menuUpdateTimer = setTimeout(() => {\n this.update();\n }, 250);\n };\n\n this.stopMenuUpdateTimer = () => {\n if (this.menuUpdateTimer) {\n clearTimeout(this.menuUpdateTimer);\n this.menuUpdateTimer = undefined;\n }\n\n return false;\n };\n\n this.pmView.dom.addEventListener(\"mouseover\", this.mouseOverHandler);\n this.pmView.root.addEventListener(\n \"click\",\n this.clickHandler as EventListener,\n true\n );\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n this.pmView.root.addEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n mouseOverHandler = (event: MouseEvent) => {\n // Resets the link mark currently hovered by the mouse cursor.\n this.mouseHoveredLinkMark = undefined;\n this.mouseHoveredLinkMarkRange = undefined;\n\n this.stopMenuUpdateTimer();\n\n if (\n event.target instanceof HTMLAnchorElement &&\n event.target.nodeName === \"A\"\n ) {\n // Finds link mark at the hovered element's position to update mouseHoveredLinkMark and\n // mouseHoveredLinkMarkRange.\n const hoveredLinkElement = event.target;\n const posInHoveredLinkMark =\n this.pmView.posAtDOM(hoveredLinkElement, 0) + 1;\n const resolvedPosInHoveredLinkMark =\n this.pmView.state.doc.resolve(posInHoveredLinkMark);\n const marksAtPos = resolvedPosInHoveredLinkMark.marks();\n\n for (const mark of marksAtPos) {\n if (\n mark.type.name === this.pmView.state.schema.mark(\"link\").type.name\n ) {\n this.mouseHoveredLinkMark = mark;\n this.mouseHoveredLinkMarkRange =\n getMarkRange(resolvedPosInHoveredLinkMark, mark.type, mark.attrs) ||\n undefined;\n\n break;\n }\n }\n }\n\n this.startMenuUpdateTimer();\n\n return false;\n };\n\n clickHandler = (event: MouseEvent) => {\n const editorWrapper = this.pmView.dom.parentElement!;\n\n if (\n // Toolbar is open.\n this.linkMark &&\n // An element is clicked.\n event &&\n event.target &&\n // The clicked element is not the editor.\n !(\n editorWrapper === (event.target as Node) ||\n editorWrapper.contains(event.target as Node)\n )\n ) {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n }\n };\n\n scrollHandler = () => {\n if (this.linkMark !== undefined) {\n if (this.state?.show) {\n this.state.referencePos = posToDOMRect(\n this.pmView,\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n );\n this.emitUpdate();\n }\n }\n };\n\n editLink(url: string, text: string) {\n const tr = this.pmView.state.tr.insertText(\n text,\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n );\n tr.addMark(\n this.linkMarkRange!.from,\n this.linkMarkRange!.from + text.length,\n this.pmView.state.schema.mark(\"link\", { href: url })\n );\n this.editor.dispatch(tr);\n this.pmView.focus();\n\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n }\n\n deleteLink() {\n this.editor.dispatch(\n this.pmView.state.tr\n .removeMark(\n this.linkMarkRange!.from,\n this.linkMarkRange!.to,\n this.linkMark!.type\n )\n .setMeta(\"preventAutolink\", true)\n );\n this.pmView.focus();\n\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n }\n\n update() {\n if (!this.pmView.hasFocus()) {\n return;\n }\n\n // Saves the currently hovered link mark before it's updated.\n const prevLinkMark = this.linkMark;\n\n // Resets the currently hovered link mark.\n this.linkMark = undefined;\n this.linkMarkRange = undefined;\n\n // Resets the link mark currently hovered by the keyboard cursor.\n this.keyboardHoveredLinkMark = undefined;\n this.keyboardHoveredLinkMarkRange = undefined;\n\n // Finds link mark at the editor selection's position to update keyboardHoveredLinkMark and\n // keyboardHoveredLinkMarkRange.\n if (this.pmView.state.selection.empty) {\n const marksAtPos = this.pmView.state.selection.$from.marks();\n\n for (const mark of marksAtPos) {\n if (\n mark.type.name === this.pmView.state.schema.mark(\"link\").type.name\n ) {\n this.keyboardHoveredLinkMark = mark;\n this.keyboardHoveredLinkMarkRange =\n getMarkRange(\n this.pmView.state.selection.$from,\n mark.type,\n mark.attrs\n ) || undefined;\n\n break;\n }\n }\n }\n\n if (this.mouseHoveredLinkMark) {\n this.linkMark = this.mouseHoveredLinkMark;\n this.linkMarkRange = this.mouseHoveredLinkMarkRange;\n }\n\n // Keyboard cursor position takes precedence over mouse hovered link.\n if (this.keyboardHoveredLinkMark) {\n this.linkMark = this.keyboardHoveredLinkMark;\n this.linkMarkRange = this.keyboardHoveredLinkMarkRange;\n }\n\n if (this.linkMark && this.editor.isEditable) {\n this.state = {\n show: true,\n referencePos: posToDOMRect(\n this.pmView,\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n ),\n url: this.linkMark!.attrs.href,\n text: this.pmView.state.doc.textBetween(\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n ),\n };\n this.emitUpdate();\n\n return;\n }\n\n // Hides menu.\n if (\n this.state?.show &&\n prevLinkMark &&\n (!this.linkMark || !this.editor.isEditable)\n ) {\n this.state.show = false;\n this.emitUpdate();\n\n return;\n }\n }\n\n closeMenu = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mouseover\", this.mouseOverHandler);\n this.pmView.root.removeEventListener(\"scroll\", this.scrollHandler, true);\n this.pmView.root.removeEventListener(\n \"click\",\n this.clickHandler as EventListener,\n true\n );\n }\n}\n\nexport const linkToolbarPluginKey = new PluginKey(\"LinkToolbarPlugin\");\n\nexport class LinkToolbarProsemirrorPlugin<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: LinkToolbarView | undefined;\n public readonly plugin: Plugin;\n\n constructor(editor: BlockNoteEditor<BSchema, I, S>) {\n super();\n this.plugin = new Plugin({\n key: linkToolbarPluginKey,\n view: (editorView) => {\n this.view = new LinkToolbarView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n props: {\n handleKeyDown: (_view, event: KeyboardEvent) => {\n if (event.key === \"Escape\" && this.shown) {\n this.view!.closeMenu();\n return true;\n }\n return false;\n },\n },\n });\n }\n\n public onUpdate(callback: (state: LinkToolbarState) => void) {\n return this.on(\"update\", callback);\n }\n\n /**\n * Edit the currently hovered link.\n */\n public editLink = (url: string, text: string) => {\n this.view!.editLink(url, text);\n };\n\n /**\n * Delete the currently hovered link.\n */\n public deleteLink = () => {\n this.view!.deleteLink();\n };\n\n /**\n * When hovering on/off links using the mouse cursor, the link toolbar will\n * open & close with a delay.\n *\n * This function starts the delay timer, and should be used for when the mouse\n * cursor enters the link toolbar.\n */\n public startHideTimer = () => {\n this.view!.startMenuUpdateTimer();\n };\n\n /**\n * When hovering on/off links using the mouse cursor, the link toolbar will\n * open & close with a delay.\n *\n * This function stops the delay timer, and should be used for when the mouse\n * cursor exits the link toolbar.\n */\n public stopHideTimer = () => {\n this.view!.stopMenuUpdateTimer();\n };\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n\n public closeMenu = () => this.view!.closeMenu();\n}\n","import { EditorView } from \"prosemirror-view\";\n\nexport function getDraggableBlockFromElement(\n element: Element,\n view: EditorView\n) {\n while (\n element &&\n element.parentElement &&\n element.parentElement !== view.dom &&\n element.getAttribute?.(\"data-node-type\") !== \"blockContainer\"\n ) {\n element = element.parentElement;\n }\n if (element.getAttribute?.(\"data-node-type\") !== \"blockContainer\") {\n return undefined;\n }\n return { node: element as HTMLElement, id: element.getAttribute(\"data-id\")! };\n}\n","import { Fragment } from \"@tiptap/pm/model\";\nimport { BlockNoteSchema } from \"../../editor/BlockNoteSchema.js\";\nimport {\n BlockNoDefaults,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { nodeToBlock } from \"./nodeToBlock.js\";\n\n/**\n * Converts all Blocks within a fragment to BlockNote blocks.\n */\nexport function fragmentToBlocks<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(fragment: Fragment, schema: BlockNoteSchema<B, I, S>) {\n // first convert selection to blocknote-style blocks, and then\n // pass these to the exporter\n const blocks: BlockNoDefaults<B, I, S>[] = [];\n fragment.descendants((node) => {\n if (node.type.name === \"blockContainer\") {\n if (node.firstChild?.type.name === \"blockGroup\") {\n // selection started within a block group\n // in this case the fragment starts with:\n // <blockContainer>\n // <blockGroup>\n // <blockContainer ... />\n // <blockContainer ... />\n // </blockGroup>\n // </blockContainer>\n //\n // instead of:\n // <blockContainer>\n // <blockContent ... />\n // <blockGroup>\n // <blockContainer ... />\n // <blockContainer ... />\n // </blockGroup>\n // </blockContainer>\n //\n // so we don't need to serialize this block, just descend into the children of the blockGroup\n return true;\n }\n }\n\n if (node.type.name === \"columnList\" && node.childCount === 1) {\n // column lists with a single column should be flattened (not the entire column list has been selected)\n node.firstChild?.forEach((child) => {\n blocks.push(\n nodeToBlock(\n child,\n schema.blockSchema,\n schema.inlineContentSchema,\n schema.styleSchema\n )\n );\n });\n return false;\n }\n\n if (node.type.isInGroup(\"bnBlock\")) {\n blocks.push(\n nodeToBlock(\n node,\n schema.blockSchema,\n schema.inlineContentSchema,\n schema.styleSchema\n )\n );\n // don't descend into children, as they're already included in the block returned by nodeToBlock\n return false;\n }\n return true;\n });\n return blocks;\n}\n","import { Fragment, Node, ResolvedPos, Slice } from \"prosemirror-model\";\nimport { Selection } from \"prosemirror-state\";\nimport { Mappable } from \"prosemirror-transform\";\n\n/**\n * This class represents an editor selection which spans multiple nodes/blocks. It's currently only used to allow users\n * to drag multiple blocks at the same time. Expects the selection anchor and head to be between nodes, i.e. just before\n * the first target node and just after the last, and that anchor and head are at the same nesting level.\n *\n * Partially based on ProseMirror's NodeSelection implementation:\n * (https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.ts)\n * MultipleNodeSelection differs from NodeSelection in the following ways:\n * 1. Stores which nodes are included in the selection instead of just a single node.\n * 2. Already expects the selection to start just before the first target node and ends just after the last, while a\n * NodeSelection automatically sets both anchor and head to just before the single target node.\n */\nexport class MultipleNodeSelection extends Selection {\n nodes: Array<Node>;\n\n constructor($anchor: ResolvedPos, $head: ResolvedPos) {\n super($anchor, $head);\n\n // Parent is at the same nesting level as anchor/head since they are just before/ just after target nodes.\n const parentNode = $anchor.node();\n\n this.nodes = [];\n $anchor.doc.nodesBetween($anchor.pos, $head.pos, (node, _pos, parent) => {\n if (parent !== null && parent.eq(parentNode)) {\n this.nodes.push(node);\n return false;\n }\n return;\n });\n }\n\n static create(doc: Node, from: number, to = from): MultipleNodeSelection {\n return new MultipleNodeSelection(doc.resolve(from), doc.resolve(to));\n }\n\n content(): Slice {\n return new Slice(Fragment.from(this.nodes), 0, 0);\n }\n\n eq(selection: Selection): boolean {\n if (!(selection instanceof MultipleNodeSelection)) {\n return false;\n }\n\n if (this.nodes.length !== selection.nodes.length) {\n return false;\n }\n\n if (this.from !== selection.from || this.to !== selection.to) {\n return false;\n }\n\n for (let i = 0; i < this.nodes.length; i++) {\n if (!this.nodes[i].eq(selection.nodes[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n map(doc: Node, mapping: Mappable): Selection {\n const fromResult = mapping.mapResult(this.from);\n const toResult = mapping.mapResult(this.to);\n\n if (toResult.deleted) {\n return Selection.near(doc.resolve(fromResult.pos));\n }\n\n if (fromResult.deleted) {\n return Selection.near(doc.resolve(toResult.pos));\n }\n\n return new MultipleNodeSelection(\n doc.resolve(fromResult.pos),\n doc.resolve(toResult.pos)\n );\n }\n\n toJSON(): any {\n return { type: \"node\", anchor: this.anchor, head: this.head };\n }\n}\n","import { Node } from \"prosemirror-model\";\nimport { NodeSelection, Selection } from \"prosemirror-state\";\nimport * as pmView from \"prosemirror-view\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport { createExternalHTMLExporter } from \"../../api/exporters/html/externalHTMLExporter.js\";\nimport { cleanHTMLToMarkdown } from \"../../api/exporters/markdown/markdownExporter.js\";\nimport { fragmentToBlocks } from \"../../api/nodeConversions/fragmentToBlocks.js\";\nimport { getNodeById } from \"../../api/nodeUtil.js\";\nimport { Block } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { MultipleNodeSelection } from \"./MultipleNodeSelection.js\";\n\nlet dragImageElement: Element | undefined;\n\nexport type SideMenuState<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = UiElementPosition & {\n // The block that the side menu is attached to.\n block: Block<BSchema, I, S>;\n};\n\nfunction blockPositionsFromSelection(selection: Selection, doc: Node) {\n // Absolute positions just before the first block spanned by the selection, and just after the last block. Having the\n // selection start and end just before and just after the target blocks ensures no whitespace/line breaks are left\n // behind after dragging & dropping them.\n let beforeFirstBlockPos: number;\n let afterLastBlockPos: number;\n\n // Even the user starts dragging blocks but drops them in the same place, the selection will still be moved just\n // before & just after the blocks spanned by the selection, and therefore doesn't need to change if they try to drag\n // the same blocks again. If this happens, the anchor & head move out of the block content node they were originally\n // in. If the anchor should update but the head shouldn't and vice versa, it means the user selection is outside a\n // block content node, which should never happen.\n const selectionStartInBlockContent =\n doc.resolve(selection.from).node().type.spec.group === \"blockContent\";\n const selectionEndInBlockContent =\n doc.resolve(selection.to).node().type.spec.group === \"blockContent\";\n\n // Ensures that entire outermost nodes are selected if the selection spans multiple nesting levels.\n const minDepth = Math.min(selection.$anchor.depth, selection.$head.depth);\n\n if (selectionStartInBlockContent && selectionEndInBlockContent) {\n // Absolute positions at the start of the first block in the selection and at the end of the last block. User\n // selections will always start and end in block content nodes, but we want the start and end positions of their\n // parent block nodes, which is why minDepth - 1 is used.\n const startFirstBlockPos = selection.$from.start(minDepth - 1);\n const endLastBlockPos = selection.$to.end(minDepth - 1);\n\n // Shifting start and end positions by one moves them just outside the first and last selected blocks.\n beforeFirstBlockPos = doc.resolve(startFirstBlockPos - 1).pos;\n afterLastBlockPos = doc.resolve(endLastBlockPos + 1).pos;\n } else {\n beforeFirstBlockPos = selection.from;\n afterLastBlockPos = selection.to;\n }\n\n return { from: beforeFirstBlockPos, to: afterLastBlockPos };\n}\n\nfunction setDragImage(view: EditorView, from: number, to = from) {\n if (from === to) {\n // Moves to position to be just after the first (and only) selected block.\n to += view.state.doc.resolve(from + 1).node().nodeSize;\n }\n\n // Parent element is cloned to remove all unselected children without affecting the editor content.\n const parentClone = view.domAtPos(from).node.cloneNode(true) as Element;\n const parent = view.domAtPos(from).node as Element;\n\n const getElementIndex = (parentElement: Element, targetElement: Element) =>\n Array.prototype.indexOf.call(parentElement.children, targetElement);\n\n const firstSelectedBlockIndex = getElementIndex(\n parent,\n // Expects from position to be just before the first selected block.\n view.domAtPos(from + 1).node.parentElement!\n );\n const lastSelectedBlockIndex = getElementIndex(\n parent,\n // Expects to position to be just after the last selected block.\n view.domAtPos(to - 1).node.parentElement!\n );\n\n for (let i = parent.childElementCount - 1; i >= 0; i--) {\n if (i > lastSelectedBlockIndex || i < firstSelectedBlockIndex) {\n parentClone.removeChild(parentClone.children[i]);\n }\n }\n\n // dataTransfer.setDragImage(element) only works if element is attached to the DOM.\n unsetDragImage(view.root);\n dragImageElement = parentClone;\n\n // TODO: This is hacky, need a better way of assigning classes to the editor so that they can also be applied to the\n // drag preview.\n const classes = view.dom.className.split(\" \");\n const inheritedClasses = classes\n .filter(\n (className) =>\n className !== \"ProseMirror\" &&\n className !== \"bn-root\" &&\n className !== \"bn-editor\"\n )\n .join(\" \");\n\n dragImageElement.className =\n dragImageElement.className + \" bn-drag-preview \" + inheritedClasses;\n\n if (view.root instanceof ShadowRoot) {\n view.root.appendChild(dragImageElement);\n } else {\n view.root.body.appendChild(dragImageElement);\n }\n}\n\nexport function unsetDragImage(rootEl: Document | ShadowRoot) {\n if (dragImageElement !== undefined) {\n if (rootEl instanceof ShadowRoot) {\n rootEl.removeChild(dragImageElement);\n } else {\n rootEl.body.removeChild(dragImageElement);\n }\n\n dragImageElement = undefined;\n }\n}\n\nexport function dragStart<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n e: { dataTransfer: DataTransfer | null; clientY: number },\n block: Block<BSchema, I, S>,\n editor: BlockNoteEditor<BSchema, I, S>\n) {\n if (!e.dataTransfer) {\n return;\n }\n\n const view = editor.prosemirrorView;\n\n const pos = getNodeById(block.id, view.state.doc).posBeforeNode;\n\n if (pos != null) {\n const selection = view.state.selection;\n const doc = view.state.doc;\n\n const { from, to } = blockPositionsFromSelection(selection, doc);\n\n const draggedBlockInSelection = from <= pos && pos < to;\n const multipleBlocksSelected =\n selection.$anchor.node() !== selection.$head.node() ||\n selection instanceof MultipleNodeSelection;\n\n if (draggedBlockInSelection && multipleBlocksSelected) {\n view.dispatch(\n view.state.tr.setSelection(MultipleNodeSelection.create(doc, from, to))\n );\n setDragImage(view, from, to);\n } else {\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos))\n );\n setDragImage(view, pos);\n }\n\n const selectedSlice = view.state.selection.content();\n const schema = editor.pmSchema;\n\n const clipboardHTML = (pmView as any).__serializeForClipboard(\n view,\n selectedSlice\n ).dom.innerHTML;\n\n const externalHTMLExporter = createExternalHTMLExporter(schema, editor);\n\n const blocks = fragmentToBlocks(selectedSlice.content, editor.schema);\n const externalHTML = externalHTMLExporter.exportBlocks(blocks, {});\n\n const plainText = cleanHTMLToMarkdown(externalHTML);\n\n e.dataTransfer.clearData();\n e.dataTransfer.setData(\"blocknote/html\", clipboardHTML);\n e.dataTransfer.setData(\"text/html\", externalHTML);\n e.dataTransfer.setData(\"text/plain\", plainText);\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setDragImage(dragImageElement!, 0, 0);\n view.dragging = { slice: selectedSlice, move: true };\n }\n}\n","import { PluginView } from \"@tiptap/pm/state\";\nimport { EditorState, Plugin, PluginKey } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport { Block } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\nimport { initializeESMDependencies } from \"../../util/esmDependencies.js\";\nimport { getDraggableBlockFromElement } from \"../getDraggableBlockFromElement.js\";\nimport { dragStart, unsetDragImage } from \"./dragging.js\";\nexport type SideMenuState<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = UiElementPosition & {\n // The block that the side menu is attached to.\n block: Block<BSchema, I, S>;\n};\n\nconst PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP = 0.1;\n\nfunction getBlockFromCoords(\n view: EditorView,\n coords: { left: number; top: number },\n adjustForColumns = true\n) {\n const elements = view.root.elementsFromPoint(coords.left, coords.top);\n\n for (const element of elements) {\n if (!view.dom.contains(element)) {\n // probably a ui overlay like formatting toolbar etc\n continue;\n }\n if (adjustForColumns) {\n const column = element.closest(\"[data-node-type=columnList]\");\n if (column) {\n return getBlockFromCoords(\n view,\n {\n left: coords.left + 50, // bit hacky, but if we're inside a column, offset x position to right to account for the width of sidemenu itself\n top: coords.top,\n },\n false\n );\n }\n }\n return getDraggableBlockFromElement(element, view);\n }\n return undefined;\n}\n\nfunction getBlockFromMousePos(\n mousePos: {\n x: number;\n y: number;\n },\n view: EditorView\n): { node: HTMLElement; id: string } | undefined {\n // Editor itself may have padding or other styling which affects\n // size/position, so we get the boundingRect of the first child (i.e. the\n // blockGroup that wraps all blocks in the editor) for more accurate side\n // menu placement.\n if (!view.dom.firstChild) {\n return;\n }\n\n const editorBoundingBox = (\n view.dom.firstChild as HTMLElement\n ).getBoundingClientRect();\n\n // this.horizontalPosAnchor = editorBoundingBox.x;\n\n // Gets block at mouse cursor's vertical position.\n const coords = {\n left: mousePos.x,\n top: mousePos.y,\n };\n\n const mouseLeftOfEditor = coords.left < editorBoundingBox.left;\n const mouseRightOfEditor = coords.left > editorBoundingBox.right;\n\n if (mouseLeftOfEditor) {\n coords.left = editorBoundingBox.left + 10;\n }\n\n if (mouseRightOfEditor) {\n coords.left = editorBoundingBox.right - 10;\n }\n\n let block = getBlockFromCoords(view, coords);\n\n if (!mouseRightOfEditor && block) {\n // note: this case is not necessary when we're on the right side of the editor\n\n /* Now, because blocks can be nested\n | BlockA |\n x | BlockB y|\n \n hovering over position x (the \"margin of block B\") will return block A instead of block B.\n to fix this, we get the block from the right side of block A (position y, which will fall in BlockB correctly)\n */\n\n const rect = block.node.getBoundingClientRect();\n coords.left = rect.right - 10;\n block = getBlockFromCoords(view, coords, false);\n }\n\n return block;\n}\n\n/**\n * With the sidemenu plugin we can position a menu next to a hovered block.\n */\nexport class SideMenuView<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> implements PluginView\n{\n public state?: SideMenuState<BSchema, I, S>;\n public readonly emitUpdate: (state: SideMenuState<BSchema, I, S>) => void;\n\n private mousePos: { x: number; y: number } | undefined;\n\n private hoveredBlock: HTMLElement | undefined;\n\n public menuFrozen = false;\n\n constructor(\n private readonly editor: BlockNoteEditor<BSchema, I, S>,\n private readonly pmView: EditorView,\n emitUpdate: (state: SideMenuState<BSchema, I, S>) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized side menu\");\n }\n\n emitUpdate(this.state);\n };\n\n this.pmView.root.addEventListener(\n \"drop\",\n this.onDrop as EventListener,\n true\n );\n this.pmView.root.addEventListener(\n \"dragover\",\n this.onDragOver as EventListener\n );\n initializeESMDependencies();\n\n // Shows or updates menu position whenever the cursor moves, if the menu isn't frozen.\n this.pmView.root.addEventListener(\n \"mousemove\",\n this.onMouseMove as EventListener,\n true\n );\n\n // Hides and unfreezes the menu whenever the user presses a key.\n this.pmView.root.addEventListener(\n \"keydown\",\n this.onKeyDown as EventListener,\n true\n );\n }\n\n updateState = (state: SideMenuState<BSchema, I, S>) => {\n this.state = state;\n this.emitUpdate(this.state);\n };\n\n updateStateFromMousePos = () => {\n if (this.menuFrozen || !this.mousePos) {\n return;\n }\n\n const block = getBlockFromMousePos(this.mousePos, this.pmView);\n\n // Closes the menu if the mouse cursor is beyond the editor vertically.\n if (!block || !this.editor.isEditable) {\n if (this.state?.show) {\n this.state.show = false;\n this.updateState(this.state);\n }\n\n return;\n }\n\n // Doesn't update if the menu is already open and the mouse cursor is still hovering the same block.\n if (\n this.state?.show &&\n this.hoveredBlock?.hasAttribute(\"data-id\") &&\n this.hoveredBlock?.getAttribute(\"data-id\") === block.id\n ) {\n return;\n }\n\n this.hoveredBlock = block.node;\n\n // Gets the block's content node, which lets to ignore child blocks when determining the block menu's position.\n // TODO: needed?\n const blockContent = block.node.firstChild as HTMLElement;\n\n if (!blockContent) {\n return;\n }\n\n // TODO: needed?\n\n // Shows or updates elements.\n if (this.editor.isEditable) {\n const blockContentBoundingBox = blockContent.getBoundingClientRect();\n const column = block.node.closest(\"[data-node-type=column]\");\n this.updateState({\n show: true,\n referencePos: new DOMRect(\n column\n ? // We take the first child as column elements have some default\n // padding. This is a little weird since this child element will\n // be the first block, but since it's always non-nested and we\n // only take the x coordinate, it's ok.\n column.firstElementChild!.getBoundingClientRect().x\n : (\n this.pmView.dom.firstChild as HTMLElement\n ).getBoundingClientRect().x,\n blockContentBoundingBox.y,\n blockContentBoundingBox.width,\n blockContentBoundingBox.height\n ),\n block: this.editor.getBlock(\n this.hoveredBlock!.getAttribute(\"data-id\")!\n )!,\n });\n }\n };\n\n /**\n * If the event is outside the editor contents,\n * we dispatch a fake event, so that we can still drop the content\n * when dragging / dropping to the side of the editor\n */\n onDrop = (event: DragEvent) => {\n this.editor._tiptapEditor.commands.blur();\n\n if (\n (event as any).synthetic ||\n !event.dataTransfer?.types.includes(\"blocknote/html\")\n ) {\n return;\n }\n\n const pos = this.pmView.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n });\n\n if (!pos || pos.inside === -1) {\n const evt = this.createSyntheticEvent(event);\n // console.log(\"dispatch fake drop\");\n this.pmView.dom.dispatchEvent(evt);\n }\n };\n\n /**\n * If the event is outside the editor contents,\n * we dispatch a fake event, so that we can still drop the content\n * when dragging / dropping to the side of the editor\n */\n onDragOver = (event: DragEvent) => {\n if (\n (event as any).synthetic ||\n !event.dataTransfer?.types.includes(\"blocknote/html\")\n ) {\n return;\n }\n const pos = this.pmView.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n });\n\n if (!pos || (pos.inside === -1 && this.pmView.dom.firstChild)) {\n const evt = this.createSyntheticEvent(event);\n // console.log(\"dispatch fake dragover\");\n this.pmView.dom.dispatchEvent(evt);\n }\n };\n\n onKeyDown = (_event: KeyboardEvent) => {\n if (this.state?.show && this.editor.isFocused()) {\n // Typing in editor should hide side menu\n this.state.show = false;\n this.emitUpdate(this.state);\n }\n };\n\n onMouseMove = (event: MouseEvent) => {\n if (this.menuFrozen) {\n return;\n }\n\n this.mousePos = { x: event.clientX, y: event.clientY };\n\n // We want the full area of the editor to check if the cursor is hovering\n // above it though.\n const editorOuterBoundingBox = this.pmView.dom.getBoundingClientRect();\n const cursorWithinEditor =\n this.mousePos.x > editorOuterBoundingBox.left &&\n this.mousePos.x < editorOuterBoundingBox.right &&\n this.mousePos.y > editorOuterBoundingBox.top &&\n this.mousePos.y < editorOuterBoundingBox.bottom;\n\n // TODO: remove parentElement, but then we need to remove padding from boundingbox or find a different solution\n const editorWrapper = this.pmView.dom!.parentElement!;\n\n // Doesn't update if the mouse hovers an element that's over the editor but\n // isn't a part of it or the side menu.\n if (\n // Cursor is within the editor area\n cursorWithinEditor &&\n // An element is hovered\n event &&\n event.target &&\n // Element is outside the editor\n !(\n editorWrapper === event.target ||\n editorWrapper.contains(event.target as HTMLElement)\n )\n ) {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate(this.state);\n }\n\n return;\n }\n\n this.updateStateFromMousePos();\n };\n\n private createSyntheticEvent(event: DragEvent) {\n const evt = new Event(event.type, event) as any;\n const editorBoundingBox = (\n this.pmView.dom.firstChild as HTMLElement\n ).getBoundingClientRect();\n evt.clientX = event.clientX;\n evt.clientY = event.clientY;\n if (\n event.clientX < editorBoundingBox.left &&\n event.clientX >\n editorBoundingBox.left -\n editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP\n ) {\n // when we're slightly left of the editor, we can drop to the side of the block\n evt.clientX =\n editorBoundingBox.left +\n (editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) /\n 2;\n } else if (\n event.clientX > editorBoundingBox.right &&\n event.clientX <\n editorBoundingBox.right +\n editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP\n ) {\n // when we're slightly right of the editor, we can drop to the side of the block\n evt.clientX =\n editorBoundingBox.right -\n (editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) /\n 2;\n } else if (\n event.clientX < editorBoundingBox.left ||\n event.clientX > editorBoundingBox.right\n ) {\n // when mouse is outside of the editor on x axis, drop it somewhere safe (but not to the side of a block)\n evt.clientX =\n editorBoundingBox.left +\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP *\n editorBoundingBox.width *\n 2; // put it somewhere in first block, but safe outside of the PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP margin\n }\n\n evt.clientY = Math.min(\n Math.max(event.clientY, editorBoundingBox.top),\n editorBoundingBox.top + editorBoundingBox.height\n );\n\n evt.dataTransfer = event.dataTransfer;\n evt.preventDefault = () => event.preventDefault();\n evt.synthetic = true; // prevent recursion\n return evt;\n }\n\n // Needed in cases where the editor state updates without the mouse cursor\n // moving, as some state updates can require a side menu update. For example,\n // adding a button to the side menu which removes the block can cause the\n // block below to jump up into the place of the removed block when clicked,\n // allowing the user to click the button again without moving the cursor. This\n // would otherwise not update the side menu, and so clicking the button again\n // would attempt to remove the same block again, causing an error.\n update(_view: EditorView, prevState: EditorState) {\n const docChanged = !prevState.doc.eq(this.pmView.state.doc);\n if (docChanged && this.state?.show) {\n this.updateStateFromMousePos();\n }\n }\n\n destroy() {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate(this.state);\n }\n this.pmView.root.removeEventListener(\n \"mousemove\",\n this.onMouseMove as EventListener,\n true\n );\n this.pmView.root.removeEventListener(\n \"dragover\",\n this.onDragOver as EventListener\n );\n\n this.pmView.root.removeEventListener(\n \"drop\",\n this.onDrop as EventListener,\n true\n );\n this.pmView.root.removeEventListener(\n \"keydown\",\n this.onKeyDown as EventListener,\n true\n );\n }\n}\n\nexport const sideMenuPluginKey = new PluginKey(\"SideMenuPlugin\");\n\nexport class SideMenuProsemirrorPlugin<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n public view: SideMenuView<BSchema, I, S> | undefined;\n public readonly plugin: Plugin;\n\n constructor(private readonly editor: BlockNoteEditor<BSchema, I, S>) {\n super();\n this.plugin = new Plugin({\n key: sideMenuPluginKey,\n view: (editorView) => {\n this.view = new SideMenuView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n });\n }\n\n public onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void) {\n return this.on(\"update\", callback);\n }\n\n /**\n * Handles drag & drop events for blocks.\n */\n blockDragStart = (\n event: {\n dataTransfer: DataTransfer | null;\n clientY: number;\n },\n block: Block<BSchema, I, S>\n ) => {\n dragStart(event, block, this.editor);\n };\n\n /**\n * Handles drag & drop events for blocks.\n */\n blockDragEnd = () => unsetDragImage(this.editor.prosemirrorView.root);\n /**\n * Freezes the side menu. When frozen, the side menu will stay\n * attached to the same block regardless of which block is hovered by the\n * mouse cursor.\n */\n freezeMenu = () => (this.view!.menuFrozen = true);\n /**\n * Unfreezes the side menu. When frozen, the side menu will stay\n * attached to the same block regardless of which block is hovered by the\n * mouse cursor.\n */\n unfreezeMenu = () => {\n this.view!.menuFrozen = false;\n this.view!.state!.show = false;\n this.view!.emitUpdate(this.view!.state!);\n };\n}\n","import { findParentNode } from \"@tiptap/core\";\nimport { EditorState, Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet, EditorView } from \"prosemirror-view\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nconst findBlock = findParentNode((node) => node.type.name === \"blockContainer\");\n\nexport type SuggestionMenuState = UiElementPosition & {\n query: string;\n ignoreQueryLength?: boolean;\n};\n\nclass SuggestionMenuView<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> {\n public state?: SuggestionMenuState;\n public emitUpdate: (triggerCharacter: string) => void;\n private rootEl?: Document | ShadowRoot;\n pluginState: SuggestionPluginState;\n\n constructor(\n private readonly editor: BlockNoteEditor<BSchema, I, S>,\n emitUpdate: (menuName: string, state: SuggestionMenuState) => void\n ) {\n this.pluginState = undefined;\n\n this.emitUpdate = (menuName: string) => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized suggestions menu\");\n }\n\n emitUpdate(menuName, {\n ...this.state,\n ignoreQueryLength: this.pluginState?.ignoreQueryLength,\n });\n };\n\n this.rootEl = this.editor._tiptapEditor.view.root;\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n this.rootEl.addEventListener(\"scroll\", this.handleScroll, true);\n }\n\n handleScroll = () => {\n if (this.state?.show) {\n const decorationNode = this.rootEl?.querySelector(\n `[data-decoration-id=\"${this.pluginState!.decorationId}\"]`\n );\n if (!decorationNode) {\n return;\n }\n this.state.referencePos = decorationNode.getBoundingClientRect();\n this.emitUpdate(this.pluginState!.triggerCharacter!);\n }\n };\n\n update(view: EditorView, prevState: EditorState) {\n const prev: SuggestionPluginState =\n suggestionMenuPluginKey.getState(prevState);\n const next: SuggestionPluginState = suggestionMenuPluginKey.getState(\n view.state\n );\n\n // See how the state changed\n const started = prev === undefined && next !== undefined;\n const stopped = prev !== undefined && next === undefined;\n const changed = prev !== undefined && next !== undefined;\n\n // Cancel when suggestion isn't active\n if (!started && !changed && !stopped) {\n return;\n }\n\n this.pluginState = stopped ? prev : next;\n\n if (stopped || !this.editor.isEditable) {\n this.state!.show = false;\n this.emitUpdate(this.pluginState!.triggerCharacter);\n\n return;\n }\n\n const decorationNode = this.rootEl?.querySelector(\n `[data-decoration-id=\"${this.pluginState!.decorationId}\"]`\n );\n\n if (this.editor.isEditable && decorationNode) {\n this.state = {\n show: true,\n referencePos: decorationNode.getBoundingClientRect(),\n query: this.pluginState!.query,\n };\n\n this.emitUpdate(this.pluginState!.triggerCharacter!);\n }\n }\n\n destroy() {\n this.rootEl?.removeEventListener(\"scroll\", this.handleScroll, true);\n }\n\n closeMenu = () => {\n this.editor.dispatch(\n this.editor._tiptapEditor.view.state.tr.setMeta(\n suggestionMenuPluginKey,\n null\n )\n );\n };\n\n clearQuery = () => {\n if (this.pluginState === undefined) {\n return;\n }\n\n this.editor._tiptapEditor\n .chain()\n .focus()\n .deleteRange({\n from:\n this.pluginState.queryStartPos! -\n (this.pluginState.deleteTriggerCharacter\n ? this.pluginState.triggerCharacter!.length\n : 0),\n to: this.editor._tiptapEditor.state.selection.from,\n })\n .run();\n };\n}\n\ntype SuggestionPluginState =\n | {\n triggerCharacter: string;\n deleteTriggerCharacter: boolean;\n queryStartPos: number;\n query: string;\n decorationId: string;\n ignoreQueryLength?: boolean;\n }\n | undefined;\n\nconst suggestionMenuPluginKey = new PluginKey(\"SuggestionMenuPlugin\");\n\n/**\n * A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.\n *\n * This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.\n *\n * This version is adapted from the aforementioned version in the following ways:\n * - This version supports generic items instead of only strings (to allow for more advanced filtering for example)\n * - This version hides some unnecessary complexity from the user of the plugin.\n * - This version handles key events differently\n */\nexport class SuggestionMenuProseMirrorPlugin<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: SuggestionMenuView<BSchema, I, S> | undefined;\n public readonly plugin: Plugin;\n\n private triggerCharacters: string[] = [];\n\n constructor(editor: BlockNoteEditor<BSchema, I, S>) {\n super();\n const triggerCharacters = this.triggerCharacters;\n this.plugin = new Plugin({\n key: suggestionMenuPluginKey,\n\n view: () => {\n this.view = new SuggestionMenuView<BSchema, I, S>(\n editor,\n (triggerCharacter, state) => {\n this.emit(`update ${triggerCharacter}`, state);\n }\n );\n return this.view;\n },\n\n state: {\n // Initialize the plugin's internal state.\n init(): SuggestionPluginState {\n return undefined;\n },\n\n // Apply changes to the plugin state from an editor transaction.\n apply(transaction, prev, _oldState, newState): SuggestionPluginState {\n // TODO: More clearly define which transactions should be ignored.\n if (transaction.getMeta(\"orderedListIndexing\") !== undefined) {\n return prev;\n }\n\n // Ignore transactions in code blocks.\n if (transaction.selection.$from.parent.type.spec.code) {\n return prev;\n }\n\n // Either contains the trigger character if the menu should be shown,\n // or null if it should be hidden.\n const suggestionPluginTransactionMeta: {\n triggerCharacter: string;\n deleteTriggerCharacter?: boolean;\n ignoreQueryLength?: boolean;\n } | null = transaction.getMeta(suggestionMenuPluginKey);\n\n // Only opens a menu of no menu is already open\n if (\n typeof suggestionPluginTransactionMeta === \"object\" &&\n suggestionPluginTransactionMeta !== null &&\n prev === undefined\n ) {\n return {\n triggerCharacter:\n suggestionPluginTransactionMeta.triggerCharacter,\n deleteTriggerCharacter:\n suggestionPluginTransactionMeta.deleteTriggerCharacter !==\n false,\n queryStartPos: newState.selection.from,\n query: \"\",\n decorationId: `id_${Math.floor(Math.random() * 0xffffffff)}`,\n ignoreQueryLength:\n suggestionPluginTransactionMeta?.ignoreQueryLength,\n };\n }\n\n // Checks if the menu is hidden, in which case it doesn't need to be hidden or updated.\n if (prev === undefined) {\n return prev;\n }\n\n // Checks if the menu should be hidden.\n if (\n // Highlighting text should hide the menu.\n newState.selection.from !== newState.selection.to ||\n // Transactions with plugin metadata should hide the menu.\n suggestionPluginTransactionMeta === null ||\n // Certain mouse events should hide the menu.\n // TODO: Change to global mousedown listener.\n transaction.getMeta(\"focus\") ||\n transaction.getMeta(\"blur\") ||\n transaction.getMeta(\"pointer\") ||\n // Moving the caret before the character which triggered the menu should hide it.\n (prev.triggerCharacter !== undefined &&\n newState.selection.from < prev.queryStartPos!)\n ) {\n return undefined;\n }\n\n const next = { ...prev };\n\n // Updates the current query.\n next.query = newState.doc.textBetween(\n prev.queryStartPos!,\n newState.selection.from\n );\n\n return next;\n },\n },\n\n props: {\n handleTextInput(view, _from, _to, text) {\n const suggestionPluginState: SuggestionPluginState = (\n this as Plugin\n ).getState(view.state);\n\n if (\n triggerCharacters.includes(text) &&\n suggestionPluginState === undefined\n ) {\n view.dispatch(\n view.state.tr\n .insertText(text)\n .scrollIntoView()\n .setMeta(suggestionMenuPluginKey, {\n triggerCharacter: text,\n })\n );\n\n return true;\n }\n return false;\n },\n\n // Setup decorator on the currently active suggestion.\n decorations(state) {\n const suggestionPluginState: SuggestionPluginState = (\n this as Plugin\n ).getState(state);\n\n if (suggestionPluginState === undefined) {\n return null;\n }\n\n // If the menu was opened programmatically by another extension, it may not use a trigger character. In this\n // case, the decoration is set on the whole block instead, as the decoration range would otherwise be empty.\n if (!suggestionPluginState.deleteTriggerCharacter) {\n const blockNode = findBlock(state.selection);\n if (blockNode) {\n return DecorationSet.create(state.doc, [\n Decoration.node(\n blockNode.pos,\n blockNode.pos + blockNode.node.nodeSize,\n {\n nodeName: \"span\",\n class: \"bn-suggestion-decorator\",\n \"data-decoration-id\": suggestionPluginState.decorationId,\n }\n ),\n ]);\n }\n }\n // Creates an inline decoration around the trigger character.\n return DecorationSet.create(state.doc, [\n Decoration.inline(\n suggestionPluginState.queryStartPos! -\n suggestionPluginState.triggerCharacter!.length,\n suggestionPluginState.queryStartPos!,\n {\n nodeName: \"span\",\n class: \"bn-suggestion-decorator\",\n \"data-decoration-id\": suggestionPluginState.decorationId,\n }\n ),\n ]);\n },\n },\n });\n }\n\n public onUpdate(\n triggerCharacter: string,\n callback: (state: SuggestionMenuState) => void\n ) {\n if (!this.triggerCharacters.includes(triggerCharacter)) {\n this.addTriggerCharacter(triggerCharacter);\n }\n // TODO: be able to remove the triggerCharacter\n return this.on(`update ${triggerCharacter}`, callback);\n }\n\n addTriggerCharacter = (triggerCharacter: string) => {\n this.triggerCharacters.push(triggerCharacter);\n };\n\n // TODO: Should this be called automatically when listeners are removed?\n removeTriggerCharacter = (triggerCharacter: string) => {\n this.triggerCharacters = this.triggerCharacters.filter(\n (c) => c !== triggerCharacter\n );\n };\n\n closeMenu = () => this.view!.closeMenu();\n\n clearQuery = () => this.view!.clearQuery();\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n}\n\nexport function createSuggestionMenu<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>, triggerCharacter: string) {\n editor.suggestionMenus.addTriggerCharacter(triggerCharacter);\n}\n","import { Plugin, PluginKey, PluginView } from \"prosemirror-state\";\nimport { Decoration, DecorationSet, EditorView } from \"prosemirror-view\";\nimport { nodeToBlock } from \"../../api/nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../api/nodeUtil.js\";\nimport { checkBlockIsDefaultType } from \"../../blocks/defaultBlockTypeGuards.js\";\nimport { DefaultBlockSchema } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfigNoChildren,\n BlockSchemaWithBlock,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\nimport { getDraggableBlockFromElement } from \"../getDraggableBlockFromElement.js\";\n\nlet dragImageElement: HTMLElement | undefined;\n\nexport type TableHandlesState<\n I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n show: boolean;\n showAddOrRemoveRowsButton: boolean;\n showAddOrRemoveColumnsButton: boolean;\n referencePosCell: DOMRect | undefined;\n referencePosTable: DOMRect;\n\n block: BlockFromConfigNoChildren<DefaultBlockSchema[\"table\"], I, S>;\n colIndex: number | undefined;\n rowIndex: number | undefined;\n\n draggingState:\n | {\n draggedCellOrientation: \"row\" | \"col\";\n originalIndex: number;\n mousePos: number;\n }\n | undefined;\n\n widgetContainer: HTMLElement | undefined;\n};\n\nfunction setHiddenDragImage(rootEl: Document | ShadowRoot) {\n if (dragImageElement) {\n return;\n }\n\n dragImageElement = document.createElement(\"div\");\n dragImageElement.innerHTML = \"_\";\n dragImageElement.style.opacity = \"0\";\n dragImageElement.style.height = \"1px\";\n dragImageElement.style.width = \"1px\";\n if (rootEl instanceof Document) {\n rootEl.body.appendChild(dragImageElement);\n } else {\n rootEl.appendChild(dragImageElement);\n }\n}\n\nfunction unsetHiddenDragImage(rootEl: Document | ShadowRoot) {\n if (dragImageElement) {\n if (rootEl instanceof Document) {\n rootEl.body.removeChild(dragImageElement);\n } else {\n rootEl.removeChild(dragImageElement);\n }\n dragImageElement = undefined;\n }\n}\n\nfunction getChildIndex(node: Element) {\n return Array.prototype.indexOf.call(node.parentElement!.childNodes, node);\n}\n\n// Finds the DOM element corresponding to the table cell that the target element\n// is currently in. If the target element is not in a table cell, returns null.\nfunction domCellAround(target: Element) {\n let currentTarget: Element | undefined = target;\n while (\n currentTarget &&\n currentTarget.nodeName !== \"TD\" &&\n currentTarget.nodeName !== \"TH\" &&\n !currentTarget.classList.contains(\"tableWrapper\")\n ) {\n if (currentTarget.classList.contains(\"ProseMirror\")) {\n return undefined;\n }\n const parent: ParentNode | null = currentTarget.parentNode;\n\n if (!parent || !(parent instanceof Element)) {\n return undefined;\n }\n currentTarget = parent;\n }\n\n return currentTarget.nodeName === \"TD\" || currentTarget.nodeName === \"TH\"\n ? {\n type: \"cell\",\n domNode: currentTarget,\n tbodyNode: currentTarget.closest(\"tbody\"),\n }\n : {\n type: \"wrapper\",\n domNode: currentTarget,\n tbodyNode: currentTarget.querySelector(\"tbody\"),\n };\n}\n\n// Hides elements in the DOMwith the provided class names.\nfunction hideElements(selector: string, rootEl: Document | ShadowRoot) {\n const elementsToHide = rootEl.querySelectorAll(selector);\n\n for (let i = 0; i < elementsToHide.length; i++) {\n (elementsToHide[i] as HTMLElement).style.visibility = \"hidden\";\n }\n}\n\nexport class TableHandlesView<\n I extends InlineContentSchema,\n S extends StyleSchema\n> implements PluginView\n{\n public state?: TableHandlesState<I, S>;\n public emitUpdate: () => void;\n\n public tableId: string | undefined;\n public tablePos: number | undefined;\n public tableElement: HTMLElement | undefined;\n\n public menuFrozen = false;\n\n public mouseState: \"up\" | \"down\" | \"selecting\" = \"up\";\n\n public prevWasEditable: boolean | null = null;\n\n constructor(\n private readonly editor: BlockNoteEditor<\n BlockSchemaWithBlock<\"table\", DefaultBlockSchema[\"table\"]>,\n I,\n S\n >,\n private readonly pmView: EditorView,\n emitUpdate: (state: TableHandlesState<I, S>) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized image toolbar\");\n }\n\n emitUpdate(this.state);\n };\n\n pmView.dom.addEventListener(\"mousemove\", this.mouseMoveHandler);\n pmView.dom.addEventListener(\"mousedown\", this.viewMousedownHandler);\n window.addEventListener(\"mouseup\", this.mouseUpHandler);\n\n pmView.root.addEventListener(\n \"dragover\",\n this.dragOverHandler as EventListener\n );\n pmView.root.addEventListener(\"drop\", this.dropHandler as EventListener);\n }\n\n viewMousedownHandler = () => {\n this.mouseState = \"down\";\n };\n\n mouseUpHandler = (event: MouseEvent) => {\n this.mouseState = \"up\";\n this.mouseMoveHandler(event);\n };\n\n mouseMoveHandler = (event: MouseEvent) => {\n if (this.menuFrozen) {\n return;\n }\n\n if (this.mouseState === \"selecting\") {\n return;\n }\n\n if (\n !(event.target instanceof Element) ||\n !this.pmView.dom.contains(event.target)\n ) {\n return;\n }\n\n const target = domCellAround(event.target);\n\n if (\n target?.type === \"cell\" &&\n this.mouseState === \"down\" &&\n !this.state?.draggingState\n ) {\n // hide draghandles when selecting text as they could be in the way of the user\n this.mouseState = \"selecting\";\n\n if (this.state?.show) {\n this.state.show = false;\n this.state.showAddOrRemoveRowsButton = false;\n this.state.showAddOrRemoveColumnsButton = false;\n this.emitUpdate();\n }\n return;\n }\n\n if (!target || !this.editor.isEditable) {\n if (this.state?.show) {\n this.state.show = false;\n this.state.showAddOrRemoveRowsButton = false;\n this.state.showAddOrRemoveColumnsButton = false;\n this.emitUpdate();\n }\n return;\n }\n\n if (!target.tbodyNode) {\n return;\n }\n\n const tableRect = target.tbodyNode.getBoundingClientRect();\n\n const blockEl = getDraggableBlockFromElement(target.domNode, this.pmView);\n if (!blockEl) {\n return;\n }\n this.tableElement = blockEl.node;\n\n let tableBlock:\n | BlockFromConfigNoChildren<DefaultBlockSchema[\"table\"], I, S>\n | undefined;\n\n const pmNodeInfo = getNodeById(\n blockEl.id,\n this.editor._tiptapEditor.state.doc\n );\n\n const block = nodeToBlock(\n pmNodeInfo.node,\n this.editor.schema.blockSchema,\n this.editor.schema.inlineContentSchema,\n this.editor.schema.styleSchema,\n this.editor.blockCache\n );\n\n if (checkBlockIsDefaultType(\"table\", block, this.editor)) {\n this.tablePos = pmNodeInfo.posBeforeNode + 1;\n tableBlock = block;\n }\n\n if (!tableBlock) {\n return;\n }\n\n this.tableId = blockEl.id;\n const widgetContainer = target.domNode\n .closest(\".tableWrapper\")\n ?.querySelector(\".table-widgets-container\") as HTMLElement;\n\n if (target?.type === \"wrapper\") {\n // if we're just to the right or below the table, show the extend buttons\n // (this is a bit hacky. It would probably be cleaner to render the extend buttons in the Table NodeView instead)\n const belowTable =\n event.clientY >= tableRect.bottom - 1 && // -1 to account for fractions of pixels in \"bottom\"\n event.clientY < tableRect.bottom + 20;\n const toRightOfTable =\n event.clientX >= tableRect.right - 1 &&\n event.clientX < tableRect.right + 20;\n\n // without this check, we'd also hide draghandles when hovering over them\n const hideHandles =\n event.clientX > tableRect.right || event.clientY > tableRect.bottom;\n\n this.state = {\n ...this.state!,\n show: true,\n showAddOrRemoveRowsButton: belowTable,\n showAddOrRemoveColumnsButton: toRightOfTable,\n referencePosTable: tableRect,\n block: tableBlock,\n widgetContainer,\n colIndex: hideHandles ? undefined : this.state!.colIndex,\n rowIndex: hideHandles ? undefined : this.state!.rowIndex,\n referencePosCell: hideHandles\n ? undefined\n : this.state!.referencePosCell,\n };\n } else {\n const colIndex = getChildIndex(target.domNode);\n const rowIndex = getChildIndex(target.domNode.parentElement!);\n const cellRect = target.domNode.getBoundingClientRect();\n\n if (\n this.state !== undefined &&\n this.state.show &&\n this.tableId === blockEl.id &&\n this.state.rowIndex === rowIndex &&\n this.state.colIndex === colIndex\n ) {\n // no update needed\n return;\n }\n\n this.state = {\n show: true,\n showAddOrRemoveColumnsButton:\n colIndex === tableBlock.content.rows[0].cells.length - 1,\n showAddOrRemoveRowsButton:\n rowIndex === tableBlock.content.rows.length - 1,\n referencePosTable: tableRect,\n\n block: tableBlock,\n draggingState: undefined,\n referencePosCell: cellRect,\n colIndex: colIndex,\n rowIndex: rowIndex,\n\n widgetContainer,\n };\n }\n this.emitUpdate();\n\n return false;\n };\n\n dragOverHandler = (event: DragEvent) => {\n if (this.state?.draggingState === undefined) {\n return;\n }\n\n event.preventDefault();\n event.dataTransfer!.dropEffect = \"move\";\n\n hideElements(\n \".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline\",\n this.pmView.root\n );\n\n // The mouse cursor coordinates, bounded to the table's bounding box. The\n // bounding box is shrunk by 1px on each side to ensure that the bounded\n // coordinates are always inside a table cell.\n const boundedMouseCoords = {\n left: Math.min(\n Math.max(event.clientX, this.state.referencePosTable.left + 1),\n this.state.referencePosTable.right - 1\n ),\n top: Math.min(\n Math.max(event.clientY, this.state.referencePosTable.top + 1),\n this.state.referencePosTable.bottom - 1\n ),\n };\n\n // Gets the table cell element that the bounded mouse cursor coordinates lie\n // in.\n const tableCellElements = this.pmView.root\n .elementsFromPoint(boundedMouseCoords.left, boundedMouseCoords.top)\n .filter(\n (element) => element.tagName === \"TD\" || element.tagName === \"TH\"\n );\n if (tableCellElements.length === 0) {\n throw new Error(\n \"Could not find table cell element that the mouse cursor is hovering over.\"\n );\n }\n const tableCellElement = tableCellElements[0];\n\n let emitStateUpdate = false;\n\n // Gets current row and column index.\n const rowIndex = getChildIndex(tableCellElement.parentElement!);\n const colIndex = getChildIndex(tableCellElement);\n\n // Checks if the drop cursor needs to be updated. This affects decorations\n // only so it doesn't trigger a state update.\n const oldIndex =\n this.state.draggingState.draggedCellOrientation === \"row\"\n ? this.state.rowIndex\n : this.state.colIndex;\n const newIndex =\n this.state.draggingState.draggedCellOrientation === \"row\"\n ? rowIndex\n : colIndex;\n const dispatchDecorationsTransaction = newIndex !== oldIndex;\n\n // Checks if either the hovered cell has changed and updates the row and\n // column index. Also updates the reference DOMRect.\n if (this.state.rowIndex !== rowIndex || this.state.colIndex !== colIndex) {\n this.state.rowIndex = rowIndex;\n this.state.colIndex = colIndex;\n\n this.state.referencePosCell = tableCellElement.getBoundingClientRect();\n\n emitStateUpdate = true;\n }\n\n // Checks if the mouse cursor position along the axis that the user is\n // dragging on has changed and updates it.\n const mousePos =\n this.state.draggingState.draggedCellOrientation === \"row\"\n ? boundedMouseCoords.top\n : boundedMouseCoords.left;\n if (this.state.draggingState.mousePos !== mousePos) {\n this.state.draggingState.mousePos = mousePos;\n\n emitStateUpdate = true;\n }\n\n // Emits a state update if any of the fields have changed.\n if (emitStateUpdate) {\n this.emitUpdate();\n }\n\n // Dispatches a dummy transaction to force a decorations update if\n // necessary.\n if (dispatchDecorationsTransaction) {\n this.editor.dispatch(\n this.pmView.state.tr.setMeta(tableHandlesPluginKey, true)\n );\n }\n };\n\n dropHandler = (event: DragEvent) => {\n this.mouseState = \"up\";\n if (this.state === undefined || this.state.draggingState === undefined) {\n return;\n }\n\n if (\n this.state.rowIndex === undefined ||\n this.state.colIndex === undefined\n ) {\n throw new Error(\n \"Attempted to drop table row or column, but no table block was hovered prior.\"\n );\n }\n\n event.preventDefault();\n\n const { draggingState, colIndex, rowIndex } = this.state;\n\n const rows = this.state.block.content.rows;\n\n if (draggingState.draggedCellOrientation === \"row\") {\n const rowToMove = rows[draggingState.originalIndex];\n rows.splice(draggingState.originalIndex, 1);\n rows.splice(rowIndex, 0, rowToMove);\n } else {\n const cellsToMove = rows.map(\n (row) => row.cells[draggingState.originalIndex]\n );\n rows.forEach((row, rowIndex) => {\n row.cells.splice(draggingState.originalIndex, 1);\n row.cells.splice(colIndex, 0, cellsToMove[rowIndex]);\n });\n }\n\n this.editor.updateBlock(this.state.block, {\n type: \"table\",\n content: {\n type: \"tableContent\",\n rows: rows,\n },\n });\n\n // Have to reset text cursor position to the block as `updateBlock` moves\n // the existing selection out of the block.\n this.editor.setTextCursorPosition(this.state.block.id);\n };\n // Updates drag handle positions on table content updates.\n update() {\n if (!this.state || !this.state.show) {\n return;\n }\n\n const tableBody = this.tableElement!.querySelector(\"tbody\");\n if (!tableBody) {\n return;\n }\n\n if (\n this.state.rowIndex !== undefined &&\n this.state.colIndex !== undefined\n ) {\n // If rows or columns are deleted in the update, the hovered indices for\n // those may now be out of bounds. If this is the case, they are moved to\n // the new last row or column.\n if (this.state.rowIndex >= tableBody.children.length) {\n this.state.rowIndex = tableBody.children.length - 1;\n }\n if (this.state.colIndex >= tableBody.children[0].children.length) {\n this.state.colIndex = tableBody.children[0].children.length - 1;\n }\n\n const row = tableBody.children[this.state.rowIndex];\n const cell = row.children[this.state.colIndex];\n this.state.referencePosCell = cell.getBoundingClientRect();\n }\n\n this.state.block = this.editor.getBlock(this.state.block.id)!;\n this.state.referencePosTable = tableBody.getBoundingClientRect();\n this.emitUpdate();\n }\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mousemove\", this.mouseMoveHandler);\n window.removeEventListener(\"mouseup\", this.mouseUpHandler);\n this.pmView.dom.removeEventListener(\"mousedown\", this.viewMousedownHandler);\n this.pmView.root.removeEventListener(\n \"dragover\",\n this.dragOverHandler as EventListener\n );\n this.pmView.root.removeEventListener(\n \"drop\",\n this.dropHandler as EventListener\n );\n }\n}\n\nexport const tableHandlesPluginKey = new PluginKey(\"TableHandlesPlugin\");\n\nexport class TableHandlesProsemirrorPlugin<\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: TableHandlesView<I, S> | undefined;\n public readonly plugin: Plugin;\n\n constructor(\n private readonly editor: BlockNoteEditor<\n BlockSchemaWithBlock<\"table\", DefaultBlockSchema[\"table\"]>,\n I,\n S\n >\n ) {\n super();\n this.plugin = new Plugin({\n key: tableHandlesPluginKey,\n view: (editorView) => {\n this.view = new TableHandlesView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n // We use decorations to render the drop cursor when dragging a table row\n // or column. The decorations are updated in the `dragOverHandler` method.\n props: {\n decorations: (state) => {\n if (\n this.view === undefined ||\n this.view.state === undefined ||\n this.view.state.draggingState === undefined ||\n this.view.tablePos === undefined\n ) {\n return;\n }\n\n const newIndex =\n this.view.state.draggingState.draggedCellOrientation === \"row\"\n ? this.view.state.rowIndex\n : this.view.state.colIndex;\n\n if (newIndex === undefined) {\n return;\n }\n\n const decorations: Decoration[] = [];\n\n if (newIndex === this.view.state.draggingState.originalIndex) {\n return DecorationSet.create(state.doc, decorations);\n }\n\n // Gets the table to show the drop cursor in.\n const tableResolvedPos = state.doc.resolve(this.view.tablePos + 1);\n const tableNode = tableResolvedPos.node();\n\n if (this.view.state.draggingState.draggedCellOrientation === \"row\") {\n // Gets the row at the new index.\n const rowResolvedPos = state.doc.resolve(\n tableResolvedPos.posAtIndex(newIndex) + 1\n );\n const rowNode = rowResolvedPos.node();\n\n // Iterates over all cells in the row.\n for (let i = 0; i < rowNode.childCount; i++) {\n // Gets each cell in the row.\n const cellResolvedPos = state.doc.resolve(\n rowResolvedPos.posAtIndex(i) + 1\n );\n const cellNode = cellResolvedPos.node();\n\n // Creates a decoration at the start or end of each cell,\n // depending on whether the new index is before or after the\n // original index.\n const decorationPos =\n cellResolvedPos.pos +\n (newIndex > this.view.state.draggingState.originalIndex\n ? cellNode.nodeSize - 2\n : 0);\n decorations.push(\n // The widget is a small bar which spans the width of the cell.\n Decoration.widget(decorationPos, () => {\n const widget = document.createElement(\"div\");\n widget.className = \"bn-table-drop-cursor\";\n widget.style.left = \"0\";\n widget.style.right = \"0\";\n // This is only necessary because the drop indicator's height\n // is an even number of pixels, whereas the border between\n // table cells is an odd number of pixels. So this makes the\n // positioning slightly more consistent regardless of where\n // the row is being dropped.\n if (\n newIndex > this.view!.state!.draggingState!.originalIndex\n ) {\n widget.style.bottom = \"-2px\";\n } else {\n widget.style.top = \"-3px\";\n }\n widget.style.height = \"4px\";\n\n return widget;\n })\n );\n }\n } else {\n // Iterates over all rows in the table.\n for (let i = 0; i < tableNode.childCount; i++) {\n // Gets each row in the table.\n const rowResolvedPos = state.doc.resolve(\n tableResolvedPos.posAtIndex(i) + 1\n );\n\n // Gets the cell at the new index in the row.\n const cellResolvedPos = state.doc.resolve(\n rowResolvedPos.posAtIndex(newIndex) + 1\n );\n const cellNode = cellResolvedPos.node();\n\n // Creates a decoration at the start or end of each cell,\n // depending on whether the new index is before or after the\n // original index.\n const decorationPos =\n cellResolvedPos.pos +\n (newIndex > this.view.state.draggingState.originalIndex\n ? cellNode.nodeSize - 2\n : 0);\n\n decorations.push(\n // The widget is a small bar which spans the height of the cell.\n Decoration.widget(decorationPos, () => {\n const widget = document.createElement(\"div\");\n widget.className = \"bn-table-drop-cursor\";\n widget.style.top = \"0\";\n widget.style.bottom = \"0\";\n // This is only necessary because the drop indicator's width\n // is an even number of pixels, whereas the border between\n // table cells is an odd number of pixels. So this makes the\n // positioning slightly more consistent regardless of where\n // the column is being dropped.\n if (\n newIndex > this.view!.state!.draggingState!.originalIndex\n ) {\n widget.style.right = \"-2px\";\n } else {\n widget.style.left = \"-3px\";\n }\n widget.style.width = \"4px\";\n\n return widget;\n })\n );\n }\n }\n\n return DecorationSet.create(state.doc, decorations);\n },\n },\n });\n }\n\n public onUpdate(callback: (state: TableHandlesState<I, S>) => void) {\n return this.on(\"update\", callback);\n }\n\n /**\n * Callback that should be set on the `dragStart` event for whichever element\n * is used as the column drag handle.\n */\n colDragStart = (event: {\n dataTransfer: DataTransfer | null;\n clientX: number;\n }) => {\n if (\n this.view!.state === undefined ||\n this.view!.state.colIndex === undefined\n ) {\n throw new Error(\n \"Attempted to drag table column, but no table block was hovered prior.\"\n );\n }\n\n this.view!.state.draggingState = {\n draggedCellOrientation: \"col\",\n originalIndex: this.view!.state.colIndex,\n mousePos: event.clientX,\n };\n this.view!.emitUpdate();\n\n this.editor.dispatch(\n this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, {\n draggedCellOrientation:\n this.view!.state.draggingState.draggedCellOrientation,\n originalIndex: this.view!.state.colIndex,\n newIndex: this.view!.state.colIndex,\n tablePos: this.view!.tablePos,\n })\n );\n\n setHiddenDragImage(this.editor._tiptapEditor.view.root);\n event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);\n event.dataTransfer!.effectAllowed = \"move\";\n };\n\n /**\n * Callback that should be set on the `dragStart` event for whichever element\n * is used as the row drag handle.\n */\n rowDragStart = (event: {\n dataTransfer: DataTransfer | null;\n clientY: number;\n }) => {\n if (\n this.view!.state === undefined ||\n this.view!.state.rowIndex === undefined\n ) {\n throw new Error(\n \"Attempted to drag table row, but no table block was hovered prior.\"\n );\n }\n\n this.view!.state.draggingState = {\n draggedCellOrientation: \"row\",\n originalIndex: this.view!.state.rowIndex,\n mousePos: event.clientY,\n };\n this.view!.emitUpdate();\n\n this.editor.dispatch(\n this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, {\n draggedCellOrientation:\n this.view!.state.draggingState.draggedCellOrientation,\n originalIndex: this.view!.state.rowIndex,\n newIndex: this.view!.state.rowIndex,\n tablePos: this.view!.tablePos,\n })\n );\n\n setHiddenDragImage(this.editor._tiptapEditor.view.root);\n event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);\n event.dataTransfer!.effectAllowed = \"copyMove\";\n };\n\n /**\n * Callback that should be set on the `dragEnd` event for both the element\n * used as the row drag handle, and the one used as the column drag handle.\n */\n dragEnd = () => {\n if (this.view!.state === undefined) {\n throw new Error(\n \"Attempted to drag table row, but no table block was hovered prior.\"\n );\n }\n\n this.view!.state.draggingState = undefined;\n this.view!.emitUpdate();\n\n this.editor.dispatch(\n this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, null)\n );\n\n unsetHiddenDragImage(this.editor._tiptapEditor.view.root);\n };\n\n /**\n * Freezes the drag handles. When frozen, they will stay attached to the same\n * cell regardless of which cell is hovered by the mouse cursor.\n */\n freezeHandles = () => {\n this.view!.menuFrozen = true;\n };\n\n /**\n * Unfreezes the drag handles. When frozen, they will stay attached to the\n * same cell regardless of which cell is hovered by the mouse cursor.\n */\n unfreezeHandles = () => {\n this.view!.menuFrozen = false;\n };\n}\n","export const acceptedMIMETypes = [\n \"vscode-editor-data\",\n \"blocknote/html\",\n \"Files\",\n \"text/html\",\n \"text/plain\",\n] as const;\n","import { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor\";\nimport {\n BlockSchema,\n FileBlockConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport {\n getBlockInfo,\n getNearestBlockContainerPos,\n} from \"../../getBlockInfoFromPos.js\";\nimport { acceptedMIMETypes } from \"./acceptedMIMETypes.js\";\n\nfunction checkFileExtensionsMatch(\n fileExtension1: string,\n fileExtension2: string\n) {\n if (!fileExtension1.startsWith(\".\") || !fileExtension2.startsWith(\".\")) {\n throw new Error(`The strings provided are not valid file extensions.`);\n }\n\n return fileExtension1 === fileExtension2;\n}\n\nfunction checkMIMETypesMatch(mimeType1: string, mimeType2: string) {\n const types1 = mimeType1.split(\"/\");\n const types2 = mimeType2.split(\"/\");\n\n if (types1.length !== 2) {\n throw new Error(`The string ${mimeType1} is not a valid MIME type.`);\n }\n if (types2.length !== 2) {\n throw new Error(`The string ${mimeType2} is not a valid MIME type.`);\n }\n\n if (types1[1] === \"*\" || types2[1] === \"*\") {\n return types1[0] === types2[0];\n }\n if (types1[0] === \"*\" || types2[0] === \"*\") {\n return types1[1] === types2[1];\n }\n\n return types1[0] === types2[0] && types1[1] === types2[1];\n}\n\nexport async function handleFileInsertion<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(event: DragEvent | ClipboardEvent, editor: BlockNoteEditor<BSchema, I, S>) {\n if (!editor.uploadFile) {\n return;\n }\n\n const dataTransfer =\n \"dataTransfer\" in event ? event.dataTransfer : event.clipboardData;\n if (dataTransfer === null) {\n return;\n }\n\n let format: (typeof acceptedMIMETypes)[number] | null = null;\n for (const mimeType of acceptedMIMETypes) {\n if (dataTransfer.types.includes(mimeType)) {\n format = mimeType;\n break;\n }\n }\n if (format !== \"Files\") {\n return;\n }\n\n const items = dataTransfer.items;\n if (!items) {\n return;\n }\n\n event.preventDefault();\n\n const fileBlockConfigs = Object.values(editor.schema.blockSchema).filter(\n (blockConfig) => blockConfig.isFileBlock\n ) as FileBlockConfig[];\n\n for (let i = 0; i < items.length; i++) {\n // Gets file block corresponding to MIME type.\n let fileBlockType = \"file\";\n for (const fileBlockConfig of fileBlockConfigs) {\n for (const mimeType of fileBlockConfig.fileBlockAccept || []) {\n const isFileExtension = mimeType.startsWith(\".\");\n const file = items[i].getAsFile();\n\n if (file) {\n if (\n (!isFileExtension &&\n file.type &&\n checkMIMETypesMatch(items[i].type, mimeType)) ||\n (isFileExtension &&\n checkFileExtensionsMatch(\n \".\" + file.name.split(\".\").pop(),\n mimeType\n ))\n ) {\n fileBlockType = fileBlockConfig.type;\n break;\n }\n }\n }\n }\n\n const file = items[i].getAsFile();\n if (file) {\n const fileBlock = {\n type: fileBlockType,\n props: {\n name: file.name,\n },\n } as PartialBlock<BSchema, I, S>;\n\n let insertedBlockId: string | undefined = undefined;\n\n if (event.type === \"paste\") {\n insertedBlockId = editor.insertBlocks(\n [fileBlock],\n editor.getTextCursorPosition().block,\n \"after\"\n )[0].id;\n } else if (event.type === \"drop\") {\n const coords = {\n left: (event as DragEvent).clientX,\n top: (event as DragEvent).clientY,\n };\n\n const pos = editor._tiptapEditor.view.posAtCoords(coords);\n if (!pos) {\n return;\n }\n\n const posInfo = getNearestBlockContainerPos(\n editor._tiptapEditor.state.doc,\n pos.pos\n );\n\n const blockInfo = getBlockInfo(posInfo);\n\n insertedBlockId = editor.insertBlocks(\n [fileBlock],\n blockInfo.bnBlock.node.attrs.id,\n \"after\"\n )[0].id;\n } else {\n return;\n }\n\n const updateData = await editor.uploadFile(file, insertedBlockId);\n\n const updatedFileBlock =\n typeof updateData === \"string\"\n ? ({\n props: {\n url: updateData,\n },\n } as PartialBlock<BSchema, I, S>)\n : { ...updateData };\n\n editor.updateBlock(insertedBlockId, updatedFileBlock);\n }\n }\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"prosemirror-state\";\n\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { acceptedMIMETypes } from \"./acceptedMIMETypes.js\";\nimport { handleFileInsertion } from \"./handleFileInsertion.js\";\n\nexport const createDropFileExtension = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>\n) =>\n Extension.create<{ editor: BlockNoteEditor<BSchema, I, S> }, undefined>({\n name: \"dropFile\",\n addProseMirrorPlugins() {\n return [\n new Plugin({\n props: {\n handleDOMEvents: {\n drop(_view, event) {\n if (!editor.isEditable) {\n return;\n }\n\n let format: (typeof acceptedMIMETypes)[number] | null = null;\n for (const mimeType of acceptedMIMETypes) {\n if (event.dataTransfer!.types.includes(mimeType)) {\n format = mimeType;\n break;\n }\n }\n if (format === null) {\n return true;\n }\n\n if (format === \"Files\") {\n handleFileInsertion(event, editor);\n return true;\n }\n\n return false;\n },\n },\n },\n }),\n ];\n },\n });\n","import { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\n\nexport async function handleVSCodePaste<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(event: ClipboardEvent, editor: BlockNoteEditor<BSchema, I, S>) {\n const view = editor.prosemirrorView;\n const { schema } = view.state;\n\n if (!event.clipboardData) {\n return false;\n }\n\n const text = event.clipboardData!.getData(\"text/plain\");\n const vscode = event.clipboardData!.getData(\"vscode-editor-data\");\n const vscodeData = vscode ? JSON.parse(vscode) : undefined;\n const language = vscodeData?.mode;\n\n if (!text) {\n return false;\n }\n\n if (!schema.nodes.codeBlock) {\n view.pasteText(text);\n\n return true;\n }\n\n if (!language) {\n return false;\n }\n\n // strip carriage return chars from text pasted as code\n // see: https://github.com/ProseMirror/prosemirror-view/commit/a50a6bcceb4ce52ac8fcc6162488d8875613aacd\n editor._tiptapEditor.view.pasteHTML(\n `<pre><code class=\"language-${language}\">${text.replace(\n /\\r\\n?/g,\n \"\\n\"\n )}</code></pre>`\n );\n\n return true;\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"prosemirror-state\";\n\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { nestedListsToBlockNoteStructure } from \"../../parsers/html/util/nestedLists.js\";\nimport { acceptedMIMETypes } from \"./acceptedMIMETypes.js\";\nimport { handleFileInsertion } from \"./handleFileInsertion.js\";\nimport { handleVSCodePaste } from \"./handleVSCodePaste.js\";\n\nexport const createPasteFromClipboardExtension = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>\n) =>\n Extension.create<{ editor: BlockNoteEditor<BSchema, I, S> }, undefined>({\n name: \"pasteFromClipboard\",\n addProseMirrorPlugins() {\n return [\n new Plugin({\n props: {\n handleDOMEvents: {\n paste(_view, event) {\n event.preventDefault();\n\n if (!editor.isEditable) {\n return;\n }\n\n let format: (typeof acceptedMIMETypes)[number] | undefined;\n for (const mimeType of acceptedMIMETypes) {\n if (event.clipboardData!.types.includes(mimeType)) {\n format = mimeType;\n break;\n }\n }\n if (!format) {\n return true;\n }\n\n if (format === \"vscode-editor-data\") {\n handleVSCodePaste(event, editor);\n return true;\n }\n\n if (format === \"Files\") {\n handleFileInsertion(event, editor);\n return true;\n }\n\n let data = event.clipboardData!.getData(format);\n\n if (format === \"blocknote/html\") {\n editor._tiptapEditor.view.pasteHTML(data);\n return true;\n }\n\n if (format === \"text/html\") {\n const htmlNode = nestedListsToBlockNoteStructure(data.trim());\n data = htmlNode.innerHTML;\n editor._tiptapEditor.view.pasteHTML(data);\n return true;\n }\n\n editor._tiptapEditor.view.pasteText(data);\n\n return true;\n },\n },\n },\n }),\n ];\n },\n });\n","import { Extension } from \"@tiptap/core\";\nimport { Fragment, Node } from \"prosemirror-model\";\nimport { NodeSelection, Plugin } from \"prosemirror-state\";\nimport { CellSelection } from \"prosemirror-tables\";\nimport * as pmView from \"prosemirror-view\";\n\nimport { EditorView } from \"prosemirror-view\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { createExternalHTMLExporter } from \"../../exporters/html/externalHTMLExporter.js\";\nimport { cleanHTMLToMarkdown } from \"../../exporters/markdown/markdownExporter.js\";\nimport { fragmentToBlocks } from \"../../nodeConversions/fragmentToBlocks.js\";\nimport {\n contentNodeToInlineContent,\n contentNodeToTableContent,\n} from \"../../nodeConversions/nodeToBlock.js\";\n\nfunction fragmentToExternalHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n view: pmView.EditorView,\n selectedFragment: Fragment,\n editor: BlockNoteEditor<BSchema, I, S>\n) {\n let isWithinBlockContent = false;\n const isWithinTable = view.state.selection instanceof CellSelection;\n\n if (!isWithinTable) {\n // Checks whether block ancestry should be included when creating external\n // HTML. If the selection is within a block content node, the block ancestry\n // is excluded as we only care about the inline content.\n const fragmentWithoutParents = view.state.doc.slice(\n view.state.selection.from,\n view.state.selection.to,\n false\n ).content;\n\n const children = [];\n for (let i = 0; i < fragmentWithoutParents.childCount; i++) {\n children.push(fragmentWithoutParents.child(i));\n }\n\n isWithinBlockContent =\n children.find(\n (child) =>\n child.type.isInGroup(\"bnBlock\") ||\n child.type.name === \"blockGroup\" ||\n child.type.spec.group === \"blockContent\"\n ) === undefined;\n if (isWithinBlockContent) {\n selectedFragment = fragmentWithoutParents;\n }\n }\n\n let externalHTML: string;\n\n const externalHTMLExporter = createExternalHTMLExporter(\n view.state.schema,\n editor\n );\n\n if (isWithinTable) {\n if (selectedFragment.firstChild?.type.name === \"table\") {\n // contentNodeToTableContent expects the fragment of the content of a table, not the table node itself\n // but cellselection.content() returns the table node itself if all cells and columns are selected\n selectedFragment = selectedFragment.firstChild.content;\n }\n\n // first convert selection to blocknote-style table content, and then\n // pass this to the exporter\n const ic = contentNodeToTableContent(\n selectedFragment as any,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n );\n\n externalHTML = externalHTMLExporter.exportInlineContent(ic as any, {});\n } else if (isWithinBlockContent) {\n // first convert selection to blocknote-style inline content, and then\n // pass this to the exporter\n const ic = contentNodeToInlineContent(\n selectedFragment as any,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n );\n externalHTML = externalHTMLExporter.exportInlineContent(ic, {});\n } else {\n const blocks = fragmentToBlocks(selectedFragment, editor.schema);\n externalHTML = externalHTMLExporter.exportBlocks(blocks, {});\n }\n return externalHTML;\n}\n\nexport function selectedFragmentToHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n view: EditorView,\n editor: BlockNoteEditor<BSchema, I, S>\n): {\n clipboardHTML: string;\n externalHTML: string;\n markdown: string;\n} {\n // Checks if a `blockContent` node is being copied and expands\n // the selection to the parent `blockContainer` node. This is\n // for the use-case in which only a block without content is\n // selected, e.g. an image block.\n if (\n \"node\" in view.state.selection &&\n (view.state.selection.node as Node).type.spec.group === \"blockContent\"\n ) {\n editor.dispatch(\n editor._tiptapEditor.state.tr.setSelection(\n new NodeSelection(view.state.doc.resolve(view.state.selection.from - 1))\n )\n );\n }\n\n // Uses default ProseMirror clipboard serialization.\n const clipboardHTML: string = (pmView as any).__serializeForClipboard(\n view,\n view.state.selection.content()\n ).dom.innerHTML;\n\n const selectedFragment = view.state.selection.content().content;\n\n const externalHTML = fragmentToExternalHTML<BSchema, I, S>(\n view,\n selectedFragment,\n editor\n );\n\n const markdown = cleanHTMLToMarkdown(externalHTML);\n\n return { clipboardHTML, externalHTML, markdown };\n}\n\nconst copyToClipboard = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n view: EditorView,\n event: ClipboardEvent\n) => {\n // Stops the default browser copy behaviour.\n event.preventDefault();\n event.clipboardData!.clearData();\n\n const { clipboardHTML, externalHTML, markdown } = selectedFragmentToHTML(\n view,\n editor\n );\n\n // TODO: Writing to other MIME types not working in Safari for\n // some reason.\n event.clipboardData!.setData(\"blocknote/html\", clipboardHTML);\n event.clipboardData!.setData(\"text/html\", externalHTML);\n event.clipboardData!.setData(\"text/plain\", markdown);\n};\n\nexport const createCopyToClipboardExtension = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>\n) =>\n Extension.create<{ editor: BlockNoteEditor<BSchema, I, S> }, undefined>({\n name: \"copyToClipboard\",\n addProseMirrorPlugins() {\n return [\n new Plugin({\n props: {\n handleDOMEvents: {\n copy(view, event) {\n copyToClipboard(editor, view, event);\n // Prevent default PM handler to be called\n return true;\n },\n cut(view, event) {\n copyToClipboard(editor, view, event);\n view.dispatch(view.state.tr.deleteSelection());\n // Prevent default PM handler to be called\n return true;\n },\n // This is for the use-case in which only a block without content\n // is selected, e.g. an image block, and dragged (not using the\n // drag handle).\n dragstart(view, event) {\n // Checks if a `NodeSelection` is active.\n if (!(\"node\" in view.state.selection)) {\n return;\n }\n\n // Checks if a `blockContent` node is being dragged.\n if (\n (view.state.selection.node as Node).type.spec.group !==\n \"blockContent\"\n ) {\n return;\n }\n\n // Expands the selection to the parent `blockContainer` node.\n editor.dispatch(\n editor._tiptapEditor.state.tr.setSelection(\n new NodeSelection(\n view.state.doc.resolve(view.state.selection.from - 1)\n )\n )\n );\n\n // Stops the default browser drag start behaviour.\n event.preventDefault();\n event.dataTransfer!.clearData();\n\n const { clipboardHTML, externalHTML, markdown } =\n selectedFragmentToHTML(view, editor);\n\n // TODO: Writing to other MIME types not working in Safari for\n // some reason.\n event.dataTransfer!.setData(\"blocknote/html\", clipboardHTML);\n event.dataTransfer!.setData(\"text/html\", externalHTML);\n event.dataTransfer!.setData(\"text/plain\", markdown);\n\n // Prevent default PM handler to be called\n return true;\n },\n },\n },\n }),\n ];\n },\n });\n","import { Extension } from \"@tiptap/core\";\nimport { defaultProps } from \"../../blocks/defaultProps.js\";\n\nexport const BackgroundColorExtension = Extension.create({\n name: \"blockBackgroundColor\",\n\n addGlobalAttributes() {\n return [\n {\n types: [\"blockContainer\"],\n attributes: {\n backgroundColor: {\n default: defaultProps.backgroundColor.default,\n parseHTML: (element) =>\n element.hasAttribute(\"data-background-color\")\n ? element.getAttribute(\"data-background-color\")\n : defaultProps.backgroundColor.default,\n renderHTML: (attributes) => {\n if (\n attributes.backgroundColor ===\n defaultProps.backgroundColor.default\n ) {\n return {};\n }\n return {\n \"data-background-color\": attributes.backgroundColor,\n };\n },\n },\n },\n },\n ];\n },\n});\n","import { Node } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\n\nimport {\n BlockInfo,\n getBlockInfoFromResolvedPos,\n} from \"../../../getBlockInfoFromPos.js\";\n\n/**\n * Returns the block info from the parent block\n * or undefined if we're at the root\n */\nexport const getParentBlockInfo = (doc: Node, beforePos: number) => {\n const $pos = doc.resolve(beforePos);\n\n if ($pos.depth <= 1) {\n return undefined;\n }\n\n // get start pos of parent\n const parentBeforePos = $pos.posAtIndex(\n $pos.index($pos.depth - 1),\n $pos.depth - 1\n );\n\n const parentBlockInfo = getBlockInfoFromResolvedPos(\n doc.resolve(parentBeforePos)\n );\n return parentBlockInfo;\n};\n\n/**\n * Returns the block info from the sibling block before (above) the given block,\n * or undefined if the given block is the first sibling.\n */\nexport const getPrevBlockInfo = (doc: Node, beforePos: number) => {\n const $pos = doc.resolve(beforePos);\n\n const indexInParent = $pos.index();\n\n if (indexInParent === 0) {\n return undefined;\n }\n\n const prevBlockBeforePos = $pos.posAtIndex(indexInParent - 1);\n\n const prevBlockInfo = getBlockInfoFromResolvedPos(\n doc.resolve(prevBlockBeforePos)\n );\n return prevBlockInfo;\n};\n\n/**\n * If a block has children like this:\n * A\n * - B\n * - C\n * -- D\n *\n * Then the bottom nested block returned is D.\n */\nexport const getBottomNestedBlockInfo = (doc: Node, blockInfo: BlockInfo) => {\n while (blockInfo.childContainer) {\n const group = blockInfo.childContainer.node;\n\n const newPos = doc\n .resolve(blockInfo.childContainer.beforePos + 1)\n .posAtIndex(group.childCount - 1);\n blockInfo = getBlockInfoFromResolvedPos(doc.resolve(newPos));\n }\n\n return blockInfo;\n};\n\nconst canMerge = (prevBlockInfo: BlockInfo, nextBlockInfo: BlockInfo) => {\n return (\n prevBlockInfo.isBlockContainer &&\n prevBlockInfo.blockContent.node.type.spec.content === \"inline*\" &&\n prevBlockInfo.blockContent.node.childCount > 0 &&\n nextBlockInfo.isBlockContainer &&\n nextBlockInfo.blockContent.node.type.spec.content === \"inline*\"\n );\n};\n\nconst mergeBlocks = (\n state: EditorState,\n dispatch: ((args?: any) => any) | undefined,\n prevBlockInfo: BlockInfo,\n nextBlockInfo: BlockInfo\n) => {\n // Un-nests all children of the next block.\n if (!nextBlockInfo.isBlockContainer) {\n throw new Error(\n `Attempted to merge block at position ${nextBlockInfo.bnBlock.beforePos} into previous block at position ${prevBlockInfo.bnBlock.beforePos}, but next block is not a block container`\n );\n }\n\n // Removes a level of nesting all children of the next block by 1 level, if it contains both content and block\n // group nodes.\n if (nextBlockInfo.childContainer) {\n const childBlocksStart = state.doc.resolve(\n nextBlockInfo.childContainer.beforePos + 1\n );\n const childBlocksEnd = state.doc.resolve(\n nextBlockInfo.childContainer.afterPos - 1\n );\n const childBlocksRange = childBlocksStart.blockRange(childBlocksEnd);\n\n if (dispatch) {\n const pos = state.doc.resolve(nextBlockInfo.bnBlock.beforePos);\n state.tr.lift(childBlocksRange!, pos.depth);\n }\n }\n\n // Deletes the boundary between the two blocks. Can be thought of as\n // removing the closing tags of the first block and the opening tags of the\n // second one to stitch them together.\n if (dispatch) {\n if (!prevBlockInfo.isBlockContainer) {\n throw new Error(\n `Attempted to merge block at position ${nextBlockInfo.bnBlock.beforePos} into previous block at position ${prevBlockInfo.bnBlock.beforePos}, but previous block is not a block container`\n );\n }\n\n // TODO: test merging between a columnList and paragraph, between two columnLists, and v.v.\n dispatch(\n state.tr.delete(\n prevBlockInfo.blockContent.afterPos - 1,\n nextBlockInfo.blockContent.beforePos + 1\n )\n );\n }\n\n return true;\n};\n\nexport const mergeBlocksCommand =\n (posBetweenBlocks: number) =>\n ({\n state,\n dispatch,\n }: {\n state: EditorState;\n dispatch: ((args?: any) => any) | undefined;\n }) => {\n const $pos = state.doc.resolve(posBetweenBlocks);\n const nextBlockInfo = getBlockInfoFromResolvedPos($pos);\n\n const prevBlockInfo = getPrevBlockInfo(\n state.doc,\n nextBlockInfo.bnBlock.beforePos\n );\n\n if (!prevBlockInfo) {\n return false;\n }\n\n const bottomNestedBlockInfo = getBottomNestedBlockInfo(\n state.doc,\n prevBlockInfo\n );\n\n if (!canMerge(bottomNestedBlockInfo, nextBlockInfo)) {\n return false;\n }\n\n return mergeBlocks(state, dispatch, bottomNestedBlockInfo, nextBlockInfo);\n };\n","import { Extension } from \"@tiptap/core\";\n\nimport { TextSelection } from \"prosemirror-state\";\nimport { ReplaceAroundStep } from \"prosemirror-transform\";\nimport {\n getBottomNestedBlockInfo,\n getParentBlockInfo,\n getPrevBlockInfo,\n mergeBlocksCommand,\n} from \"../../api/blockManipulation/commands/mergeBlocks/mergeBlocks.js\";\nimport { nestBlock } from \"../../api/blockManipulation/commands/nestBlock/nestBlock.js\";\nimport { splitBlockCommand } from \"../../api/blockManipulation/commands/splitBlock/splitBlock.js\";\nimport { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nexport const KeyboardShortcutsExtension = Extension.create<{\n editor: BlockNoteEditor<any, any, any>;\n}>({\n priority: 50,\n\n // TODO: The shortcuts need a refactor. Do we want to use a command priority\n // design as there is now, or clump the logic into a single function?\n addKeyboardShortcuts() {\n // handleBackspace is partially adapted from https://github.com/ueberdosis/tiptap/blob/ed56337470efb4fd277128ab7ef792b37cfae992/packages/core/src/extensions/keymap.ts\n const handleBackspace = () =>\n this.editor.commands.first(({ chain, commands }) => [\n // Deletes the selection if it's not empty.\n () => commands.deleteSelection(),\n // Undoes an input rule if one was triggered in the last editor state change.\n () => commands.undoInputRule(),\n // Reverts block content type to a paragraph if the selection is at the start of the block.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n\n const selectionAtBlockStart =\n state.selection.from === blockInfo.blockContent.beforePos + 1;\n const isParagraph =\n blockInfo.blockContent.node.type.name === \"paragraph\";\n\n if (selectionAtBlockStart && !isParagraph) {\n return commands.command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"paragraph\",\n props: {},\n }\n )\n );\n }\n\n return false;\n }),\n // Removes a level of nesting if the block is indented if the selection is at the start of the block.\n () =>\n commands.command(({ state }) => {\n const { blockContent } = getBlockInfoFromSelection(state);\n\n const selectionAtBlockStart =\n state.selection.from === blockContent.beforePos + 1;\n\n if (selectionAtBlockStart) {\n return commands.liftListItem(\"blockContainer\");\n }\n\n return false;\n }),\n // Merges block with the previous one if it isn't indented, and the selection is at the start of the\n // block. The target block for merging must contain inline content.\n () =>\n commands.command(({ state }) => {\n const { bnBlock: blockContainer, blockContent } =\n getBlockInfoFromSelection(state);\n\n const selectionAtBlockStart =\n state.selection.from === blockContent.beforePos + 1;\n const selectionEmpty = state.selection.empty;\n\n const posBetweenBlocks = blockContainer.beforePos;\n\n if (selectionAtBlockStart && selectionEmpty) {\n return chain()\n .command(mergeBlocksCommand(posBetweenBlocks))\n .scrollIntoView()\n .run();\n }\n\n return false;\n }),\n () =>\n commands.command(({ state, dispatch }) => {\n // when at the start of a first block in a column\n const blockInfo = getBlockInfoFromSelection(state);\n\n const selectionAtBlockStart =\n state.selection.from === blockInfo.blockContent.beforePos + 1;\n\n if (!selectionAtBlockStart) {\n return false;\n }\n\n const prevBlockInfo = getPrevBlockInfo(\n state.doc,\n blockInfo.bnBlock.beforePos\n );\n\n if (prevBlockInfo) {\n // should be no previous block\n return false;\n }\n\n const parentBlockInfo = getParentBlockInfo(\n state.doc,\n blockInfo.bnBlock.beforePos\n );\n\n if (parentBlockInfo?.blockNoteType !== \"column\") {\n return false;\n }\n\n const column = parentBlockInfo;\n\n const columnList = getParentBlockInfo(\n state.doc,\n column.bnBlock.beforePos\n );\n if (columnList?.blockNoteType !== \"columnList\") {\n throw new Error(\"parent of column is not a column list\");\n }\n\n const shouldRemoveColumn =\n column.childContainer!.node.childCount === 1;\n\n const shouldRemoveColumnList =\n shouldRemoveColumn &&\n columnList.childContainer!.node.childCount === 2;\n\n const isFirstColumn =\n columnList.childContainer!.node.firstChild ===\n column.bnBlock.node;\n\n if (dispatch) {\n const blockToMove = state.doc.slice(\n blockInfo.bnBlock.beforePos,\n blockInfo.bnBlock.afterPos,\n false\n );\n\n /*\n There are 3 different cases:\n a) remove entire column list (if no columns would be remaining)\n b) remove just a column (if no blocks inside a column would be remaining)\n c) keep columns (if there are blocks remaining inside a column)\n\n Each of these 3 cases has 2 sub-cases, depending on whether the backspace happens at the start of the first (most-left) column,\n or at the start of a non-first column.\n */\n if (shouldRemoveColumnList) {\n if (isFirstColumn) {\n state.tr.step(\n new ReplaceAroundStep(\n // replace entire column list\n columnList.bnBlock.beforePos,\n columnList.bnBlock.afterPos,\n // select content of remaining column:\n column.bnBlock.afterPos + 1,\n columnList.bnBlock.afterPos - 2,\n blockToMove,\n blockToMove.size, // append existing content to blockToMove\n false\n )\n );\n const pos = state.tr.doc.resolve(column.bnBlock.beforePos);\n state.tr.setSelection(TextSelection.between(pos, pos));\n } else {\n // replaces the column list with the blockToMove slice, prepended with the content of the remaining column\n state.tr.step(\n new ReplaceAroundStep(\n // replace entire column list\n columnList.bnBlock.beforePos,\n columnList.bnBlock.afterPos,\n // select content of existing column:\n columnList.bnBlock.beforePos + 2,\n column.bnBlock.beforePos - 1,\n blockToMove,\n 0, // prepend existing content to blockToMove\n false\n )\n );\n const pos = state.tr.doc.resolve(\n state.tr.mapping.map(column.bnBlock.beforePos - 1)\n );\n state.tr.setSelection(TextSelection.between(pos, pos));\n }\n } else if (shouldRemoveColumn) {\n if (isFirstColumn) {\n // delete column\n state.tr.delete(\n column.bnBlock.beforePos,\n column.bnBlock.afterPos\n );\n\n // move before columnlist\n state.tr.insert(\n columnList.bnBlock.beforePos,\n blockToMove.content\n );\n\n const pos = state.tr.doc.resolve(\n columnList.bnBlock.beforePos\n );\n state.tr.setSelection(TextSelection.between(pos, pos));\n } else {\n // just delete the </column><column> closing and opening tags to merge the columns\n state.tr.delete(\n column.bnBlock.beforePos - 1,\n column.bnBlock.beforePos + 1\n );\n }\n } else {\n // delete block\n state.tr.delete(\n blockInfo.bnBlock.beforePos,\n blockInfo.bnBlock.afterPos\n );\n if (isFirstColumn) {\n // move before columnlist\n state.tr.insert(\n columnList.bnBlock.beforePos - 1,\n blockToMove.content\n );\n } else {\n // append block to previous column\n state.tr.insert(\n column.bnBlock.beforePos - 1,\n blockToMove.content\n );\n }\n const pos = state.tr.doc.resolve(column.bnBlock.beforePos - 1);\n state.tr.setSelection(TextSelection.between(pos, pos));\n }\n }\n\n return true;\n }),\n // Deletes previous block if it contains no content and isn't a table,\n // when the selection is empty and at the start of the block. Moves the\n // current block into the deleted block's place.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n\n if (!blockInfo.isBlockContainer) {\n // TODO\n throw new Error(`todo`);\n }\n\n const selectionAtBlockStart =\n state.selection.from === blockInfo.blockContent.beforePos + 1;\n const selectionEmpty = state.selection.empty;\n\n const prevBlockInfo = getPrevBlockInfo(\n state.doc,\n blockInfo.bnBlock.beforePos\n );\n\n if (prevBlockInfo && selectionAtBlockStart && selectionEmpty) {\n const bottomBlock = getBottomNestedBlockInfo(\n state.doc,\n prevBlockInfo\n );\n\n if (!bottomBlock.isBlockContainer) {\n // TODO\n throw new Error(`todo`);\n }\n\n const prevBlockNotTableAndNoContent =\n bottomBlock.blockContent.node.type.spec.content === \"\" ||\n (bottomBlock.blockContent.node.type.spec.content ===\n \"inline*\" &&\n bottomBlock.blockContent.node.childCount === 0);\n\n if (prevBlockNotTableAndNoContent) {\n return chain()\n .cut(\n {\n from: blockInfo.bnBlock.beforePos,\n to: blockInfo.bnBlock.afterPos,\n },\n bottomBlock.bnBlock.afterPos\n )\n .deleteRange({\n from: bottomBlock.bnBlock.beforePos,\n to: bottomBlock.bnBlock.afterPos,\n })\n .run();\n }\n }\n\n return false;\n }),\n ]);\n\n const handleDelete = () =>\n this.editor.commands.first(({ commands }) => [\n // Deletes the selection if it's not empty.\n () => commands.deleteSelection(),\n // Merges block with the next one (at the same nesting level or lower),\n // if one exists, the block has no children, and the selection is at the\n // end of the block.\n () =>\n commands.command(({ state }) => {\n // TODO: Change this to not rely on offsets & schema assumptions\n const {\n bnBlock: blockContainer,\n blockContent,\n childContainer,\n } = getBlockInfoFromSelection(state);\n\n const { depth } = state.doc.resolve(blockContainer.beforePos);\n const blockAtDocEnd =\n blockContainer.afterPos === state.doc.nodeSize - 3;\n const selectionAtBlockEnd =\n state.selection.from === blockContent.afterPos - 1;\n const selectionEmpty = state.selection.empty;\n const hasChildBlocks = childContainer !== undefined;\n\n if (\n !blockAtDocEnd &&\n selectionAtBlockEnd &&\n selectionEmpty &&\n !hasChildBlocks\n ) {\n let oldDepth = depth;\n let newPos = blockContainer.afterPos + 1;\n let newDepth = state.doc.resolve(newPos).depth;\n\n while (newDepth < oldDepth) {\n oldDepth = newDepth;\n newPos += 2;\n newDepth = state.doc.resolve(newPos).depth;\n }\n\n return commands.command(mergeBlocksCommand(newPos - 1));\n }\n\n return false;\n }),\n ]);\n\n const handleEnter = () =>\n this.editor.commands.first(({ commands }) => [\n // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start\n // of the block.\n () =>\n commands.command(({ state }) => {\n const { blockContent, bnBlock: blockContainer } =\n getBlockInfoFromSelection(state);\n\n const { depth } = state.doc.resolve(blockContainer.beforePos);\n\n const selectionAtBlockStart =\n state.selection.$anchor.parentOffset === 0;\n const selectionEmpty =\n state.selection.anchor === state.selection.head;\n const blockEmpty = blockContent.node.childCount === 0;\n const blockIndented = depth > 1;\n\n if (\n selectionAtBlockStart &&\n selectionEmpty &&\n blockEmpty &&\n blockIndented\n ) {\n return commands.liftListItem(\"blockContainer\");\n }\n\n return false;\n }),\n // Creates a new block and moves the selection to it if the current one is empty, while the selection is also\n // empty & at the start of the block.\n () =>\n commands.command(({ state, dispatch }) => {\n const { bnBlock: blockContainer, blockContent } =\n getBlockInfoFromSelection(state);\n\n const selectionAtBlockStart =\n state.selection.$anchor.parentOffset === 0;\n const selectionEmpty =\n state.selection.anchor === state.selection.head;\n const blockEmpty = blockContent.node.childCount === 0;\n\n if (selectionAtBlockStart && selectionEmpty && blockEmpty) {\n const newBlockInsertionPos = blockContainer.afterPos;\n const newBlockContentPos = newBlockInsertionPos + 2;\n\n if (dispatch) {\n const newBlock =\n state.schema.nodes[\"blockContainer\"].createAndFill()!;\n\n state.tr\n .insert(newBlockInsertionPos, newBlock)\n .scrollIntoView();\n state.tr.setSelection(\n new TextSelection(state.doc.resolve(newBlockContentPos))\n );\n }\n\n return true;\n }\n\n return false;\n }),\n // Splits the current block, moving content inside that's after the cursor to a new text block below. Also\n // deletes the selection beforehand, if it's not empty.\n () =>\n commands.command(({ state, chain }) => {\n const { blockContent } = getBlockInfoFromSelection(state);\n\n const selectionAtBlockStart =\n state.selection.$anchor.parentOffset === 0;\n const blockEmpty = blockContent.node.childCount === 0;\n\n if (!blockEmpty) {\n chain()\n .deleteSelection()\n .command(\n splitBlockCommand(\n state.selection.from,\n selectionAtBlockStart,\n selectionAtBlockStart\n )\n )\n .run();\n\n return true;\n }\n\n return false;\n }),\n ]);\n\n return {\n Backspace: handleBackspace,\n Delete: handleDelete,\n Enter: handleEnter,\n // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the\n // editor since the browser will try to use tab for keyboard navigation.\n Tab: () => {\n if (\n this.options.editor.formattingToolbar?.shown ||\n this.options.editor.linkToolbar?.shown ||\n this.options.editor.filePanel?.shown\n ) {\n // don't handle tabs if a toolbar is shown, so we can tab into / out of it\n return false;\n }\n return nestBlock(this.options.editor);\n // return true;\n },\n \"Shift-Tab\": () => {\n if (\n this.options.editor.formattingToolbar?.shown ||\n this.options.editor.linkToolbar?.shown ||\n this.options.editor.filePanel?.shown\n ) {\n // don't handle tabs if a toolbar is shown, so we can tab into / out of it\n return false;\n }\n this.editor.commands.liftListItem(\"blockContainer\");\n return true;\n },\n \"Shift-Mod-ArrowUp\": () => {\n this.options.editor.moveBlockUp();\n return true;\n },\n \"Shift-Mod-ArrowDown\": () => {\n this.options.editor.moveBlockDown();\n return true;\n },\n };\n },\n});\n","import { Extension } from \"@tiptap/core\";\n\nexport const TextAlignmentExtension = Extension.create({\n name: \"textAlignment\",\n\n addGlobalAttributes() {\n return [\n {\n // Attribute is applied to block content instead of container so that child blocks don't inherit the text\n // alignment styling.\n types: [\n \"paragraph\",\n \"heading\",\n \"bulletListItem\",\n \"numberedListItem\",\n \"checkListItem\",\n ],\n attributes: {\n textAlignment: {\n default: \"left\",\n parseHTML: (element) => {\n return element.getAttribute(\"data-text-alignment\");\n },\n renderHTML: (attributes) => {\n if (attributes.textAlignment === \"left\") {\n return {};\n }\n return {\n \"data-text-alignment\": attributes.textAlignment,\n };\n },\n },\n },\n },\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport { defaultProps } from \"../../blocks/defaultProps.js\";\n\nexport const TextColorExtension = Extension.create({\n name: \"blockTextColor\",\n\n addGlobalAttributes() {\n return [\n {\n types: [\"blockContainer\"],\n attributes: {\n textColor: {\n default: defaultProps.textColor.default,\n parseHTML: (element) =>\n element.hasAttribute(\"data-text-color\")\n ? element.getAttribute(\"data-text-color\")\n : defaultProps.textColor.default,\n renderHTML: (attributes) => {\n if (attributes.textColor === defaultProps.textColor.default) {\n return {};\n }\n return {\n \"data-text-color\": attributes.textColor,\n };\n },\n },\n },\n },\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"prosemirror-state\";\n\n// based on https://github.com/ueberdosis/tiptap/blob/40a9404c94c7fef7900610c195536384781ae101/demos/src/Experiments/TrailingNode/Vue/trailing-node.ts\n\n/**\n * Extension based on:\n * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js\n * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts\n */\n\nexport interface TrailingNodeOptions {\n node: string;\n}\n\n/**\n * Add a trailing node to the document so the user can always click at the bottom of the document and start typing\n */\nexport const TrailingNode = Extension.create<TrailingNodeOptions>({\n name: \"trailingNode\",\n\n addProseMirrorPlugins() {\n const plugin = new PluginKey(this.name);\n // const disabledNodes = Object.entries(this.editor.schema.nodes)\n // .map(([, value]) => value)\n // .filter((node) => this.options.notAfter.includes(node.name));\n\n return [\n new Plugin({\n key: plugin,\n appendTransaction: (_, __, state) => {\n const { doc, tr, schema } = state;\n const shouldInsertNodeAtEnd = plugin.getState(state);\n const endPosition = doc.content.size - 2;\n const type = schema.nodes[\"blockContainer\"];\n const contentType = schema.nodes[\"paragraph\"];\n if (!shouldInsertNodeAtEnd) {\n return;\n }\n\n return tr.insert(\n endPosition,\n type.create(undefined, contentType.create())\n );\n },\n state: {\n init: (_, _state) => {\n // (maybe fix): use same logic as apply() here\n // so it works when initializing\n },\n apply: (tr, value) => {\n if (!tr.docChanged) {\n return value;\n }\n\n let lastNode = tr.doc.lastChild;\n\n if (!lastNode || lastNode.type.name !== \"blockGroup\") {\n throw new Error(\"Expected blockGroup\");\n }\n\n lastNode = lastNode.lastChild;\n\n if (!lastNode || lastNode.type.name !== \"blockContainer\") {\n return true; // not a blockContainer, but for example Columns. Insert trailing node\n }\n\n const lastContentNode = lastNode.firstChild;\n\n if (!lastContentNode) {\n throw new Error(\"Expected blockContent\");\n }\n\n // If last node is not empty (size > 4) or it doesn't contain\n // inline content, we need to add a trailing node.\n return (\n lastNode.nodeSize > 4 ||\n lastContentNode.type.spec.content !== \"inline*\"\n );\n },\n },\n }),\n ];\n },\n});\n","import { Node } from \"@tiptap/core\";\n\nimport type { BlockNoteEditor } from \"../editor/BlockNoteEditor.js\";\nimport { BlockNoteDOMAttributes } from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\n\n// Object containing all possible block attributes.\nconst BlockAttributes: Record<string, string> = {\n blockColor: \"data-block-color\",\n blockStyle: \"data-block-style\",\n id: \"data-id\",\n depth: \"data-depth\",\n depthChange: \"data-depth-change\",\n};\n\n/**\n * The main \"Block node\" documents consist of\n */\nexport const BlockContainer = Node.create<{\n domAttributes?: BlockNoteDOMAttributes;\n editor: BlockNoteEditor<any, any, any>;\n}>({\n name: \"blockContainer\",\n group: \"blockGroupChild bnBlock\",\n // A block always contains content, and optionally a blockGroup which contains nested blocks\n content: \"blockContent blockGroup?\",\n // Ensures content-specific keyboard handlers trigger first.\n priority: 50,\n defining: true,\n\n parseHTML() {\n return [\n {\n tag: \"div\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const attrs: Record<string, string> = {};\n for (const [nodeAttr, HTMLAttr] of Object.entries(BlockAttributes)) {\n if (element.getAttribute(HTMLAttr)) {\n attrs[nodeAttr] = element.getAttribute(HTMLAttr)!;\n }\n }\n\n if (element.getAttribute(\"data-node-type\") === \"blockContainer\") {\n return attrs;\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n const blockOuter = document.createElement(\"div\");\n blockOuter.className = \"bn-block-outer\";\n blockOuter.setAttribute(\"data-node-type\", \"blockOuter\");\n for (const [attribute, value] of Object.entries(HTMLAttributes)) {\n if (attribute !== \"class\") {\n blockOuter.setAttribute(attribute, value);\n }\n }\n\n const blockHTMLAttributes = {\n ...(this.options.domAttributes?.block || {}),\n ...HTMLAttributes,\n };\n const block = document.createElement(\"div\");\n block.className = mergeCSSClasses(\"bn-block\", blockHTMLAttributes.class);\n block.setAttribute(\"data-node-type\", this.name);\n for (const [attribute, value] of Object.entries(blockHTMLAttributes)) {\n if (attribute !== \"class\") {\n block.setAttribute(attribute, value);\n }\n }\n\n blockOuter.appendChild(block);\n\n return {\n dom: blockOuter,\n contentDOM: block,\n };\n },\n});\n","import { Node } from \"@tiptap/core\";\nimport { BlockNoteDOMAttributes } from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\n\nexport const BlockGroup = Node.create<{\n domAttributes?: BlockNoteDOMAttributes;\n}>({\n name: \"blockGroup\",\n group: \"childContainer\",\n content: \"blockGroupChild+\",\n\n parseHTML() {\n return [\n {\n tag: \"div\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if (element.getAttribute(\"data-node-type\") === \"blockGroup\") {\n // Null means the element matches, but we don't want to add any attributes to the node.\n return null;\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n const blockGroupHTMLAttributes = {\n ...(this.options.domAttributes?.blockGroup || {}),\n ...HTMLAttributes,\n };\n const blockGroup = document.createElement(\"div\");\n blockGroup.className = mergeCSSClasses(\n \"bn-block-group\",\n blockGroupHTMLAttributes.class\n );\n blockGroup.setAttribute(\"data-node-type\", \"blockGroup\");\n for (const [attribute, value] of Object.entries(blockGroupHTMLAttributes)) {\n if (attribute !== \"class\") {\n blockGroup.setAttribute(attribute, value);\n }\n }\n\n return {\n dom: blockGroup,\n contentDOM: blockGroup,\n };\n },\n});\n","import {Node} from \"@tiptap/core\";\n\nexport const Doc = Node.create({\n name: \"doc\",\n topNode: true,\n content: \"blockGroup\",\n});\n","import { Extension, Extensions, extensions } from \"@tiptap/core\";\n\nimport type { BlockNoteEditor } from \"./BlockNoteEditor.js\";\n\nimport Collaboration from \"@tiptap/extension-collaboration\";\nimport CollaborationCursor from \"@tiptap/extension-collaboration-cursor\";\nimport { Gapcursor } from \"@tiptap/extension-gapcursor\";\nimport { HardBreak } from \"@tiptap/extension-hard-break\";\nimport { History } from \"@tiptap/extension-history\";\nimport { Link } from \"@tiptap/extension-link\";\nimport { Text } from \"@tiptap/extension-text\";\nimport * as Y from \"yjs\";\nimport { createDropFileExtension } from \"../api/clipboard/fromClipboard/fileDropExtension.js\";\nimport { createPasteFromClipboardExtension } from \"../api/clipboard/fromClipboard/pasteExtension.js\";\nimport { createCopyToClipboardExtension } from \"../api/clipboard/toClipboard/copyExtension.js\";\nimport { BackgroundColorExtension } from \"../extensions/BackgroundColor/BackgroundColorExtension.js\";\nimport { KeyboardShortcutsExtension } from \"../extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js\";\nimport { TextAlignmentExtension } from \"../extensions/TextAlignment/TextAlignmentExtension.js\";\nimport { TextColorExtension } from \"../extensions/TextColor/TextColorExtension.js\";\nimport { TrailingNode } from \"../extensions/TrailingNode/TrailingNodeExtension.js\";\nimport UniqueID from \"../extensions/UniqueID/UniqueID.js\";\nimport { BlockContainer, BlockGroup, Doc } from \"../pm-nodes/index.js\";\nimport {\n BlockNoteDOMAttributes,\n BlockSchema,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSpecs,\n StyleSchema,\n StyleSpecs,\n} from \"../schema/index.js\";\n\n/**\n * Get all the Tiptap extensions BlockNote is configured with by default\n */\nexport const getBlockNoteExtensions = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(opts: {\n editor: BlockNoteEditor<BSchema, I, S>;\n domAttributes: Partial<BlockNoteDOMAttributes>;\n blockSpecs: BlockSpecs;\n inlineContentSpecs: InlineContentSpecs;\n styleSpecs: StyleSpecs;\n trailingBlock: boolean | undefined;\n collaboration?: {\n fragment: Y.XmlFragment;\n user: {\n name: string;\n color: string;\n [key: string]: string;\n };\n provider: any;\n renderCursor?: (user: any) => HTMLElement;\n };\n disableExtensions: string[] | undefined;\n setIdAttribute?: boolean;\n}) => {\n const ret: Extensions = [\n extensions.ClipboardTextSerializer,\n extensions.Commands,\n extensions.Editable,\n extensions.FocusEvents,\n extensions.Tabindex,\n\n // DevTools,\n Gapcursor,\n\n // DropCursor,\n UniqueID.configure({\n // everything from bnBlock group (nodes that represent a BlockNote block should have an id)\n types: [\"blockContainer\", \"columnList\", \"column\"],\n setIdAttribute: opts.setIdAttribute,\n }),\n HardBreak.extend({ priority: 10 }),\n // Comments,\n\n // basics:\n Text,\n\n // marks:\n Link.extend({\n addKeyboardShortcuts() {\n return {\n \"Mod-k\": () => {\n this.editor.commands.toggleLink({ href: \"\" });\n return true;\n },\n };\n },\n }),\n ...Object.values(opts.styleSpecs).map((styleSpec) => {\n return styleSpec.implementation.mark;\n }),\n\n TextColorExtension,\n\n BackgroundColorExtension,\n TextAlignmentExtension,\n\n // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)\n Extension.create({\n name: \"OverrideEscape\",\n addKeyboardShortcuts() {\n return {\n Escape: () => {\n if (opts.editor.suggestionMenus.shown) {\n // escape is handled by suggestionmenu\n return false;\n }\n return this.editor.commands.blur();\n },\n };\n },\n }),\n\n // nodes\n Doc,\n BlockContainer.configure({\n editor: opts.editor,\n domAttributes: opts.domAttributes,\n }),\n KeyboardShortcutsExtension.configure({\n editor: opts.editor,\n }),\n BlockGroup.configure({\n domAttributes: opts.domAttributes,\n }),\n ...Object.values(opts.inlineContentSpecs)\n .filter((a) => a.config !== \"link\" && a.config !== \"text\")\n .map((inlineContentSpec) => {\n return inlineContentSpec.implementation!.node.configure({\n editor: opts.editor as any,\n });\n }),\n\n ...Object.values(opts.blockSpecs).flatMap((blockSpec) => {\n return [\n // dependent nodes (e.g.: tablecell / row)\n ...(blockSpec.implementation.requiredExtensions || []).map((ext) =>\n ext.configure({\n editor: opts.editor,\n domAttributes: opts.domAttributes,\n })\n ),\n // the actual node itself\n blockSpec.implementation.node.configure({\n editor: opts.editor,\n domAttributes: opts.domAttributes,\n }),\n ];\n }),\n createCopyToClipboardExtension(opts.editor),\n createPasteFromClipboardExtension(opts.editor),\n createDropFileExtension(opts.editor),\n\n // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),\n // should be handled before Enter handlers in other components like splitListItem\n ...(opts.trailingBlock === undefined || opts.trailingBlock\n ? [TrailingNode]\n : []),\n ];\n\n if (opts.collaboration) {\n ret.push(\n Collaboration.configure({\n fragment: opts.collaboration.fragment,\n })\n );\n if (opts.collaboration.provider?.awareness) {\n const defaultRender = (user: { color: string; name: string }) => {\n const cursor = document.createElement(\"span\");\n\n cursor.classList.add(\"collaboration-cursor__caret\");\n cursor.setAttribute(\"style\", `border-color: ${user.color}`);\n\n const label = document.createElement(\"span\");\n\n label.classList.add(\"collaboration-cursor__label\");\n label.setAttribute(\"style\", `background-color: ${user.color}`);\n label.insertBefore(document.createTextNode(user.name), null);\n\n const nonbreakingSpace1 = document.createTextNode(\"\\u2060\");\n const nonbreakingSpace2 = document.createTextNode(\"\\u2060\");\n cursor.insertBefore(nonbreakingSpace1, null);\n cursor.insertBefore(label, null);\n cursor.insertBefore(nonbreakingSpace2, null);\n return cursor;\n };\n ret.push(\n CollaborationCursor.configure({\n user: opts.collaboration.user,\n render: opts.collaboration.renderCursor || defaultRender,\n provider: opts.collaboration.provider,\n })\n );\n }\n } else {\n // disable history extension when collaboration is enabled as Yjs takes care of undo / redo\n ret.push(History);\n }\n\n const disableExtensions: string[] = opts.disableExtensions || [];\n return ret.filter((ex) => !disableExtensions.includes(ex.name));\n};\n","import { Fragment, Schema, Slice } from \"@tiptap/pm/model\";\nimport { EditorView } from \"@tiptap/pm/view\";\n\n// helper function to remove a child from a fragment\nfunction removeChild(node: Fragment, n: number) {\n const children: any[] = [];\n node.forEach((child, _, i) => {\n if (i !== n) {\n children.push(child);\n }\n });\n return Fragment.from(children);\n}\n\n/**\n * Wrap adjacent tableRow items in a table.\n *\n * This makes sure the content that we paste is always a table (and not a tableRow)\n * A table works better for the remaing paste handling logic, as it's actually a blockContent node\n */\nexport function wrapTableRows(f: Fragment, schema: Schema) {\n const newItems: any[] = [];\n for (let i = 0; i < f.childCount; i++) {\n if (f.child(i).type.name === \"tableRow\") {\n if (\n newItems.length > 0 &&\n newItems[newItems.length - 1].type.name === \"table\"\n ) {\n // append to existing table\n const prevTable = newItems[newItems.length - 1];\n const newTable = prevTable.copy(prevTable.content.addToEnd(f.child(i)));\n newItems[newItems.length - 1] = newTable;\n } else {\n // create new table to wrap tableRow with\n const newTable = schema.nodes.table.createChecked(\n undefined,\n f.child(i)\n );\n newItems.push(newTable);\n }\n } else {\n newItems.push(f.child(i));\n }\n }\n f = Fragment.from(newItems);\n return f;\n}\n\n/**\n * fix for https://github.com/ProseMirror/prosemirror/issues/1430#issuecomment-1822570821\n *\n * Without this fix, pasting two paragraphs would cause the second one to be indented in the other\n * this fix wraps every element in the slice in it's own blockContainer, to prevent Prosemirror from nesting the\n * elements on paste.\n *\n * The exception is when we encounter blockGroups with listitems, because those actually should be nested\n */\nexport function transformPasted(slice: Slice, view: EditorView) {\n let f = Fragment.from(slice.content);\n f = wrapTableRows(f, view.state.schema);\n\n for (let i = 0; i < f.childCount; i++) {\n if (f.child(i).type.spec.group === \"blockContent\") {\n const content = [f.child(i)];\n\n // when there is a blockGroup with lists, it should be nested in the new blockcontainer\n // (if we remove this if-block, the nesting bug will be fixed, but lists won't be nested correctly)\n if (\n i + 1 < f.childCount &&\n f.child(i + 1).type.name === \"blockGroup\" // TODO\n ) {\n const nestedChild = f\n .child(i + 1)\n .child(0)\n .child(0);\n\n if (\n nestedChild.type.name === \"bulletListItem\" ||\n nestedChild.type.name === \"numberedListItem\" ||\n nestedChild.type.name === \"checkListItem\"\n ) {\n content.push(f.child(i + 1));\n f = removeChild(f, i + 1);\n }\n }\n const container = view.state.schema.nodes.blockContainer.createChecked(\n undefined,\n content\n );\n f = f.replaceChild(i, container);\n }\n }\n return new Slice(f, slice.openStart, slice.openEnd);\n}\n","import {\n defaultBlockSpecs,\n defaultInlineContentSpecs,\n defaultStyleSpecs,\n} from \"../blocks/defaultBlocks.js\";\nimport type {\n BlockNoDefaults,\n PartialBlockNoDefaults,\n} from \"../schema/blocks/types.js\";\nimport {\n BlockSchema,\n BlockSchemaFromSpecs,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSchemaFromSpecs,\n InlineContentSpecs,\n StyleSchema,\n StyleSchemaFromSpecs,\n StyleSpecs,\n getBlockSchemaFromSpecs,\n getInlineContentSchemaFromSpecs,\n getStyleSchemaFromSpecs,\n} from \"../schema/index.js\";\nimport type { BlockNoteEditor } from \"./BlockNoteEditor.js\";\n\nfunction removeUndefined<T extends Record<string, any> | undefined>(obj: T): T {\n if (!obj) {\n return obj;\n }\n return Object.fromEntries(\n Object.entries(obj).filter(([, value]) => value !== undefined)\n ) as T;\n}\n\nexport class BlockNoteSchema<\n BSchema extends BlockSchema,\n ISchema extends InlineContentSchema,\n SSchema extends StyleSchema\n> {\n public readonly blockSpecs: BlockSpecs;\n public readonly inlineContentSpecs: InlineContentSpecs;\n public readonly styleSpecs: StyleSpecs;\n\n public readonly blockSchema: BSchema;\n public readonly inlineContentSchema: ISchema;\n public readonly styleSchema: SSchema;\n\n // Helper so that you can use typeof schema.BlockNoteEditor\n public readonly BlockNoteEditor: BlockNoteEditor<BSchema, ISchema, SSchema> =\n \"only for types\" as any;\n\n public readonly Block: BlockNoDefaults<BSchema, ISchema, SSchema> =\n \"only for types\" as any;\n\n public readonly PartialBlock: PartialBlockNoDefaults<\n BSchema,\n ISchema,\n SSchema\n > = \"only for types\" as any;\n\n public static create<\n BSpecs extends BlockSpecs = typeof defaultBlockSpecs,\n ISpecs extends InlineContentSpecs = typeof defaultInlineContentSpecs,\n SSpecs extends StyleSpecs = typeof defaultStyleSpecs\n >(options?: {\n /**\n * A list of custom block types that should be available in the editor.\n */\n blockSpecs?: BSpecs;\n /**\n * A list of custom InlineContent types that should be available in the editor.\n */\n inlineContentSpecs?: ISpecs;\n /**\n * A list of custom Styles that should be available in the editor.\n */\n styleSpecs?: SSpecs;\n }) {\n return new BlockNoteSchema<\n BlockSchemaFromSpecs<BSpecs>,\n InlineContentSchemaFromSpecs<ISpecs>,\n StyleSchemaFromSpecs<SSpecs>\n >(options);\n // as BlockNoteSchema<\n // BlockSchemaFromSpecs<BSpecs>,\n // InlineContentSchemaFromSpecs<ISpecs>,\n // StyleSchemaFromSpecs<SSpecs>\n // >;\n }\n\n constructor(opts?: {\n blockSpecs?: BlockSpecs;\n inlineContentSpecs?: InlineContentSpecs;\n styleSpecs?: StyleSpecs;\n }) {\n this.blockSpecs = removeUndefined(opts?.blockSpecs) || defaultBlockSpecs;\n this.inlineContentSpecs =\n removeUndefined(opts?.inlineContentSpecs) || defaultInlineContentSpecs;\n this.styleSpecs = removeUndefined(opts?.styleSpecs) || defaultStyleSpecs;\n\n this.blockSchema = getBlockSchemaFromSpecs(this.blockSpecs) as any;\n this.inlineContentSchema = getInlineContentSchemaFromSpecs(\n this.inlineContentSpecs\n ) as any;\n this.styleSchema = getStyleSchemaFromSpecs(this.styleSpecs) as any;\n }\n}\n","import { EditorOptions, createDocument } from \"@tiptap/core\";\n// import \"./blocknote.css\";\nimport { Editor as TiptapEditor } from \"@tiptap/core\";\n\nimport { Node } from \"@tiptap/pm/model\";\n\nimport { EditorView } from \"@tiptap/pm/view\";\n\nimport { EditorState, Transaction } from \"@tiptap/pm/state\";\nimport { blockToNode } from \"../api/nodeConversions/blockToNode.js\";\nimport { PartialBlock } from \"../blocks/defaultBlocks.js\";\nimport { StyleSchema } from \"../schema/index.js\";\n\nexport type BlockNoteTipTapEditorOptions = Partial<\n Omit<EditorOptions, \"content\">\n> & {\n content: PartialBlock<any, any, any>[];\n};\n\n/**\n * Custom Editor class that extends TiptapEditor and separates\n * the creation of the view from the constructor.\n */\n// @ts-ignore\nexport class BlockNoteTipTapEditor extends TiptapEditor {\n private _state: EditorState;\n private _creating = false;\n public static create = (\n options: BlockNoteTipTapEditorOptions,\n styleSchema: StyleSchema\n ) => {\n // because we separate the constructor from the creation of the view,\n // we need to patch setTimeout to prevent this code from having any effect:\n // https://github.com/ueberdosis/tiptap/blob/45bac803283446795ad1b03f43d3746fa54a68ff/packages/core/src/Editor.ts#L117\n const oldSetTimeout = globalThis?.window?.setTimeout;\n if (typeof globalThis?.window?.setTimeout !== \"undefined\") {\n globalThis.window.setTimeout = (() => {\n return 0;\n }) as any;\n }\n try {\n return new BlockNoteTipTapEditor(options, styleSchema);\n } finally {\n if (oldSetTimeout) {\n globalThis.window.setTimeout = oldSetTimeout;\n }\n }\n };\n\n protected constructor(\n options: BlockNoteTipTapEditorOptions,\n styleSchema: StyleSchema\n ) {\n // possible fix for next.js server side rendering\n // const d = globalThis.document;\n // const w = globalThis.window;\n // if (!globalThis.document) {\n // globalThis.document = {\n // createElement: () => {},\n // };\n // }\n\n // options.injectCSS = false\n\n super({ ...options, content: undefined });\n // try {\n // globalThis.window = w;\n // } catch(e) {}\n // try {\n // globalThis.document = d;\n // } catch(e) {}\n\n // This is a hack to make \"initial content detection\" by y-prosemirror (and also tiptap isEmpty)\n // properly detect whether or not the document has changed.\n // We change the doc.createAndFill function to make sure the initial block id is set, instead of null\n const schema = this.schema;\n let cache: any;\n const oldCreateAndFill = schema.nodes.doc.createAndFill;\n (schema.nodes.doc as any).createAndFill = (...args: any) => {\n if (cache) {\n return cache;\n }\n const ret = oldCreateAndFill.apply(schema.nodes.doc, args);\n\n // create a copy that we can mutate (otherwise, assigning attrs is not safe and corrupts the pm state)\n const jsonNode = JSON.parse(JSON.stringify(ret!.toJSON()));\n jsonNode.content[0].content[0].attrs.id = \"initialBlockId\";\n\n cache = Node.fromJSON(schema, jsonNode);\n return cache;\n };\n\n let doc: Node;\n\n try {\n const pmNodes = options?.content.map((b) =>\n blockToNode(b, this.schema, styleSchema).toJSON()\n );\n doc = createDocument(\n {\n type: \"doc\",\n content: [\n {\n type: \"blockGroup\",\n content: pmNodes,\n },\n ],\n },\n this.schema,\n this.options.parseOptions\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Error creating document from blocks passed as `initialContent`. Caused by exception: \",\n e\n );\n throw new Error(\n \"Error creating document from blocks passed as `initialContent`:\\n\" +\n +JSON.stringify(options.content)\n );\n }\n\n // Create state immediately, so that it's available independently from the View,\n // the way Prosemirror \"intends it to be\". This also makes sure that we can access\n // the state before the view is created / mounted.\n this._state = EditorState.create({\n doc,\n schema: this.schema,\n // selection: selection || undefined,\n });\n }\n\n get state() {\n if (this.view) {\n this._state = this.view.state;\n }\n return this._state;\n }\n\n dispatch(tr: Transaction) {\n if (this.view) {\n this.view.dispatch(tr);\n } else {\n // before view has been initialized\n this._state = this.state.apply(tr);\n }\n }\n\n /**\n * Replace the default `createView` method with a custom one - which we call on mount\n */\n private createViewAlternative() {\n this._creating = true;\n // Without queueMicrotask, custom IC / styles will give a React FlushSync error\n queueMicrotask(() => {\n if (!this._creating) {\n return;\n }\n this.view = new EditorView(\n { mount: this.options.element as any }, // use mount option so that we reuse the existing element instead of creating a new one\n {\n ...this.options.editorProps,\n // @ts-ignore\n dispatchTransaction: this.dispatchTransaction.bind(this),\n state: this.state,\n }\n );\n\n // `editor.view` is not yet available at this time.\n // Therefore we will add all plugins and node views directly afterwards.\n const newState = this.state.reconfigure({\n plugins: this.extensionManager.plugins,\n });\n\n this.view.updateState(newState);\n\n this.createNodeViews();\n\n // emit the created event, call here manually because we blocked the default call in the constructor\n // (https://github.com/ueberdosis/tiptap/blob/45bac803283446795ad1b03f43d3746fa54a68ff/packages/core/src/Editor.ts#L117)\n this.commands.focus(this.options.autofocus);\n this.emit(\"create\", { editor: this });\n this.isInitialized = true;\n this._creating = false;\n });\n }\n\n /**\n * Mounts / unmounts the editor to a dom element\n *\n * @param element DOM element to mount to, ur null / undefined to destroy\n */\n public mount = (element?: HTMLElement | null) => {\n if (!element) {\n this.destroy();\n // cancel pending microtask\n this._creating = false;\n } else {\n this.options.element = element;\n // @ts-ignore\n this.createViewAlternative();\n }\n };\n}\n\n(BlockNoteTipTapEditor.prototype as any).createView = function () {\n // no-op\n // Disable default call to `createView` in the Editor constructor.\n // We should call `createView` manually only when a DOM element is available\n\n // additional fix because onPaste and onDrop depend on installing plugins in constructor which we don't support\n this.options.onPaste = this.options.onDrop = undefined;\n};\n","import { Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nconst PLUGIN_KEY = new PluginKey(`blocknote-placeholder`);\n\nexport const PlaceholderPlugin = (\n editor: BlockNoteEditor<any, any, any>,\n placeholders: Record<string | \"default\", string>\n) => {\n return new Plugin({\n key: PLUGIN_KEY,\n view: () => {\n const styleEl = document.createElement(\"style\");\n const nonce = editor._tiptapEditor.options.injectNonce;\n if (nonce) {\n styleEl.setAttribute(\"nonce\", nonce);\n }\n if (editor._tiptapEditor.view.root instanceof ShadowRoot) {\n editor._tiptapEditor.view.root.append(styleEl);\n } else {\n editor._tiptapEditor.view.root.head.appendChild(styleEl);\n }\n\n const styleSheet = styleEl.sheet!;\n\n const getBaseSelector = (additionalSelectors = \"\") =>\n `.bn-block-content${additionalSelectors} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;\n\n const getSelector = (\n blockType: string | \"default\",\n mustBeFocused = true\n ) => {\n const mustBeFocusedSelector = mustBeFocused\n ? `[data-is-empty-and-focused]`\n : ``;\n\n if (blockType === \"default\") {\n return getBaseSelector(mustBeFocusedSelector);\n }\n\n const blockTypeSelector = `[data-content-type=\"${blockType}\"]`;\n return getBaseSelector(mustBeFocusedSelector + blockTypeSelector);\n };\n\n for (const [blockType, placeholder] of Object.entries(placeholders)) {\n const mustBeFocused = blockType === \"default\";\n\n styleSheet.insertRule(\n `${getSelector(blockType, mustBeFocused)}{ content: ${JSON.stringify(\n placeholder\n )}; }`\n );\n\n // For some reason, the placeholders which show when the block is focused\n // take priority over ones which show depending on block type, so we need\n // to make sure the block specific ones are also used when the block is\n // focused.\n if (!mustBeFocused) {\n styleSheet.insertRule(\n `${getSelector(blockType, true)}{ content: ${JSON.stringify(\n placeholder\n )}; }`\n );\n }\n }\n\n return {\n destroy: () => {\n if (editor._tiptapEditor.view.root instanceof ShadowRoot) {\n editor._tiptapEditor.view.root.removeChild(styleEl);\n } else {\n editor._tiptapEditor.view.root.head.removeChild(styleEl);\n }\n },\n };\n },\n props: {\n // TODO: maybe also add placeholder for empty document (\"e.g.: start writing..\")\n decorations: (state) => {\n const { doc, selection } = state;\n\n if (!editor.isEditable) {\n return;\n }\n\n if (!selection.empty) {\n return;\n }\n\n // Don't show placeholder when the cursor is inside a code block\n if (selection.$from.parent.type.spec.code) {\n return;\n }\n\n const $pos = selection.$anchor;\n const node = $pos.parent;\n\n if (node.content.size > 0) {\n return null;\n }\n\n const before = $pos.before();\n\n const dec = Decoration.node(before, before + node.nodeSize, {\n \"data-is-empty-and-focused\": \"true\",\n });\n\n return DecorationSet.create(doc, [dec]);\n },\n },\n });\n};\n","import { Plugin, PluginKey, TextSelection } from \"prosemirror-state\";\n\nconst PLUGIN_KEY = new PluginKey(\"node-selection-keyboard\");\n// By default, typing with a node selection active will cause ProseMirror to\n// replace the node with one that contains editable content. This plugin blocks\n// this behaviour without also blocking things like keyboard shortcuts:\n//\n// - Lets through key presses that do not include alphanumeric characters. This\n// includes things like backspace/delete/home/end/etc.\n// - Lets through any key presses that include ctrl/meta keys. These will be\n// shortcuts of some kind like ctrl+C/mod+C.\n// - Special case for Enter key which creates a new paragraph block below and\n// sets the selection to it. This is just to bring the UX closer to Notion\n//\n// While a more elegant solution would probably process transactions instead of\n// keystrokes, this brings us most of the way to Notion's UX without much added\n// complexity.\nexport const NodeSelectionKeyboardPlugin = () => {\n return new Plugin({\n key: PLUGIN_KEY,\n props: {\n handleKeyDown: (view, event) => {\n // Checks for node selection\n if (\"node\" in view.state.selection) {\n // Checks if key press uses ctrl/meta modifier\n if (event.ctrlKey || event.metaKey) {\n return false;\n }\n // Checks if key press is alphanumeric\n if (event.key.length === 1) {\n event.preventDefault();\n\n return true;\n }\n // Checks if key press is Enter\n if (\n event.key === \"Enter\" &&\n !event.shiftKey &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n const tr = view.state.tr;\n view.dispatch(\n tr\n .insert(\n view.state.tr.selection.$to.after(),\n view.state.schema.nodes[\"paragraph\"].createChecked()\n )\n .setSelection(\n new TextSelection(\n tr.doc.resolve(view.state.tr.selection.$to.after() + 1)\n )\n )\n );\n\n return true;\n }\n }\n\n return false;\n },\n },\n });\n};\n","import { findChildren } from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\n\nconst PLUGIN_KEY = new PluginKey(`previous-blocks`);\n\nconst nodeAttributes: Record<string, string> = {\n // Numbered List Items\n index: \"index\",\n // Headings\n level: \"level\",\n // All Blocks\n type: \"type\",\n depth: \"depth\",\n \"depth-change\": \"depth-change\",\n};\n\n/**\n * This plugin tracks transformation of Block node attributes, so we can support CSS transitions.\n *\n * Problem it solves: ProseMirror recreates the DOM when transactions happen. So when a transaction changes a Node attribute,\n * it results in a completely new DOM element. This means CSS transitions don't work.\n *\n * Solution: When attributes change on a node, this plugin sets a data-* attribute with the \"previous\" value. This way we can still use CSS transitions. (See block.module.css)\n */\nexport const PreviousBlockTypePlugin = () => {\n let timeout: any;\n return new Plugin({\n key: PLUGIN_KEY,\n view(_editorView) {\n return {\n update: async (view, _prevState) => {\n if (this.key?.getState(view.state).updatedBlocks.size > 0) {\n // use setTimeout 0 to clear the decorations so that at least\n // for one DOM-render the decorations have been applied\n timeout = setTimeout(() => {\n view.dispatch(\n view.state.tr.setMeta(PLUGIN_KEY, { clearUpdate: true })\n );\n }, 0);\n }\n },\n destroy: () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n },\n };\n },\n state: {\n init() {\n return {\n // Block attributes, by block ID, from just before the previous transaction.\n prevTransactionOldBlockAttrs: {} as any,\n // Block attributes, by block ID, from just before the current transaction.\n currentTransactionOldBlockAttrs: {} as any,\n // Set of IDs of blocks whose attributes changed from the current transaction.\n updatedBlocks: new Set<string>(),\n };\n },\n\n apply(transaction, prev, oldState, newState) {\n prev.currentTransactionOldBlockAttrs = {};\n prev.updatedBlocks.clear();\n\n if (!transaction.docChanged || oldState.doc.eq(newState.doc)) {\n return prev;\n }\n\n // TODO: Instead of iterating through the entire document, only check nodes affected by the transactions. Will\n // also probably require checking nodes affected by the previous transaction too.\n // We didn't get this to work yet:\n // const transform = combineTransactionSteps(oldState.doc, [transaction]);\n // // const { mapping } = transform;\n // const changes = getChangedRanges(transform);\n //\n // changes.forEach(({ oldRange, newRange }) => {\n // const oldNodes = findChildrenInRange(\n // oldState.doc,\n // oldRange,\n // (node) => node.attrs.id\n // );\n //\n // const newNodes = findChildrenInRange(\n // newState.doc,\n // newRange,\n // (node) => node.attrs.id\n // );\n\n const currentTransactionOriginalOldBlockAttrs = {} as any;\n\n const oldNodes = findChildren(oldState.doc, (node) => node.attrs.id);\n const oldNodesById = new Map(\n oldNodes.map((node) => [node.node.attrs.id, node])\n );\n const newNodes = findChildren(newState.doc, (node) => node.attrs.id);\n\n // Traverses all block containers in the new editor state.\n for (const node of newNodes) {\n const oldNode = oldNodesById.get(node.node.attrs.id);\n\n const oldContentNode = oldNode?.node.firstChild;\n const newContentNode = node.node.firstChild;\n\n if (oldNode && oldContentNode && newContentNode) {\n const newAttrs = {\n index: newContentNode.attrs.index,\n level: newContentNode.attrs.level,\n type: newContentNode.type.name,\n depth: newState.doc.resolve(node.pos).depth,\n };\n\n let oldAttrs = {\n index: oldContentNode.attrs.index,\n level: oldContentNode.attrs.level,\n type: oldContentNode.type.name,\n depth: oldState.doc.resolve(oldNode.pos).depth,\n };\n\n currentTransactionOriginalOldBlockAttrs[node.node.attrs.id] =\n oldAttrs;\n\n // Whenever a transaction is appended by the OrderedListItemIndexPlugin, it's given the metadata:\n // { \"orderedListIndexing\": true }\n // These appended transactions happen immediately after any transaction which causes ordered list item\n // indices to require updating, including those which trigger animations. Therefore, these animations are\n // immediately overridden when the PreviousBlockTypePlugin processes the appended transaction, despite only\n // the listItemIndex attribute changing. To solve this, oldAttrs must be edited for transactions with the\n // \"orderedListIndexing\" metadata, so the correct animation can be re-triggered.\n if (transaction.getMeta(\"numberedListIndexing\")) {\n // If the block existed before the transaction, gets the attributes from before the previous transaction\n // (i.e. the transaction that caused list item indices to need updating).\n if (node.node.attrs.id in prev.prevTransactionOldBlockAttrs) {\n oldAttrs =\n prev.prevTransactionOldBlockAttrs[node.node.attrs.id];\n }\n\n // Stops list item indices themselves being animated (looks smoother), unless the block's content type is\n // changing from a numbered list item to something else.\n if (newAttrs.type === \"numberedListItem\") {\n oldAttrs.index = newAttrs.index;\n }\n }\n\n prev.currentTransactionOldBlockAttrs[node.node.attrs.id] = oldAttrs;\n\n // TODO: faster deep equal?\n if (JSON.stringify(oldAttrs) !== JSON.stringify(newAttrs)) {\n (oldAttrs as any)[\"depth-change\"] =\n oldAttrs.depth - newAttrs.depth;\n\n // for debugging:\n // console.log(\n // \"id:\",\n // node.node.attrs.id,\n // \"previousBlockTypePlugin changes detected, oldAttrs\",\n // oldAttrs,\n // \"new\",\n // newAttrs\n // );\n\n prev.updatedBlocks.add(node.node.attrs.id);\n }\n }\n }\n\n prev.prevTransactionOldBlockAttrs =\n currentTransactionOriginalOldBlockAttrs;\n\n return prev;\n },\n },\n props: {\n decorations(state) {\n const pluginState = (this as Plugin).getState(state);\n if (pluginState.updatedBlocks.size === 0) {\n return undefined;\n }\n\n const decorations: Decoration[] = [];\n\n state.doc.descendants((node, pos) => {\n if (!node.attrs.id) {\n return;\n }\n\n if (!pluginState.updatedBlocks.has(node.attrs.id)) {\n return;\n }\n\n const prevAttrs =\n pluginState.currentTransactionOldBlockAttrs[node.attrs.id];\n const decorationAttrs: any = {};\n\n for (const [nodeAttr, val] of Object.entries(prevAttrs)) {\n decorationAttrs[\"data-prev-\" + nodeAttributes[nodeAttr]] =\n val || \"none\";\n }\n\n // for debugging:\n // console.log(\n // \"previousBlockTypePlugin committing decorations\",\n // decorationAttrs\n // );\n\n const decoration = Decoration.node(pos, pos + node.nodeSize, {\n ...decorationAttrs,\n });\n\n decorations.push(decoration);\n });\n\n return DecorationSet.create(state.doc, decorations);\n },\n },\n });\n};\n","import { EditorOptions, Extension, getSchema } from \"@tiptap/core\";\nimport { Node, Schema } from \"prosemirror-model\";\n// import \"./blocknote.css\";\nimport * as Y from \"yjs\";\nimport { insertBlocks } from \"../api/blockManipulation/commands/insertBlocks/insertBlocks.js\";\nimport {\n moveBlockDown,\n moveBlockUp,\n} from \"../api/blockManipulation/commands/moveBlock/moveBlock.js\";\nimport {\n canNestBlock,\n canUnnestBlock,\n nestBlock,\n unnestBlock,\n} from \"../api/blockManipulation/commands/nestBlock/nestBlock.js\";\nimport { removeBlocks } from \"../api/blockManipulation/commands/removeBlocks/removeBlocks.js\";\nimport { replaceBlocks } from \"../api/blockManipulation/commands/replaceBlocks/replaceBlocks.js\";\nimport { updateBlock } from \"../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { insertContentAt } from \"../api/blockManipulation/insertContentAt.js\";\nimport {\n getTextCursorPosition,\n setTextCursorPosition,\n} from \"../api/blockManipulation/selections/textCursorPosition/textCursorPosition.js\";\nimport { createExternalHTMLExporter } from \"../api/exporters/html/externalHTMLExporter.js\";\nimport { blocksToMarkdown } from \"../api/exporters/markdown/markdownExporter.js\";\nimport { HTMLToBlocks } from \"../api/parsers/html/parseHTML.js\";\nimport { markdownToBlocks } from \"../api/parsers/markdown/parseMarkdown.js\";\nimport {\n Block,\n DefaultBlockSchema,\n DefaultInlineContentSchema,\n DefaultStyleSchema,\n PartialBlock,\n} from \"../blocks/defaultBlocks.js\";\nimport { FilePanelProsemirrorPlugin } from \"../extensions/FilePanel/FilePanelPlugin.js\";\nimport { FormattingToolbarProsemirrorPlugin } from \"../extensions/FormattingToolbar/FormattingToolbarPlugin.js\";\nimport { LinkToolbarProsemirrorPlugin } from \"../extensions/LinkToolbar/LinkToolbarPlugin.js\";\nimport { SideMenuProsemirrorPlugin } from \"../extensions/SideMenu/SideMenuPlugin.js\";\nimport { SuggestionMenuProseMirrorPlugin } from \"../extensions/SuggestionMenu/SuggestionPlugin.js\";\nimport { TableHandlesProsemirrorPlugin } from \"../extensions/TableHandles/TableHandlesPlugin.js\";\nimport { UniqueID } from \"../extensions/UniqueID/UniqueID.js\";\nimport {\n BlockIdentifier,\n BlockNoteDOMAttributes,\n BlockSchema,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSpecs,\n PartialInlineContent,\n StyleSchema,\n StyleSpecs,\n Styles,\n} from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\nimport { NoInfer, UnreachableCaseError } from \"../util/typescript.js\";\n\nimport { getBlockNoteExtensions } from \"./BlockNoteExtensions.js\";\nimport { TextCursorPosition } from \"./cursorPositionTypes.js\";\n\nimport { Selection } from \"./selectionTypes.js\";\nimport { transformPasted } from \"./transformPasted.js\";\n\nimport { checkDefaultBlockTypeInSchema } from \"../blocks/defaultBlockTypeGuards.js\";\nimport { BlockNoteSchema } from \"./BlockNoteSchema.js\";\nimport {\n BlockNoteTipTapEditor,\n BlockNoteTipTapEditorOptions,\n} from \"./BlockNoteTipTapEditor.js\";\n\nimport { PlaceholderPlugin } from \"../extensions/Placeholder/PlaceholderPlugin.js\";\nimport { Dictionary } from \"../i18n/dictionary.js\";\nimport { en } from \"../i18n/locales/index.js\";\n\nimport { Plugin, Transaction } from \"@tiptap/pm/state\";\nimport { dropCursor } from \"prosemirror-dropcursor\";\nimport { createInternalHTMLSerializer } from \"../api/exporters/html/internalHTMLSerializer.js\";\nimport { inlineContentToNodes } from \"../api/nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../api/nodeConversions/nodeToBlock.js\";\nimport { NodeSelectionKeyboardPlugin } from \"../extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js\";\nimport { PreviousBlockTypePlugin } from \"../extensions/PreviousBlockType/PreviousBlockTypePlugin.js\";\nimport \"../style.css\";\n\nexport type BlockNoteEditorOptions<\n BSchema extends BlockSchema,\n ISchema extends InlineContentSchema,\n SSchema extends StyleSchema\n> = {\n /**\n * Whether changes to blocks (like indentation, creating lists, changing headings) should be animated or not. Defaults to `true`.\n *\n * @default true\n */\n animations?: boolean;\n\n disableExtensions: string[];\n /**\n * A dictionary object containing translations for the editor.\n */\n dictionary?: Dictionary & Record<string, any>;\n\n /**\n * @deprecated, provide placeholders via dictionary instead\n */\n placeholders: Record<string | \"default\", string>;\n\n /**\n * An object containing attributes that should be added to HTML elements of the editor.\n *\n * @example { editor: { class: \"my-editor-class\" } }\n */\n domAttributes: Partial<BlockNoteDOMAttributes>;\n\n /**\n * The content that should be in the editor when it's created, represented as an array of partial block objects.\n */\n initialContent: PartialBlock<\n NoInfer<BSchema>,\n NoInfer<ISchema>,\n NoInfer<SSchema>\n >[];\n /**\n * Use default BlockNote font and reset the styles of <p> <li> <h1> elements etc., that are used in BlockNote.\n *\n * @default true\n */\n defaultStyles: boolean;\n\n schema: BlockNoteSchema<BSchema, ISchema, SSchema>;\n\n /**\n * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).\n * This method should set when creating the editor as this is application-specific.\n *\n * `undefined` means the application doesn't support file uploads.\n *\n * @param file The file that should be uploaded.\n * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)\n */\n uploadFile: (\n file: File,\n blockId?: string\n ) => Promise<string | Record<string, any>>;\n\n /**\n * Resolve a URL of a file block to one that can be displayed or downloaded. This can be used for creating authenticated URL or\n * implementing custom protocols / schemes\n * @returns The URL that's\n */\n resolveFileUrl: (url: string) => Promise<string>;\n\n /**\n * When enabled, allows for collaboration between multiple users.\n */\n collaboration: {\n /**\n * The Yjs XML fragment that's used for collaboration.\n */\n fragment: Y.XmlFragment;\n /**\n * The user info for the current user that's shown to other collaborators.\n */\n user: {\n name: string;\n color: string;\n };\n /**\n * A Yjs provider (used for awareness / cursor information)\n */\n provider: any;\n /**\n * Optional function to customize how cursors of users are rendered\n */\n renderCursor?: (user: any) => HTMLElement;\n };\n\n // tiptap options, undocumented\n _tiptapOptions: Partial<EditorOptions>;\n\n trailingBlock?: boolean;\n\n /**\n * Boolean indicating whether the editor is in headless mode.\n * Headless mode means we can use features like importing / exporting blocks,\n * but there's no underlying editor (UI) instantiated.\n *\n * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally\n */\n _headless: boolean;\n\n /**\n * A flag indicating whether to set an HTML ID for every block\n *\n * When set to `true`, on each block an id attribute will be set with the block id\n * Otherwise, the HTML ID attribute will not be set.\n *\n * (note that the id is always set on the `data-id` attribute)\n */\n setIdAttribute?: boolean;\n\n dropCursor?: (opts: any) => Plugin;\n};\n\nconst blockNoteTipTapOptions = {\n enableInputRules: true,\n enablePasteRules: true,\n enableCoreExtensions: false,\n};\n\nexport class BlockNoteEditor<\n BSchema extends BlockSchema = DefaultBlockSchema,\n ISchema extends InlineContentSchema = DefaultInlineContentSchema,\n SSchema extends StyleSchema = DefaultStyleSchema\n> {\n private readonly _pmSchema: Schema;\n\n /**\n * Boolean indicating whether the editor is in headless mode.\n * Headless mode means we can use features like importing / exporting blocks,\n * but there's no underlying editor (UI) instantiated.\n *\n * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally\n */\n public readonly headless: boolean = false;\n\n public readonly _tiptapEditor:\n | BlockNoteTipTapEditor & {\n contentComponent: any;\n } = undefined as any; // TODO: Type should actually reflect that it can be `undefined` in headless mode\n\n /**\n * Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements\n * in the correct context (used by `ReactRenderUtil`)\n */\n public elementRenderer: ((node: any, container: HTMLElement) => void) | null =\n null;\n\n /**\n * Cache of all blocks. This makes sure we don't have to \"recompute\" blocks if underlying Prosemirror Nodes haven't changed.\n * This is especially useful when we want to keep track of the same block across multiple operations,\n * with this cache, blocks stay the same object reference (referential equality with ===).\n */\n public blockCache = new WeakMap<Node, Block<any, any, any>>();\n\n /**\n * The dictionary contains translations for the editor.\n */\n public readonly dictionary: Dictionary & Record<string, any>;\n\n /**\n * The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.\n */\n public readonly schema: BlockNoteSchema<BSchema, ISchema, SSchema>;\n\n public readonly blockImplementations: BlockSpecs;\n public readonly inlineContentImplementations: InlineContentSpecs;\n public readonly styleImplementations: StyleSpecs;\n\n public readonly formattingToolbar: FormattingToolbarProsemirrorPlugin;\n public readonly linkToolbar: LinkToolbarProsemirrorPlugin<\n BSchema,\n ISchema,\n SSchema\n >;\n public readonly sideMenu: SideMenuProsemirrorPlugin<\n BSchema,\n ISchema,\n SSchema\n >;\n public readonly suggestionMenus: SuggestionMenuProseMirrorPlugin<\n BSchema,\n ISchema,\n SSchema\n >;\n public readonly filePanel?: FilePanelProsemirrorPlugin<ISchema, SSchema>;\n public readonly tableHandles?: TableHandlesProsemirrorPlugin<\n ISchema,\n SSchema\n >;\n\n /**\n * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).\n * This method should set when creating the editor as this is application-specific.\n *\n * `undefined` means the application doesn't support file uploads.\n *\n * @param file The file that should be uploaded.\n * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)\n */\n public readonly uploadFile:\n | ((file: File, blockId?: string) => Promise<string | Record<string, any>>)\n | undefined;\n\n private onUploadStartCallbacks: ((blockId?: string) => void)[] = [];\n private onUploadEndCallbacks: ((blockId?: string) => void)[] = [];\n\n public readonly resolveFileUrl: (url: string) => Promise<string>;\n\n public get pmSchema() {\n return this._pmSchema;\n }\n\n public static create<\n BSchema extends BlockSchema = DefaultBlockSchema,\n ISchema extends InlineContentSchema = DefaultInlineContentSchema,\n SSchema extends StyleSchema = DefaultStyleSchema\n >(options: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>> = {}) {\n return new BlockNoteEditor<BSchema, ISchema, SSchema>(options);\n }\n\n protected constructor(\n protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>\n ) {\n const anyOpts = options as any;\n if (anyOpts.onEditorContentChange) {\n throw new Error(\n \"onEditorContentChange initialization option is deprecated, use <BlockNoteView onChange={...} />, the useEditorChange(...) hook, or editor.onChange(...)\"\n );\n }\n\n if (anyOpts.onTextCursorPositionChange) {\n throw new Error(\n \"onTextCursorPositionChange initialization option is deprecated, use <BlockNoteView onSelectionChange={...} />, the useEditorSelectionChange(...) hook, or editor.onSelectionChange(...)\"\n );\n }\n\n if (anyOpts.onEditorReady) {\n throw new Error(\n \"onEditorReady is deprecated. Editor is immediately ready for use after creation.\"\n );\n }\n\n if (anyOpts.editable) {\n throw new Error(\n \"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false\"\n );\n }\n\n this.dictionary = options.dictionary || en;\n\n // apply defaults\n const newOptions = {\n defaultStyles: true,\n schema: options.schema || BlockNoteSchema.create(),\n _headless: false,\n ...options,\n placeholders: {\n ...this.dictionary.placeholders,\n ...options.placeholders,\n },\n };\n\n // @ts-ignore\n this.schema = newOptions.schema;\n this.blockImplementations = newOptions.schema.blockSpecs;\n this.inlineContentImplementations = newOptions.schema.inlineContentSpecs;\n this.styleImplementations = newOptions.schema.styleSpecs;\n\n this.formattingToolbar = new FormattingToolbarProsemirrorPlugin(this);\n this.linkToolbar = new LinkToolbarProsemirrorPlugin(this);\n this.sideMenu = new SideMenuProsemirrorPlugin(this);\n this.suggestionMenus = new SuggestionMenuProseMirrorPlugin(this);\n this.filePanel = new FilePanelProsemirrorPlugin(this as any);\n\n if (checkDefaultBlockTypeInSchema(\"table\", this)) {\n this.tableHandles = new TableHandlesProsemirrorPlugin(this as any);\n }\n\n const extensions = getBlockNoteExtensions({\n editor: this,\n domAttributes: newOptions.domAttributes || {},\n blockSpecs: this.schema.blockSpecs,\n styleSpecs: this.schema.styleSpecs,\n inlineContentSpecs: this.schema.inlineContentSpecs,\n collaboration: newOptions.collaboration,\n trailingBlock: newOptions.trailingBlock,\n disableExtensions: newOptions.disableExtensions,\n setIdAttribute: newOptions.setIdAttribute,\n });\n\n const dropCursorPlugin: any = this.options.dropCursor ?? dropCursor;\n const blockNoteUIExtension = Extension.create({\n name: \"BlockNoteUIExtension\",\n\n addProseMirrorPlugins: () => {\n return [\n this.formattingToolbar.plugin,\n this.linkToolbar.plugin,\n this.sideMenu.plugin,\n this.suggestionMenus.plugin,\n ...(this.filePanel ? [this.filePanel.plugin] : []),\n ...(this.tableHandles ? [this.tableHandles.plugin] : []),\n dropCursorPlugin({ width: 5, color: \"#ddeeff\", editor: this }),\n PlaceholderPlugin(this, newOptions.placeholders),\n NodeSelectionKeyboardPlugin(),\n ...(this.options.animations ?? true\n ? [PreviousBlockTypePlugin()]\n : []),\n ];\n },\n });\n extensions.push(blockNoteUIExtension);\n\n if (newOptions.uploadFile) {\n const uploadFile = newOptions.uploadFile;\n this.uploadFile = async (file, block) => {\n this.onUploadStartCallbacks.forEach((callback) =>\n callback.apply(this, [block])\n );\n try {\n return await uploadFile(file, block);\n } finally {\n this.onUploadEndCallbacks.forEach((callback) =>\n callback.apply(this, [block])\n );\n }\n };\n }\n\n this.resolveFileUrl = newOptions.resolveFileUrl || (async (url) => url);\n this.headless = newOptions._headless;\n\n if (newOptions.collaboration && newOptions.initialContent) {\n // eslint-disable-next-line no-console\n console.warn(\n \"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider\"\n );\n }\n\n const initialContent =\n newOptions.initialContent ||\n (options.collaboration\n ? [\n {\n type: \"paragraph\",\n id: \"initialBlockId\",\n },\n ]\n : [\n {\n type: \"paragraph\",\n id: UniqueID.options.generateID(),\n },\n ]);\n\n if (!Array.isArray(initialContent) || initialContent.length === 0) {\n throw new Error(\n \"initialContent must be a non-empty array of blocks, received: \" +\n initialContent\n );\n }\n\n const tiptapOptions: BlockNoteTipTapEditorOptions = {\n ...blockNoteTipTapOptions,\n ...newOptions._tiptapOptions,\n content: initialContent,\n extensions: [\n ...(newOptions._tiptapOptions?.extensions || []),\n ...extensions,\n ],\n editorProps: {\n ...newOptions._tiptapOptions?.editorProps,\n attributes: {\n // As of TipTap v2.5.0 the tabIndex is removed when the editor is not\n // editable, so you can't focus it. We want to revert this as we have\n // UI behaviour that relies on it.\n tabIndex: \"0\",\n ...newOptions._tiptapOptions?.editorProps?.attributes,\n ...newOptions.domAttributes?.editor,\n class: mergeCSSClasses(\n \"bn-editor\",\n newOptions.defaultStyles ? \"bn-default-styles\" : \"\",\n newOptions.domAttributes?.editor?.class || \"\"\n ),\n },\n transformPasted,\n },\n };\n\n if (!this.headless) {\n this._tiptapEditor = BlockNoteTipTapEditor.create(\n tiptapOptions,\n this.schema.styleSchema\n ) as BlockNoteTipTapEditor & {\n contentComponent: any;\n };\n this._pmSchema = this._tiptapEditor.schema;\n } else {\n // In headless mode, we don't instantiate an underlying TipTap editor,\n // but we still need the schema\n this._pmSchema = getSchema(tiptapOptions.extensions!);\n }\n }\n\n dispatch(tr: Transaction) {\n this._tiptapEditor.dispatch(tr);\n }\n\n /**\n * Mount the editor to a parent DOM element. Call mount(undefined) to clean up\n *\n * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting\n */\n public mount = (parentElement?: HTMLElement | null) => {\n this._tiptapEditor.mount(parentElement);\n };\n\n public get prosemirrorView() {\n return this._tiptapEditor.view;\n }\n\n public get domElement() {\n return this._tiptapEditor.view.dom as HTMLDivElement;\n }\n\n public isFocused() {\n return this._tiptapEditor.view.hasFocus();\n }\n\n public focus() {\n this._tiptapEditor.view.focus();\n }\n\n public onUploadStart(callback: (blockId?: string) => void) {\n this.onUploadStartCallbacks.push(callback);\n\n return () => {\n const index = this.onUploadStartCallbacks.indexOf(callback);\n if (index > -1) {\n this.onUploadStartCallbacks.splice(index, 1);\n }\n };\n }\n\n public onUploadEnd(callback: (blockId?: string) => void) {\n this.onUploadEndCallbacks.push(callback);\n\n return () => {\n const index = this.onUploadEndCallbacks.indexOf(callback);\n if (index > -1) {\n this.onUploadEndCallbacks.splice(index, 1);\n }\n };\n }\n\n /**\n * @deprecated, use `editor.document` instead\n */\n public get topLevelBlocks(): Block<BSchema, ISchema, SSchema>[] {\n return this.document;\n }\n\n /**\n * Gets a snapshot of all top-level (non-nested) blocks in the editor.\n * @returns A snapshot of all top-level (non-nested) blocks in the editor.\n */\n public get document(): Block<BSchema, ISchema, SSchema>[] {\n const blocks: Block<BSchema, ISchema, SSchema>[] = [];\n\n this._tiptapEditor.state.doc.firstChild!.descendants((node) => {\n blocks.push(\n nodeToBlock(\n node,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.blockCache\n )\n );\n\n return false;\n });\n\n return blocks;\n }\n\n /**\n * Gets a snapshot of an existing block from the editor.\n * @param blockIdentifier The identifier of an existing block that should be retrieved.\n * @returns The block that matches the identifier, or `undefined` if no matching block was found.\n */\n public getBlock(\n blockIdentifier: BlockIdentifier\n ): Block<BSchema, ISchema, SSchema> | undefined {\n const id =\n typeof blockIdentifier === \"string\"\n ? blockIdentifier\n : blockIdentifier.id;\n let newBlock: Block<BSchema, ISchema, SSchema> | undefined = undefined;\n\n this._tiptapEditor.state.doc.firstChild!.descendants((node) => {\n if (typeof newBlock !== \"undefined\") {\n return false;\n }\n\n if (node.type.name !== \"blockContainer\" || node.attrs.id !== id) {\n return true;\n }\n\n newBlock = nodeToBlock(\n node,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.blockCache\n );\n\n return false;\n });\n\n return newBlock;\n }\n\n /**\n * Traverses all blocks in the editor depth-first, and executes a callback for each.\n * @param callback The callback to execute for each block. Returning `false` stops the traversal.\n * @param reverse Whether the blocks should be traversed in reverse order.\n */\n public forEachBlock(\n callback: (block: Block<BSchema, ISchema, SSchema>) => boolean,\n reverse = false\n ): void {\n const blocks = this.document.slice();\n\n if (reverse) {\n blocks.reverse();\n }\n\n function traverseBlockArray(\n blockArray: Block<BSchema, ISchema, SSchema>[]\n ): boolean {\n for (const block of blockArray) {\n if (callback(block) === false) {\n return false;\n }\n\n const children = reverse\n ? block.children.slice().reverse()\n : block.children;\n\n if (!traverseBlockArray(children)) {\n return false;\n }\n }\n\n return true;\n }\n\n traverseBlockArray(blocks);\n }\n\n /**\n * Executes a callback whenever the editor's contents change.\n * @param callback The callback to execute.\n */\n public onEditorContentChange(callback: () => void) {\n this._tiptapEditor.on(\"update\", callback);\n }\n\n /**\n * Executes a callback whenever the editor's selection changes.\n * @param callback The callback to execute.\n */\n public onEditorSelectionChange(callback: () => void) {\n this._tiptapEditor.on(\"selectionUpdate\", callback);\n }\n\n /**\n * Gets a snapshot of the current text cursor position.\n * @returns A snapshot of the current text cursor position.\n */\n public getTextCursorPosition(): TextCursorPosition<\n BSchema,\n ISchema,\n SSchema\n > {\n return getTextCursorPosition(this);\n }\n\n /**\n * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could\n * not be found.\n * @param targetBlock The identifier of an existing block that the text cursor should be moved to.\n * @param placement Whether the text cursor should be placed at the start or end of the block.\n */\n public setTextCursorPosition(\n targetBlock: BlockIdentifier,\n placement: \"start\" | \"end\" = \"start\"\n ) {\n setTextCursorPosition(this, targetBlock, placement);\n }\n\n /**\n * Gets a snapshot of the current selection.\n */\n public getSelection(): Selection<BSchema, ISchema, SSchema> | undefined {\n // Either the TipTap selection is empty, or it's a node selection. In either\n // case, it only spans one block, so we return undefined.\n if (\n this._tiptapEditor.state.selection.from ===\n this._tiptapEditor.state.selection.to ||\n \"node\" in this._tiptapEditor.state.selection\n ) {\n return undefined;\n }\n\n const blocks: Block<BSchema, ISchema, SSchema>[] = [];\n\n // TODO: This adds all child blocks to the same array. Needs to find min\n // depth and only add blocks at that depth.\n this._tiptapEditor.state.doc.descendants((node, pos) => {\n if (node.type.spec.group !== \"blockContent\") {\n return true;\n }\n\n // Fixed the block pos and size\n // all block is wrapped with a blockContent wrapper\n // and blockContent wrapper pos = inner block pos - 1\n // blockContent wrapper end = inner block pos + nodeSize + 1\n // need to add 1 to start and -1 to end\n const end = pos + node.nodeSize - 1;\n const start = pos + 1;\n if (\n end <= this._tiptapEditor.state.selection.from ||\n start >= this._tiptapEditor.state.selection.to\n ) {\n return true;\n }\n\n blocks.push(\n nodeToBlock(\n this._tiptapEditor.state.doc.resolve(pos).node(),\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.blockCache\n )\n );\n\n return false;\n });\n\n return { blocks: blocks };\n }\n\n /**\n * Checks if the editor is currently editable, or if it's locked.\n * @returns True if the editor is editable, false otherwise.\n */\n public get isEditable(): boolean {\n if (!this._tiptapEditor) {\n if (!this.headless) {\n throw new Error(\"no editor, but also not headless?\");\n }\n return false;\n }\n return this._tiptapEditor.isEditable === undefined\n ? true\n : this._tiptapEditor.isEditable;\n }\n\n /**\n * Makes the editor editable or locks it, depending on the argument passed.\n * @param editable True to make the editor editable, or false to lock it.\n */\n public set isEditable(editable: boolean) {\n if (!this._tiptapEditor) {\n if (!this.headless) {\n throw new Error(\"no editor, but also not headless?\");\n }\n // not relevant on headless\n return;\n }\n if (this._tiptapEditor.options.editable !== editable) {\n this._tiptapEditor.setEditable(editable);\n }\n }\n\n /**\n * Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an\n * error if the reference block could not be found.\n * @param blocksToInsert An array of partial blocks that should be inserted.\n * @param referenceBlock An identifier for an existing block, at which the new blocks should be inserted.\n * @param placement Whether the blocks should be inserted just before, just after, or nested inside the\n * `referenceBlock`.\n */\n public insertBlocks(\n blocksToInsert: PartialBlock<BSchema, ISchema, SSchema>[],\n referenceBlock: BlockIdentifier,\n placement: \"before\" | \"after\" = \"before\"\n ) {\n return insertBlocks(this, blocksToInsert, referenceBlock, placement);\n }\n\n /**\n * Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be\n * defined. These undefined fields are kept as-is from the existing block. Throws an error if the block to update could\n * not be found.\n * @param blockToUpdate The block that should be updated.\n * @param update A partial block which defines how the existing block should be changed.\n */\n public updateBlock(\n blockToUpdate: BlockIdentifier,\n update: PartialBlock<BSchema, ISchema, SSchema>\n ) {\n return updateBlock(this, blockToUpdate, update);\n }\n\n /**\n * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.\n * @param blocksToRemove An array of identifiers for existing blocks that should be removed.\n */\n public removeBlocks(blocksToRemove: BlockIdentifier[]) {\n return removeBlocks(this, blocksToRemove);\n }\n\n /**\n * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or\n * are at different nesting levels, `blocksToInsert` will be inserted at the position of the first block in\n * `blocksToRemove`. Throws an error if any of the blocks to remove could not be found.\n * @param blocksToRemove An array of blocks that should be replaced.\n * @param blocksToInsert An array of partial blocks to replace the old ones with.\n */\n public replaceBlocks(\n blocksToRemove: BlockIdentifier[],\n blocksToInsert: PartialBlock<BSchema, ISchema, SSchema>[]\n ) {\n return replaceBlocks(this, blocksToRemove, blocksToInsert);\n }\n\n /**\n * Insert a piece of content at the current cursor position.\n *\n * @param content can be a string, or array of partial inline content elements\n */\n public insertInlineContent(content: PartialInlineContent<ISchema, SSchema>) {\n const nodes = inlineContentToNodes(\n content,\n this.pmSchema,\n this.schema.styleSchema\n );\n\n insertContentAt(\n {\n from: this._tiptapEditor.state.selection.from,\n to: this._tiptapEditor.state.selection.to,\n },\n nodes,\n this\n );\n }\n\n /**\n * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.\n */\n public getActiveStyles() {\n const styles: Styles<SSchema> = {};\n const marks = this._tiptapEditor.state.selection.$to.marks();\n\n for (const mark of marks) {\n const config = this.schema.styleSchema[mark.type.name];\n if (!config) {\n if (mark.type.name !== \"link\") {\n // eslint-disable-next-line no-console\n console.warn(\"mark not found in styleschema\", mark.type.name);\n }\n\n continue;\n }\n if (config.propSchema === \"boolean\") {\n (styles as any)[config.type] = true;\n } else {\n (styles as any)[config.type] = mark.attrs.stringValue;\n }\n }\n\n return styles;\n }\n\n /**\n * Adds styles to the currently selected content.\n * @param styles The styles to add.\n */\n public addStyles(styles: Styles<SSchema>) {\n for (const [style, value] of Object.entries(styles)) {\n const config = this.schema.styleSchema[style];\n if (!config) {\n throw new Error(`style ${style} not found in styleSchema`);\n }\n if (config.propSchema === \"boolean\") {\n this._tiptapEditor.commands.setMark(style);\n } else if (config.propSchema === \"string\") {\n this._tiptapEditor.commands.setMark(style, { stringValue: value });\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n }\n\n /**\n * Removes styles from the currently selected content.\n * @param styles The styles to remove.\n */\n public removeStyles(styles: Styles<SSchema>) {\n for (const style of Object.keys(styles)) {\n this._tiptapEditor.commands.unsetMark(style);\n }\n }\n\n /**\n * Toggles styles on the currently selected content.\n * @param styles The styles to toggle.\n */\n public toggleStyles(styles: Styles<SSchema>) {\n for (const [style, value] of Object.entries(styles)) {\n const config = this.schema.styleSchema[style];\n if (!config) {\n throw new Error(`style ${style} not found in styleSchema`);\n }\n if (config.propSchema === \"boolean\") {\n this._tiptapEditor.commands.toggleMark(style);\n } else if (config.propSchema === \"string\") {\n this._tiptapEditor.commands.toggleMark(style, { stringValue: value });\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n }\n\n /**\n * Gets the currently selected text.\n */\n public getSelectedText() {\n return this._tiptapEditor.state.doc.textBetween(\n this._tiptapEditor.state.selection.from,\n this._tiptapEditor.state.selection.to\n );\n }\n\n /**\n * Gets the URL of the last link in the current selection, or `undefined` if there are no links in the selection.\n */\n public getSelectedLinkUrl() {\n return this._tiptapEditor.getAttributes(\"link\").href as string | undefined;\n }\n\n /**\n * Creates a new link to replace the selected content.\n * @param url The link URL.\n * @param text The text to display the link with.\n */\n public createLink(url: string, text?: string) {\n if (url === \"\") {\n return;\n }\n\n const { from, to } = this._tiptapEditor.state.selection;\n\n if (!text) {\n text = this._tiptapEditor.state.doc.textBetween(from, to);\n }\n\n const mark = this.pmSchema.mark(\"link\", { href: url });\n\n this.dispatch(\n this._tiptapEditor.state.tr\n .insertText(text, from, to)\n .addMark(from, from + text.length, mark)\n );\n }\n\n /**\n * Checks if the block containing the text cursor can be nested.\n */\n public canNestBlock() {\n return canNestBlock(this);\n }\n\n /**\n * Nests the block containing the text cursor into the block above it.\n */\n public nestBlock() {\n nestBlock(this);\n }\n\n /**\n * Checks if the block containing the text cursor is nested.\n */\n public canUnnestBlock() {\n return canUnnestBlock(this);\n }\n\n /**\n * Lifts the block containing the text cursor out of its parent.\n */\n public unnestBlock() {\n unnestBlock(this);\n }\n\n /**\n * Moves the block containing the text cursor up. If the previous block has\n * children, moves it to the end of its children. If there is no previous\n * block, but the current block is nested, moves it out of & before its parent.\n */\n public moveBlockUp() {\n moveBlockUp(this);\n }\n\n /**\n * Moves the block containing the text cursor down. If the next block has\n * children, moves it to the start of its children. If there is no next block,\n * but the current block is nested, moves it out of & after its parent.\n */\n public moveBlockDown() {\n moveBlockDown(this);\n }\n\n /**\n * Exports blocks into a simplified HTML string. To better conform to HTML standards, children of blocks which aren't list\n * items are un-nested in the output HTML.\n *\n * @param blocks An array of blocks that should be serialized into HTML.\n * @returns The blocks, serialized as an HTML string.\n */\n public async blocksToHTMLLossy(\n blocks: PartialBlock<BSchema, ISchema, SSchema>[] = this.document\n ): Promise<string> {\n const exporter = createExternalHTMLExporter(this.pmSchema, this);\n return exporter.exportBlocks(blocks, {});\n }\n\n /**\n * Serializes blocks into an HTML string in the format that would normally be rendered by the editor.\n *\n * Use this method if you want to server-side render HTML (for example, a blog post that has been edited in BlockNote)\n * and serve it to users without loading the editor on the client (i.e.: displaying the blog post)\n *\n * @param blocks An array of blocks that should be serialized into HTML.\n * @returns The blocks, serialized as an HTML string.\n */\n public async blocksToFullHTML(\n blocks: PartialBlock<BSchema, ISchema, SSchema>[]\n ): Promise<string> {\n const exporter = createInternalHTMLSerializer(this.pmSchema, this);\n return exporter.serializeBlocks(blocks, {});\n }\n /**\n * Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and\n * `InlineNode` objects from any HTML inline elements, though not all element types are recognized. If BlockNote\n * doesn't recognize an HTML element's tag, it will parse it as a paragraph or plain text.\n * @param html The HTML string to parse blocks from.\n * @returns The blocks parsed from the HTML string.\n */\n public async tryParseHTMLToBlocks(\n html: string\n ): Promise<Block<BSchema, ISchema, SSchema>[]> {\n return HTMLToBlocks(\n html,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.pmSchema\n );\n }\n\n /**\n * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of\n * BlockNote - children of blocks which aren't list items are un-nested and certain styles are removed.\n * @param blocks An array of blocks that should be serialized into Markdown.\n * @returns The blocks, serialized as a Markdown string.\n */\n public async blocksToMarkdownLossy(\n blocks: PartialBlock<BSchema, ISchema, SSchema>[] = this.document\n ): Promise<string> {\n return blocksToMarkdown(blocks, this.pmSchema, this, {});\n }\n\n /**\n * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on\n * Markdown syntax, though not all symbols are recognized. If BlockNote doesn't recognize a symbol, it will parse it\n * as text.\n * @param markdown The Markdown string to parse blocks from.\n * @returns The blocks parsed from the Markdown string.\n */\n public async tryParseMarkdownToBlocks(\n markdown: string\n ): Promise<Block<BSchema, ISchema, SSchema>[]> {\n return markdownToBlocks(\n markdown,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.pmSchema\n );\n }\n\n /**\n * Updates the user info for the current user that's shown to other collaborators.\n */\n public updateCollaborationUserInfo(user: { name: string; color: string }) {\n if (!this.options.collaboration) {\n throw new Error(\n \"Cannot update collaboration user info when collaboration is disabled.\"\n );\n }\n this._tiptapEditor.commands.updateUser(user);\n }\n\n /**\n * A callback function that runs whenever the editor's contents change.\n *\n * @param callback The callback to execute.\n * @returns A function to remove the callback.\n */\n public onChange(\n callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void\n ) {\n if (this.headless) {\n // Note: would be nice if this is possible in headless mode as well\n return;\n }\n\n const cb = () => {\n callback(this);\n };\n\n this._tiptapEditor.on(\"update\", cb);\n\n return () => {\n this._tiptapEditor.off(\"update\", cb);\n };\n }\n\n /**\n * A callback function that runs whenever the text cursor position or selection changes.\n *\n * @param callback The callback to execute.\n * @returns A function to remove the callback.\n */\n public onSelectionChange(\n callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void\n ) {\n if (this.headless) {\n return;\n }\n\n const cb = () => {\n callback(this);\n };\n\n this._tiptapEditor.on(\"selectionUpdate\", cb);\n\n return () => {\n this._tiptapEditor.off(\"selectionUpdate\", cb);\n };\n }\n\n public openSuggestionMenu(\n triggerCharacter: string,\n pluginState?: {\n deleteTriggerCharacter?: boolean;\n ignoreQueryLength?: boolean;\n }\n ) {\n const tr = this.prosemirrorView.state.tr;\n const transaction =\n pluginState && pluginState.deleteTriggerCharacter\n ? tr.insertText(triggerCharacter)\n : tr;\n\n this.prosemirrorView.focus();\n this.prosemirrorView.dispatch(\n transaction.scrollIntoView().setMeta(this.suggestionMenus.plugin, {\n triggerCharacter: triggerCharacter,\n deleteTriggerCharacter: pluginState?.deleteTriggerCharacter || false,\n ignoreQueryLength: pluginState?.ignoreQueryLength || false,\n })\n );\n }\n}\n","export const COLORS_DEFAULT = {\n gray: {\n text: \"#9b9a97\",\n background: \"#ebeced\",\n },\n brown: {\n text: \"#64473a\",\n background: \"#e9e5e3\",\n },\n red: {\n text: \"#e03e3e\",\n background: \"#fbe4e4\",\n },\n orange: {\n text: \"#d9730d\",\n background: \"#f6e9d9\",\n },\n yellow: {\n text: \"#dfab01\",\n background: \"#fbf3db\",\n },\n green: {\n text: \"#4d6461\",\n background: \"#ddedea\",\n },\n blue: {\n text: \"#0b6e99\",\n background: \"#ddebf1\",\n },\n purple: {\n text: \"#6940a5\",\n background: \"#eae4f2\",\n },\n pink: {\n text: \"#ad1a72\",\n background: \"#f4dfeb\",\n },\n};\n\nexport const COLORS_DARK_MODE_DEFAULT = {\n gray: {\n text: \"#bebdb8\",\n background: \"#9b9a97\",\n },\n brown: {\n text: \"#8e6552\",\n background: \"#64473a\",\n },\n red: {\n text: \"#ec4040\",\n background: \"#be3434\",\n },\n orange: {\n text: \"#e3790d\",\n background: \"#b7600a\",\n },\n yellow: {\n text: \"#dfab01\",\n background: \"#b58b00\",\n },\n green: {\n text: \"#6b8b87\",\n background: \"#4d6461\",\n },\n blue: {\n text: \"#0e87bc\",\n background: \"#0b6e99\",\n },\n purple: {\n text: \"#8552d7\",\n background: \"#6940a5\",\n },\n pink: {\n text: \"#da208f\",\n background: \"#ad1a72\",\n },\n};\n","import { BlockNoteSchema } from \"../editor/BlockNoteSchema.js\";\nimport { COLORS_DEFAULT } from \"../editor/defaultColors.js\";\nimport {\n BlockFromConfig,\n BlockSchema,\n InlineContent,\n InlineContentSchema,\n StyleSchema,\n StyledText,\n Styles,\n} from \"../schema/index.js\";\n\nimport type {\n BlockMapping,\n InlineContentMapping,\n StyleMapping,\n} from \"./mapping.js\";\n\nexport type ExporterOptions = {\n /**\n * A function that can be used to resolve files, images, etc.\n * Exporters might need the binary contents of files like images,\n * which might not always be available from the same origin as the main page.\n * You can use this option to proxy requests through a server you control\n * to avoid cross-origin (CORS) issues.\n *\n * @default uses a BlockNote hosted proxy (https://corsproxy.api.blocknotejs.org/)\n * @param url - The URL of the file to resolve\n * @returns A Promise that resolves to a string (the URL to use instead of the original)\n * or a Blob (you can return the Blob directly if you have already fetched it)\n */\n resolveFileUrl?: (url: string) => Promise<string | Blob>;\n /**\n * Colors to use for background of blocks, font colors, and highlight colors\n */\n colors: typeof COLORS_DEFAULT;\n};\nexport abstract class Exporter<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n RB,\n RI,\n RS,\n TS\n> {\n public constructor(\n _schema: BlockNoteSchema<B, I, S>, // only used for type inference\n protected readonly mappings: {\n blockMapping: BlockMapping<B, I, S, RB, RI>;\n inlineContentMapping: InlineContentMapping<I, S, RI, TS>;\n styleMapping: StyleMapping<S, RS>;\n },\n public readonly options: ExporterOptions\n ) {}\n\n public async resolveFile(url: string) {\n if (!this.options?.resolveFileUrl) {\n return (await fetch(url)).blob();\n }\n const ret = await this.options.resolveFileUrl(url);\n if (ret instanceof Blob) {\n return ret;\n }\n return (await fetch(ret)).blob();\n }\n\n public mapStyles(styles: Styles<S>) {\n const stylesArray = Object.entries(styles).map(([key, value]) => {\n const mappedStyle = this.mappings.styleMapping[key](value, this);\n return mappedStyle;\n });\n return stylesArray;\n }\n\n public mapInlineContent(inlineContent: InlineContent<I, S>) {\n return this.mappings.inlineContentMapping[inlineContent.type](\n inlineContent,\n this\n );\n }\n\n public transformInlineContent(inlineContentArray: InlineContent<I, S>[]) {\n return inlineContentArray.map((ic) => this.mapInlineContent(ic));\n }\n\n public abstract transformStyledText(styledText: StyledText<S>): TS;\n\n public async mapBlock(\n block: BlockFromConfig<B[keyof B], I, S>,\n nestingLevel: number,\n numberedListIndex: number\n ) {\n return this.mappings.blockMapping[block.type](\n block,\n this,\n nestingLevel,\n numberedListIndex\n );\n }\n}\n","import { BlockNoteSchema } from \"../editor/BlockNoteSchema.js\";\nimport {\n BlockFromConfigNoChildren,\n BlockSchema,\n InlineContentFromConfig,\n InlineContentSchema,\n StyleSchema,\n Styles,\n} from \"../schema/index.js\";\nimport type { Exporter } from \"./Exporter.js\";\n\n/**\n * Defines a mapping from all block types with a schema to a result type `R`.\n */\nexport type BlockMapping<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n RB,\n RI\n> = {\n [K in keyof B]: (\n block: BlockFromConfigNoChildren<B[K], I, S>,\n // we don't know the exact types that are supported by the exporter at this point,\n // because the mapping only knows about converting certain types (which might be a subset of the supported types)\n // this is why there are many `any` types here (same for types below)\n exporter: Exporter<any, any, any, RB, RI, any, any>,\n nestingLevel: number,\n numberedListIndex?: number\n ) => RB | Promise<RB>;\n};\n\n/**\n * Defines a mapping from all inline content types with a schema to a result type R.\n */\nexport type InlineContentMapping<\n I extends InlineContentSchema,\n S extends StyleSchema,\n RI,\n TS\n> = {\n [K in keyof I]: (\n inlineContent: InlineContentFromConfig<I[K], S>,\n exporter: Exporter<any, I, S, any, RI, any, TS>\n ) => RI;\n};\n\n/**\n * Defines a mapping from all style types with a schema to a result type R.\n */\nexport type StyleMapping<S extends StyleSchema, RS> = {\n [K in keyof S]: (\n style: Styles<S>[K],\n exporter: Exporter<any, any, any, any, any, RS, any>\n ) => RS;\n};\n\n/**\n * The mapping factory is a utility function to easily create mappings for\n * a BlockNoteSchema. Using the factory makes it easier to get typescript code completion etc.\n */\nexport function mappingFactory<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(_schema: BlockNoteSchema<B, I, S>) {\n return {\n createBlockMapping: <R, RI>(mapping: BlockMapping<B, I, S, R, RI>) =>\n mapping,\n createInlineContentMapping: <R, RS>(\n mapping: InlineContentMapping<I, S, R, RS>\n ) => mapping,\n createStyleMapping: <R>(mapping: StyleMapping<S, R>) => mapping,\n };\n}\n","import type { Emoji, EmojiMartData } from \"@emoji-mart/data\";\n\nimport { checkDefaultInlineContentTypeInSchema } from \"../../blocks/defaultBlockTypeGuards.js\";\nimport { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { DefaultGridSuggestionItem } from \"./DefaultGridSuggestionItem.js\";\n\nlet data:\n | Promise<{\n default: EmojiMartData;\n }>\n | undefined;\n\nlet emojiMart: typeof import(\"emoji-mart\") | undefined;\n\nexport async function getDefaultEmojiPickerItems<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n query: string\n): Promise<DefaultGridSuggestionItem[]> {\n if (!checkDefaultInlineContentTypeInSchema(\"text\", editor)) {\n return [];\n }\n\n if (!data) {\n // use a dynamic import to encourage bundle-splitting\n // and a smaller initial client bundle size\n\n data = import(\"@emoji-mart/data\") as any;\n\n // load dynamically because emoji-mart doesn't specify type: module and breaks in nodejs\n emojiMart = await import(\"emoji-mart\");\n const emojiMartData = (await data)!.default;\n await emojiMart.init({ data: emojiMartData });\n }\n\n const emojiMartData = (await data)!.default;\n\n const emojisToShow =\n query.trim() === \"\"\n ? Object.values(emojiMartData.emojis)\n : ((await emojiMart!.SearchIndex.search(query)) as Emoji[]);\n\n return emojisToShow.map((emoji) => ({\n id: emoji.skins[0].native,\n onItemClick: () => editor.insertInlineContent(emoji.skins[0].native + \" \"),\n }));\n}\n","import { Block, PartialBlock } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nimport { checkDefaultBlockTypeInSchema } from \"../../blocks/defaultBlockTypeGuards.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n isStyledTextInlineContent,\n} from \"../../schema/index.js\";\nimport { formatKeyboardShortcut } from \"../../util/browser.js\";\nimport { DefaultSuggestionItem } from \"./DefaultSuggestionItem.js\";\n\n// Sets the editor's text cursor position to the next content editable block,\n// so either a block with inline content or a table. The last block is always a\n// paragraph, so this function won't try to set the cursor position past the\n// last block.\nfunction setSelectionToNextContentEditableBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>) {\n let block = editor.getTextCursorPosition().block;\n let contentType = editor.schema.blockSchema[block.type].content;\n\n while (contentType === \"none\") {\n block = editor.getTextCursorPosition().nextBlock!;\n contentType = editor.schema.blockSchema[block.type].content as\n | \"inline\"\n | \"table\"\n | \"none\";\n editor.setTextCursorPosition(block, \"end\");\n }\n}\n\n// Checks if the current block is empty or only contains a slash, and if so,\n// updates the current block instead of inserting a new one below. If the new\n// block doesn't contain editable content, the cursor is moved to the next block\n// that does.\nexport function insertOrUpdateBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n block: PartialBlock<BSchema, I, S>\n): Block<BSchema, I, S> {\n const currentBlock = editor.getTextCursorPosition().block;\n\n if (currentBlock.content === undefined) {\n throw new Error(\"Slash Menu open in a block that doesn't contain content.\");\n }\n\n let newBlock: Block<BSchema, I, S>;\n\n if (\n Array.isArray(currentBlock.content) &&\n ((currentBlock.content.length === 1 &&\n isStyledTextInlineContent(currentBlock.content[0]) &&\n currentBlock.content[0].type === \"text\" &&\n currentBlock.content[0].text === \"/\") ||\n currentBlock.content.length === 0)\n ) {\n newBlock = editor.updateBlock(currentBlock, block);\n // We make sure to reset the cursor position to the new block as calling\n // `updateBlock` may move it out. This generally happens when the content\n // changes, or the update makes the block multi-column.\n editor.setTextCursorPosition(newBlock);\n } else {\n newBlock = editor.insertBlocks([block], currentBlock, \"after\")[0];\n editor.setTextCursorPosition(editor.getTextCursorPosition().nextBlock!);\n }\n\n setSelectionToNextContentEditableBlock(editor);\n\n return newBlock;\n}\n\nexport function getDefaultSlashMenuItems<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>) {\n const items: DefaultSuggestionItem[] = [];\n\n if (checkDefaultBlockTypeInSchema(\"heading\", editor)) {\n items.push(\n {\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"heading\",\n props: { level: 1 },\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-1\"),\n key: \"heading\",\n ...editor.dictionary.slash_menu.heading,\n },\n {\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"heading\",\n props: { level: 2 },\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-2\"),\n key: \"heading_2\",\n ...editor.dictionary.slash_menu.heading_2,\n },\n {\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"heading\",\n props: { level: 3 },\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-3\"),\n key: \"heading_3\",\n ...editor.dictionary.slash_menu.heading_3,\n }\n );\n }\n\n if (checkDefaultBlockTypeInSchema(\"numberedListItem\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"numberedListItem\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Shift-7\"),\n key: \"numbered_list\",\n ...editor.dictionary.slash_menu.numbered_list,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"bulletListItem\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"bulletListItem\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Shift-8\"),\n key: \"bullet_list\",\n ...editor.dictionary.slash_menu.bullet_list,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"checkListItem\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"checkListItem\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Shift-9\"),\n key: \"check_list\",\n ...editor.dictionary.slash_menu.check_list,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"paragraph\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"paragraph\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-0\"),\n key: \"paragraph\",\n ...editor.dictionary.slash_menu.paragraph,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"codeBlock\", editor)) {\n items.push({\n onItemClick: () => {\n const pos = editor._tiptapEditor.state.selection.from;\n\n insertOrUpdateBlock(editor, {\n type: \"codeBlock\",\n });\n\n // Move the cursor inside the code block\n editor._tiptapEditor.commands.setTextSelection(pos);\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-c\"),\n key: \"code_block\",\n ...editor.dictionary.slash_menu.code_block,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"table\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"table\",\n content: {\n type: \"tableContent\",\n rows: [\n {\n cells: [\"\", \"\", \"\"],\n },\n {\n cells: [\"\", \"\", \"\"],\n },\n ],\n },\n });\n },\n badge: undefined,\n key: \"table\",\n ...editor.dictionary.slash_menu.table,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"image\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"image\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"image\",\n ...editor.dictionary.slash_menu.image,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"video\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"video\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"video\",\n ...editor.dictionary.slash_menu.video,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"audio\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"audio\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"audio\",\n ...editor.dictionary.slash_menu.audio,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"file\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"file\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"file\",\n ...editor.dictionary.slash_menu.file,\n });\n }\n\n items.push({\n onItemClick: () => {\n editor.openSuggestionMenu(\":\", {\n deleteTriggerCharacter: true,\n ignoreQueryLength: true,\n });\n },\n key: \"emoji\",\n ...editor.dictionary.slash_menu.emoji,\n });\n\n return items;\n}\n\nexport function filterSuggestionItems<\n T extends { title: string; aliases?: readonly string[] }\n>(items: T[], query: string) {\n return items.filter(\n ({ title, aliases }) =>\n title.toLowerCase().includes(query.toLowerCase()) ||\n (aliases &&\n aliases.filter((alias) =>\n alias.toLowerCase().includes(query.toLowerCase())\n ).length !== 0)\n );\n}\n","/**\n * Combines items by group. This can be used to combine multiple slash menu item arrays,\n * while making sure that items from the same group are adjacent to each other.\n */\nexport function combineByGroup<T extends { group?: string }>(\n items: T[],\n ...additionalItemsArray: {\n group?: string;\n }[][]\n) {\n const combinedItems = [...items];\n for (const additionalItems of additionalItemsArray) {\n for (const additionalItem of additionalItems) {\n const lastItemWithSameGroup = combinedItems.findLastIndex(\n (item) => item.group === additionalItem.group\n );\n if (lastItemWithSameGroup === -1) {\n combinedItems.push(additionalItem as T);\n } else {\n combinedItems.splice(lastItemWithSameGroup + 1, 0, additionalItem as T);\n }\n }\n }\n return combinedItems;\n}\n","import { Block, PartialBlock } from \"../../blocks/defaultBlocks.js\";\nimport { BlockNoteSchema } from \"../../editor/BlockNoteSchema.js\";\nimport UniqueID from \"../../extensions/UniqueID/UniqueID.js\";\nimport { BlockSchema, TableContent } from \"../../schema/blocks/types.js\";\nimport {\n InlineContent,\n InlineContentSchema,\n PartialInlineContent,\n StyledText,\n isPartialLinkInlineContent,\n isStyledTextInlineContent,\n} from \"../../schema/inlineContent/types.js\";\nimport { StyleSchema } from \"../../schema/styles/types.js\";\n\nfunction textShorthandToStyledText(\n content: string | StyledText<any>[] = \"\"\n): StyledText<any>[] {\n if (typeof content === \"string\") {\n return [\n {\n type: \"text\",\n text: content,\n styles: {},\n },\n ];\n }\n return content;\n}\n\nfunction partialContentToInlineContent(\n content: PartialInlineContent<any, any> | TableContent<any> | undefined\n): InlineContent<any, any>[] | TableContent<any> | undefined {\n if (typeof content === \"string\") {\n return textShorthandToStyledText(content);\n }\n\n if (Array.isArray(content)) {\n return content.flatMap((partialContent) => {\n if (typeof partialContent === \"string\") {\n return textShorthandToStyledText(partialContent);\n } else if (isPartialLinkInlineContent(partialContent)) {\n return {\n ...partialContent,\n content: textShorthandToStyledText(partialContent.content),\n };\n } else if (isStyledTextInlineContent(partialContent)) {\n return partialContent;\n } else {\n // custom inline content\n\n return {\n props: {},\n ...partialContent,\n content: partialContentToInlineContent(partialContent.content),\n } as any;\n }\n });\n } else if (content?.type === \"tableContent\") {\n return {\n type: \"tableContent\",\n columnWidths: content.columnWidths,\n rows: content.rows.map((row) => ({\n ...row,\n cells: row.cells.map(\n (cell) => partialContentToInlineContent(cell) as any\n ),\n })),\n };\n }\n\n return content;\n}\n\nexport function partialBlocksToBlocksForTesting<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: BlockNoteSchema<BSchema, I, S>,\n partialBlocks: Array<PartialBlock<NoInfer<BSchema>, NoInfer<I>, NoInfer<S>>>\n): Array<Block<BSchema, I, S>> {\n return partialBlocks.map((partialBlock) =>\n partialBlockToBlockForTesting(schema.blockSchema, partialBlock)\n );\n}\n\nexport function partialBlockToBlockForTesting<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: BSchema,\n partialBlock: PartialBlock<BSchema, I, S>\n): Block<BSchema, I, S> {\n const contentType: \"inline\" | \"table\" | \"none\" =\n schema[partialBlock.type!].content;\n\n const withDefaults: Block<BSchema, I, S> = {\n id: \"\",\n type: partialBlock.type!,\n props: {} as any,\n content:\n contentType === \"inline\"\n ? []\n : contentType === \"table\"\n ? { type: \"tableContent\", columnWidths: [], rows: [] }\n : (undefined as any),\n children: [] as any,\n ...partialBlock,\n };\n\n Object.entries(schema[partialBlock.type!].propSchema).forEach(\n ([propKey, propValue]) => {\n if (withDefaults.props[propKey] === undefined) {\n (withDefaults.props as any)[propKey] = propValue.default;\n }\n }\n );\n\n if (contentType === \"inline\") {\n const content = withDefaults.content as InlineContent<I, S>[] | undefined;\n withDefaults.content = partialContentToInlineContent(content) as any;\n } else if (contentType === \"table\") {\n const content = withDefaults.content as TableContent<I, S> | undefined;\n withDefaults.content = {\n type: \"tableContent\",\n columnWidths:\n content?.columnWidths ||\n content?.rows[0]?.cells.map(() => undefined) ||\n [],\n rows:\n content?.rows.map((row) => ({\n cells: row.cells.map((cell) => partialContentToInlineContent(cell)),\n })) || [],\n } as any;\n }\n\n return {\n ...withDefaults,\n content: partialContentToInlineContent(withDefaults.content),\n children: withDefaults.children.map((c) => {\n return partialBlockToBlockForTesting(schema, c);\n }),\n } as any;\n}\n\nexport function addIdsToBlock(block: PartialBlock<any, any, any>) {\n if (!block.id) {\n block.id = UniqueID.options.generateID();\n }\n if (block.children) {\n addIdsToBlocks(block.children);\n }\n}\n\nexport function addIdsToBlocks(blocks: PartialBlock<any, any, any>[]) {\n for (const block of blocks) {\n addIdsToBlock(block);\n }\n}\n"],"names":["ar","de","en","es","fr","hr","is","ja","ko","nl","pl","pt","ru","vi","zh","UnreachableCaseError","val","assertEmpty","obj","throwError","dataTest","rest","removeDuplicates","array","by","seen","item","key","findDuplicates","items","filtered","el","index","UniqueID","Extension","testOptions","v4","element","attributes","defaultIdAttributes","dragSourceElement","transformPasted","Plugin","PluginKey","transactions","oldState","newState","docChanges","transaction","filterTransactions","tr","_a","_b","types","attributeName","generateID","transform","combineTransactionSteps","mapping","getChangedRanges","newRange","newNodes","findChildrenInRange","node","newIds","id","duplicatedNewIds","pos","initialDoc","jsonNode","deleted","view","handleDragstart","event","slice","removeId","fragment","list","nodeWithoutId","Fragment","Slice","isLinkInlineContent","content","isPartialLinkInlineContent","isStyledTextInlineContent","styledTextToNodes","styledText","schema","styleSchema","marks","style","value","config","text","linkToNodes","link","linkMark","styledTextArrayToNodes","nodes","inlineContentToNodes","blockContent","blockOrInlineContentToContentNode","tableContentToNodes","tableContent","rowNodes","row","columnNodes","i","cell","pNode","textNodes","cellNode","rowNode","block","contentNode","type","blockToNode","children","child","nodeTypeCorrespondingToBlock","groupNode","addAttributesAndRemoveClasses","className","serializeInlineContentExternalHTML","editor","serializer","options","dom","serializeBlock","orderedListItemBlockTypes","unorderedListItemBlockTypes","doc","BC_NODE","props","name","spec","attrs","ret","elementFragment","blockContentDataAttributes","attr","ic","listType","_c","li","childFragment","serializeBlocksToFragment","_d","_e","_f","_g","_h","blocks","serializeBlocksExternalHTML","createExternalHTMLExporter","DOMSerializer","html","div","inlineContent","domFragment","parent","serializeInlineContentInternalHTML","listIndex","serializeBlocks","bc","serializeBlocksInternalHTML","blockDOM","BG_NODE","bg","createInternalHTMLSerializer","getNearestBlockContainerPos","$pos","depth","allBlockContainerPositions","resolvedPos","position","getBlockInfoWithManualOffset","bnBlockBeforePosOffset","bnBlockNode","bnBlockBeforePos","bnBlockAfterPos","bnBlock","blockGroup","offset","blockContentNode","blockContentBeforePos","blockContentAfterPos","blockGroupNode","blockGroupBeforePos","blockGroupAfterPos","getBlockInfo","posInfo","getBlockInfoFromResolvedPos","getBlockInfoFromSelection","state","getNodeById","targetNode","posBeforeNode","isAppleOS","formatKeyboardShortcut","shortcut","ctrlText","mergeCSSClasses","classes","c","isSafari","createDefaultBlockDOMOutputSpec","blockName","htmlTag","blockContentHTMLAttributes","inlineContentHTMLAttributes","attribute","defaultBlockToHTML","toDOM","renderSpec","defaultProps","inheritedProps","camelToDataKebab","str","filenameFromURL","url","parts","propsToAttributes","propSchema","tiptapAttributes","_spec","asNumber","getBlockFromPos","getPos","tipTapEditor","blockIdentifier","wrapInBlockStructure","blockType","blockProps","isFileBlock","domAttributes","prop","createStronglyTypedTiptapNode","Node","createInternalBlockSpec","implementation","createBlockSpecFromStronglyTypedTiptapNode","requiredExtensions","getBlockSchemaFromSpecs","specs","applyNonSelectableBlockFix","nodeView","getParseRules","customParseFunction","rules","createBlockSpec","blockConfig","blockImplementation","HTMLAttributes","blockContentDOMAttributes","output","contentNodeToTableContent","inlineContentSchema","_offset","contentNodeToInlineContent","currentContent","nodeToCustomInlineContent","styles","mark","icConfig","nodeToBlock","blockSchema","blockCache","cachedBlock","blockInfo","blockSpec","addInlineContentAttributes","inlineContentType","inlineContentProps","addInlineContentKeyboardShortcuts","createInternalInlineContentSpec","createInlineContentSpecFromTipTapNode","getInlineContentSchemaFromSpecs","getInlineContentParseRules","htmlElement","createInlineContentSpec","inlineContentConfig","inlineContentImplementation","update","stylePropsToAttributes","addStyleAttributes","styleType","styleValue","createInternalStyleSpec","createStyleSpecFromTipTapMark","getStyleSchemaFromSpecs","getStyleParseRules","createStyleSpec","styleConfig","styleImplementation","Mark","renderResult","FILE_ICON_SVG","createFileBlockWrapper","buttonText","buttonIcon","wrapper","addFileButton","createAddFileButton","loading","destroyUploadStartHandler","blockId","destroyUploadEndHandler","file","createDefaultFilePreview","createFileAndCaptionWrapper","icon","fileName","fileAndCaptionWrapper","caption","addFileButtonIcon","addFileButtonText","addFileButtonMouseDownHandler","addFileButtonClickHandler","parseEmbedElement","embedElement","parseFigureElement","figureElement","targetTag","targetElement","captionElement","createLinkWithCaption","fileCaption","createFigureWithCaption","figure","createResizeHandlesWrapper","getWidth","setWidth","leftResizeHandle","rightResizeHandle","resizeParams","windowMouseMoveHandler","newWidth","minWidth","windowMouseUpHandler","elementMouseEnterHandler","elementMouseLeaveHandler","leftResizeHandleMouseDownHandler","rightResizeHandleMouseDownHandler","parseAudioElement","audioElement","FILE_AUDIO_ICON_SVG","audioPropSchema","audioBlockConfig","audioRender","audio","downloadUrl","audioParse","parsedFigure","audioToExternalHTML","AudioBlock","defaultSupportedLanguages","bundledLanguagesInfo","lang","defaultCodeBlockPropSchema","CodeBlockContent","inputElement","dataLanguage","languages","language","pre","contentDOM","supportedLanguages","select","selectWrapper","handleLanguageChange","option","newNode","highlighter","parser","createHighlightPlugin","createHighlighter","createdHighlighter","createParser","InputRule","range","match","$start","languageName","TextSelection","selection","$from","isTextSelection","from","isAtEnd","endsWithDoubleNewline","CodeBlock","customizeCodeBlock","filePropSchema","fileBlockConfig","fileRender","fileParse","fileToExternalHTML","fileSrcLink","FileBlock","uploadToTmpFilesDotOrg_DEV_ONLY","body","parseImageElement","imageElement","previewWidth","FILE_IMAGE_ICON_SVG","imagePropSchema","imageBlockConfig","imageRender","image","width","imageParse","imageToExternalHTML","ImageBlock","RESIZE_MIN_WIDTH","EMPTY_CELL_WIDTH","EMPTY_CELL_HEIGHT","TableExtension","columnResizing","tableEditing","selectionIsEmpty","selectionIsAtStartOfNode","selectionIsInTableParagraphNode","extension","context","callOrReturn","getExtensionField","parseVideoElement","videoElement","FILE_VIDEO_ICON_SVG","videoPropSchema","videoBlockConfig","videoRender","video","videoParse","videoToExternalHTML","VideoBlock","BackgroundColorMark","BackgroundColor","TextColorMark","TextColor","updateBlockCommand","posBeforeBlock","dispatch","oldNodeType","newNodeType","newBnBlockNodeType","updateChildren","updateBlockContentNode","existingBlock","childNodes","ReplaceStep","updateBlock","blockToUpdate","ttEditor","blockContainerNode","headingPropSchema","HeadingBlockContent","parsed","level","chain","Heading","splitBlockCommand","posInBlock","keepType","keepProps","nearestBlockContainerPos","info","handleEnter","blockContainer","selectionEmpty","commands","bulletListItemPropSchema","BulletListItemBlockContent","BulletListItem","checkListItemPropSchema","checkListItemBlockContent","checkbox","checkboxWrapper","changeHandler","beforeBlockContainerPos","label","CheckListItem","PLUGIN_KEY","NumberedListIndexingPlugin","_transactions","_oldState","modified","newIndex","prevBlock","prevBlockInfo","prevBlockIndex","numberedListItemPropSchema","NumberedListItemBlockContent","NumberedListItem","paragraphPropSchema","ParagraphBlockContent","Paragraph","tablePropSchema","TableBlockContent","BlockNoteTableView","TableView","cellMinWidth","tableWrapper","tableWrapperInner","floatingContainer","record","TableParagraph","_element","Table","TableHeader","TableCell","TableRow","defaultBlockSpecs","defaultBlockSchema","defaultStyleSpecs","Bold","Italic","Underline","Strike","Code","defaultStyleSchema","defaultInlineContentSpecs","defaultInlineContentSchema","checkDefaultBlockTypeInSchema","checkDefaultInlineContentTypeInSchema","checkBlockIsDefaultType","checkBlockIsFileBlock","checkBlockIsFileBlockWithPreview","checkBlockIsFileBlockWithPlaceholder","checkBlockTypeHasDefaultProp","checkBlockHasDefaultProp","insertBlocks","blocksToInsert","referenceBlock","placement","nodesToInsert","insertedBlocks","getBlockSelectionData","selectionData","CellSelection","NodeSelection","updateBlockSelectionFromData","data","blockPos","moveSelectedBlockAndSelection","moveBlockUp","editorSelection","parentBlock","referenceBlockId","moveBlockDown","nextBlock","sinkListItem","itemType","groupType","$to","startIndex","nodeBefore","nestedBefore","inner","before","after","ReplaceAroundStep","nestBlock","unnestBlock","canNestBlock","canUnnestBlock","removeBlocksWithCallback","blocksToRemove","callback","idsOfBlocksToRemove","removedBlocks","removedSize","oldDocSize","newDocSize","notFoundIds","removeBlocks","replaceBlocks","idOfFirstBlock","insertContentAt","to","isOnlyTextContent","isOnlyBlockContent","selectionToInsertionEnd","getTextCursorPosition","prevNode","nextNode","parentNode","setTextCursorPosition","targetBlock","contentType","esmDependencies","initializeESMDependencies","vals","removeUnderlines","removeUnderlinesHelper","tree","numChildElements","numElementsAdded","addSpacesToCheckboxes","deps","helper","nextChild","cleanHTMLToMarkdown","cleanHTMLString","blocksToMarkdown","externalHTML","getChildIndex","isWhitespaceNode","liftNestedListsToParent","parentListItem","siblingsAfter","sibling","siblingContainer","createGroups","listItem","_detachedDoc","detachedDoc","nestedListsToBlockNoteStructure","elementOrHTML","HTMLToBlocks","icSchema","pmSchema","htmlNode","DOMParser","code","properties","result","markdownToBlocks","markdown","htmlString","EventEmitter","__publicField","fn","args","callbacks","FilePanelView","pluginKey","pmView","emitUpdate","blockElement","prevState","pluginState","filePanelPluginKey","FilePanelProsemirrorPlugin","editorView","_view","FormattingToolbarView","empty","isEmptyTextBlock","isNodeSelection","editorWrapper","composing","isSame","ranges","shouldShow","posToDOMRect","formattingToolbarPluginKey","FormattingToolbarProsemirrorPlugin","LinkToolbarView","hoveredLinkElement","posInHoveredLinkMark","resolvedPosInHoveredLinkMark","marksAtPos","getMarkRange","prevLinkMark","linkToolbarPluginKey","LinkToolbarProsemirrorPlugin","getDraggableBlockFromElement","fragmentToBlocks","MultipleNodeSelection","Selection","$anchor","$head","_pos","fromResult","toResult","dragImageElement","blockPositionsFromSelection","beforeFirstBlockPos","afterLastBlockPos","selectionStartInBlockContent","selectionEndInBlockContent","minDepth","startFirstBlockPos","endLastBlockPos","setDragImage","parentClone","getElementIndex","parentElement","firstSelectedBlockIndex","lastSelectedBlockIndex","unsetDragImage","inheritedClasses","rootEl","dragStart","draggedBlockInSelection","multipleBlocksSelected","selectedSlice","clipboardHTML","externalHTMLExporter","plainText","PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP","getBlockFromCoords","coords","adjustForColumns","elements","getBlockFromMousePos","mousePos","editorBoundingBox","mouseLeftOfEditor","mouseRightOfEditor","rect","SideMenuView","blockContentBoundingBox","column","evt","_event","editorOuterBoundingBox","cursorWithinEditor","sideMenuPluginKey","SideMenuProsemirrorPlugin","findBlock","findParentNode","SuggestionMenuView","decorationNode","suggestionMenuPluginKey","menuName","prev","next","started","stopped","SuggestionMenuProseMirrorPlugin","triggerCharacter","triggerCharacters","suggestionPluginTransactionMeta","_from","_to","suggestionPluginState","blockNode","DecorationSet","Decoration","createSuggestionMenu","setHiddenDragImage","unsetHiddenDragImage","domCellAround","target","currentTarget","hideElements","selector","elementsToHide","TableHandlesView","tableRect","blockEl","tableBlock","pmNodeInfo","widgetContainer","belowTable","toRightOfTable","hideHandles","colIndex","rowIndex","cellRect","boundedMouseCoords","tableCellElements","tableCellElement","emitStateUpdate","oldIndex","dispatchDecorationsTransaction","tableHandlesPluginKey","draggingState","rows","rowToMove","cellsToMove","tableBody","TableHandlesProsemirrorPlugin","decorations","tableResolvedPos","tableNode","rowResolvedPos","cellResolvedPos","decorationPos","widget","acceptedMIMETypes","checkFileExtensionsMatch","fileExtension1","fileExtension2","checkMIMETypesMatch","mimeType1","mimeType2","types1","types2","handleFileInsertion","dataTransfer","format","mimeType","fileBlockConfigs","fileBlockType","isFileExtension","fileBlock","insertedBlockId","updateData","updatedFileBlock","createDropFileExtension","handleVSCodePaste","vscode","vscodeData","createPasteFromClipboardExtension","fragmentToExternalHTML","selectedFragment","isWithinBlockContent","isWithinTable","fragmentWithoutParents","selectedFragmentToHTML","copyToClipboard","createCopyToClipboardExtension","BackgroundColorExtension","getParentBlockInfo","beforePos","parentBeforePos","getPrevBlockInfo","indexInParent","prevBlockBeforePos","getBottomNestedBlockInfo","group","newPos","canMerge","nextBlockInfo","mergeBlocks","childBlocksStart","childBlocksEnd","childBlocksRange","mergeBlocksCommand","posBetweenBlocks","bottomNestedBlockInfo","KeyboardShortcutsExtension","selectionAtBlockStart","isParagraph","parentBlockInfo","columnList","shouldRemoveColumn","shouldRemoveColumnList","isFirstColumn","blockToMove","bottomBlock","childContainer","blockAtDocEnd","selectionAtBlockEnd","oldDepth","newDepth","blockEmpty","blockIndented","newBlockInsertionPos","newBlockContentPos","newBlock","TextAlignmentExtension","TextColorExtension","TrailingNode","plugin","_","__","shouldInsertNodeAtEnd","endPosition","_state","lastNode","lastContentNode","BlockAttributes","BlockContainer","nodeAttr","HTMLAttr","blockOuter","blockHTMLAttributes","BlockGroup","blockGroupHTMLAttributes","Doc","getBlockNoteExtensions","opts","extensions","Gapcursor","HardBreak","Text","Link","styleSpec","a","inlineContentSpec","ext","Collaboration","defaultRender","user","cursor","nonbreakingSpace1","nonbreakingSpace2","CollaborationCursor","History","disableExtensions","ex","removeChild","n","wrapTableRows","f","newItems","prevTable","newTable","nestedChild","container","removeUndefined","BlockNoteSchema","_BlockNoteTipTapEditor","TiptapEditor","cache","oldCreateAndFill","pmNodes","b","createDocument","e","EditorState","EditorView","oldSetTimeout","BlockNoteTipTapEditor","PlaceholderPlugin","placeholders","styleEl","nonce","styleSheet","getBaseSelector","additionalSelectors","getSelector","mustBeFocused","mustBeFocusedSelector","blockTypeSelector","placeholder","dec","NodeSelectionKeyboardPlugin","nodeAttributes","PreviousBlockTypePlugin","timeout","_editorView","_prevState","currentTransactionOriginalOldBlockAttrs","oldNodes","findChildren","oldNodesById","oldNode","oldContentNode","newContentNode","newAttrs","oldAttrs","prevAttrs","decorationAttrs","decoration","blockNoteTipTapOptions","BlockNoteEditor","anyOpts","newOptions","dropCursorPlugin","dropCursor","blockNoteUIExtension","uploadFile","initialContent","tiptapOptions","getSchema","reverse","traverseBlockArray","blockArray","end","start","editable","cb","COLORS_DEFAULT","COLORS_DARK_MODE_DEFAULT","Exporter","_schema","mappings","inlineContentArray","nestingLevel","numberedListIndex","mappingFactory","emojiMart","getDefaultEmojiPickerItems","query","emojiMartData","emoji","setSelectionToNextContentEditableBlock","insertOrUpdateBlock","currentBlock","getDefaultSlashMenuItems","insertedBlock","filterSuggestionItems","title","aliases","alias","combineByGroup","additionalItemsArray","combinedItems","additionalItems","additionalItem","lastItemWithSameGroup","textShorthandToStyledText","partialContentToInlineContent","partialContent","partialBlocksToBlocksForTesting","partialBlocks","partialBlock","partialBlockToBlockForTesting","withDefaults","propKey","propValue","addIdsToBlock","addIdsToBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,KAAiB;AAAA,EAC5B,YAAY;AAAA,IACV,SAAS;AAAA,MACP,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,KAAK,UAAU,IAAI;AAAA,MAC7B,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,UAAU,YAAY;AAAA,MACtC,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,UAAU,YAAY;AAAA,MACtC,OAAO;AAAA,IACT;AAAA,IACA,eAAe;AAAA,MACb,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,KAAK,eAAe,SAAS,aAAa;AAAA,MACpD,OAAO;AAAA,IACT;AAAA,IACA,aAAa;AAAA,MACX,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,KAA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A,EAAA,WACnD4f,MAAgB,SAAS;AAClC,UAAM5f,IAAU05B,EAAa;AAC7B,IAAAA,EAAa,UAAU;AAAA,MACrB,MAAM;AAAA,MACN,eACE15B,KAAA,gBAAAA,EAAS,mBACT/B,IAAA+B,KAAA,gBAAAA,EAAS,KAAK,OAAd,gBAAA/B,EAAkB,MAAM,IAAI;aAC5B,CAAC;AAAA,MACH,OACE+B,KAAA,gBAAAA,EAAS,KAAK,IAAI,CAACuB,OAAS;AAAA,QAC1B,OAAOA,EAAI,MAAM,IAAI,CAACG,MAAS03B,GAA8B13B,CAAI,CAAC;AAAA,MACpE,QAAO,CAAC;AAAA,IAAA;AAAA,EAEd;AAEO,SAAA;AAAA,IACL,GAAGg4B;AAAA,IACH,SAASN,GAA8BM,EAAa,OAAO;AAAA,IAC3D,UAAUA,EAAa,SAAS,IAAI,CAAChyB,MAC5B+xB,GAA8Bp5B,GAAQqH,CAAC,CAC/C;AAAA,EAAA;AAEL;AAEO,SAASmyB,GAAc93B,GAAoC;AAC5D,EAACA,EAAM,OACHA,EAAA,KAAKhF,GAAS,QAAQ,WAAW,IAErCgF,EAAM,YACR+3B,GAAe/3B,EAAM,QAAQ;AAEjC;AAEO,SAAS+3B,GAAex1B,GAAuC;AACpE,aAAWvC,KAASuC;AAClB,IAAAu1B,GAAc93B,CAAK;AAEvB;"}
|
|
1
|
+
{"version":3,"file":"blocknote.js","sources":["../src/i18n/locales/ar.ts","../src/i18n/locales/de.ts","../src/i18n/locales/en.ts","../src/i18n/locales/es.ts","../src/i18n/locales/fr.ts","../src/i18n/locales/hr.ts","../src/i18n/locales/is.ts","../src/i18n/locales/ja.ts","../src/i18n/locales/ko.ts","../src/i18n/locales/nl.ts","../src/i18n/locales/pl.ts","../src/i18n/locales/pt.ts","../src/i18n/locales/ru.ts","../src/i18n/locales/vi.ts","../src/i18n/locales/zh.ts","../src/util/typescript.ts","../src/extensions/UniqueID/UniqueID.ts","../src/schema/inlineContent/types.ts","../src/api/nodeConversions/blockToNode.ts","../src/api/exporters/html/util/serializeBlocksExternalHTML.ts","../src/api/exporters/html/externalHTMLExporter.ts","../src/api/exporters/html/util/serializeBlocksInternalHTML.ts","../src/api/exporters/html/internalHTMLSerializer.ts","../src/api/getBlockInfoFromPos.ts","../src/api/nodeUtil.ts","../src/util/browser.ts","../src/blocks/defaultBlockHelpers.ts","../src/blocks/defaultProps.ts","../src/util/string.ts","../src/schema/blocks/internal.ts","../src/schema/blocks/createSpec.ts","../src/api/nodeConversions/nodeToBlock.ts","../src/schema/inlineContent/internal.ts","../src/schema/inlineContent/createSpec.ts","../src/schema/styles/internal.ts","../src/schema/styles/createSpec.ts","../src/blocks/FileBlockContent/fileBlockHelpers.ts","../src/blocks/AudioBlockContent/audioBlockHelpers.ts","../src/blocks/AudioBlockContent/AudioBlockContent.ts","../src/blocks/CodeBlockContent/defaultSupportedLanguages.ts","../src/blocks/CodeBlockContent/CodeBlockContent.ts","../src/blocks/FileBlockContent/FileBlockContent.ts","../src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","../src/blocks/ImageBlockContent/imageBlockHelpers.ts","../src/blocks/ImageBlockContent/ImageBlockContent.ts","../src/blocks/TableBlockContent/TableExtension.ts","../src/blocks/VideoBlockContent/videoBlockHelpers.ts","../src/blocks/VideoBlockContent/VideoBlockContent.ts","../src/extensions/BackgroundColor/BackgroundColorMark.ts","../src/extensions/TextColor/TextColorMark.ts","../src/api/blockManipulation/commands/updateBlock/updateBlock.ts","../src/blocks/HeadingBlockContent/HeadingBlockContent.ts","../src/api/blockManipulation/commands/splitBlock/splitBlock.ts","../src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","../src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","../src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","../src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","../src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","../src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","../src/blocks/TableBlockContent/TableBlockContent.ts","../src/blocks/defaultBlocks.ts","../src/blocks/defaultBlockTypeGuards.ts","../src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts","../src/api/blockManipulation/commands/moveBlock/moveBlock.ts","../src/api/blockManipulation/commands/nestBlock/nestBlock.ts","../src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts","../src/api/blockManipulation/commands/removeBlocks/removeBlocks.ts","../src/api/blockManipulation/insertContentAt.ts","../src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts","../src/util/esmDependencies.ts","../src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","../src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","../src/api/exporters/markdown/markdownExporter.ts","../src/api/parsers/html/util/nestedLists.ts","../src/api/parsers/html/parseHTML.ts","../src/api/parsers/markdown/parseMarkdown.ts","../src/api/clipboard/fromClipboard/acceptedMIMETypes.ts","../src/api/clipboard/fromClipboard/handleFileInsertion.ts","../src/api/clipboard/fromClipboard/fileDropExtension.ts","../src/api/clipboard/fromClipboard/handleVSCodePaste.ts","../src/api/clipboard/fromClipboard/pasteExtension.ts","../src/api/nodeConversions/fragmentToBlocks.ts","../src/api/clipboard/toClipboard/copyExtension.ts","../src/extensions/BackgroundColor/BackgroundColorExtension.ts","../src/util/EventEmitter.ts","../src/extensions/FilePanel/FilePanelPlugin.ts","../src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","../src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts","../src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts","../src/extensions/LinkToolbar/LinkToolbarPlugin.ts","../src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts","../src/extensions/Placeholder/PlaceholderPlugin.ts","../src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","../src/extensions/getDraggableBlockFromElement.ts","../src/extensions/SideMenu/MultipleNodeSelection.ts","../src/extensions/SideMenu/dragging.ts","../src/extensions/SideMenu/SideMenuPlugin.ts","../src/extensions/SuggestionMenu/SuggestionPlugin.ts","../src/extensions/TableHandles/TableHandlesPlugin.ts","../src/extensions/TextAlignment/TextAlignmentExtension.ts","../src/extensions/TextColor/TextColorExtension.ts","../src/extensions/TrailingNode/TrailingNodeExtension.ts","../src/pm-nodes/BlockContainer.ts","../src/pm-nodes/BlockGroup.ts","../src/pm-nodes/Doc.ts","../src/editor/BlockNoteExtensions.ts","../src/editor/transformPasted.ts","../src/editor/BlockNoteSchema.ts","../src/editor/BlockNoteTipTapEditor.ts","../src/editor/BlockNoteEditor.ts","../src/editor/defaultColors.ts","../src/exporter/Exporter.ts","../src/exporter/mapping.ts","../src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","../src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","../src/util/combineByGroup.ts","../src/api/testUtil/partialBlockTestUtil.ts"],"sourcesContent":["import type { Dictionary } from \"../dictionary.js\";\n\nexport const ar: Dictionary = {\n slash_menu: {\n heading: {\n title: \"عنوان 1\",\n subtext: \"يستخدم لعناوين المستوى الأعلى\",\n aliases: [\"ع\", \"عنوان1\", \"ع1\"],\n group: \"العناوين\",\n },\n heading_2: {\n title: \"عنوان 2\",\n subtext: \"يستخدم للأقسام الرئيسية\",\n aliases: [\"ع2\", \"عنوان2\", \"عنوان فرعي\"],\n group: \"العناوين\",\n },\n heading_3: {\n title: \"عنوان 3\",\n subtext: \"يستخدم للأقسام الفرعية والعناوين المجموعة\",\n aliases: [\"ع3\", \"عنوان3\", \"عنوان فرعي\"],\n group: \"العناوين\",\n },\n numbered_list: {\n title: \"قائمة مرقمة\",\n subtext: \"تستخدم لعرض قائمة مرقمة\",\n aliases: [\"ق\", \"عناصر قائمة\", \"قائمة\", \"قائمة مرقمة\"],\n group: \"الكتل الأساسية\",\n },\n bullet_list: {\n title: \"قائمة نقطية\",\n subtext: \"تستخدم لعرض قائمة غير مرتبة\",\n aliases: [\"ق\", \"عناصر قائمة\", \"قائمة\", \"قائمة نقطية\"],\n group: \"الكتل الأساسية\",\n },\n check_list: {\n title: \"قائمة تحقق\",\n subtext: \"تستخدم لعرض قائمة بمربعات التحقق\",\n aliases: [\n \"قوائم غير مرتبة\",\n \"عناصر قائمة\",\n \"قائمة\",\n \"قائمة تحقق\",\n \"قائمة التحقق\",\n \"قائمة مشطوبة\",\n \"مربع التحقق\",\n ],\n group: \"الكتل الأساسية\",\n },\n paragraph: {\n title: \"فقرة\",\n subtext: \"تستخدم لنص الوثيقة الأساسي\",\n aliases: [\"ف\", \"فقرة\"],\n group: \"الكتل الأساسية\",\n },\n code_block: {\n title: \"كود\",\n subtext: \"يستخدم لعرض الكود مع تحديد الصيغة\",\n aliases: [\"كود\", \"مسبق\"],\n group: \"الكتل الأساسية\",\n },\n table: {\n title: \"جدول\",\n subtext: \"يستخدم للجداول\",\n aliases: [\"جدول\"],\n group: \"متقدم\",\n },\n image: {\n title: \"صورة\",\n subtext: \"إدراج صورة\",\n aliases: [\"صورة\", \"رفع صورة\", \"تحميل\", \"صورة\", \"صورة\", \"وسائط\", \"رابط\"],\n group: \"وسائط\",\n },\n video: {\n title: \"فيديو\",\n subtext: \"إدراج فيديو\",\n aliases: [\n \"فيديو\",\n \"رفع فيديو\",\n \"تحميل\",\n \"فيديو\",\n \"فيلم\",\n \"وسائط\",\n \"رابط\",\n ],\n group: \"وسائط\",\n },\n audio: {\n title: \"صوت\",\n subtext: \"إدراج صوت\",\n aliases: [\"صوت\", \"رفع صوت\", \"تحميل\", \"صوت\", \"صوت\", \"وسائط\", \"رابط\"],\n group: \"وسائط\",\n },\n file: {\n title: \"ملف\",\n subtext: \"إدراج ملف\",\n aliases: [\"ملف\", \"تحميل\", \"تضمين\", \"وسائط\", \"رابط\"],\n group: \"وسائط\",\n },\n emoji: {\n title: \"الرموز التعبيرية\",\n subtext: \"تُستخدم لإدراج رمز تعبيري\",\n aliases: [\"رمز تعبيري\", \"إيموجي\", \"إيموت\", \"عاطفة\", \"وجه\"],\n group: \"آخرون\",\n },\n },\n placeholders: {\n default: \"أدخل نصًا أو اكتب '/' للأوامر\",\n heading: \"عنوان\",\n bulletListItem: \"قائمة\",\n numberedListItem: \"قائمة\",\n checkListItem: \"قائمة\",\n },\n file_blocks: {\n image: {\n add_button_text: \"إضافة صورة\",\n },\n video: {\n add_button_text: \"إضافة فيديو\",\n },\n audio: {\n add_button_text: \"إضافة صوت\",\n },\n file: {\n add_button_text: \"إضافة ملف\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"إضافة محتوي\",\n drag_handle_label: \"فتح قائمة المحتويات\",\n },\n drag_handle: {\n delete_menuitem: \"حذف\",\n colors_menuitem: \"ألوان\",\n },\n table_handle: {\n delete_column_menuitem: \"حذف عمود\",\n delete_row_menuitem: \"حذف صف\",\n add_left_menuitem: \"إضافة عمود إلى اليسار\",\n add_right_menuitem: \"إضافة عمود إلى اليمين\",\n add_above_menuitem: \"إضافة صف أعلى\",\n add_below_menuitem: \"إضافة صف أسفل\",\n },\n suggestion_menu: {\n no_items_title: \"لم يتم العثور على عناصر\",\n loading: \"جارٍ التحميل…\",\n },\n color_picker: {\n text_title: \"نص\",\n background_title: \"خلفية\",\n colors: {\n default: \"افتراضي\",\n gray: \"رمادي\",\n brown: \"بني\",\n red: \"أحمر\",\n orange: \"برتقالي\",\n yellow: \"أصفر\",\n green: \"أخضر\",\n blue: \"أزرق\",\n purple: \"أرجواني\",\n pink: \"وردي\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"عريض\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"مائل\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"تحته خط\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"مشطوب\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"كود\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"ألوان\",\n },\n link: {\n tooltip: \"إنشاء رابط\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"تحرير التسمية التوضيحية\",\n input_placeholder: \"تحرير التسمية التوضيحية\",\n },\n file_replace: {\n tooltip: {\n image: \"استبدال الصورة\",\n video: \"استبدال الفيديو\",\n audio: \"استبدال الصوت\",\n file: \"استبدال الملف\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"إعادة تسمية الصورة\",\n video: \"إعادة تسمية الفيديو\",\n audio: \"إعادة تسمية الصوت\",\n file: \"إعادة تسمية الملف\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"إعادة تسمية الصورة\",\n video: \"إعادة تسمية الفيديو\",\n audio: \"إعادة تسمية الصوت\",\n file: \"إعادة تسمية الملف\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"تنزيل الصورة\",\n video: \"تنزيل الفيديو\",\n audio: \"تنزيل الصوت\",\n file: \"تنزيل الملف\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"حذف الصورة\",\n video: \"حذف الفيديو\",\n audio: \"حذف الصوت\",\n file: \"حذف الملف\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"تبديل المعاينة\",\n },\n nest: {\n tooltip: \"محتويات متداخلة\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"إلغاء التداخل\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"محاذاة النص إلى اليسار\",\n },\n align_center: {\n tooltip: \"محاذاة النص في المنتصف\",\n },\n align_right: {\n tooltip: \"محاذاة النص إلى اليمين\",\n },\n align_justify: {\n tooltip: \"ضبط النص\",\n },\n },\n file_panel: {\n upload: {\n title: \"تحميل\",\n file_placeholder: {\n image: \"تحميل صورة\",\n video: \"تحميل فيديو\",\n audio: \"تحميل صوت\",\n file: \"تحميل ملف\",\n } as Record<string, string>,\n upload_error: \"خطأ: فشل التحميل\",\n },\n embed: {\n title: \"تضمين\",\n embed_button: {\n image: \"تضمين صورة\",\n video: \"تضمين فيديو\",\n audio: \"تضمين صوت\",\n file: \"تضمين ملف\",\n } as Record<string, string>,\n url_placeholder: \"أدخل الرابط\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"إزالة الرابط\",\n },\n edit: {\n text: \"تحرير الرابط\",\n tooltip: \"تحرير\",\n },\n open: {\n tooltip: \"فتح في تبويب جديد\",\n },\n form: {\n title_placeholder: \"تحرير العنوان\",\n url_placeholder: \"تحرير الرابط\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export const de = {\n slash_menu: {\n heading: {\n title: \"Überschrift 1\",\n subtext: \"Hauptebene Überschrift\",\n aliases: [\"h\", \"überschrift1\", \"h1\"],\n group: \"Überschriften\",\n },\n heading_2: {\n title: \"Überschrift 2\",\n subtext: \"Wichtige Abschnittsüberschrift\",\n aliases: [\"h2\", \"überschrift2\", \"unterüberschrift\"],\n group: \"Überschriften\",\n },\n heading_3: {\n title: \"Überschrift 3\",\n subtext: \"Unterabschnitts- und Gruppenüberschrift\",\n aliases: [\"h3\", \"überschrift3\", \"unterüberschrift\"],\n group: \"Überschriften\",\n },\n numbered_list: {\n title: \"Nummerierte Liste\",\n subtext: \"Liste mit nummerierten Elementen\",\n aliases: [\"ol\", \"li\", \"liste\", \"nummerierteliste\", \"nummerierte liste\"],\n group: \"Grundlegende blöcke\",\n },\n bullet_list: {\n title: \"Aufzählungsliste\",\n subtext: \"Liste mit unnummerierten Elementen\",\n aliases: [\"ul\", \"li\", \"liste\", \"aufzählungsliste\", \"aufzählung liste\"],\n group: \"Grundlegende blöcke\",\n },\n check_list: {\n title: \"Checkliste\",\n subtext: \"Liste mit Kontrollkästchen\",\n aliases: [\n \"ul\",\n \"li\",\n \"liste\",\n \"checkliste\",\n \"check liste\",\n \"geprüfte liste\",\n \"kontrollkästchen\",\n ],\n group: \"Grundlegende blöcke\",\n },\n paragraph: {\n title: \"Absatz\",\n subtext: \"Der Hauptteil Ihres Dokuments\",\n aliases: [\"p\", \"absatz\"],\n group: \"Grundlegende blöcke\",\n },\n code_block: {\n title: \"Codeblock\",\n subtext: \"Codeblock mit Syntaxhervorhebung\",\n aliases: [\"code\", \"pre\"],\n group: \"Grundlegende blöcke\",\n },\n table: {\n title: \"Tabelle\",\n subtext: \"Tabelle mit editierbaren Zellen\",\n aliases: [\"tabelle\"],\n group: \"Erweitert\",\n },\n image: {\n title: \"Bild\",\n subtext: \"Größenveränderbares Bild mit Beschriftung\",\n aliases: [\n \"bild\",\n \"bildhochladen\",\n \"hochladen\",\n \"img\",\n \"bild\",\n \"medien\",\n \"url\",\n ],\n group: \"Medien\",\n },\n video: {\n title: \"Video\",\n subtext: \"Größenveränderbares Video mit Beschriftung\",\n aliases: [\n \"video\",\n \"videoupload\",\n \"hochladen\",\n \"mp4\",\n \"film\",\n \"medien\",\n \"url\",\n ],\n group: \"Medien\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Eingebettetes Audio mit Beschriftung\",\n aliases: [\n \"audio\",\n \"audioupload\",\n \"hochladen\",\n \"mp3\",\n \"ton\",\n \"medien\",\n \"url\",\n ],\n group: \"Medien\",\n },\n file: {\n title: \"Datei\",\n subtext: \"Eingebettete Datei\",\n aliases: [\"datei\", \"hochladen\", \"einbetten\", \"medien\", \"url\"],\n group: \"Medien\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Nach Emoji suchen und einfügen\",\n aliases: [\"emoji\", \"emote\", \"emotion\", \"gesicht\"],\n group: \"Andere\",\n },\n },\n placeholders: {\n default: \"Text eingeben oder '/' für Befehle tippen\",\n heading: \"Überschrift\",\n bulletListItem: \"Liste\",\n numberedListItem: \"Liste\",\n checkListItem: \"Liste\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Bild hinzufügen\",\n },\n video: {\n add_button_text: \"Video hinzufügen\",\n },\n audio: {\n add_button_text: \"Audio hinzufügen\",\n },\n file: {\n add_button_text: \"Datei hinzufügen\",\n },\n },\n side_menu: {\n add_block_label: \"Block hinzufügen\",\n drag_handle_label: \"Blockmenü öffnen\",\n },\n drag_handle: {\n delete_menuitem: \"Löschen\",\n colors_menuitem: \"Farben\",\n },\n table_handle: {\n delete_column_menuitem: \"Spalte löschen\",\n delete_row_menuitem: \"Zeile löschen\",\n add_left_menuitem: \"Spalte links hinzufügen\",\n add_right_menuitem: \"Spalte rechts hinzufügen\",\n add_above_menuitem: \"Zeile oberhalb hinzufügen\",\n add_below_menuitem: \"Zeile unterhalb hinzufügen\",\n },\n suggestion_menu: {\n no_items_title: \"Keine Elemente gefunden\",\n loading: \"Laden…\",\n },\n color_picker: {\n text_title: \"Text\",\n background_title: \"Hintergrund\",\n colors: {\n default: \"Standard\",\n gray: \"Grau\",\n brown: \"Braun\",\n red: \"Rot\",\n orange: \"Orange\",\n yellow: \"Gelb\",\n green: \"Grün\",\n blue: \"Blau\",\n purple: \"Lila\",\n pink: \"Rosa\",\n },\n },\n formatting_toolbar: {\n bold: {\n tooltip: \"Fett\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Kursiv\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Unterstrichen\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Durchgestrichen\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Farben\",\n },\n link: {\n tooltip: \"Link erstellen\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Beschriftung bearbeiten\",\n input_placeholder: \"Beschriftung bearbeiten\",\n },\n file_replace: {\n tooltip: {\n image: \"Bild ersetzen\",\n video: \"Video ersetzen\",\n audio: \"Audio ersetzen\",\n file: \"Datei ersetzen\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Bild umbenennen\",\n video: \"Video umbenennen\",\n audio: \"Audio umbenennen\",\n file: \"Datei umbenennen\",\n },\n input_placeholder: {\n image: \"Bild umbenennen\",\n video: \"Video umbenennen\",\n audio: \"Audio umbenennen\",\n file: \"Datei umbenennen\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Bild herunterladen\",\n video: \"Video herunterladen\",\n audio: \"Audio herunterladen\",\n file: \"Datei herunterladen\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Bild löschen\",\n video: \"Video löschen\",\n audio: \"Audio löschen\",\n file: \"Datei löschen\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Vorschau umschalten\",\n },\n nest: {\n tooltip: \"Block verschachteln\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Block entnesten\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Text linksbündig\",\n },\n align_center: {\n tooltip: \"Text zentrieren\",\n },\n align_right: {\n tooltip: \"Text rechtsbündig\",\n },\n align_justify: {\n tooltip: \"Text Blocksatz\",\n },\n },\n file_panel: {\n upload: {\n title: \"Hochladen\",\n file_placeholder: {\n image: \"Bild hochladen\",\n video: \"Video hochladen\",\n audio: \"Audio hochladen\",\n file: \"Datei hochladen\",\n },\n upload_error: \"Fehler: Hochladen fehlgeschlagen\",\n },\n embed: {\n title: \"Einbetten\",\n embed_button: {\n image: \"Bild einbetten\",\n video: \"Video einbetten\",\n audio: \"Audio einbetten\",\n file: \"Datei einbetten\",\n },\n url_placeholder: \"URL eingeben\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Link entfernen\",\n },\n edit: {\n text: \"Link bearbeiten\",\n tooltip: \"Bearbeiten\",\n },\n open: {\n tooltip: \"In neuem Tab öffnen\",\n },\n form: {\n title_placeholder: \"Titel bearbeiten\",\n url_placeholder: \"URL bearbeiten\",\n },\n },\n generic: {\n ctrl_shortcut: \"Strg\",\n },\n};\n","export const en = {\n slash_menu: {\n heading: {\n title: \"Heading 1\",\n subtext: \"Top-level heading\",\n aliases: [\"h\", \"heading1\", \"h1\"],\n group: \"Headings\",\n },\n heading_2: {\n title: \"Heading 2\",\n subtext: \"Key section heading\",\n aliases: [\"h2\", \"heading2\", \"subheading\"],\n group: \"Headings\",\n },\n heading_3: {\n title: \"Heading 3\",\n subtext: \"Subsection and group heading\",\n aliases: [\"h3\", \"heading3\", \"subheading\"],\n group: \"Headings\",\n },\n numbered_list: {\n title: \"Numbered List\",\n subtext: \"List with ordered items\",\n aliases: [\"ol\", \"li\", \"list\", \"numberedlist\", \"numbered list\"],\n group: \"Basic blocks\",\n },\n bullet_list: {\n title: \"Bullet List\",\n subtext: \"List with unordered items\",\n aliases: [\"ul\", \"li\", \"list\", \"bulletlist\", \"bullet list\"],\n group: \"Basic blocks\",\n },\n check_list: {\n title: \"Check List\",\n subtext: \"List with checkboxes\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"checklist\",\n \"check list\",\n \"checked list\",\n \"checkbox\",\n ],\n group: \"Basic blocks\",\n },\n paragraph: {\n title: \"Paragraph\",\n subtext: \"The body of your document\",\n aliases: [\"p\", \"paragraph\"],\n group: \"Basic blocks\",\n },\n code_block: {\n title: \"Code Block\",\n subtext: \"Code block with syntax highlighting\",\n aliases: [\"code\", \"pre\"],\n group: \"Basic blocks\",\n },\n table: {\n title: \"Table\",\n subtext: \"Table with editable cells\",\n aliases: [\"table\"],\n group: \"Advanced\",\n },\n image: {\n title: \"Image\",\n subtext: \"Resizable image with caption\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n video: {\n title: \"Video\",\n subtext: \"Resizable video with caption\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Embedded audio with caption\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n file: {\n title: \"File\",\n subtext: \"Embedded file\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"url\"],\n group: \"Media\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Search for and insert an emoji\",\n aliases: [\"emoji\", \"emote\", \"emotion\", \"face\"],\n group: \"Others\",\n },\n },\n placeholders: {\n default: \"Enter text or type '/' for commands\",\n heading: \"Heading\",\n bulletListItem: \"List\",\n numberedListItem: \"List\",\n checkListItem: \"List\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Add image\",\n },\n video: {\n add_button_text: \"Add video\",\n },\n audio: {\n add_button_text: \"Add audio\",\n },\n file: {\n add_button_text: \"Add file\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Add block\",\n drag_handle_label: \"Open block menu\",\n },\n drag_handle: {\n delete_menuitem: \"Delete\",\n colors_menuitem: \"Colors\",\n },\n table_handle: {\n delete_column_menuitem: \"Delete column\",\n delete_row_menuitem: \"Delete row\",\n add_left_menuitem: \"Add column left\",\n add_right_menuitem: \"Add column right\",\n add_above_menuitem: \"Add row above\",\n add_below_menuitem: \"Add row below\",\n },\n suggestion_menu: {\n no_items_title: \"No items found\",\n loading: \"Loading…\",\n },\n color_picker: {\n text_title: \"Text\",\n background_title: \"Background\",\n colors: {\n default: \"Default\",\n gray: \"Gray\",\n brown: \"Brown\",\n red: \"Red\",\n orange: \"Orange\",\n yellow: \"Yellow\",\n green: \"Green\",\n blue: \"Blue\",\n purple: \"Purple\",\n pink: \"Pink\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Bold\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Italic\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Underline\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Strike\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Colors\",\n },\n link: {\n tooltip: \"Create link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Edit caption\",\n input_placeholder: \"Edit caption\",\n },\n file_replace: {\n tooltip: {\n image: \"Replace image\",\n video: \"Replace video\",\n audio: \"Replace audio\",\n file: \"Replace file\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"Rename image\",\n video: \"Rename video\",\n audio: \"Rename audio\",\n file: \"Rename file\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"Rename image\",\n video: \"Rename video\",\n audio: \"Rename audio\",\n file: \"Rename file\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"Download image\",\n video: \"Download video\",\n audio: \"Download audio\",\n file: \"Download file\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"Delete image\",\n video: \"Delete video\",\n audio: \"Delete audio\",\n file: \"Delete file\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"Toggle preview\",\n },\n nest: {\n tooltip: \"Nest block\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Unnest block\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Align text left\",\n },\n align_center: {\n tooltip: \"Align text center\",\n },\n align_right: {\n tooltip: \"Align text right\",\n },\n align_justify: {\n tooltip: \"Justify text\",\n },\n },\n file_panel: {\n upload: {\n title: \"Upload\",\n file_placeholder: {\n image: \"Upload image\",\n video: \"Upload video\",\n audio: \"Upload audio\",\n file: \"Upload file\",\n } as Record<string, string>,\n upload_error: \"Error: Upload failed\",\n },\n embed: {\n title: \"Embed\",\n embed_button: {\n image: \"Embed image\",\n video: \"Embed video\",\n audio: \"Embed audio\",\n file: \"Embed file\",\n } as Record<string, string>,\n url_placeholder: \"Enter URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Remove link\",\n },\n edit: {\n text: \"Edit link\",\n tooltip: \"Edit\",\n },\n open: {\n tooltip: \"Open in new tab\",\n },\n form: {\n title_placeholder: \"Edit title\",\n url_placeholder: \"Edit URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export const es = {\n slash_menu: {\n heading: {\n title: \"Encabezado 1\",\n subtext: \"Encabezado de primer nivel\",\n aliases: [\"h\", \"encabezado1\", \"h1\"],\n group: \"Encabezados\",\n },\n heading_2: {\n title: \"Encabezado 2\",\n subtext: \"Encabezado de sección principal\",\n aliases: [\"h2\", \"encabezado2\", \"subencabezado\"],\n group: \"Encabezados\",\n },\n heading_3: {\n title: \"Encabezado 3\",\n subtext: \"Encabezado de subsección y grupo\",\n aliases: [\"h3\", \"encabezado3\", \"subencabezado\"],\n group: \"Encabezados\",\n },\n numbered_list: {\n title: \"Lista Numerada\",\n subtext: \"Lista con elementos ordenados\",\n aliases: [\"ol\", \"li\", \"lista\", \"lista numerada\"],\n group: \"Bloques básicos\",\n },\n bullet_list: {\n title: \"Lista con Viñetas\",\n subtext: \"Lista con elementos no ordenados\",\n aliases: [\"ul\", \"li\", \"lista\", \"lista con viñetas\"],\n group: \"Bloques básicos\",\n },\n check_list: {\n title: \"Lista de Verificación\",\n subtext: \"Lista con casillas de verificación\",\n aliases: [\n \"ul\",\n \"li\",\n \"lista\",\n \"lista de verificación\",\n \"lista de chequeo\",\n \"checkbox\",\n ],\n group: \"Bloques básicos\",\n },\n paragraph: {\n title: \"Párrafo\",\n subtext: \"El cuerpo de tu documento\",\n aliases: [\"p\", \"párrafo\"],\n group: \"Bloques básicos\",\n },\n code_block: {\n title: \"Bloque de Código\",\n subtext: \"Bloque de código con resaltado de sintaxis\",\n aliases: [\"code\", \"pre\"],\n group: \"Bloques básicos\",\n },\n table: {\n title: \"Tabla\",\n subtext: \"Tabla con celdas editables\",\n aliases: [\"tabla\"],\n group: \"Avanzado\",\n },\n image: {\n title: \"Imagen\",\n subtext: \"Imagen redimensionable con leyenda\",\n aliases: [\n \"imagen\",\n \"subir imagen\",\n \"cargar\",\n \"img\",\n \"foto\",\n \"media\",\n \"url\",\n ],\n group: \"Medios\",\n },\n video: {\n title: \"Vídeo\",\n subtext: \"Vídeo redimensionable con leyenda\",\n aliases: [\n \"video\",\n \"subir vídeo\",\n \"cargar\",\n \"mp4\",\n \"película\",\n \"media\",\n \"url\",\n ],\n group: \"Medios\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Audio incrustado con leyenda\",\n aliases: [\n \"audio\",\n \"subir audio\",\n \"cargar\",\n \"mp3\",\n \"sonido\",\n \"media\",\n \"url\",\n ],\n group: \"Medios\",\n },\n file: {\n title: \"Archivo\",\n subtext: \"Archivo incrustado\",\n aliases: [\"archivo\", \"cargar\", \"incrustar\", \"media\", \"url\"],\n group: \"Medios\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Busca e inserta un emoji\",\n aliases: [\"emoji\", \"emoticono\", \"emoción\", \"cara\"],\n group: \"Otros\",\n },\n },\n placeholders: {\n default: \"Escribe o teclea '/' para comandos\",\n heading: \"Encabezado\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Agregar imagen\",\n },\n video: {\n add_button_text: \"Agregar vídeo\",\n },\n audio: {\n add_button_text: \"Agregar audio\",\n },\n file: {\n add_button_text: \"Agregar archivo\",\n },\n },\n side_menu: {\n add_block_label: \"Agregar bloque\",\n drag_handle_label: \"Abrir menú de bloque\",\n },\n drag_handle: {\n delete_menuitem: \"Eliminar\",\n colors_menuitem: \"Colores\",\n },\n table_handle: {\n delete_column_menuitem: \"Eliminar columna\",\n delete_row_menuitem: \"Eliminar fila\",\n add_left_menuitem: \"Agregar columna a la izquierda\",\n add_right_menuitem: \"Agregar columna a la derecha\",\n add_above_menuitem: \"Agregar fila arriba\",\n add_below_menuitem: \"Agregar fila abajo\",\n },\n suggestion_menu: {\n no_items_title: \"No se encontraron elementos\",\n loading: \"Cargando…\",\n },\n color_picker: {\n text_title: \"Texto\",\n background_title: \"Fondo\",\n colors: {\n default: \"Por defecto\",\n gray: \"Gris\",\n brown: \"Marrón\",\n red: \"Rojo\",\n orange: \"Naranja\",\n yellow: \"Amarillo\",\n green: \"Verde\",\n blue: \"Azul\",\n purple: \"Morado\",\n pink: \"Rosa\",\n },\n },\n formatting_toolbar: {\n bold: {\n tooltip: \"Negrita\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Cursiva\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Subrayado\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Tachado\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Código\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Colores\",\n },\n link: {\n tooltip: \"Crear enlace\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Editar leyenda\",\n input_placeholder: \"Editar leyenda\",\n },\n file_replace: {\n tooltip: {\n image: \"Reemplazar imagen\",\n video: \"Reemplazar vídeo\",\n audio: \"Reemplazar audio\",\n file: \"Reemplazar archivo\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"Renombrar imagen\",\n video: \"Renombrar vídeo\",\n audio: \"Renombrar audio\",\n file: \"Renombrar archivo\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"Renombrar imagen\",\n video: \"Renombrar vídeo\",\n audio: \"Renombrar audio\",\n file: \"Renombrar archivo\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"Descargar imagen\",\n video: \"Descargar vídeo\",\n audio: \"Descargar audio\",\n file: \"Descargar archivo\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"Eliminar imagen\",\n video: \"Eliminar vídeo\",\n audio: \"Eliminar audio\",\n file: \"Eliminar archivo\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"Alternar vista previa\",\n },\n nest: {\n tooltip: \"Anidar bloque\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Desanidar bloque\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Alinear texto a la izquierda\",\n },\n align_center: {\n tooltip: \"Alinear texto al centro\",\n },\n align_right: {\n tooltip: \"Alinear texto a la derecha\",\n },\n align_justify: {\n tooltip: \"Justificar texto\",\n },\n },\n file_panel: {\n upload: {\n title: \"Subir\",\n file_placeholder: {\n image: \"Subir imagen\",\n video: \"Subir vídeo\",\n audio: \"Subir audio\",\n file: \"Subir archivo\",\n } as Record<string, string>,\n upload_error: \"Error: Fallo en la subida\",\n },\n embed: {\n title: \"Incrustar\",\n embed_button: {\n image: \"Incrustar imagen\",\n video: \"Incrustar vídeo\",\n audio: \"Incrustar audio\",\n file: \"Incrustar archivo\",\n } as Record<string, string>,\n url_placeholder: \"Introduce la URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Eliminar enlace\",\n },\n edit: {\n text: \"Editar enlace\",\n tooltip: \"Editar\",\n },\n open: {\n tooltip: \"Abrir en nueva pestaña\",\n },\n form: {\n title_placeholder: \"Editar título\",\n url_placeholder: \"Editar URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const fr: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Titre 1\",\n subtext: \"Utilisé pour un titre de premier niveau\",\n aliases: [\"h\", \"titre1\", \"h1\"],\n group: \"Titres\",\n },\n heading_2: {\n title: \"Titre 2\",\n subtext: \"Utilisé pour les sections clés\",\n aliases: [\"h2\", \"titre2\", \"sous-titre\"],\n group: \"Titres\",\n },\n heading_3: {\n title: \"Titre 3\",\n subtext: \"Utilisé pour les sous-sections et les titres de groupe\",\n aliases: [\"h3\", \"titre3\", \"sous-titre\"],\n group: \"Titres\",\n },\n numbered_list: {\n title: \"Liste Numérotée\",\n subtext: \"Utilisé pour afficher une liste numérotée\",\n aliases: [\"ol\", \"li\", \"liste\", \"listenumérotée\", \"liste numérotée\"],\n group: \"Blocs de base\",\n },\n bullet_list: {\n title: \"Liste à Puces\",\n subtext: \"Utilisé pour afficher une liste non ordonnée\",\n aliases: [\"ul\", \"li\", \"liste\", \"listeàpuces\", \"liste à puces\"],\n group: \"Blocs de base\",\n },\n check_list: {\n title: \"Liste de vérification\",\n subtext: \"Utilisé pour afficher une liste avec des cases à cocher\",\n aliases: [\n \"ul\",\n \"li\",\n \"liste\",\n \"liste de vérification\",\n \"liste cochée\",\n \"case à cocher\",\n ],\n group: \"Blocs de base\",\n },\n paragraph: {\n title: \"Paragraphe\",\n subtext: \"Utilisé pour le corps de votre document\",\n aliases: [\"p\", \"paragraphe\"],\n group: \"Blocs de base\",\n },\n code_block: {\n title: \"Bloc de code\",\n subtext: \"Bloc de code avec coloration syntaxique\",\n aliases: [\"code\", \"pre\"],\n group: \"Blocs de base\",\n },\n table: {\n title: \"Tableau\",\n subtext: \"Utilisé pour les tableaux\",\n aliases: [\"tableau\"],\n group: \"Avancé\",\n },\n image: {\n title: \"Image\",\n subtext: \"Insérer une image\",\n aliases: [\n \"image\",\n \"uploadImage\",\n \"télécharger\",\n \"img\",\n \"photo\",\n \"média\",\n \"url\",\n ],\n group: \"Médias\",\n },\n video: {\n title: \"Vidéo\",\n subtext: \"Insérer une vidéo\",\n aliases: [\n \"vidéo\",\n \"téléchargerVidéo\",\n \"téléverser\",\n \"mp4\",\n \"film\",\n \"média\",\n \"url\",\n ],\n group: \"Média\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Insérer un audio\",\n aliases: [\n \"audio\",\n \"téléchargerAudio\",\n \"téléverser\",\n \"mp3\",\n \"son\",\n \"média\",\n \"url\",\n ],\n group: \"Média\",\n },\n file: {\n title: \"Fichier\",\n subtext: \"Insérer un fichier\",\n aliases: [\"fichier\", \"téléverser\", \"intégrer\", \"média\", \"url\"],\n group: \"Média\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Utilisé pour insérer un emoji\",\n aliases: [\"emoji\", \"émoticône\", \"émotion\", \"visage\"],\n group: \"Autres\",\n },\n },\n placeholders: {\n default: \"Entrez du texte ou tapez '/' pour les commandes\",\n heading: \"Titre\",\n bulletListItem: \"Liste\",\n numberedListItem: \"Liste\",\n checkListItem: \"Liste\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Ajouter une image\",\n },\n video: {\n add_button_text: \"Ajouter une vidéo\",\n },\n audio: {\n add_button_text: \"Ajouter un audio\",\n },\n file: {\n add_button_text: \"Ajouter un fichier\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Ajouter un bloc\",\n drag_handle_label: \"Ouvrir le menu du bloc\",\n },\n drag_handle: {\n delete_menuitem: \"Supprimer\",\n colors_menuitem: \"Couleurs\",\n },\n table_handle: {\n delete_column_menuitem: \"Supprimer la colonne\",\n delete_row_menuitem: \"Supprimer la ligne\",\n add_left_menuitem: \"Ajouter une colonne à gauche\",\n add_right_menuitem: \"Ajouter une colonne à droite\",\n add_above_menuitem: \"Ajouter une ligne au-dessus\",\n add_below_menuitem: \"Ajouter une ligne en dessous\",\n },\n suggestion_menu: {\n no_items_title: \"Aucun élément trouvé\",\n loading: \"Chargement…\",\n },\n color_picker: {\n text_title: \"Texte\",\n background_title: \"Fond\",\n colors: {\n default: \"Défaut\",\n gray: \"Gris\",\n brown: \"Marron\",\n red: \"Rouge\",\n orange: \"Orange\",\n yellow: \"Jaune\",\n green: \"Vert\",\n blue: \"Bleu\",\n purple: \"Violet\",\n pink: \"Rose\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Gras\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Italique\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Souligner\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Barré\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Couleurs\",\n },\n link: {\n tooltip: \"Créer un lien\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Modifier la légende\",\n input_placeholder: \"Modifier la légende\",\n },\n file_replace: {\n tooltip: {\n image: \"Remplacer l'image\",\n video: \"Remplacer la vidéo\",\n audio: \"Remplacer l'audio\",\n file: \"Remplacer le fichier\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Renommer l'image\",\n video: \"Renommer la vidéo\",\n audio: \"Renommer l'audio\",\n file: \"Renommer le fichier\",\n },\n input_placeholder: {\n image: \"Renommer l'image\",\n video: \"Renommer la vidéo\",\n audio: \"Renommer l'audio\",\n file: \"Renommer le fichier\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Télécharger l'image\",\n video: \"Télécharger la vidéo\",\n audio: \"Télécharger l'audio\",\n file: \"Télécharger le fichier\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Supprimer l'image\",\n video: \"Supprimer la vidéo\",\n audio: \"Supprimer l'audio\",\n file: \"Supprimer le fichier\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Basculer l'aperçu\",\n },\n nest: {\n tooltip: \"Emboîter le bloc\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Démboîter le bloc\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Aligner le texte à gauche\",\n },\n align_center: {\n tooltip: \"Aligner le texte au centre\",\n },\n align_right: {\n tooltip: \"Aligner le texte à droite\",\n },\n align_justify: {\n tooltip: \"Justifier le texte\",\n },\n },\n file_panel: {\n upload: {\n title: \"Télécharger\",\n file_placeholder: {\n image: \"Télécharger une image\",\n video: \"Télécharger une vidéo\",\n audio: \"Télécharger un fichier audio\",\n file: \"Télécharger un fichier\",\n },\n upload_error: \"Erreur : Échec du téléchargement\",\n },\n embed: {\n title: \"Intégrer\",\n embed_button: {\n image: \"Intégrer une image\",\n video: \"Intégrer une vidéo\",\n audio: \"Intégrer un fichier audio\",\n file: \"Intégrer un fichier\",\n },\n url_placeholder: \"Entrez l'URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Supprimer le lien\",\n },\n edit: {\n text: \"Modifier le lien\",\n tooltip: \"Modifier\",\n },\n open: {\n tooltip: \"Ouvrir dans un nouvel onglet\",\n },\n form: {\n title_placeholder: \"Modifier le titre\",\n url_placeholder: \"Modifier l'URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export const hr = {\n slash_menu: {\n heading: {\n title: \"Naslov 1\",\n subtext: \"Glavni naslov\",\n aliases: [\"h\", \"naslov1\", \"h1\"],\n group: \"Naslovi\",\n },\n heading_2: {\n title: \"Naslov 2\",\n subtext: \"Naslov poglavlja\",\n aliases: [\"h2\", \"naslov2\", \"podnaslov\"],\n group: \"Naslovi\",\n },\n heading_3: {\n title: \"Naslov 3\",\n subtext: \"Naslov podpoglavlja\",\n aliases: [\"h3\", \"naslov3\", \"podnaslov\"],\n group: \"Naslovi\",\n },\n numbered_list: {\n title: \"Numerirani popis\",\n subtext: \"Popis s numeriranim stavkama\",\n aliases: [\"poredaniPopis\", \"stavkaPopisa\", \"popis\", \"numeriraniPopis\", \"numerirani popis\"],\n group: \"Osnovni blokovi\",\n },\n bullet_list: {\n title: \"Popis s oznakama\",\n subtext: \"Popis s grafičkim oznakama\",\n aliases: [\"neporedaniPopis\", \"stavkaPopisa\", \"popis\", \"popisSOznakama\", \"popis s oznakama\"],\n group: \"Osnovni blokovi\",\n },\n check_list: {\n title: \"Check lista\",\n subtext: \"Popis s kućicama za označavanje\",\n aliases: [\n \"neporedaniPopis\",\n \"stavkaPopisa\",\n \"popis\",\n \"popisZaProvjeru\",\n \"check lista\",\n \"označeni popis\",\n \"kućicaZaOznačavanje\",\n ],\n group: \"Osnovni blokovi\",\n },\n paragraph: {\n title: \"Normalan tekst\",\n subtext: \"Tekst paragrafa\",\n aliases: [\"p\", \"paragraf\"],\n group: \"Osnovni blokovi\",\n },\n table: {\n title: \"Tablica\",\n subtext: \"Tablica s podesivim ćelijama\",\n aliases: [\"tablica\"],\n group: \"Napredno\",\n },\n image: {\n title: \"Slika\",\n subtext: \"Slika s podesivom veličinom i natpisom\",\n aliases: [\n \"slika\",\n \"učitavanjeSlike\",\n \"učitaj\",\n \"img\",\n \"fotografija\",\n \"medij\",\n \"url\",\n ],\n group: \"Mediji\",\n },\n video: {\n title: \"Video\",\n subtext: \"Video s podesivom veličinom i natpisom\",\n aliases: [\n \"video\",\n \"učitavanjeVidea\",\n \"učitaj\",\n \"mp4\",\n \"film\",\n \"medij\",\n \"url\",\n ],\n group: \"Mediji\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Audio s natpisom\",\n aliases: [\n \"audio\",\n \"učitavanjeAudija\",\n \"učitaj\",\n \"mp3\",\n \"zvuk\",\n \"medij\",\n \"url\",\n ],\n group: \"Mediji\",\n },\n file: {\n title: \"Datoteka\",\n subtext: \"Ugrađena datoteka\",\n aliases: [\"datoteka\", \"učitaj\", \"ugradi\", \"medij\", \"url\"],\n group: \"Mediji\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Pretraži i umetni emoji\",\n aliases: [\"emoji\", \"emotikon\", \"emocija\", \"lice\"],\n group: \"Ostalo\",\n },\n },\n placeholders: {\n default: \"Unesi tekst ili upiši ‘/’ za naredbe\",\n heading: \"Naslov\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Dodaj sliku\",\n },\n video: {\n add_button_text: \"Dodaj video\",\n },\n audio: {\n add_button_text: \"Dodaj audio\",\n },\n file: {\n add_button_text: \"Dodaj datoteku\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Dodaj blok\",\n drag_handle_label: \"Meni za dodavanje bloka\",\n },\n drag_handle: {\n delete_menuitem: \"Ukloni\",\n colors_menuitem: \"Boje\",\n },\n table_handle: {\n delete_column_menuitem: \"Ukloni stupac\",\n delete_row_menuitem: \"Ukloni redak\",\n add_left_menuitem: \"Dodaj stupac lijevo\",\n add_right_menuitem: \"Dodaj stupac desno\",\n add_above_menuitem: \"Dodaj redak iznad\",\n add_below_menuitem: \"Dodaj redak ispod\",\n },\n suggestion_menu: {\n no_items_title: \"Stavke nisu pronađene\",\n loading: \"Učitavanje…\",\n },\n color_picker: {\n text_title: \"Tekst\",\n background_title: \"Pozadina\",\n colors: {\n default: \"Zadano\",\n gray: \"Siva\",\n brown: \"Smeđa\",\n red: \"Crvena\",\n orange: \"Narančasta\",\n yellow: \"Žuta\",\n green: \"Zelena\",\n blue: \"Plava\",\n purple: \"Ljubičasta\",\n pink: \"Ružičasta\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Podebljano\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Kurziv\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Podcrtano\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Precrtano\",\n secondary_tooltip: \"Mod+Shift+S\",\n },\n code: {\n tooltip: \"Kod\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Boja\",\n },\n link: {\n tooltip: \"Kreiraj poveznicu\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Uredi natpis\",\n input_placeholder: \"Uredi natpis\",\n },\n file_replace: {\n tooltip: {\n image: \"Zamijeni sliku\",\n video: \"Zamijeni video\",\n audio: \"Zamijeni audio\",\n file: \"Zamijeni datoteku\",\n } as Record<string, string>,\n },\n file_rename: {\n tooltip: {\n image: \"Preimenuj sliku\",\n video: \"Preimenuj video\",\n audio: \"Preimenuj audio\",\n file: \"Preimenuj datoteku\",\n } as Record<string, string>,\n input_placeholder: {\n image: \"Preimenuj sliku\",\n video: \"Preimenuj video\",\n audio: \"Preimenuj audio\",\n file: \"Preimenuj datoteku\",\n } as Record<string, string>,\n },\n file_download: {\n tooltip: {\n image: \"Preuzmi sliku\",\n video: \"Preuzmi video\",\n audio: \"Preuzmi audio\",\n file: \"Preuzmi datoteku\",\n } as Record<string, string>,\n },\n file_delete: {\n tooltip: {\n image: \"Ukloni sliku\",\n video: \"Ukloni video\",\n audio: \"Ukloni audio\",\n file: \"Ukloni datoteku\",\n } as Record<string, string>,\n },\n file_preview_toggle: {\n tooltip: \"Prikaži/sakrij pregled\",\n },\n nest: {\n tooltip: \"Ugnijezdi blok\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Razgnijezdi blok\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Poravnaj tekst lijevo\",\n },\n align_center: {\n tooltip: \"Poravnaj tekst po sredini\",\n },\n align_right: {\n tooltip: \"Poravnaj tekst desno\",\n },\n align_justify: {\n tooltip: \"Poravnaj tekst obostrano\",\n },\n },\n file_panel: {\n upload: {\n title: \"Učitaj\",\n file_placeholder: {\n image: \"Učitaj sliku\",\n video: \"Učitaj video\",\n audio: \"Učitaj audio\",\n file: \"Učitaj datoteku\",\n } as Record<string, string>,\n upload_error: \"Pogreška: Učitavanje nije uspjelo\",\n },\n embed: {\n title: \"Ugradi\",\n embed_button: {\n image: \"Ugradi sliku\",\n video: \"Ugradi video\",\n audio: \"Ugradi audio\",\n file: \"Ugradi datoteku\",\n } as Record<string, string>,\n url_placeholder: \"Dodaj URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Ukloni poveznicu\",\n },\n edit: {\n text: \"Uredi poveznicu\",\n tooltip: \"Uredi\",\n },\n open: {\n tooltip: \"Otvori u novoj kartici\",\n },\n form: {\n title_placeholder: \"Uredi naslov\",\n url_placeholder: \"Uredi URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const is: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Fyrirsögn 1\",\n subtext: \"Notað fyrir efstu fyrirsögn\",\n aliases: [\"h\", \"fyrirsogn1\", \"h1\"],\n group: \"Fyrirsagnir\",\n },\n heading_2: {\n title: \"Fyrirsögn 2\",\n subtext: \"Notað fyrir lykilhluta\",\n aliases: [\"h2\", \"fyrirsogn2\", \"undirfyrirsogn\"],\n group: \"Fyrirsagnir\",\n },\n heading_3: {\n title: \"Fyrirsögn 3\",\n subtext: \"Notað fyrir undirhluta og hópfyrirsagnir\",\n aliases: [\"h3\", \"fyrirsogn3\", \"undirfyrirsogn\"],\n group: \"Fyrirsagnir\",\n },\n numbered_list: {\n title: \"Númeruð listi\",\n subtext: \"Notað til að birta númeraðan lista\",\n aliases: [\"ol\", \"li\", \"listi\", \"numeradurlisti\"],\n group: \"Grunnblokkar\",\n },\n bullet_list: {\n title: \"Punktalisti\",\n subtext: \"Notað til að birta óraðaðan lista\",\n aliases: [\"ul\", \"li\", \"listi\", \"punktalisti\"],\n group: \"Grunnblokkar\",\n },\n check_list: {\n title: \"Athugunarlisti\",\n subtext: \"Notað til að sýna lista með gátreitum\",\n aliases: [\"ul\", \"li\", \"listi\", \"athugunarlisti\", \"merktur listi\"],\n group: \"Grunnblokkar\",\n },\n paragraph: {\n title: \"Málsgrein\",\n subtext: \"Notað fyrir meginmál skjalsins\",\n aliases: [\"p\", \"malsgrein\"],\n group: \"Grunnblokkar\",\n },\n code_block: {\n title: \"Kóðablokk\",\n subtext: \"Kóðablokkur með litskiptingu\",\n aliases: [\"kóði\", \"pre\"],\n group: \"Grunnblokkar\",\n },\n table: {\n title: \"Tafla\",\n subtext: \"Notað fyrir töflur\",\n aliases: [\"tafla\"],\n group: \"Ítarlegt\",\n },\n image: {\n title: \"Mynd\",\n subtext: \"Settu inn mynd\",\n aliases: [\n \"mynd\",\n \"myndaupphlaed\",\n \"upphlaed\",\n \"img\",\n \"mynd\",\n \"media\",\n \"url\",\n ],\n group: \"Miðlar\",\n },\n video: {\n title: \"Myndband\",\n subtext: \"Setja inn myndband\",\n aliases: [\n \"myndband\",\n \"videoUpphala\",\n \"hlaða upp\",\n \"mp4\",\n \"kvikmynd\",\n \"miðill\",\n \"url\",\n ],\n group: \"Miðill\",\n },\n audio: {\n title: \"Hljóð\",\n subtext: \"Setja inn hljóð\",\n aliases: [\n \"hljóð\",\n \"audioUpphala\",\n \"hlaða upp\",\n \"mp3\",\n \"hljóð\",\n \"miðill\",\n \"url\",\n ],\n group: \"Miðlar\",\n },\n file: {\n title: \"Skrá\",\n subtext: \"Setja inn skrá\",\n aliases: [\"skrá\", \"hlaða upp\", \"fella inn\", \"miðill\", \"url\"],\n group: \"Miðlar\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Notað til að setja inn smámynd\",\n aliases: [\"emoji\", \"andlitsávísun\", \"tilfinningar\", \"andlit\"],\n group: \"Annað\",\n },\n },\n placeholders: {\n default: \"Sláðu inn texta eða skrifaðu '/' fyrir skipanir\",\n heading: \"Fyrirsögn\",\n bulletListItem: \"Listi\",\n numberedListItem: \"Listi\",\n checkListItem: \"Listi\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Bæta við mynd\",\n },\n video: {\n add_button_text: \"Bæta við myndbandi\",\n },\n audio: {\n add_button_text: \"Bæta við hljóði\",\n },\n file: {\n add_button_text: \"Bæta við skrá\",\n },\n },\n side_menu: {\n add_block_label: \"Bæta við blokki\",\n drag_handle_label: \"Opna blokkarvalmynd\",\n },\n drag_handle: {\n delete_menuitem: \"Eyða\",\n colors_menuitem: \"Litir\",\n },\n table_handle: {\n delete_column_menuitem: \"Eyða dálki\",\n delete_row_menuitem: \"Eyða röð\",\n add_left_menuitem: \"Bæta dálki við til vinstri\",\n add_right_menuitem: \"Bæta dálki við til hægri\",\n add_above_menuitem: \"Bæta röð við fyrir ofan\",\n add_below_menuitem: \"Bæta röð við fyrir neðan\",\n },\n suggestion_menu: {\n no_items_title: \"Engir hlutir fundust\",\n loading: \"Hleður…\",\n },\n color_picker: {\n text_title: \"Texti\",\n background_title: \"Bakgrunnur\",\n colors: {\n default: \"Sjálfgefið\",\n gray: \"Grár\",\n brown: \"Brúnn\",\n red: \"Rauður\",\n orange: \"Appelsínugulur\",\n yellow: \"Gulur\",\n green: \"Grænn\",\n blue: \"Blár\",\n purple: \"Fjólublár\",\n pink: \"Bleikur\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Feitletrað\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Skáletrað\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Undirstrikað\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Yfirstrikað\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Kóði\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Litir\",\n },\n link: {\n tooltip: \"Búa til tengil\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Breyta myndatexta\",\n input_placeholder: \"Breyta myndatexta\",\n },\n file_replace: {\n tooltip: {\n image: \"Skipta um mynd\",\n video: \"Skipta um myndband\",\n audio: \"Skipta um hljóð\",\n file: \"Skipta um skrá\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Endurnefna mynd\",\n video: \"Endurnefna myndband\",\n audio: \"Endurnefna hljóð\",\n file: \"Endurnefna skrá\",\n },\n input_placeholder: {\n image: \"Endurnefna mynd\",\n video: \"Endurnefna myndband\",\n audio: \"Endurnefna hljóð\",\n file: \"Endurnefna skrá\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Sækja mynd\",\n video: \"Sækja myndband\",\n audio: \"Sækja hljóð\",\n file: \"Sækja skrá\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Eyða mynd\",\n video: \"Eyða myndbandi\",\n audio: \"Eyða hljóði\",\n file: \"Eyða skrá\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Skipta um forskoðun\",\n },\n nest: {\n tooltip: \"Fella blokk saman\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Afþýða blokk\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Vinstrijafna texta\",\n },\n align_center: {\n tooltip: \"Miðjustilla texta\",\n },\n align_right: {\n tooltip: \"Hægrijafna texta\",\n },\n align_justify: {\n tooltip: \"Jafna texta\",\n },\n },\n file_panel: {\n upload: {\n title: \"Hlaða upp\",\n file_placeholder: {\n image: \"Hlaða upp mynd\",\n video: \"Hlaða upp myndband\",\n audio: \"Hlaða upp hljóð\",\n file: \"Hlaða upp skrá\",\n },\n upload_error: \"Villa: Upphleðsla mistókst\",\n },\n embed: {\n title: \"Innsetja\",\n embed_button: {\n image: \"Innsetja mynd\",\n video: \"Innsetja myndband\",\n audio: \"Innsetja hljóð\",\n file: \"Innsetja skrá\",\n },\n url_placeholder: \"Sláðu inn URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Fjarlægja tengil\",\n },\n edit: {\n text: \"Breyta tengli\",\n tooltip: \"Breyta\",\n },\n open: {\n tooltip: \"Opna í nýjum flipa\",\n },\n form: {\n title_placeholder: \"Breyta titli\",\n url_placeholder: \"Breyta URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const ja: Dictionary = {\n slash_menu: {\n heading: {\n title: \"見出し1\",\n subtext: \"トップレベルの見出しに使用\",\n aliases: [\"h\", \"見出し1\", \"h1\", \"大見出し\"],\n group: \"見出し\",\n },\n heading_2: {\n title: \"見出し2\",\n subtext: \"重要なセクションに使用\",\n aliases: [\"h2\", \"見出し2\", \"subheading\", \"中見出し\"],\n group: \"見出し\",\n },\n heading_3: {\n title: \"見出し3\",\n subtext: \"セクションやグループの見出しに使用\",\n aliases: [\"h3\", \"見出し3\", \"subheading\", \"小見出し\"],\n group: \"見出し\",\n },\n numbered_list: {\n title: \"番号付リスト\",\n subtext: \"番号付リストを表示するために使用\",\n aliases: [\n \"ol\",\n \"li\",\n \"numberedlist\",\n \"numbered list\",\n \"リスト\",\n \"番号付リスト\",\n \"番号 リスト\",\n ],\n group: \"基本ブロック\",\n },\n bullet_list: {\n title: \"箇条書き\",\n subtext: \"箇条書きを表示するために使用\",\n aliases: [\n \"ul\",\n \"li\",\n \"bulletlist\",\n \"bullet list\",\n \"リスト\",\n \"箇条書きリスト\",\n ],\n group: \"基本ブロック\",\n },\n check_list: {\n title: \"チェックリスト\",\n subtext: \"チェックボックス付きリストを表示するために使用されます\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"checklist\",\n \"checked list\",\n \"リスト\",\n \"チェックリスト\",\n \"チェックされたリスト\",\n ],\n group: \"基本ブロック\",\n },\n paragraph: {\n title: \"標準テキスト\",\n subtext: \"本文に使用\",\n aliases: [\"p\", \"paragraph\", \"標準テキスト\"],\n group: \"基本ブロック\",\n },\n code_block: {\n title: \"コードブロック\",\n subtext: \"シンタックスハイライト付きのコードブロック\",\n aliases: [\"code\", \"pre\", \"コード\", \"コードブロック\"],\n group: \"基本ブロック\",\n },\n table: {\n title: \"表\",\n subtext: \"表に使用\",\n aliases: [\"table\", \"表\", \"テーブル\"],\n group: \"高度なブロック\",\n },\n image: {\n title: \"画像\",\n subtext: \"画像を挿入\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"url\",\n \"画像\",\n ],\n group: \"メディア\",\n },\n video: {\n title: \"ビデオ\",\n subtext: \"ビデオを挿入\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n \"ビデオ\",\n ],\n group: \"メディア\",\n },\n audio: {\n title: \"オーディオ\",\n subtext: \"オーディオを挿入\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"url\",\n \"オーディオ\",\n ],\n group: \"メディア\",\n },\n file: {\n title: \"ファイル\",\n subtext: \"ファイルを挿入\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"url\", \"ファイル\"],\n group: \"メディア\",\n },\n emoji: {\n title: \"絵文字\",\n subtext: \"絵文字を挿入するために使用します\",\n aliases: [\"絵文字\", \"顔文字\", \"感情表現\", \"顔\"],\n group: \"その他\",\n },\n },\n placeholders: {\n default: \"テキストを入力するか'/' を入力してコマンド選択\",\n heading: \"見出し\",\n bulletListItem: \"リストを追加\",\n numberedListItem: \"リストを追加\",\n checkListItem: \"リストを追加\",\n },\n file_blocks: {\n image: {\n add_button_text: \"画像を追加\",\n },\n video: {\n add_button_text: \"ビデオを追加\",\n },\n audio: {\n add_button_text: \"オーディオを追加\",\n },\n file: {\n add_button_text: \"ファイルを追加\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"ブロックを追加\",\n drag_handle_label: \"ブロックメニュー\",\n },\n drag_handle: {\n delete_menuitem: \"削除\",\n colors_menuitem: \"色を変更\",\n },\n table_handle: {\n delete_column_menuitem: \"列を削除\",\n delete_row_menuitem: \"行を削除\",\n add_left_menuitem: \"左に列を追加\",\n add_right_menuitem: \"右に列を追加\",\n add_above_menuitem: \"上に行を追加\",\n add_below_menuitem: \"下に行を追加\",\n },\n suggestion_menu: {\n no_items_title: \"アイテムが見つかりません\",\n loading: \"読込中…\",\n },\n color_picker: {\n text_title: \"文字色\",\n background_title: \"背景色\",\n colors: {\n default: \"デフォルト\",\n gray: \"グレー\",\n brown: \"茶色\",\n red: \"赤\",\n orange: \"オレンジ\",\n yellow: \"黄色\",\n green: \"緑\",\n blue: \"青\",\n purple: \"紫\",\n pink: \"ピンク\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"太字\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"斜体\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"下線\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"打ち消し\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"コード\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"色\",\n },\n link: {\n tooltip: \"リンク\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"キャプションを編集\",\n input_placeholder: \"キャプションを編集\",\n },\n file_replace: {\n tooltip: {\n image: \"画像を置換\",\n video: \"ビデオを置換\",\n audio: \"オーディオを置換\",\n file: \"ファイルを置換\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"画像の名前を変更\",\n video: \"ビデオの名前を変更\",\n audio: \"オーディオの名前を変更\",\n file: \"ファイルの名前を変更\",\n },\n input_placeholder: {\n image: \"画像の名前を変更\",\n video: \"ビデオの名前を変更\",\n audio: \"オーディオの名前を変更\",\n file: \"ファイルの名前を変更\",\n },\n },\n file_download: {\n tooltip: {\n image: \"画像をダウンロード\",\n video: \"ビデオをダウンロード\",\n audio: \"オーディオをダウンロード\",\n file: \"ファイルをダウンロード\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"画像を削除\",\n video: \"ビデオを削除\",\n audio: \"オーディオを削除\",\n file: \"ファイルを削除\",\n },\n },\n file_preview_toggle: {\n tooltip: \"プレビューの切り替え\",\n },\n nest: {\n tooltip: \"インデント増\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"インデント減\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"左揃え\",\n },\n align_center: {\n tooltip: \"中央揃え\",\n },\n align_right: {\n tooltip: \"右揃え\",\n },\n align_justify: {\n tooltip: \"両端揃え\",\n },\n },\n file_panel: {\n upload: {\n title: \"アップロード\",\n file_placeholder: {\n image: \"画像をアップロード\",\n video: \"ビデオをアップロード\",\n audio: \"オーディオをアップロード\",\n file: \"ファイルをアップロード\",\n },\n upload_error: \"エラー: アップロードが失敗しました\",\n },\n embed: {\n title: \"埋め込み\",\n embed_button: {\n image: \"画像を埋め込む\",\n video: \"ビデオを埋め込む\",\n audio: \"オーディオを埋め込む\",\n file: \"ファイルを埋め込む\",\n },\n url_placeholder: \"URLを入力\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"リンクを解除\",\n },\n edit: {\n text: \"リンクを編集\",\n tooltip: \"編集\",\n },\n open: {\n tooltip: \"新しいタブでリンクを開く\",\n },\n form: {\n title_placeholder: \"タイトルを編集\",\n url_placeholder: \"URLを編集\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const ko: Dictionary = {\n slash_menu: {\n heading: {\n title: \"제목1\",\n subtext: \"섹션 제목(대)\",\n aliases: [\"h\", \"제목1\", \"h1\", \"대제목\"],\n group: \"제목\",\n },\n heading_2: {\n title: \"제목2\",\n subtext: \"섹션 제목(중)\",\n aliases: [\"h2\", \"제목2\", \"중제목\"],\n group: \"제목\",\n },\n heading_3: {\n title: \"제목3\",\n subtext: \"섹션 제목(소)\",\n aliases: [\"h3\", \"제목3\", \"subheading\"],\n group: \"제목\",\n },\n numbered_list: {\n title: \"번호 매기기 목록\",\n subtext: \"번호가 매겨진 목록을 추가합니다.\",\n aliases: [\"ol\", \"li\", \"목록\", \"번호 매기기 목록\", \"번호 목록\"],\n group: \"기본 블록\",\n },\n bullet_list: {\n title: \"글머리 기호 목록\",\n subtext: \"간단한 글머리 기호를 추가합니다.\",\n aliases: [\"ul\", \"li\", \"목록\", \"글머리 기호 목록\", \"글머리 목록\"],\n group: \"기본 블록\",\n },\n check_list: {\n title: \"체크리스트\",\n subtext: \"체크박스가 있는 목록을 표시하는 데 사용\",\n aliases: [\n \"ul\",\n \"li\",\n \"목록\",\n \"체크리스트\",\n \"체크 리스트\",\n \"체크된 목록\",\n \"체크박스\",\n ],\n group: \"기본 블록\",\n },\n paragraph: {\n title: \"본문\",\n subtext: \"일반 텍스트\",\n aliases: [\"p\", \"paragraph\", \"본문\"],\n group: \"기본 블록\",\n },\n code_block: {\n title: \"코드 블록\",\n subtext: \"구문 강조가 있는 코드 블록\",\n aliases: [\"code\", \"pre\"],\n group: \"기본 블록\",\n },\n table: {\n title: \"표\",\n subtext: \"간단한 표를 추가합니다.\",\n aliases: [\"표\"],\n group: \"고급\",\n },\n image: {\n title: \"이미지\",\n subtext: \"이미지 파일을 업로드합니다.\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"이미지\",\n \"url\",\n ],\n group: \"미디어\",\n },\n video: {\n title: \"비디오\",\n subtext: \"비디오 삽입\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"동영상\",\n \"url\",\n ],\n group: \"미디어\",\n },\n audio: {\n title: \"오디오\",\n subtext: \"오디오 삽입\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"오디오\",\n \"url\",\n ],\n group: \"미디어\",\n },\n file: {\n title: \"파일\",\n subtext: \"파일 삽입\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"파일\", \"url\"],\n group: \"미디어\",\n },\n emoji: {\n title: \"이모지\",\n subtext: \"이모지 삽입용으로 사용됩니다\",\n aliases: [\n \"이모지\",\n \"emoji\",\n \"감정 표현\",\n \"emotion expression\",\n \"표정\",\n \"face expression\",\n \"얼굴\",\n \"face\",\n ],\n group: \"기타\",\n },\n },\n placeholders: {\n default: \"텍스트를 입력하거나 /를 입력하여 명령을 입력하세요.\",\n heading: \"제목\",\n bulletListItem: \"목록\",\n numberedListItem: \"목록\",\n checkListItem: \"목록\",\n },\n file_blocks: {\n image: {\n add_button_text: \"이미지 추가\",\n },\n video: {\n add_button_text: \"비디오 추가\",\n },\n audio: {\n add_button_text: \"오디오 추가\",\n },\n file: {\n add_button_text: \"파일 추가\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"블록 추가\",\n drag_handle_label: \"블록 메뉴 열기\",\n },\n drag_handle: {\n delete_menuitem: \"삭제\",\n colors_menuitem: \"색깔\",\n },\n table_handle: {\n delete_column_menuitem: \"열 1개 삭제\",\n delete_row_menuitem: \"행 삭제\",\n add_left_menuitem: \"왼쪽에 열 1개 추가\",\n add_right_menuitem: \"오른쪽에 열 1개 추가\",\n add_above_menuitem: \"위에 행 1개 추가\",\n add_below_menuitem: \"아래에 행 1개 추가\",\n },\n suggestion_menu: {\n no_items_title: \"항목을 찾을 수 없음\",\n loading: \"로딩 중…\",\n },\n color_picker: {\n text_title: \"텍스트\",\n background_title: \"배경\",\n colors: {\n default: \"기본\",\n gray: \"회색\",\n brown: \"갈색\",\n red: \"빨간색\",\n orange: \"주황색\",\n yellow: \"노란색\",\n green: \"녹색\",\n blue: \"파란색\",\n purple: \"보라색\",\n pink: \"분홍색\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"진하게\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"기울임\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"밑줄\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"취소선\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"코드\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"색깔\",\n },\n link: {\n tooltip: \"링크 만들기\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"이미지 캡션 수정\",\n input_placeholder: \"이미지 캡션 수정\",\n },\n file_replace: {\n tooltip: {\n image: \"이미지 교체\",\n video: \"비디오 교체\",\n audio: \"오디오 교체\",\n file: \"파일 교체\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"이미지 이름 변경\",\n video: \"비디오 이름 변경\",\n audio: \"오디오 이름 변경\",\n file: \"파일 이름 변경\",\n },\n input_placeholder: {\n image: \"이미지 이름 변경\",\n video: \"비디오 이름 변경\",\n audio: \"오디오 이름 변경\",\n file: \"파일 이름 변경\",\n },\n },\n file_download: {\n tooltip: {\n image: \"이미지 다운로드\",\n video: \"비디오 다운로드\",\n audio: \"오디오 다운로드\",\n file: \"파일 다운로드\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"이미지 삭제\",\n video: \"비디오 삭제\",\n audio: \"오디오 삭제\",\n file: \"파일 삭제\",\n },\n },\n file_preview_toggle: {\n tooltip: \"미리보기 전환\",\n },\n nest: {\n tooltip: \"중첩 블록\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"비중첩 블록\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"텍스트 왼쪽 맞춤\",\n },\n align_center: {\n tooltip: \"텍스트 가운데 맞춤\",\n },\n align_right: {\n tooltip: \"텍스트 오른쪽 맞춤\",\n },\n align_justify: {\n tooltip: \"텍스트 양쪽 맞춤\",\n },\n },\n file_panel: {\n upload: {\n title: \"업로드\",\n file_placeholder: {\n image: \"이미지 업로드\",\n video: \"비디오 업로드\",\n audio: \"오디오 업로드\",\n file: \"파일 업로드\",\n },\n upload_error: \"오류: 업로드 실패\",\n },\n embed: {\n title: \"임베드\",\n embed_button: {\n image: \"이미지 삽입\",\n video: \"비디오 삽입\",\n audio: \"오디오 삽입\",\n file: \"파일 삽입\",\n },\n url_placeholder: \"URL을 입력하세요.\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"링크 삭제\",\n },\n edit: {\n text: \"링크 수정\",\n tooltip: \"수정\",\n },\n open: {\n tooltip: \"새 탭으로 열기\",\n },\n form: {\n title_placeholder: \"제목 수정\",\n url_placeholder: \"URL 수정\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const nl: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Kop 1\",\n subtext: \"Gebruikt voor een hoofdkop\",\n aliases: [\"h\", \"kop1\", \"h1\"],\n group: \"Koppen\",\n },\n heading_2: {\n title: \"Kop 2\",\n subtext: \"Gebruikt voor belangrijke secties\",\n aliases: [\"h2\", \"kop2\", \"subkop\"],\n group: \"Koppen\",\n },\n heading_3: {\n title: \"Kop 3\",\n subtext: \"Gebruikt voor subsecties en groepskoppen\",\n aliases: [\"h3\", \"kop3\", \"subkop\"],\n group: \"Koppen\",\n },\n numbered_list: {\n title: \"Genummerde Lijst\",\n subtext: \"Gebruikt om een genummerde lijst weer te geven\",\n aliases: [\"ol\", \"li\", \"lijst\", \"genummerdelijst\", \"genummerde lijst\"],\n group: \"Basisblokken\",\n },\n bullet_list: {\n title: \"Puntenlijst\",\n subtext: \"Gebruikt om een ongeordende lijst weer te geven\",\n aliases: [\"ul\", \"li\", \"lijst\", \"puntenlijst\", \"punten lijst\"],\n group: \"Basisblokken\",\n },\n check_list: {\n title: \"Controlelijst\",\n subtext: \"Gebruikt om een lijst met selectievakjes weer te geven\",\n aliases: [\"ul\", \"li\", \"lijst\", \"aangevinkte lijst\", \"selectievakje\"],\n group: \"Basisblokken\",\n },\n paragraph: {\n title: \"Paragraaf\",\n subtext: \"Gebruikt voor de hoofdtekst van uw document\",\n aliases: [\"p\", \"paragraaf\"],\n group: \"Basisblokken\",\n },\n code_block: {\n title: \"Codeblok\",\n subtext: \"Codeblok met syntax highlighting\",\n aliases: [\"code\", \"pre\"],\n group: \"Basisblokken\",\n },\n table: {\n title: \"Tabel\",\n subtext: \"Gebruikt voor tabellen\",\n aliases: [\"tabel\"],\n group: \"Geavanceerd\",\n },\n image: {\n title: \"Afbeelding\",\n subtext: \"Voeg een afbeelding in\",\n aliases: [\n \"afbeelding\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"foto\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n video: {\n title: \"Video\",\n subtext: \"Voeg een video in\",\n aliases: [\n \"video\",\n \"videoUploaden\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n \"drive\",\n \"dropbox\",\n ],\n group: \"Media\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Voeg audio in\",\n aliases: [\n \"audio\",\n \"audioUploaden\",\n \"upload\",\n \"mp3\",\n \"geluid\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n file: {\n title: \"Bestand\",\n subtext: \"Voeg een bestand in\",\n aliases: [\"bestand\", \"upload\", \"insluiten\", \"media\", \"url\"],\n group: \"Media\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Gebruikt voor het invoegen van een emoji\",\n aliases: [\n \"emoji\",\n \"emotie-uitdrukking\",\n \"gezichtsuitdrukking\",\n \"gezicht\",\n ],\n group: \"Overig\",\n },\n },\n placeholders: {\n default: \"Voer tekst in of type '/' voor commando's\",\n heading: \"Kop\",\n bulletListItem: \"Lijst\",\n numberedListItem: \"Lijst\",\n checkListItem: \"Lijst\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Afbeelding toevoegen\",\n },\n video: {\n add_button_text: \"Video toevoegen\",\n },\n audio: {\n add_button_text: \"Audio toevoegen\",\n },\n file: {\n add_button_text: \"Bestand toevoegen\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Nieuw blok\",\n drag_handle_label: \"Open blok menu\",\n },\n drag_handle: {\n delete_menuitem: \"Verwijder\",\n colors_menuitem: \"Kleuren\",\n },\n table_handle: {\n delete_column_menuitem: \"Verwijder kolom\",\n delete_row_menuitem: \"Verwijder rij\",\n add_left_menuitem: \"Voeg kolom links toe\",\n add_right_menuitem: \"Voeg kolom rechts toe\",\n add_above_menuitem: \"Voeg rij boven toe\",\n add_below_menuitem: \"Voeg rij onder toe\",\n },\n suggestion_menu: {\n no_items_title: \"Geen items gevonden\",\n loading: \"Laden…\",\n },\n color_picker: {\n text_title: \"Tekst\",\n background_title: \"Achtergrond\",\n colors: {\n default: \"Standaard\",\n gray: \"Grijs\",\n brown: \"Bruin\",\n red: \"Rood\",\n orange: \"Oranje\",\n yellow: \"Geel\",\n green: \"Groen\",\n blue: \"Blauw\",\n purple: \"Paars\",\n pink: \"Roze\",\n },\n },\n formatting_toolbar: {\n bold: {\n tooltip: \"Vet\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Cursief\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Onderstrepen\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Doorstrepen\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Kleuren\",\n },\n link: {\n tooltip: \"Maak link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Bewerk onderschrift\",\n input_placeholder: \"Bewerk onderschrift\",\n },\n file_replace: {\n tooltip: {\n image: \"Afbeelding vervangen\",\n video: \"Video vervangen\",\n audio: \"Audio vervangen\",\n file: \"Bestand vervangen\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Afbeelding hernoemen\",\n video: \"Video hernoemen\",\n audio: \"Audio hernoemen\",\n file: \"Bestand hernoemen\",\n },\n input_placeholder: {\n image: \"Afbeelding hernoemen\",\n video: \"Video hernoemen\",\n audio: \"Audio hernoemen\",\n file: \"Bestand hernoemen\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Afbeelding downloaden\",\n video: \"Video downloaden\",\n audio: \"Audio downloaden\",\n file: \"Bestand downloaden\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Afbeelding verwijderen\",\n video: \"Video verwijderen\",\n audio: \"Audio verwijderen\",\n file: \"Bestand verwijderen\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Voorbeeldschakelaar\",\n },\n nest: {\n tooltip: \"Nest blok\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Ontnest blok\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Tekst links uitlijnen\",\n },\n align_center: {\n tooltip: \"Tekst centreren\",\n },\n align_right: {\n tooltip: \"Tekst rechts uitlijnen\",\n },\n align_justify: {\n tooltip: \"Tekst uitvullen\",\n },\n },\n file_panel: {\n upload: {\n title: \"Upload\",\n file_placeholder: {\n image: \"Afbeelding uploaden\",\n video: \"Video uploaden\",\n audio: \"Audio uploaden\",\n file: \"Bestand uploaden\",\n },\n upload_error: \"Fout: Upload mislukt\",\n },\n embed: {\n title: \"Insluiten\",\n embed_button: {\n image: \"Afbeelding insluiten\",\n video: \"Video insluiten\",\n audio: \"Audio insluiten\",\n file: \"Bestand insluiten\",\n },\n url_placeholder: \"Voer URL in\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Verwijder link\",\n },\n edit: {\n text: \"Bewerk link\",\n tooltip: \"Bewerk\",\n },\n open: {\n tooltip: \"Open in nieuw tabblad\",\n },\n form: {\n title_placeholder: \"Bewerk titel\",\n url_placeholder: \"Bewerk URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const pl: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Nagłówek 1\",\n subtext: \"Używany dla nagłówka najwyższego poziomu\",\n aliases: [\"h\", \"naglowek1\", \"h1\"],\n group: \"Nagłówki\",\n },\n heading_2: {\n title: \"Nagłówek 2\",\n subtext: \"Używany dla kluczowych sekcji\",\n aliases: [\"h2\", \"naglowek2\", \"podnaglowek\"],\n group: \"Nagłówki\",\n },\n heading_3: {\n title: \"Nagłówek 3\",\n subtext: \"Używany dla podsekcji i grup nagłówków\",\n aliases: [\"h3\", \"naglowek3\", \"podnaglowek\"],\n group: \"Nagłówki\",\n },\n numbered_list: {\n title: \"Lista numerowana\",\n subtext: \"Używana do wyświetlania listy numerowanej\",\n aliases: [\"ol\", \"li\", \"lista\", \"numerowana lista\"],\n group: \"Podstawowe bloki\",\n },\n bullet_list: {\n title: \"Lista punktowana\",\n subtext: \"Używana do wyświetlania listy bez numeracji\",\n aliases: [\"ul\", \"li\", \"lista\", \"punktowana lista\"],\n group: \"Podstawowe bloki\",\n },\n check_list: {\n title: \"Lista z polami wyboru\",\n subtext: \"Używana do wyświetlania listy z polami wyboru\",\n aliases: [\"ul\", \"li\", \"lista\", \"lista z polami wyboru\", \"pole wyboru\"],\n group: \"Podstawowe bloki\",\n },\n paragraph: {\n title: \"Akapit\",\n subtext: \"Używany dla treści dokumentu\",\n aliases: [\"p\", \"akapit\"],\n group: \"Podstawowe bloki\",\n },\n code_block: {\n title: \"Blok kodu\",\n subtext: \"Blok kodu z podświetleniem składni\",\n aliases: [\"kod\", \"pre\"],\n group: \"Podstawowe bloki\",\n },\n table: {\n title: \"Tabela\",\n subtext: \"Używana do tworzenia tabel\",\n aliases: [\"tabela\"],\n group: \"Zaawansowane\",\n },\n image: {\n title: \"Zdjęcie\",\n subtext: \"Wstaw zdjęcie\",\n aliases: [\n \"obraz\",\n \"wrzućZdjęcie\",\n \"wrzuć\",\n \"img\",\n \"zdjęcie\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n video: {\n title: \"Wideo\",\n subtext: \"Wstaw wideo\",\n aliases: [\"wideo\", \"wrzućWideo\", \"wrzuć\", \"mp4\", \"film\", \"media\", \"url\"],\n group: \"Media\",\n },\n audio: {\n title: \"Audio\",\n subtext: \"Wstaw audio\",\n aliases: [\n \"audio\",\n \"wrzućAudio\",\n \"wrzuć\",\n \"mp3\",\n \"dźwięk\",\n \"media\",\n \"url\",\n ],\n group: \"Media\",\n },\n file: {\n title: \"Plik\",\n subtext: \"Wstaw plik\",\n aliases: [\"plik\", \"wrzuć\", \"wstaw\", \"media\", \"url\"],\n group: \"Media\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Używane do wstawiania emoji\",\n aliases: [\"emoji\", \"emotka\", \"wyrażenie emocji\", \"twarz\"],\n group: \"Inne\",\n },\n },\n placeholders: {\n default: \"Wprowadź tekst lub wpisz '/' aby użyć poleceń\",\n heading: \"Nagłówek\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Dodaj zdjęcie\",\n },\n video: {\n add_button_text: \"Dodaj wideo\",\n },\n audio: {\n add_button_text: \"Dodaj audio\",\n },\n file: {\n add_button_text: \"Dodaj plik\",\n },\n },\n side_menu: {\n add_block_label: \"Dodaj blok\",\n drag_handle_label: \"Otwórz menu bloków\",\n },\n drag_handle: {\n delete_menuitem: \"Usuń\",\n colors_menuitem: \"Kolory\",\n },\n table_handle: {\n delete_column_menuitem: \"Usuń kolumnę\",\n delete_row_menuitem: \"Usuń wiersz\",\n add_left_menuitem: \"Dodaj kolumnę po lewej\",\n add_right_menuitem: \"Dodaj kolumnę po prawej\",\n add_above_menuitem: \"Dodaj wiersz powyżej\",\n add_below_menuitem: \"Dodaj wiersz poniżej\",\n },\n suggestion_menu: {\n no_items_title: \"Nie znaleziono elementów\",\n loading: \"Ładowanie…\",\n },\n color_picker: {\n text_title: \"Tekst\",\n background_title: \"Tło\",\n colors: {\n default: \"Domyślny\",\n gray: \"Szary\",\n brown: \"Brązowy\",\n red: \"Czerwony\",\n orange: \"Pomarańczowy\",\n yellow: \"Żółty\",\n green: \"Zielony\",\n blue: \"Niebieski\",\n purple: \"Fioletowy\",\n pink: \"Różowy\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Pogrubienie\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Kursywa\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Podkreślenie\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Przekreślenie\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Kod\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Kolory\",\n },\n link: {\n tooltip: \"Utwórz link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Zmień podpis\",\n input_placeholder: \"Zmień podpis\",\n },\n file_replace: {\n tooltip: {\n image: \"Zmień obraz\",\n video: \"Zmień wideo\",\n audio: \"Zmień audio\",\n file: \"Zmień plik\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Zmień nazwę zdjęcia\",\n video: \"Zmień nazwę wideo\",\n audio: \"Zmień nazwę audio\",\n file: \"Zmień nazwę pliku\",\n },\n input_placeholder: {\n image: \"Zmień nazwę zdjęcia\",\n video: \"Zmień nazwę wideo\",\n audio: \"Zmień nazwę audio\",\n file: \"Zmień nazwę pliku\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Pobierz zdjęcie\",\n video: \"Pobierz wideo\",\n audio: \"Pobierz audio\",\n file: \"Pobierz plik\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Usuń zdjęcie\",\n video: \"Usuń wideo\",\n audio: \"Usuń audio\",\n file: \"Usuń plik\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Przełącz podgląd\",\n },\n nest: {\n tooltip: \"Zagnieźdź blok\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Odgagnieźdź blok\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Wyrównaj tekst do lewej\",\n },\n align_center: {\n tooltip: \"Wyśrodkuj tekst\",\n },\n align_right: {\n tooltip: \"Wyrównaj tekst do prawej\",\n },\n align_justify: {\n tooltip: \"Wyjustuj tekst\",\n },\n },\n file_panel: {\n upload: {\n title: \"Wrzuć\",\n file_placeholder: {\n image: \"Wrzuć zdjęcie\",\n video: \"Wrzuć wideo\",\n audio: \"Wrzuć audio\",\n file: \"Wrzuć plik\",\n },\n upload_error: \"Błąd: Przesyłanie nie powiodło się\",\n },\n embed: {\n title: \"Wstaw\",\n embed_button: {\n image: \"Wstaw zdjęice\",\n video: \"Wstaw wideo\",\n audio: \"Wstaw audio\",\n file: \"Wstaw plik\",\n },\n url_placeholder: \"Wprowadź URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Usuń link\",\n },\n edit: {\n text: \"Edytuj link\",\n tooltip: \"Edytuj\",\n },\n open: {\n tooltip: \"Otwórz w nowej karcie\",\n },\n form: {\n title_placeholder: \"Edytuj tytuł\",\n url_placeholder: \"Edytuj URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const pt: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Título\",\n subtext: \"Usado para um título de nível superior\",\n aliases: [\"h\", \"titulo1\", \"h1\"],\n group: \"Títulos\",\n },\n heading_2: {\n title: \"Título 2\",\n subtext: \"Usado para seções principais\",\n aliases: [\"h2\", \"titulo2\", \"subtitulo\"],\n group: \"Títulos\",\n },\n heading_3: {\n title: \"Título 3\",\n subtext: \"Usado para subseções e títulos de grupo\",\n aliases: [\"h3\", \"titulo3\", \"subtitulo\"],\n group: \"Títulos\",\n },\n numbered_list: {\n title: \"Lista Numerada\",\n subtext: \"Usado para exibir uma lista numerada\",\n aliases: [\"ol\", \"li\", \"lista\", \"listanumerada\", \"lista numerada\"],\n group: \"Blocos básicos\",\n },\n bullet_list: {\n title: \"Lista com Marcadores\",\n subtext: \"Usado para exibir uma lista não ordenada\",\n aliases: [\"ul\", \"li\", \"lista\", \"listamarcadores\", \"lista com marcadores\"],\n group: \"Blocos básicos\",\n },\n check_list: {\n title: \"Lista de verificação\",\n subtext: \"Usado para exibir uma lista com caixas de seleção\",\n aliases: [\n \"ul\",\n \"li\",\n \"lista\",\n \"lista de verificação\",\n \"lista marcada\",\n \"caixa de seleção\",\n ],\n group: \"Blocos básicos\",\n },\n paragraph: {\n title: \"Parágrafo\",\n subtext: \"Usado para o corpo do seu documento\",\n aliases: [\"p\", \"paragrafo\"],\n group: \"Blocos básicos\",\n },\n code_block: {\n title: \"Bloco de Código\",\n subtext: \"Usado para exibir código com destaque de sintaxe\",\n aliases: [\"codigo\", \"pre\"],\n group: \"Blocos básicos\",\n },\n table: {\n title: \"Tabela\",\n subtext: \"Usado para tabelas\",\n aliases: [\"tabela\"],\n group: \"Avançado\",\n },\n image: {\n title: \"Imagem\",\n subtext: \"Inserir uma imagem\",\n aliases: [\n \"imagem\",\n \"uploadImagem\",\n \"upload\",\n \"img\",\n \"foto\",\n \"media\",\n \"url\",\n ],\n group: \"Mídia\",\n },\n video: {\n title: \"Vídeo\",\n subtext: \"Inserir um vídeo\",\n aliases: [\n \"vídeo\",\n \"uploadVídeo\",\n \"upload\",\n \"mp4\",\n \"filme\",\n \"mídia\",\n \"url\",\n ],\n group: \"Mídia\",\n },\n audio: {\n title: \"Áudio\",\n subtext: \"Inserir um áudio\",\n aliases: [\"áudio\", \"uploadÁudio\", \"upload\", \"mp3\", \"som\", \"mídia\", \"url\"],\n group: \"Mídia\",\n },\n file: {\n title: \"Arquivo\",\n subtext: \"Inserir um arquivo\",\n aliases: [\"arquivo\", \"upload\", \"incorporar\", \"mídia\", \"url\"],\n group: \"Mídia\",\n },\n emoji: {\n title: \"Emoji\",\n subtext: \"Usado para inserir um emoji\",\n aliases: [\"emoji\", \"emoticon\", \"expressão emocional\", \"rosto\"],\n group: \"Outros\",\n },\n },\n placeholders: {\n default: \"Digite texto ou use '/' para comandos\",\n heading: \"Título\",\n bulletListItem: \"Lista\",\n numberedListItem: \"Lista\",\n checkListItem: \"Lista\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Adicionar imagem\",\n },\n video: {\n add_button_text: \"Adicionar vídeo\",\n },\n audio: {\n add_button_text: \"Adicionar áudio\",\n },\n file: {\n add_button_text: \"Adicionar arquivo\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Adicionar bloco\",\n drag_handle_label: \"Abrir menu do bloco\",\n },\n drag_handle: {\n delete_menuitem: \"Excluir\",\n colors_menuitem: \"Cores\",\n },\n table_handle: {\n delete_column_menuitem: \"Excluir coluna\",\n delete_row_menuitem: \"Excluir linha\",\n add_left_menuitem: \"Adicionar coluna à esquerda\",\n add_right_menuitem: \"Adicionar coluna à direita\",\n add_above_menuitem: \"Adicionar linha acima\",\n add_below_menuitem: \"Adicionar linha abaixo\",\n },\n suggestion_menu: {\n no_items_title: \"Nenhum item encontrado\",\n loading: \"Carregando…\",\n },\n color_picker: {\n text_title: \"Texto\",\n background_title: \"Fundo\",\n colors: {\n default: \"Padrão\",\n gray: \"Cinza\",\n brown: \"Marrom\",\n red: \"Vermelho\",\n orange: \"Laranja\",\n yellow: \"Amarelo\",\n green: \"Verde\",\n blue: \"Azul\",\n purple: \"Roxo\",\n pink: \"Rosa\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Negrito\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Itálico\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Sublinhado\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Riscado\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Código\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Cores\",\n },\n link: {\n tooltip: \"Criar link\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Editar legenda\",\n input_placeholder: \"Editar legenda\",\n },\n file_replace: {\n tooltip: {\n image: \"Substituir imagem\",\n video: \"Substituir vídeo\",\n audio: \"Substituir áudio\",\n file: \"Substituir arquivo\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Renomear imagem\",\n video: \"Renomear vídeo\",\n audio: \"Renomear áudio\",\n file: \"Renomear arquivo\",\n },\n input_placeholder: {\n image: \"Renomear imagem\",\n video: \"Renomear vídeo\",\n audio: \"Renomear áudio\",\n file: \"Renomear arquivo\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Baixar imagem\",\n video: \"Baixar vídeo\",\n audio: \"Baixar áudio\",\n file: \"Baixar arquivo\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Excluir imagem\",\n video: \"Excluir vídeo\",\n audio: \"Excluir áudio\",\n file: \"Excluir arquivo\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Alternar visualização\",\n },\n nest: {\n tooltip: \"Aninhar bloco\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Desaninhar bloco\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Alinhar à esquerda\",\n },\n align_center: {\n tooltip: \"Alinhar ao centro\",\n },\n align_right: {\n tooltip: \"Alinhar à direita\",\n },\n align_justify: {\n tooltip: \"Justificar texto\",\n },\n },\n file_panel: {\n upload: {\n title: \"Upload\",\n file_placeholder: {\n image: \"Upload de imagem\",\n video: \"Upload de vídeo\",\n audio: \"Upload de áudio\",\n file: \"Upload de arquivo\",\n },\n upload_error: \"Erro: Falha no upload\",\n },\n embed: {\n title: \"Incorporar\",\n embed_button: {\n image: \"Incorporar imagem\",\n video: \"Incorporar vídeo\",\n audio: \"Incorporar áudio\",\n file: \"Incorporar arquivo\",\n },\n url_placeholder: \"Insira a URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Remover link\",\n },\n edit: {\n text: \"Editar link\",\n tooltip: \"Editar\",\n },\n open: {\n tooltip: \"Abrir em nova aba\",\n },\n form: {\n title_placeholder: \"Editar título\",\n url_placeholder: \"Editar URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import { Dictionary } from \"../dictionary.js\";\n\nexport const ru: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Заголовок 1 уровня\",\n subtext: \"Используется для заголовка верхнего уровня\",\n aliases: [\"h\", \"heading1\", \"h1\", \"заголовок1\"],\n group: \"Заголовки\",\n },\n heading_2: {\n title: \"Заголовок 2 уровня\",\n subtext: \"Используется для ключевых разделов\",\n aliases: [\"h2\", \"heading2\", \"subheading\", \"заголовок2\", \"подзаголовок\"],\n group: \"Заголовки\",\n },\n heading_3: {\n title: \"Заголовок 3 уровня\",\n subtext: \"Используется для подразделов и групп\",\n aliases: [\"h3\", \"heading3\", \"subheading\", \"заголовок3\", \"подзаголовок\"],\n group: \"Заголовки\",\n },\n numbered_list: {\n title: \"Нумерованный список\",\n subtext: \"Используется для отображения нумерованного списка\",\n aliases: [\n \"ol\",\n \"li\",\n \"list\",\n \"numberedlist\",\n \"numbered list\",\n \"список\",\n \"нумерованный список\",\n ],\n group: \"Базовые блоки\",\n },\n bullet_list: {\n title: \"Маркированный список\",\n subtext: \"Для отображения неупорядоченного списка.\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"bulletlist\",\n \"bullet list\",\n \"список\",\n \"маркированный список\",\n ],\n group: \"Базовые блоки\",\n },\n check_list: {\n title: \"Контрольный список\",\n subtext: \"Для отображения списка с флажками\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"checklist\",\n \"check list\",\n \"checked list\",\n \"checkbox\",\n \"список\",\n ],\n group: \"Базовые блоки\",\n },\n paragraph: {\n title: \"Параграф\",\n subtext: \"Основной текст\",\n aliases: [\"p\", \"paragraph\", \"параграф\"],\n group: \"Базовые блоки\",\n },\n code_block: {\n title: \"Блок кода\",\n subtext: \"Блок кода с подсветкой синтаксиса\",\n aliases: [\"code\", \"pre\", \"блок кода\"],\n group: \"Базовые блоки\",\n },\n table: {\n title: \"Таблица\",\n subtext: \"Используется для таблиц\",\n aliases: [\"table\", \"таблица\"],\n group: \"Продвинутый\",\n },\n image: {\n title: \"Картинка\",\n subtext: \"Вставить изображение\",\n aliases: [\n \"image\",\n \"imageUpload\",\n \"upload\",\n \"img\",\n \"picture\",\n \"media\",\n \"url\",\n \"загрузка\",\n \"картинка\",\n \"рисунок\",\n ],\n group: \"Медиа\",\n },\n video: {\n title: \"Видео\",\n subtext: \"Вставить видео\",\n aliases: [\n \"video\",\n \"videoUpload\",\n \"upload\",\n \"mp4\",\n \"film\",\n \"media\",\n \"url\",\n \"загрузка\",\n \"видео\",\n ],\n group: \"Медиа\",\n },\n audio: {\n title: \"Аудио\",\n subtext: \"Вставить аудио\",\n aliases: [\n \"audio\",\n \"audioUpload\",\n \"upload\",\n \"mp3\",\n \"sound\",\n \"media\",\n \"url\",\n \"загрузка\",\n \"аудио\",\n \"звук\",\n \"музыка\",\n ],\n group: \"Медиа\",\n },\n file: {\n title: \"Файл\",\n subtext: \"Вставить файл\",\n aliases: [\"file\", \"upload\", \"embed\", \"media\", \"url\", \"загрузка\", \"файл\"],\n group: \"Медиа\",\n },\n emoji: {\n title: \"Эмодзи\",\n subtext: \"Используется для вставки эмодзи\",\n aliases: [\"эмодзи\", \"смайлик\", \"выражение эмоций\", \"лицо\"],\n group: \"Прочее\",\n },\n },\n placeholders: {\n default: \"Ведите текст или введите «/» для команд\",\n heading: \"Заголовок\",\n bulletListItem: \"Список\",\n numberedListItem: \"Список\",\n checkListItem: \"Список\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Добавить изображение\",\n },\n video: {\n add_button_text: \"Добавить видео\",\n },\n audio: {\n add_button_text: \"Добавить аудио\",\n },\n file: {\n add_button_text: \"Добавить файл\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"Добавить блок\",\n drag_handle_label: \"Открыть меню блока\",\n },\n drag_handle: {\n delete_menuitem: \"Удалить\",\n colors_menuitem: \"Цвета\",\n },\n table_handle: {\n delete_column_menuitem: \"Удалить столбец\",\n delete_row_menuitem: \"Удалить строку\",\n add_left_menuitem: \"Добавить столбец слева\",\n add_right_menuitem: \"Добавить столбец справа\",\n add_above_menuitem: \"Добавить строку выше\",\n add_below_menuitem: \"Добавить строку ниже\",\n },\n suggestion_menu: {\n no_items_title: \"ничего не найдено\",\n loading: \"Загрузка…\",\n },\n color_picker: {\n text_title: \"Текст\",\n background_title: \"Задний фон\",\n colors: {\n default: \"По умолчинию\",\n gray: \"Серый\",\n brown: \"Коричневый\",\n red: \"Красный\",\n orange: \"Оранжевый\",\n yellow: \"Жёлтый\",\n green: \"Зелёный\",\n blue: \"Голубой\",\n purple: \"Фиолетовый\",\n pink: \"Розовый\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"Жирный\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"Курсив\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Подчёркнутый\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Зачёркнутый\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Код\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Цвета\",\n },\n link: {\n tooltip: \"Создать ссылку\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Изменить подпись\",\n input_placeholder: \"Изменить подпись\",\n },\n file_replace: {\n tooltip: {\n image: \"Заменить изображение\",\n video: \"Заменить видео\",\n audio: \"Заменить аудио\",\n file: \"Заменить файл\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Переименовать изображение\",\n video: \"Переименовать видео\",\n audio: \"Переименовать аудио\",\n file: \"Переименовать файл\",\n },\n input_placeholder: {\n image: \"Переименовать изображение\",\n video: \"Переименовать видео\",\n audio: \"Переименовать аудио\",\n file: \"Переименовать файл\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Скачать картинку\",\n video: \"Скачать видео\",\n audio: \"Скачать аудио\",\n file: \"Скачать файл\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Удалить картинку\",\n video: \"Удалить видео\",\n audio: \"Удалить аудио\",\n file: \"Скачать файл\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Переключить предварительный просмотр\",\n },\n nest: {\n tooltip: \"Сдвинуть вправо\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Сдвинуть влево\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Текст по левому краю\",\n },\n align_center: {\n tooltip: \"Текст по середине\",\n },\n align_right: {\n tooltip: \"Текст по правому краю\",\n },\n align_justify: {\n tooltip: \"По середине текст\",\n },\n },\n file_panel: {\n upload: {\n title: \"Загрузить\",\n file_placeholder: {\n image: \"Загрузить картинки\",\n video: \"Загрузить видео\",\n audio: \"Загрузить аудио\",\n file: \"Загрузить файл\",\n },\n upload_error: \"Ошибка: не удалось загрузить\",\n },\n embed: {\n title: \"Вставить\",\n embed_button: {\n image: \"Вставить картинку\",\n video: \"Вставить видео\",\n audio: \"Вставить аудио\",\n file: \"Вставить файл\",\n },\n url_placeholder: \"Введите URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Удалить ссылку\",\n },\n edit: {\n text: \"Изменить ссылку\",\n tooltip: \"Редактировать\",\n },\n open: {\n tooltip: \"Открыть в новой вкладке\",\n },\n form: {\n title_placeholder: \"Изменить заголовок\",\n url_placeholder: \"Изменить URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const vi: Dictionary = {\n slash_menu: {\n heading: {\n title: \"Tiêu đề H1\",\n subtext: \"Sử dụng cho tiêu đề cấp cao nhất\",\n aliases: [\"h\", \"tieude1\", \"dd1\"],\n group: \"Tiêu đề\",\n },\n heading_2: {\n title: \"Tiêu đề H2\",\n subtext: \"Sử dụng cho các phần chính\",\n aliases: [\"h2\", \"tieude2\", \"tieudephu\"],\n group: \"Tiêu đề\",\n },\n heading_3: {\n title: \"Tiêu đề H3\",\n subtext: \"Sử dụng cho phụ đề và tiêu đề nhóm\",\n aliases: [\"h3\", \"tieude3\", \"tieudephu\"],\n group: \"Tiêu đề\",\n },\n numbered_list: {\n title: \"Danh sách đánh số\",\n subtext: \"Sử dụng để hiển thị danh sách có đánh số\",\n aliases: [\"ol\", \"li\", \"ds\", \"danhsachdso\", \"danh sach danh so\"],\n group: \"Khối cơ bản\",\n },\n bullet_list: {\n title: \"Danh sách\",\n subtext: \"Sử dụng để hiển thị danh sách không đánh số\",\n aliases: [\"ul\", \"li\", \"ds\", \"danhsach\", \"danh sach\"],\n group: \"Khối cơ bản\",\n },\n check_list: {\n title: \"Danh sách kiểm tra\",\n subtext: \"Dùng để hiển thị danh sách có hộp kiểm\",\n aliases: [\n \"ul\",\n \"li\",\n \"danh sach\",\n \"danh sach kiem tra\",\n \"danh sach da kiem tra\",\n \"hop kiem\",\n ],\n group: \"Khối cơ bản\",\n },\n paragraph: {\n title: \"Đoạn văn\",\n subtext: \"Sử dụng cho nội dung chính của tài liệu\",\n aliases: [\"p\", \"doanvan\"],\n group: \"Khối cơ bản\",\n },\n code_block: {\n title: \"Mã\",\n subtext: \"Sử dụng để hiển thị mã với cú pháp\",\n aliases: [\"code\", \"pre\"],\n group: \"Khối cơ bản\",\n },\n table: {\n title: \"Bảng\",\n subtext: \"Sử dụng để tạo bảng\",\n aliases: [\"bang\"],\n group: \"Nâng cao\",\n },\n image: {\n title: \"Hình ảnh\",\n subtext: \"Chèn hình ảnh\",\n aliases: [\"anh\", \"tai-len-anh\", \"tai-len\", \"img\", \"hinh\", \"media\", \"url\"],\n group: \"Phương tiện\",\n },\n video: {\n title: \"Video\",\n subtext: \"Chèn video\",\n aliases: [\n \"video\",\n \"tai-len-video\",\n \"tai-len\",\n \"mp4\",\n \"phim\",\n \"media\",\n \"url\",\n ],\n group: \"Phương tiện\",\n },\n audio: {\n title: \"Âm thanh\",\n subtext: \"Chèn âm thanh\",\n aliases: [\n \"âm thanh\",\n \"tai-len-am-thanh\",\n \"tai-len\",\n \"mp3\",\n \"am thanh\",\n \"media\",\n \"url\",\n ],\n group: \"Phương tiện\",\n },\n file: {\n title: \"Tệp\",\n subtext: \"Chèn tệp\",\n aliases: [\"tep\", \"tai-len\", \"nhung\", \"media\", \"url\"],\n group: \"Phương tiện\",\n },\n emoji: {\n title: \"Biểu tượng cảm xúc\",\n subtext: \"Dùng để chèn biểu tượng cảm xúc\",\n aliases: [\n \"biểu tượng cảm xúc\",\n \"emoji\",\n \"emoticon\",\n \"cảm xúc expression\",\n \"khuôn mặt\",\n \"face\",\n ],\n group: \"Khác\",\n },\n },\n placeholders: {\n default: \"Nhập văn bản hoặc gõ '/' để thêm định dạng\",\n heading: \"Tiêu đề\",\n bulletListItem: \"Danh sách\",\n numberedListItem: \"Danh sách\",\n checkListItem: \"Danh sách\",\n },\n file_blocks: {\n image: {\n add_button_text: \"Thêm ảnh\",\n },\n video: {\n add_button_text: \"Thêm video\",\n },\n audio: {\n add_button_text: \"Thêm âm thanh\",\n },\n file: {\n add_button_text: \"Thêm tệp\",\n },\n },\n // từ gói phản ứng:\n side_menu: {\n add_block_label: \"Thêm khối\",\n drag_handle_label: \"Mở trình đơn khối\",\n },\n drag_handle: {\n delete_menuitem: \"Xóa\",\n colors_menuitem: \"Màu sắc\",\n },\n table_handle: {\n delete_column_menuitem: \"Xóa cột\",\n delete_row_menuitem: \"Xóa hàng\",\n add_left_menuitem: \"Thêm cột bên trái\",\n add_right_menuitem: \"Thêm cột bên phải\",\n add_above_menuitem: \"Thêm hàng phía trên\",\n add_below_menuitem: \"Thêm hàng phía dưới\",\n },\n suggestion_menu: {\n no_items_title: \"Không tìm thấy mục nào\",\n loading: \"Đang tải...\",\n },\n color_picker: {\n text_title: \"Văn bản\",\n background_title: \"Nền\",\n colors: {\n default: \"Mặc định\",\n gray: \"Xám\",\n brown: \"Nâu\",\n red: \"Đỏ\",\n orange: \"Cam\",\n yellow: \"Vàng\",\n green: \"Xanh lá\",\n blue: \"Xanh dương\",\n purple: \"Tím\",\n pink: \"Hồng\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"In đậm\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"In nghiêng\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"Gạch dưới\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"Gạch ngang\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"Code\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"Màu sắc\",\n },\n link: {\n tooltip: \"Tạo liên kết\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"Chỉnh sửa chú thích\",\n input_placeholder: \"Chỉnh sửa chú thích\",\n },\n file_replace: {\n tooltip: {\n image: \"Thay thế hình ảnh\",\n video: \"Thay thế video\",\n audio: \"Thay thế âm thanh\",\n file: \"Thay thế tệp\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"Đổi tên hình ảnh\",\n video: \"Đổi tên video\",\n audio: \"Đổi tên âm thanh\",\n file: \"Đổi tên tệp\",\n },\n input_placeholder: {\n image: \"Đổi tên hình ảnh\",\n video: \"Đổi tên video\",\n audio: \"Đổi tên âm thanh\",\n file: \"Đổi tên tệp\",\n },\n },\n file_download: {\n tooltip: {\n image: \"Tải xuống hình ảnh\",\n video: \"Tải xuống video\",\n audio: \"Tải xuống âm thanh\",\n file: \"Tải xuống tệp\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"Xóa hình ảnh\",\n video: \"Xóa video\",\n audio: \"Xóa âm thanh\",\n file: \"Xóa tệp\",\n },\n },\n file_preview_toggle: {\n tooltip: \"Chuyển đổi xem trước\",\n },\n nest: {\n tooltip: \"Lồng khối\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"Bỏ lồng khối\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"Căn trái văn bản\",\n },\n align_center: {\n tooltip: \"Căn giữa văn bản\",\n },\n align_right: {\n tooltip: \"Căn phải văn bản\",\n },\n align_justify: {\n tooltip: \"Căn đều văn bản\",\n },\n },\n file_panel: {\n upload: {\n title: \"Tải lên\",\n file_placeholder: {\n image: \"Tải lên hình ảnh\",\n video: \"Tải lên video\",\n audio: \"Tải lên âm thanh\",\n file: \"Tải lên tệp\",\n },\n upload_error: \"Lỗi: Tải lên thất bại\",\n },\n embed: {\n title: \"Nhúng\",\n embed_button: {\n image: \"Nhúng hình ảnh\",\n video: \"Nhúng video\",\n audio: \"Nhúng âm thanh\",\n file: \"Nhúng tệp\",\n },\n url_placeholder: \"Nhập URL\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"Xóa liên kết\",\n },\n edit: {\n text: \"Chỉnh sửa liên kết\",\n tooltip: \"Chỉnh sửa\",\n },\n open: {\n tooltip: \"Mở trong tab mới\",\n },\n form: {\n title_placeholder: \"Chỉnh sửa tiêu đề\",\n url_placeholder: \"Chỉnh sửa URL\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","import type { Dictionary } from \"../dictionary.js\";\n\nexport const zh: Dictionary = {\n slash_menu: {\n heading: {\n title: \"一级标题\",\n subtext: \"用于顶级标题\",\n aliases: [\"h\", \"heading1\", \"h1\", \"标题\", \"一级标题\"],\n group: \"标题\",\n },\n heading_2: {\n title: \"二级标题\",\n subtext: \"用于关键部分\",\n aliases: [\"h2\", \"heading2\", \"subheading\", \"标题\", \"二级标题\", \"副标题\"],\n group: \"标题\",\n },\n heading_3: {\n title: \"三级标题\",\n subtext: \"用于小节和分组标题\",\n aliases: [\"h3\", \"heading3\", \"subheading\", \"标题\", \"三级标题\"],\n group: \"标题\",\n },\n numbered_list: {\n title: \"有序列表\",\n subtext: \"用于显示有序列表\",\n aliases: [\n \"ol\",\n \"li\",\n \"list\",\n \"numberedlist\",\n \"numbered list\",\n \"列表\",\n \"有序列表\",\n ],\n group: \"基础\",\n },\n bullet_list: {\n title: \"无序列表\",\n subtext: \"用于显示无序列表\",\n aliases: [\n \"ul\",\n \"li\",\n \"list\",\n \"bulletlist\",\n \"bullet list\",\n \"列表\",\n \"无序列表\",\n ],\n group: \"基础\",\n },\n check_list: {\n title: \"检查清单\",\n subtext: \"用于显示带有复选框的列表\",\n aliases: [\n \"ul\",\n \"li\",\n \"checklist\",\n \"checked list\",\n \"列表\",\n \"检查清单\",\n \"勾选列表\",\n \"复选框\",\n ],\n group: \"基础\",\n },\n paragraph: {\n title: \"段落\",\n subtext: \"用于文档正文\",\n aliases: [\"p\", \"paragraph\", \"text\", \"正文\"],\n group: \"基础\",\n },\n code_block: {\n title: \"代码块\",\n subtext: \"用于显示带有语法高亮的代码块\",\n aliases: [\"code\", \"pre\", \"代码\", \"预格式\"],\n group: \"基础\",\n },\n table: {\n title: \"表格\",\n subtext: \"使用表格\",\n aliases: [\"table\", \"表格\"],\n group: \"高级功能\",\n },\n image: {\n title: \"图片\",\n subtext: \"插入图片\",\n aliases: [\n \"图片\",\n \"上传图片\",\n \"上传\",\n \"image\",\n \"img\",\n \"相册\",\n \"媒体\",\n \"url\",\n ],\n group: \"媒体\",\n },\n video: {\n title: \"视频\",\n subtext: \"插入视频\",\n aliases: [\n \"视频\",\n \"视频上传\",\n \"上传\",\n \"video\",\n \"mp4\",\n \"电影\",\n \"媒体\",\n \"url\",\n \"驱动\",\n \"dropbox\",\n ],\n group: \"媒体\",\n },\n audio: {\n title: \"音频\",\n subtext: \"插入音频\",\n aliases: [\n \"音频\",\n \"音频上传\",\n \"上传\",\n \"audio\",\n \"mp3\",\n \"声音\",\n \"媒体\",\n \"url\",\n \"驱动\",\n \"dropbox\",\n ],\n group: \"媒体\",\n },\n file: {\n title: \"文件\",\n subtext: \"插入文件\",\n aliases: [\"文件\", \"上传\", \"file\", \"嵌入\", \"媒体\", \"url\"],\n group: \"媒体\",\n },\n emoji: {\n title: \"表情符号\",\n subtext: \"用于插入表情符号\",\n aliases: [\n \"表情符号\",\n \"emoji\",\n \"face\",\n \"emote\",\n \"表情\",\n \"表情表达\",\n \"表情\",\n ],\n group: \"其他\",\n },\n },\n placeholders: {\n default: \"输入 '/' 以使用命令\",\n heading: \"标题\",\n bulletListItem: \"列表\",\n numberedListItem: \"列表\",\n checkListItem: \"列表\",\n },\n file_blocks: {\n image: {\n add_button_text: \"添加图片\",\n },\n video: {\n add_button_text: \"添加视频\",\n },\n audio: {\n add_button_text: \"添加音频\",\n },\n file: {\n add_button_text: \"添加文件\",\n },\n },\n // from react package:\n side_menu: {\n add_block_label: \"添加块\",\n drag_handle_label: \"打开菜单\",\n },\n drag_handle: {\n delete_menuitem: \"删除\",\n colors_menuitem: \"颜色\",\n },\n table_handle: {\n delete_column_menuitem: \"删除列\",\n delete_row_menuitem: \"删除行\",\n add_left_menuitem: \"左侧添加列\",\n add_right_menuitem: \"右侧添加列\",\n add_above_menuitem: \"上方添加行\",\n add_below_menuitem: \"下方添加行\",\n },\n suggestion_menu: {\n no_items_title: \"无匹配项\",\n loading: \"加载中…\",\n },\n color_picker: {\n text_title: \"文本\",\n background_title: \"背景色\",\n colors: {\n default: \"默认\",\n gray: \"灰色\",\n brown: \"棕色\",\n red: \"红色\",\n orange: \"橙色\",\n yellow: \"黄色\",\n green: \"绿色\",\n blue: \"蓝色\",\n purple: \"紫色\",\n pink: \"粉色\",\n },\n },\n\n formatting_toolbar: {\n bold: {\n tooltip: \"加粗\",\n secondary_tooltip: \"Mod+B\",\n },\n italic: {\n tooltip: \"斜体\",\n secondary_tooltip: \"Mod+I\",\n },\n underline: {\n tooltip: \"下划线\",\n secondary_tooltip: \"Mod+U\",\n },\n strike: {\n tooltip: \"删除线\",\n secondary_tooltip: \"Mod+Shift+X\",\n },\n code: {\n tooltip: \"代码标记\",\n secondary_tooltip: \"\",\n },\n colors: {\n tooltip: \"颜色\",\n },\n link: {\n tooltip: \"添加链接\",\n secondary_tooltip: \"Mod+K\",\n },\n file_caption: {\n tooltip: \"编辑标题\",\n input_placeholder: \"编辑标题\",\n },\n file_replace: {\n tooltip: {\n image: \"替换图片\",\n video: \"替换视频\",\n audio: \"替换音频\",\n file: \"替换文件\",\n },\n },\n file_rename: {\n tooltip: {\n image: \"重命名图片\",\n video: \"重命名视频\",\n audio: \"重命名音频\",\n file: \"重命名文件\",\n },\n input_placeholder: {\n image: \"重命名图片\",\n video: \"重命名视频\",\n audio: \"重命名音频\",\n file: \"重命名文件\",\n },\n },\n file_download: {\n tooltip: {\n image: \"下载图片\",\n video: \"下载视频\",\n audio: \"下载音频\",\n file: \"下载文件\",\n },\n },\n file_delete: {\n tooltip: {\n image: \"删除图片\",\n video: \"删除视频\",\n audio: \"删除音频\",\n file: \"删除文件\",\n },\n },\n file_preview_toggle: {\n tooltip: \"切换预览\",\n },\n nest: {\n tooltip: \"嵌套\",\n secondary_tooltip: \"Tab\",\n },\n unnest: {\n tooltip: \"取消嵌套\",\n secondary_tooltip: \"Shift+Tab\",\n },\n align_left: {\n tooltip: \"左对齐\",\n },\n align_center: {\n tooltip: \"居中\",\n },\n align_right: {\n tooltip: \"右对齐\",\n },\n align_justify: {\n tooltip: \"文本对齐\",\n },\n },\n file_panel: {\n upload: {\n title: \"上传\",\n file_placeholder: {\n image: \"上传图片\",\n video: \"上传视频\",\n audio: \"上传音频\",\n file: \"上传文件\",\n },\n upload_error: \"Error:上传失败\",\n },\n embed: {\n title: \"嵌入\",\n embed_button: {\n image: \"嵌入图片\",\n video: \"嵌入视频\",\n audio: \"嵌入音频\",\n file: \"嵌入文件\",\n },\n url_placeholder: \"输入图片地址\",\n },\n },\n link_toolbar: {\n delete: {\n tooltip: \"清除链接\",\n },\n edit: {\n text: \"编辑链接\",\n tooltip: \"编辑\",\n },\n open: {\n tooltip: \"新窗口打开\",\n },\n form: {\n title_placeholder: \"编辑标题\",\n url_placeholder: \"编辑链接地址\",\n },\n },\n generic: {\n ctrl_shortcut: \"Ctrl\",\n },\n};\n","export class UnreachableCaseError extends Error {\n constructor(val: never) {\n super(`Unreachable case: ${val}`);\n }\n}\n\nexport function assertEmpty(obj: Record<string, never>, throwError = true) {\n const { \"data-test\": dataTest, ...rest } = obj; // exclude data-test\n\n if (Object.keys(rest).length > 0 && throwError) {\n throw new Error(\"Object must be empty \" + JSON.stringify(obj));\n }\n}\n\n// TODO: change for built-in version of typescript 5.4 after upgrade\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n","import {\n combineTransactionSteps,\n Extension,\n findChildrenInRange,\n getChangedRanges,\n} from \"@tiptap/core\";\nimport { Fragment, Slice } from \"prosemirror-model\";\nimport { Plugin, PluginKey } from \"prosemirror-state\";\nimport { v4 } from \"uuid\";\n\n/**\n * Code from Tiptap UniqueID extension (https://tiptap.dev/api/extensions/unique-id)\n * This extension is licensed under MIT (even though it's part of Tiptap pro).\n *\n * If you're a user of BlockNote, we still recommend to support their awesome work and become a sponsor!\n * https://tiptap.dev/pro\n */\n\n/**\n * Removes duplicated values within an array.\n * Supports numbers, strings and objects.\n */\nfunction removeDuplicates(array: any, by = JSON.stringify) {\n const seen: any = {};\n return array.filter((item: any) => {\n const key = by(item);\n return Object.prototype.hasOwnProperty.call(seen, key)\n ? false\n : (seen[key] = true);\n });\n}\n\n/**\n * Returns a list of duplicated items within an array.\n */\nfunction findDuplicates(items: any) {\n const filtered = items.filter(\n (el: any, index: number) => items.indexOf(el) !== index\n );\n const duplicates = removeDuplicates(filtered);\n return duplicates;\n}\n\nconst UniqueID = Extension.create({\n name: \"uniqueID\",\n // we’ll set a very high priority to make sure this runs first\n // and is compatible with `appendTransaction` hooks of other extensions\n priority: 10000,\n addOptions() {\n return {\n attributeName: \"id\",\n types: [],\n setIdAttribute: false,\n generateID: () => {\n // Use mock ID if tests are running.\n if (typeof window !== \"undefined\" && (window as any).__TEST_OPTIONS) {\n const testOptions = (window as any).__TEST_OPTIONS;\n if (testOptions.mockID === undefined) {\n testOptions.mockID = 0;\n } else {\n testOptions.mockID++;\n }\n\n return testOptions.mockID.toString() as string;\n }\n\n return v4();\n },\n filterTransaction: null,\n };\n },\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n [this.options.attributeName]: {\n default: null,\n parseHTML: (element) =>\n element.getAttribute(`data-${this.options.attributeName}`),\n renderHTML: (attributes) => {\n const defaultIdAttributes = {\n [`data-${this.options.attributeName}`]:\n attributes[this.options.attributeName],\n };\n if (this.options.setIdAttribute) {\n return {\n ...defaultIdAttributes,\n id: attributes[this.options.attributeName],\n };\n } else {\n return defaultIdAttributes;\n }\n },\n },\n },\n },\n ];\n },\n // check initial content for missing ids\n // onCreate() {\n // // Don’t do this when the collaboration extension is active\n // // because this may update the content, so Y.js tries to merge these changes.\n // // This leads to empty block nodes.\n // // See: https://github.com/ueberdosis/tiptap/issues/2400\n // if (\n // this.editor.extensionManager.extensions.find(\n // (extension) => extension.name === \"collaboration\"\n // )\n // ) {\n // return;\n // }\n // const { view, state } = this.editor;\n // const { tr, doc } = state;\n // const { types, attributeName, generateID } = this.options;\n // const nodesWithoutId = findChildren(doc, (node) => {\n // return (\n // types.includes(node.type.name) && node.attrs[attributeName] === null\n // );\n // });\n // nodesWithoutId.forEach(({ node, pos }) => {\n // tr.setNodeMarkup(pos, undefined, {\n // ...node.attrs,\n // [attributeName]: generateID(),\n // });\n // });\n // tr.setMeta(\"addToHistory\", false);\n // view.dispatch(tr);\n // },\n addProseMirrorPlugins() {\n let dragSourceElement: any = null;\n let transformPasted = false;\n return [\n new Plugin({\n key: new PluginKey(\"uniqueID\"),\n appendTransaction: (transactions, oldState, newState) => {\n // console.log(\"appendTransaction\");\n const docChanges =\n transactions.some((transaction) => transaction.docChanged) &&\n !oldState.doc.eq(newState.doc);\n const filterTransactions =\n this.options.filterTransaction &&\n transactions.some((tr) => {\n let _a, _b;\n return !((_b = (_a = this.options).filterTransaction) === null ||\n _b === void 0\n ? void 0\n : _b.call(_a, tr));\n });\n if (!docChanges || filterTransactions) {\n return;\n }\n const { tr } = newState;\n const { types, attributeName, generateID } = this.options;\n const transform = combineTransactionSteps(\n oldState.doc,\n transactions as any\n );\n const { mapping } = transform;\n // get changed ranges based on the old state\n const changes = getChangedRanges(transform);\n\n changes.forEach(({ newRange }) => {\n const newNodes = findChildrenInRange(\n newState.doc,\n newRange,\n (node) => {\n return types.includes(node.type.name);\n }\n );\n const newIds = newNodes\n .map(({ node }) => node.attrs[attributeName])\n .filter((id) => id !== null);\n const duplicatedNewIds = findDuplicates(newIds);\n newNodes.forEach(({ node, pos }) => {\n let _a;\n // instead of checking `node.attrs[attributeName]` directly\n // we look at the current state of the node within `tr.doc`.\n // this helps to prevent adding new ids to the same node\n // if the node changed multiple times within one transaction\n const id =\n (_a = tr.doc.nodeAt(pos)) === null || _a === void 0\n ? void 0\n : _a.attrs[attributeName];\n if (id === null) {\n // edge case, when using collaboration, yjs will set the id to null in `_forceRerender`\n // when loading the editor\n // this checks for this case and keeps it at initialBlockId so there will be no change\n const initialDoc = oldState.doc.type.createAndFill()!.content;\n const wasInitial =\n oldState.doc.content.findDiffStart(initialDoc) === null;\n\n if (wasInitial) {\n // the old state was the \"initial content\"\n const jsonNode = JSON.parse(\n JSON.stringify(newState.doc.toJSON())\n );\n jsonNode.content[0].content[0].attrs.id = \"initialBlockId\";\n // would the new state with the fix also be the \"initial content\"?\n if (\n JSON.stringify(jsonNode.content) ===\n JSON.stringify(initialDoc.toJSON())\n ) {\n // yes, apply the fix\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: \"initialBlockId\",\n });\n return;\n }\n }\n\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n });\n return;\n }\n // check if the node doesn’t exist in the old state\n const { deleted } = mapping.invert().mapResult(pos);\n const newNode = deleted && duplicatedNewIds.includes(id);\n if (newNode) {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n });\n }\n });\n });\n if (!tr.steps.length) {\n return;\n }\n return tr;\n },\n // we register a global drag handler to track the current drag source element\n view(view) {\n const handleDragstart = (event: any) => {\n let _a;\n dragSourceElement = (\n (_a = view.dom.parentElement) === null || _a === void 0\n ? void 0\n : _a.contains(event.target)\n )\n ? view.dom.parentElement\n : null;\n };\n window.addEventListener(\"dragstart\", handleDragstart);\n return {\n destroy() {\n window.removeEventListener(\"dragstart\", handleDragstart);\n },\n };\n },\n props: {\n // `handleDOMEvents` is called before `transformPasted`\n // so we can do some checks before\n handleDOMEvents: {\n // only create new ids for dropped content while holding `alt`\n // or content is dragged from another editor\n drop: (view, event: any) => {\n let _a;\n if (\n dragSourceElement !== view.dom.parentElement ||\n ((_a = event.dataTransfer) === null || _a === void 0\n ? void 0\n : _a.effectAllowed) === \"copy\"\n ) {\n dragSourceElement = null;\n transformPasted = true;\n }\n return false;\n },\n // always create new ids on pasted content\n paste: () => {\n transformPasted = true;\n return false;\n },\n },\n // we’ll remove ids for every pasted node\n // so we can create a new one within `appendTransaction`\n transformPasted: (slice) => {\n if (!transformPasted) {\n return slice;\n }\n const { types, attributeName } = this.options;\n const removeId = (fragment: any) => {\n const list: any[] = [];\n fragment.forEach((node: any) => {\n // don’t touch text nodes\n if (node.isText) {\n list.push(node);\n return;\n }\n // check for any other child nodes\n if (!types.includes(node.type.name)) {\n list.push(node.copy(removeId(node.content)));\n return;\n }\n // remove id\n const nodeWithoutId = node.type.create(\n {\n ...node.attrs,\n [attributeName]: null,\n },\n removeId(node.content),\n node.marks\n );\n list.push(nodeWithoutId);\n });\n return Fragment.from(list);\n };\n // reset check\n transformPasted = false;\n return new Slice(\n removeId(slice.content),\n slice.openStart,\n slice.openEnd\n );\n },\n },\n }),\n ];\n },\n});\n\nexport { UniqueID as default, UniqueID };\n","import { Node } from \"@tiptap/core\";\nimport { PropSchema, Props } from \"../propTypes.js\";\nimport { StyleSchema, Styles } from \"../styles/types.js\";\n\nexport type CustomInlineContentConfig = {\n type: string;\n content: \"styled\" | \"none\"; // | \"plain\"\n readonly propSchema: PropSchema;\n // content: \"inline\" | \"none\" | \"table\";\n};\n// InlineContentConfig contains the \"schema\" info about an InlineContent type\n// i.e. what props it supports, what content it supports, etc.\nexport type InlineContentConfig = CustomInlineContentConfig | \"text\" | \"link\";\n\n// InlineContentImplementation contains the \"implementation\" info about an InlineContent element\n// such as the functions / Nodes required to render and / or serialize it\n// @ts-ignore\nexport type InlineContentImplementation<T extends InlineContentConfig> =\n T extends \"link\" | \"text\"\n ? undefined\n : {\n node: Node;\n };\n\n// Container for both the config and implementation of InlineContent,\n// and the type of `implementation` is based on that of the config\nexport type InlineContentSpec<T extends InlineContentConfig> = {\n config: T;\n implementation: InlineContentImplementation<T>;\n};\n\n// A Schema contains all the types (Configs) supported in an editor\n// The keys are the \"type\" of InlineContent elements\nexport type InlineContentSchema = Record<string, InlineContentConfig>;\n\nexport type InlineContentSpecs = {\n text: { config: \"text\"; implementation: undefined };\n link: { config: \"link\"; implementation: undefined };\n} & Record<string, InlineContentSpec<InlineContentConfig>>;\n\nexport type InlineContentSchemaFromSpecs<T extends InlineContentSpecs> = {\n [K in keyof T]: T[K][\"config\"];\n};\n\nexport type CustomInlineContentFromConfig<\n I extends CustomInlineContentConfig,\n S extends StyleSchema\n> = {\n type: I[\"type\"];\n props: Props<I[\"propSchema\"]>;\n content: I[\"content\"] extends \"styled\"\n ? StyledText<S>[]\n : I[\"content\"] extends \"plain\"\n ? string\n : I[\"content\"] extends \"none\"\n ? undefined\n : never;\n};\n\nexport type InlineContentFromConfig<\n I extends InlineContentConfig,\n S extends StyleSchema\n> = I extends \"text\"\n ? StyledText<S>\n : I extends \"link\"\n ? Link<S>\n : I extends CustomInlineContentConfig\n ? CustomInlineContentFromConfig<I, S>\n : never;\n\nexport type PartialCustomInlineContentFromConfig<\n I extends CustomInlineContentConfig,\n S extends StyleSchema\n> = {\n type: I[\"type\"];\n props?: Props<I[\"propSchema\"]>;\n content?: I[\"content\"] extends \"styled\"\n ? StyledText<S>[] | string\n : I[\"content\"] extends \"plain\"\n ? string\n : I[\"content\"] extends \"none\"\n ? undefined\n : never;\n};\n\nexport type PartialInlineContentFromConfig<\n I extends InlineContentConfig,\n S extends StyleSchema\n> = I extends \"text\"\n ? string | StyledText<S>\n : I extends \"link\"\n ? PartialLink<S>\n : I extends CustomInlineContentConfig\n ? PartialCustomInlineContentFromConfig<I, S>\n : never;\n\nexport type StyledText<T extends StyleSchema> = {\n type: \"text\";\n text: string;\n styles: Styles<T>;\n};\n\nexport type Link<T extends StyleSchema> = {\n type: \"link\";\n href: string;\n content: StyledText<T>[];\n};\n\nexport type PartialLink<T extends StyleSchema> = Omit<Link<T>, \"content\"> & {\n content: string | Link<T>[\"content\"];\n};\n\nexport type InlineContent<\n I extends InlineContentSchema,\n T extends StyleSchema\n> = InlineContentFromConfig<I[keyof I], T>;\n\ntype PartialInlineContentElement<\n I extends InlineContentSchema,\n T extends StyleSchema\n> = PartialInlineContentFromConfig<I[keyof I], T>;\n\nexport type PartialInlineContent<\n I extends InlineContentSchema,\n T extends StyleSchema\n> = PartialInlineContentElement<I, T>[] | string;\n\nexport function isLinkInlineContent<T extends StyleSchema>(\n content: InlineContent<any, T>\n): content is Link<T> {\n return content.type === \"link\";\n}\n\nexport function isPartialLinkInlineContent<T extends StyleSchema>(\n content: PartialInlineContentElement<any, T>\n): content is PartialLink<T> {\n return typeof content !== \"string\" && content.type === \"link\";\n}\n\nexport function isStyledTextInlineContent<T extends StyleSchema>(\n content: PartialInlineContentElement<any, T>\n): content is StyledText<T> {\n return typeof content !== \"string\" && content.type === \"text\";\n}\n","import { Mark, Node, Schema } from \"@tiptap/pm/model\";\n\nimport UniqueID from \"../../extensions/UniqueID/UniqueID.js\";\nimport type {\n InlineContentSchema,\n PartialCustomInlineContentFromConfig,\n PartialInlineContent,\n PartialLink,\n PartialTableContent,\n StyleSchema,\n StyledText,\n} from \"../../schema\";\n\nimport type { PartialBlock } from \"../../blocks/defaultBlocks\";\nimport {\n isPartialLinkInlineContent,\n isStyledTextInlineContent,\n} from \"../../schema/inlineContent/types.js\";\nimport { UnreachableCaseError } from \"../../util/typescript.js\";\n\n/**\n * Convert a StyledText inline element to a\n * prosemirror text node with the appropriate marks\n */\nfunction styledTextToNodes<T extends StyleSchema>(\n styledText: StyledText<T>,\n schema: Schema,\n styleSchema: T\n): Node[] {\n const marks: Mark[] = [];\n\n for (const [style, value] of Object.entries(styledText.styles)) {\n const config = styleSchema[style];\n if (!config) {\n throw new Error(`style ${style} not found in styleSchema`);\n }\n\n if (config.propSchema === \"boolean\") {\n marks.push(schema.mark(style));\n } else if (config.propSchema === \"string\") {\n marks.push(schema.mark(style, { stringValue: value }));\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n\n return (\n styledText.text\n // Splits text & line breaks.\n .split(/(\\n)/g)\n // If the content ends with a line break, an empty string is added to the\n // end, which this removes.\n .filter((text) => text.length > 0)\n // Converts text & line breaks to nodes.\n .map((text) => {\n if (text === \"\\n\") {\n return schema.nodes[\"hardBreak\"].createChecked();\n } else {\n return schema.text(text, marks);\n }\n })\n );\n}\n\n/**\n * Converts a Link inline content element to\n * prosemirror text nodes with the appropriate marks\n */\nfunction linkToNodes(\n link: PartialLink<StyleSchema>,\n schema: Schema,\n styleSchema: StyleSchema\n): Node[] {\n const linkMark = schema.marks.link.create({\n href: link.href,\n });\n\n return styledTextArrayToNodes(link.content, schema, styleSchema).map(\n (node) => {\n if (node.type.name === \"text\") {\n return node.mark([...node.marks, linkMark]);\n }\n\n if (node.type.name === \"hardBreak\") {\n return node;\n }\n throw new Error(\"unexpected node type\");\n }\n );\n}\n\n/**\n * Converts an array of StyledText inline content elements to\n * prosemirror text nodes with the appropriate marks\n */\nfunction styledTextArrayToNodes<S extends StyleSchema>(\n content: string | StyledText<S>[],\n schema: Schema,\n styleSchema: S\n): Node[] {\n const nodes: Node[] = [];\n\n if (typeof content === \"string\") {\n nodes.push(\n ...styledTextToNodes(\n { type: \"text\", text: content, styles: {} },\n schema,\n styleSchema\n )\n );\n return nodes;\n }\n\n for (const styledText of content) {\n nodes.push(...styledTextToNodes(styledText, schema, styleSchema));\n }\n return nodes;\n}\n\n/**\n * converts an array of inline content elements to prosemirror nodes\n */\nexport function inlineContentToNodes<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockContent: PartialInlineContent<I, S>,\n schema: Schema,\n styleSchema: S\n): Node[] {\n const nodes: Node[] = [];\n\n for (const content of blockContent) {\n if (typeof content === \"string\") {\n nodes.push(...styledTextArrayToNodes(content, schema, styleSchema));\n } else if (isPartialLinkInlineContent(content)) {\n nodes.push(...linkToNodes(content, schema, styleSchema));\n } else if (isStyledTextInlineContent(content)) {\n nodes.push(...styledTextArrayToNodes([content], schema, styleSchema));\n } else {\n nodes.push(\n blockOrInlineContentToContentNode(content, schema, styleSchema)\n );\n }\n }\n return nodes;\n}\n\n/**\n * converts an array of inline content elements to prosemirror nodes\n */\nexport function tableContentToNodes<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n tableContent: PartialTableContent<I, S>,\n schema: Schema,\n styleSchema: StyleSchema\n): Node[] {\n const rowNodes: Node[] = [];\n\n for (const row of tableContent.rows) {\n const columnNodes: Node[] = [];\n for (let i = 0; i < row.cells.length; i++) {\n const cell = row.cells[i];\n let pNode: Node;\n if (!cell) {\n pNode = schema.nodes[\"tableParagraph\"].createChecked({});\n } else if (typeof cell === \"string\") {\n pNode = schema.nodes[\"tableParagraph\"].createChecked(\n {},\n schema.text(cell)\n );\n } else {\n const textNodes = inlineContentToNodes(cell, schema, styleSchema);\n pNode = schema.nodes[\"tableParagraph\"].createChecked({}, textNodes);\n }\n\n const cellNode = schema.nodes[\"tableCell\"].createChecked(\n {\n // The colwidth array should have multiple values when the colspan of\n // a cell is greater than 1. However, this is not yet implemented so\n // we can always assume a length of 1.\n colwidth: tableContent.columnWidths?.[i]\n ? [tableContent.columnWidths[i]]\n : null,\n },\n pNode\n );\n columnNodes.push(cellNode);\n }\n const rowNode = schema.nodes[\"tableRow\"].createChecked({}, columnNodes);\n rowNodes.push(rowNode);\n }\n return rowNodes;\n}\n\nfunction blockOrInlineContentToContentNode(\n block:\n | PartialBlock<any, any, any>\n | PartialCustomInlineContentFromConfig<any, any>,\n schema: Schema,\n styleSchema: StyleSchema\n) {\n let contentNode: Node;\n let type = block.type;\n\n // TODO: needed? came from previous code\n if (type === undefined) {\n type = \"paragraph\";\n }\n\n if (!schema.nodes[type]) {\n throw new Error(`node type ${type} not found in schema`);\n }\n\n if (!block.content) {\n contentNode = schema.nodes[type].createChecked(block.props);\n } else if (typeof block.content === \"string\") {\n const nodes = inlineContentToNodes([block.content], schema, styleSchema);\n contentNode = schema.nodes[type].createChecked(block.props, nodes);\n } else if (Array.isArray(block.content)) {\n const nodes = inlineContentToNodes(block.content, schema, styleSchema);\n contentNode = schema.nodes[type].createChecked(block.props, nodes);\n } else if (block.content.type === \"tableContent\") {\n const nodes = tableContentToNodes(block.content, schema, styleSchema);\n contentNode = schema.nodes[type].createChecked(block.props, nodes);\n } else {\n throw new UnreachableCaseError(block.content.type);\n }\n return contentNode;\n}\n\n/**\n * Converts a BlockNote block to a Prosemirror node.\n */\nexport function blockToNode(\n block: PartialBlock<any, any, any>,\n schema: Schema,\n styleSchema: StyleSchema\n) {\n let id = block.id;\n\n if (id === undefined) {\n id = UniqueID.options.generateID();\n }\n\n const children: Node[] = [];\n\n if (block.children) {\n for (const child of block.children) {\n children.push(blockToNode(child, schema, styleSchema));\n }\n }\n\n const nodeTypeCorrespondingToBlock = schema.nodes[block.type];\n\n if (nodeTypeCorrespondingToBlock.isInGroup(\"blockContent\")) {\n // Blocks with a type that matches \"blockContent\" group always need to be wrapped in a blockContainer\n\n const contentNode = blockOrInlineContentToContentNode(\n block,\n schema,\n styleSchema\n );\n\n const groupNode =\n children.length > 0\n ? schema.nodes[\"blockGroup\"].createChecked({}, children)\n : undefined;\n\n return schema.nodes[\"blockContainer\"].createChecked(\n {\n id: id,\n ...block.props,\n },\n groupNode ? [contentNode, groupNode] : contentNode\n );\n } else if (nodeTypeCorrespondingToBlock.isInGroup(\"bnBlock\")) {\n // this is a bnBlock node like Column or ColumnList that directly translates to a prosemirror node\n return schema.nodes[block.type].createChecked(\n {\n id: id,\n ...block.props,\n },\n children\n );\n } else {\n throw new Error(\n `block type ${block.type} doesn't match blockContent or bnBlock group`\n );\n }\n}\n","import { DOMSerializer, Fragment } from \"prosemirror-model\";\n\nimport { PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n inlineContentToNodes,\n tableContentToNodes,\n} from \"../../../nodeConversions/blockToNode.js\";\n\nfunction addAttributesAndRemoveClasses(element: HTMLElement) {\n // Removes all BlockNote specific class names.\n const className =\n [...element.classList].filter(\n (className) => !className.startsWith(\"bn-\")\n ) || [];\n\n if (className.length > 0) {\n element.className = className.join(\" \");\n } else {\n element.removeAttribute(\"class\");\n }\n}\n\nexport function serializeInlineContentExternalHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<any, I, S>,\n blockContent: PartialBlock<BSchema, I, S>[\"content\"],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) {\n let nodes: any;\n\n // TODO: reuse function from nodeconversions?\n if (!blockContent) {\n throw new Error(\"blockContent is required\");\n } else if (typeof blockContent === \"string\") {\n nodes = inlineContentToNodes(\n [blockContent],\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (Array.isArray(blockContent)) {\n nodes = inlineContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (blockContent.type === \"tableContent\") {\n nodes = tableContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else {\n throw new UnreachableCaseError(blockContent.type);\n }\n\n // We call the prosemirror serializer here because it handles Marks and Inline Content nodes nicely.\n // If we'd want to support custom serialization or externalHTML for Inline Content, we'd have to implement\n // a custom serializer here.\n const dom = serializer.serializeFragment(Fragment.from(nodes), options);\n\n if (dom.nodeType === 1 /* Node.ELEMENT_NODE */) {\n addAttributesAndRemoveClasses(dom as HTMLElement);\n }\n\n return dom;\n}\n\n/**\n * TODO: there's still quite some logic that handles getting and filtering properties,\n * we should make sure the `toExternalHTML` methods of default blocks actually handle this,\n * instead of the serializer.\n */\nfunction serializeBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n fragment: DocumentFragment,\n editor: BlockNoteEditor<BSchema, I, S>,\n block: PartialBlock<BSchema, I, S>,\n serializer: DOMSerializer,\n orderedListItemBlockTypes: Set<string>,\n unorderedListItemBlockTypes: Set<string>,\n options?: { document?: Document }\n) {\n const doc = options?.document ?? document;\n const BC_NODE = editor.pmSchema.nodes[\"blockContainer\"];\n\n let props = block.props;\n // set default props in case we were passed a partial block\n if (!block.props) {\n props = {};\n for (const [name, spec] of Object.entries(\n editor.schema.blockSchema[block.type as any].propSchema\n )) {\n (props as any)[name] = spec.default;\n }\n }\n\n const bc = BC_NODE.spec?.toDOM?.(\n BC_NODE.create({\n id: block.id,\n ...props,\n })\n ) as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n // the container node is just used as a workaround to get some block-level attributes.\n // we should change toExternalHTML so that this is not necessary\n const attrs = [...bc.dom.attributes];\n\n const ret = editor.blockImplementations[\n block.type as any\n ].implementation.toExternalHTML({ ...block, props } as any, editor as any);\n\n const elementFragment = doc.createDocumentFragment();\n if (ret.dom.classList.contains(\"bn-block-content\")) {\n const blockContentDataAttributes = [...attrs, ...ret.dom.attributes].filter(\n (attr) =>\n attr.name.startsWith(\"data\") &&\n attr.name !== \"data-content-type\" &&\n attr.name !== \"data-file-block\" &&\n attr.name !== \"data-node-view-wrapper\" &&\n attr.name !== \"data-node-type\" &&\n attr.name !== \"data-id\" &&\n attr.name !== \"data-index\" &&\n attr.name !== \"data-editable\"\n );\n\n // ret.dom = ret.dom.firstChild! as any;\n for (const attr of blockContentDataAttributes) {\n (ret.dom.firstChild! as HTMLElement).setAttribute(attr.name, attr.value);\n }\n\n addAttributesAndRemoveClasses(ret.dom.firstChild! as HTMLElement);\n elementFragment.append(...ret.dom.childNodes);\n } else {\n elementFragment.append(ret.dom);\n }\n\n if (ret.contentDOM && block.content) {\n const ic = serializeInlineContentExternalHTML(\n editor,\n block.content as any, // TODO\n serializer,\n options\n );\n\n ret.contentDOM.appendChild(ic);\n }\n\n let listType = undefined;\n if (orderedListItemBlockTypes.has(block.type!)) {\n listType = \"OL\";\n } else if (unorderedListItemBlockTypes.has(block.type!)) {\n listType = \"UL\";\n }\n\n if (listType) {\n if (fragment.lastChild?.nodeName !== listType) {\n const list = doc.createElement(listType);\n fragment.append(list);\n }\n const li = doc.createElement(\"li\");\n li.append(elementFragment);\n fragment.lastChild!.appendChild(li);\n } else {\n fragment.append(elementFragment);\n }\n\n if (block.children && block.children.length > 0) {\n const childFragment = doc.createDocumentFragment();\n serializeBlocksToFragment(\n childFragment,\n editor,\n block.children,\n serializer,\n orderedListItemBlockTypes,\n unorderedListItemBlockTypes,\n options\n );\n if (\n fragment.lastChild?.nodeName === \"UL\" ||\n fragment.lastChild?.nodeName === \"OL\"\n ) {\n // add nested lists to the last list item\n while (\n childFragment.firstChild?.nodeName === \"UL\" ||\n childFragment.firstChild?.nodeName === \"OL\"\n ) {\n fragment.lastChild!.lastChild!.appendChild(childFragment.firstChild!);\n }\n }\n\n if (editor.pmSchema.nodes[block.type as any].isInGroup(\"blockContent\")) {\n // default \"blockContainer\" style blocks are flattened (no \"nested block\" support) for externalHTML, so append the child fragment to the outer fragment\n fragment.append(childFragment);\n } else {\n // for columns / column lists, do use nesting\n ret.contentDOM?.append(childFragment);\n }\n }\n}\n\nconst serializeBlocksToFragment = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n fragment: DocumentFragment,\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n orderedListItemBlockTypes: Set<string>,\n unorderedListItemBlockTypes: Set<string>,\n options?: { document?: Document }\n) => {\n for (const block of blocks) {\n serializeBlock(\n fragment,\n editor,\n block,\n serializer,\n orderedListItemBlockTypes,\n unorderedListItemBlockTypes,\n options\n );\n }\n};\n\nexport const serializeBlocksExternalHTML = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n orderedListItemBlockTypes: Set<string>,\n unorderedListItemBlockTypes: Set<string>,\n options?: { document?: Document }\n) => {\n const doc = options?.document ?? document;\n const fragment = doc.createDocumentFragment();\n\n serializeBlocksToFragment(\n fragment,\n editor,\n blocks,\n serializer,\n orderedListItemBlockTypes,\n unorderedListItemBlockTypes,\n options\n );\n return fragment;\n};\n","import { DOMSerializer, Schema } from \"prosemirror-model\";\n\nimport { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContent,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport {\n serializeBlocksExternalHTML,\n serializeInlineContentExternalHTML,\n} from \"./util/serializeBlocksExternalHTML.js\";\n\n// Used to export BlockNote blocks and ProseMirror nodes to HTML for use outside\n// the editor. Blocks are exported using the `toExternalHTML` method in their\n// `blockSpec`, or `toInternalHTML` if `toExternalHTML` is not defined.\n//\n// The HTML created by this serializer is different to what's rendered by the\n// editor to the DOM. This also means that data is likely to be lost when\n// converting back to original blocks. The differences in the output HTML are:\n// 1. It doesn't include the `blockGroup` and `blockContainer` wrappers meaning\n// that nesting is not preserved for non-list-item blocks.\n// 2. `li` items in the output HTML are wrapped in `ul` or `ol` elements.\n// 3. While nesting for list items is preserved, other types of blocks nested\n// inside a list are un-nested and a new list is created after them.\n// 4. The HTML is wrapped in a single `div` element.\n\n// Needs to be sync because it's used in drag handler event (SideMenuPlugin)\n// Ideally, call `await initializeESMDependencies()` before calling this function\nexport const createExternalHTMLExporter = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: Schema,\n editor: BlockNoteEditor<BSchema, I, S>\n) => {\n const serializer = DOMSerializer.fromSchema(schema);\n\n return {\n exportBlocks: (\n blocks: PartialBlock<BSchema, I, S>[],\n options: { document?: Document }\n ) => {\n const html = serializeBlocksExternalHTML(\n editor,\n blocks,\n serializer,\n new Set<string>([\"numberedListItem\"]),\n new Set<string>([\"bulletListItem\", \"checkListItem\"]),\n options\n );\n const div = document.createElement(\"div\");\n div.append(html);\n return div.innerHTML;\n },\n\n exportInlineContent: (\n inlineContent: InlineContent<I, S>[],\n options: { document?: Document }\n ) => {\n const domFragment = serializeInlineContentExternalHTML(\n editor,\n inlineContent as any,\n serializer,\n options\n );\n\n const parent = document.createElement(\"div\");\n parent.append(domFragment.cloneNode(true));\n\n return parent.innerHTML;\n },\n };\n};\n","import { DOMSerializer, Fragment } from \"prosemirror-model\";\n\nimport { PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n inlineContentToNodes,\n tableContentToNodes,\n} from \"../../../nodeConversions/blockToNode.js\";\n\nexport function serializeInlineContentInternalHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<any, I, S>,\n blockContent: PartialBlock<BSchema, I, S>[\"content\"],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) {\n let nodes: any;\n\n // TODO: reuse function from nodeconversions?\n if (!blockContent) {\n throw new Error(\"blockContent is required\");\n } else if (typeof blockContent === \"string\") {\n nodes = inlineContentToNodes(\n [blockContent],\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (Array.isArray(blockContent)) {\n nodes = inlineContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else if (blockContent.type === \"tableContent\") {\n nodes = tableContentToNodes(\n blockContent,\n editor.pmSchema,\n editor.schema.styleSchema\n );\n } else {\n throw new UnreachableCaseError(blockContent.type);\n }\n\n // We call the prosemirror serializer here because it handles Marks and Inline Content nodes nicely.\n // If we'd want to support custom serialization or externalHTML for Inline Content, we'd have to implement\n // a custom serializer here.\n const dom = serializer.serializeFragment(Fragment.from(nodes), options);\n\n return dom;\n}\n\nfunction serializeBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n block: PartialBlock<BSchema, I, S>,\n serializer: DOMSerializer,\n listIndex: number,\n options?: { document?: Document }\n) {\n const BC_NODE = editor.pmSchema.nodes[\"blockContainer\"];\n\n let props = block.props;\n // set default props in case we were passed a partial block\n if (!block.props) {\n props = {};\n for (const [name, spec] of Object.entries(\n editor.schema.blockSchema[block.type as any].propSchema\n )) {\n (props as any)[name] = spec.default;\n }\n }\n\n const impl = editor.blockImplementations[block.type as any].implementation;\n const ret = impl.toInternalHTML({ ...block, props } as any, editor as any);\n\n if (block.type === \"numberedListItem\") {\n // This is a workaround to make sure there's a list index set.\n // Normally, this is set on the internal prosemirror nodes by the NumberedListIndexingPlugin,\n // but:\n // - (a) this information is not available on the Blocks passed to the serializer. (we only have access to BlockNote Blocks)\n // - (b) the NumberedListIndexingPlugin might not even have run, because we can manually call blocksToFullHTML\n // with blocks that are not part of the active document\n ret.dom.setAttribute(\"data-index\", listIndex.toString());\n }\n\n if (ret.contentDOM && block.content) {\n const ic = serializeInlineContentInternalHTML(\n editor,\n block.content as any, // TODO\n serializer,\n options\n );\n ret.contentDOM.appendChild(ic);\n }\n\n const pmType = editor.pmSchema.nodes[block.type as any];\n\n if (pmType.isInGroup(\"bnBlock\")) {\n if (block.children && block.children.length > 0) {\n const fragment = serializeBlocks(\n editor,\n block.children,\n serializer,\n options\n );\n\n ret.contentDOM?.append(fragment);\n }\n return ret.dom;\n }\n\n // wrap the block in a blockContainer\n const bc = BC_NODE.spec?.toDOM?.(\n BC_NODE.create({\n id: block.id,\n ...props,\n })\n ) as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n bc.contentDOM?.appendChild(ret.dom);\n\n if (block.children && block.children.length > 0) {\n bc.contentDOM?.appendChild(\n serializeBlocksInternalHTML(editor, block.children, serializer, options)\n );\n }\n return bc.dom;\n}\n\nfunction serializeBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) {\n const doc = options?.document ?? document;\n const fragment = doc.createDocumentFragment();\n\n let listIndex = 0;\n for (const block of blocks) {\n if (block.type === \"numberedListItem\") {\n listIndex++;\n } else {\n listIndex = 0;\n }\n const blockDOM = serializeBlock(\n editor,\n block,\n serializer,\n listIndex,\n options\n );\n fragment.appendChild(blockDOM);\n }\n\n return fragment;\n}\n\nexport const serializeBlocksInternalHTML = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocks: PartialBlock<BSchema, I, S>[],\n serializer: DOMSerializer,\n options?: { document?: Document }\n) => {\n const BG_NODE = editor.pmSchema.nodes[\"blockGroup\"];\n\n const bg = BG_NODE.spec!.toDOM!(BG_NODE.create({})) as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n const fragment = serializeBlocks(editor, blocks, serializer, options);\n\n bg.contentDOM?.appendChild(fragment);\n\n return bg.dom;\n};\n","import { DOMSerializer, Schema } from \"prosemirror-model\";\nimport { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { serializeBlocksInternalHTML } from \"./util/serializeBlocksInternalHTML.js\";\n// Used to serialize BlockNote blocks and ProseMirror nodes to HTML without\n// losing data. Blocks are exported using the `toInternalHTML` method in their\n// `blockSpec`.\n//\n// The HTML created by this serializer is the same as what's rendered by the\n// editor to the DOM. This means that it retains the same structure as the\n// editor, including the `blockGroup` and `blockContainer` wrappers. This also\n// means that it can be converted back to the original blocks without any data\n// loss.\nexport const createInternalHTMLSerializer = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: Schema,\n editor: BlockNoteEditor<BSchema, I, S>\n) => {\n const serializer = DOMSerializer.fromSchema(schema);\n\n return {\n serializeBlocks: (\n blocks: PartialBlock<BSchema, I, S>[],\n options: { document?: Document }\n ) => {\n return serializeBlocksInternalHTML(editor, blocks, serializer, options)\n .outerHTML;\n },\n };\n};\n","import { Node, ResolvedPos } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\n\ntype SingleBlockInfo = {\n node: Node;\n beforePos: number;\n afterPos: number;\n};\n\nexport type BlockInfo = {\n /**\n * The outer node that represents a BlockNote block. This is the node that has the ID.\n * Most of the time, this will be a blockContainer node, but it could also be a Column or ColumnList\n */\n bnBlock: SingleBlockInfo;\n /**\n * The type of BlockNote block that this node represents.\n * When dealing with a blockContainer, this is retrieved from the blockContent node, otherwise it's retrieved from the bnBlock node.\n */\n blockNoteType: string;\n} & (\n | {\n // In case we're not dealing with a BlockContainer, we're dealing with a \"wrapper node\" (like a Column or ColumnList), so it will always have children\n\n /**\n * The Prosemirror node that holds block.children. For non-blockContainer, this node will be the same as bnBlock.\n */\n childContainer: SingleBlockInfo;\n isBlockContainer: false;\n }\n | {\n /**\n * The Prosemirror node that holds block.children. For blockContainers, this is the blockGroup node, if it exists.\n */\n childContainer?: SingleBlockInfo;\n /**\n * The Prosemirror node that wraps block.content and has most of the props\n */\n blockContent: SingleBlockInfo;\n /**\n * Whether bnBlock is a blockContainer node\n */\n isBlockContainer: true;\n }\n);\n\n/**\n * Retrieves the position just before the nearest block node in a ProseMirror\n * doc, relative to a position. If the position is within a block node or its\n * descendants, the position just before it is returned. If the position is not\n * within a block node or its descendants, the position just before the next\n * closest block node is returned. If the position is beyond the last block, the\n * position just before the last block is returned.\n * @param doc The ProseMirror doc.\n * @param pos An integer position in the document.\n * @returns The position just before the nearest blockContainer node.\n */\nexport function getNearestBlockPos(doc: Node, pos: number) {\n const $pos = doc.resolve(pos);\n\n // Checks if the position provided is already just before a block node, in\n // which case we return the position.\n if ($pos.nodeAfter && $pos.nodeAfter.type.isInGroup(\"bnBlock\")) {\n return {\n posBeforeNode: $pos.pos,\n node: $pos.nodeAfter,\n };\n }\n\n // Checks the node containing the position and its ancestors until a\n // block node is found and returned.\n let depth = $pos.depth;\n let node = $pos.node(depth);\n while (depth > 0) {\n if (node.type.isInGroup(\"bnBlock\")) {\n return {\n posBeforeNode: $pos.before(depth),\n node: node,\n };\n }\n\n depth--;\n node = $pos.node(depth);\n }\n\n // If the position doesn't lie within a block node, we instead find the\n // position of the next closest one. If the position is beyond the last block,\n // we return the position of the last block. While running `doc.descendants`\n // is expensive, this case should be very rarely triggered. However, it's\n // possible for the position to sometimes be beyond the last block node. This\n // is a problem specifically when using the collaboration plugin.\n const allBlockContainerPositions: number[] = [];\n doc.descendants((node, pos) => {\n if (node.type.isInGroup(\"bnBlock\")) {\n allBlockContainerPositions.push(pos);\n }\n });\n\n // eslint-disable-next-line no-console\n console.warn(`Position ${pos} is not within a blockContainer node.`);\n\n const resolvedPos = doc.resolve(\n allBlockContainerPositions.find((position) => position >= pos) ||\n allBlockContainerPositions[allBlockContainerPositions.length - 1]\n );\n return {\n posBeforeNode: resolvedPos.pos,\n node: resolvedPos.nodeAfter!,\n };\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block in a\n * BlockNote document. This includes the main `blockContainer` node, the\n * `blockContent` node with the block's main body, and the optional `blockGroup`\n * node which contains the block's children. As well as the nodes, also returns\n * the ProseMirror positions just before & after each node.\n * @param node The main `blockContainer` node that the block information should\n * be retrieved from,\n * @param bnBlockBeforePosOffset the position just before the\n * `blockContainer` node in the document.\n */\nexport function getBlockInfoWithManualOffset(\n node: Node,\n bnBlockBeforePosOffset: number\n): BlockInfo {\n if (!node.type.isInGroup(\"bnBlock\")) {\n throw new Error(\n `Attempted to get bnBlock node at position but found node of different type ${node.type}`\n );\n }\n\n const bnBlockNode = node;\n const bnBlockBeforePos = bnBlockBeforePosOffset;\n const bnBlockAfterPos = bnBlockBeforePos + bnBlockNode.nodeSize;\n\n const bnBlock: SingleBlockInfo = {\n node: bnBlockNode,\n beforePos: bnBlockBeforePos,\n afterPos: bnBlockAfterPos,\n };\n\n if (bnBlockNode.type.name === \"blockContainer\") {\n let blockContent: SingleBlockInfo | undefined;\n let blockGroup: SingleBlockInfo | undefined;\n\n bnBlockNode.forEach((node, offset) => {\n if (node.type.spec.group === \"blockContent\") {\n // console.log(beforePos, offset);\n const blockContentNode = node;\n const blockContentBeforePos = bnBlockBeforePos + offset + 1;\n const blockContentAfterPos = blockContentBeforePos + node.nodeSize;\n\n blockContent = {\n node: blockContentNode,\n beforePos: blockContentBeforePos,\n afterPos: blockContentAfterPos,\n };\n } else if (node.type.name === \"blockGroup\") {\n const blockGroupNode = node;\n const blockGroupBeforePos = bnBlockBeforePos + offset + 1;\n const blockGroupAfterPos = blockGroupBeforePos + node.nodeSize;\n\n blockGroup = {\n node: blockGroupNode,\n beforePos: blockGroupBeforePos,\n afterPos: blockGroupAfterPos,\n };\n }\n });\n\n if (!blockContent) {\n throw new Error(\n `blockContainer node does not contain a blockContent node in its children: ${bnBlockNode}`\n );\n }\n\n return {\n isBlockContainer: true,\n bnBlock,\n blockContent,\n childContainer: blockGroup,\n blockNoteType: blockContent.node.type.name,\n };\n } else {\n if (!bnBlock.node.type.isInGroup(\"childContainer\")) {\n throw new Error(\n `bnBlock node is not in the childContainer group: ${bnBlock.node}`\n );\n }\n\n return {\n isBlockContainer: false,\n bnBlock: bnBlock,\n childContainer: bnBlock,\n blockNoteType: bnBlock.node.type.name,\n };\n }\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block in a\n * BlockNote document. This includes the main `blockContainer` node, the\n * `blockContent` node with the block's main body, and the optional `blockGroup`\n * node which contains the block's children. As well as the nodes, also returns\n * the ProseMirror positions just before & after each node.\n * @param posInfo An object with the main `blockContainer` node that the block\n * information should be retrieved from, and the position just before it in the\n * document.\n */\nexport function getBlockInfo(posInfo: { posBeforeNode: number; node: Node }) {\n return getBlockInfoWithManualOffset(posInfo.node, posInfo.posBeforeNode);\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block from a\n * resolved position just before the `blockContainer` node in the document that\n * corresponds to it.\n * @param resolvedPos The resolved position just before the `blockContainer`\n * node.\n */\nexport function getBlockInfoFromResolvedPos(resolvedPos: ResolvedPos) {\n if (!resolvedPos.nodeAfter) {\n throw new Error(\n `Attempted to get blockContainer node at position ${resolvedPos.pos} but a node at this position does not exist`\n );\n }\n return getBlockInfoWithManualOffset(resolvedPos.nodeAfter, resolvedPos.pos);\n}\n\n/**\n * Gets information regarding the ProseMirror nodes that make up a block. The\n * block chosen is the one currently containing the current ProseMirror\n * selection.\n * @param state The ProseMirror editor state.\n */\nexport function getBlockInfoFromSelection(state: EditorState) {\n const posInfo = getNearestBlockPos(state.doc, state.selection.anchor);\n\n return getBlockInfo(posInfo);\n}\n","import { Node } from \"prosemirror-model\";\n\n/**\n * Get a TipTap node by id\n */\nexport function getNodeById(\n id: string,\n doc: Node\n): { node: Node; posBeforeNode: number } {\n let targetNode: Node | undefined = undefined;\n let posBeforeNode: number | undefined = undefined;\n\n doc.firstChild!.descendants((node, pos) => {\n // Skips traversing nodes after node with target ID has been found.\n if (targetNode) {\n return false;\n }\n\n // Keeps traversing nodes if block with target ID has not been found.\n if (!node.type.isInGroup(\"bnBlock\") || node.attrs.id !== id) {\n return true;\n }\n\n targetNode = node;\n posBeforeNode = pos + 1;\n\n return false;\n });\n\n if (targetNode === undefined || posBeforeNode === undefined) {\n throw Error(\"Could not find block in the editor with matching ID.\");\n }\n\n return {\n node: targetNode,\n posBeforeNode: posBeforeNode,\n };\n}\n","export const isAppleOS = () =>\n typeof navigator !== \"undefined\" &&\n (/Mac/.test(navigator.platform) ||\n (/AppleWebKit/.test(navigator.userAgent) &&\n /Mobile\\/\\w+/.test(navigator.userAgent)));\n\nexport function formatKeyboardShortcut(shortcut: string, ctrlText = \"Ctrl\") {\n if (isAppleOS()) {\n return shortcut.replace(\"Mod\", \"⌘\");\n } else {\n return shortcut.replace(\"Mod\", ctrlText);\n }\n}\n\nexport function mergeCSSClasses(...classes: string[]) {\n return classes.filter((c) => c).join(\" \");\n}\n\nexport const isSafari = () =>\n /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n","import { blockToNode } from \"../api/nodeConversions/blockToNode.js\";\nimport type { BlockNoteEditor } from \"../editor/BlockNoteEditor.js\";\nimport type {\n BlockNoDefaults,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\n\n// Function that creates a ProseMirror `DOMOutputSpec` for a default block.\n// Since all default blocks have the same structure (`blockContent` div with a\n// `inlineContent` element inside), this function only needs the block's name\n// for the `data-content-type` attribute of the `blockContent` element and the\n// HTML tag of the `inlineContent` element, as well as any HTML attributes to\n// add to those.\nexport function createDefaultBlockDOMOutputSpec(\n blockName: string,\n htmlTag: string,\n blockContentHTMLAttributes: Record<string, string>,\n inlineContentHTMLAttributes: Record<string, string>\n) {\n const blockContent = document.createElement(\"div\");\n blockContent.className = mergeCSSClasses(\n \"bn-block-content\",\n blockContentHTMLAttributes.class\n );\n blockContent.setAttribute(\"data-content-type\", blockName);\n for (const [attribute, value] of Object.entries(blockContentHTMLAttributes)) {\n if (attribute !== \"class\") {\n blockContent.setAttribute(attribute, value);\n }\n }\n\n const inlineContent = document.createElement(htmlTag);\n inlineContent.className = mergeCSSClasses(\n \"bn-inline-content\",\n inlineContentHTMLAttributes.class\n );\n for (const [attribute, value] of Object.entries(\n inlineContentHTMLAttributes\n )) {\n if (attribute !== \"class\") {\n inlineContent.setAttribute(attribute, value);\n }\n }\n\n blockContent.appendChild(inlineContent);\n\n return {\n dom: blockContent,\n contentDOM: inlineContent,\n };\n}\n\n// Function used to convert default blocks to HTML. It uses the corresponding\n// node's `renderHTML` method to do the conversion by using a default\n// `DOMSerializer`.\nexport const defaultBlockToHTML = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: BlockNoDefaults<BSchema, I, S>,\n editor: BlockNoteEditor<BSchema, I, S>\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n} => {\n let node = blockToNode(block, editor.pmSchema, editor.schema.styleSchema);\n\n if (node.type.name === \"blockContainer\") {\n // for regular blocks, get the toDOM spec from the blockContent node\n node = node.firstChild!;\n }\n\n const toDOM = editor.pmSchema.nodes[node.type.name].spec.toDOM;\n\n if (toDOM === undefined) {\n throw new Error(\n \"This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.\"\n );\n }\n\n const renderSpec = toDOM(node);\n\n if (typeof renderSpec !== \"object\" || !(\"dom\" in renderSpec)) {\n throw new Error(\n \"Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.\"\n );\n }\n\n return renderSpec as {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n};\n","import type { Props, PropSchema } from \"../schema/index.js\";\n\n// TODO: this system should probably be moved / refactored.\n// The dependency from schema on this file doesn't make sense\n\nexport const defaultProps = {\n backgroundColor: {\n default: \"default\" as const,\n },\n textColor: {\n default: \"default\" as const,\n },\n textAlignment: {\n default: \"left\" as const,\n values: [\"left\", \"center\", \"right\", \"justify\"] as const,\n },\n} satisfies PropSchema;\n\nexport type DefaultProps = Props<typeof defaultProps>;\n\n// Default props which are set on `blockContainer` nodes rather than\n// `blockContent` nodes. Ensures that they are not redundantly added to\n// a custom block's TipTap node attributes.\nexport const inheritedProps = [\"backgroundColor\", \"textColor\"];\n","export function camelToDataKebab(str: string): string {\n return \"data-\" + str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\nexport function filenameFromURL(url: string): string {\n const parts = url.split(\"/\");\n if (\n !parts.length || // invalid?\n parts[parts.length - 1] === \"\" // for example, URL ends in a directory-like trailing slash\n ) {\n // in this case just return the original url\n return url;\n }\n return parts[parts.length - 1];\n}\n","import {\n Attribute,\n Attributes,\n Editor,\n Extension,\n Node,\n NodeConfig,\n} from \"@tiptap/core\";\nimport { defaultBlockToHTML } from \"../../blocks/defaultBlockHelpers.js\";\nimport { inheritedProps } from \"../../blocks/defaultProps.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { mergeCSSClasses } from \"../../util/browser.js\";\nimport { camelToDataKebab } from \"../../util/string.js\";\nimport { InlineContentSchema } from \"../inlineContent/types.js\";\nimport { PropSchema, Props } from \"../propTypes.js\";\nimport { StyleSchema } from \"../styles/types.js\";\nimport {\n BlockConfig,\n BlockSchemaFromSpecs,\n BlockSchemaWithBlock,\n BlockSpec,\n BlockSpecs,\n SpecificBlock,\n TiptapBlockImplementation,\n} from \"./types.js\";\n\n// Function that uses the 'propSchema' of a blockConfig to create a TipTap\n// node's `addAttributes` property.\n// TODO: extract function\nexport function propsToAttributes(propSchema: PropSchema): Attributes {\n const tiptapAttributes: Record<string, Attribute> = {};\n\n Object.entries(propSchema)\n .filter(([name, _spec]) => !inheritedProps.includes(name))\n .forEach(([name, spec]) => {\n tiptapAttributes[name] = {\n default: spec.default,\n keepOnSplit: true,\n // Props are displayed in kebab-case as HTML attributes. If a prop's\n // value is the same as its default, we don't display an HTML\n // attribute for it.\n parseHTML: (element) => {\n const value = element.getAttribute(camelToDataKebab(name));\n\n if (value === null) {\n return null;\n }\n\n if (typeof spec.default === \"boolean\") {\n if (value === \"true\") {\n return true;\n }\n\n if (value === \"false\") {\n return false;\n }\n\n return null;\n }\n\n if (typeof spec.default === \"number\") {\n const asNumber = parseFloat(value);\n const isNumeric =\n !Number.isNaN(asNumber) && Number.isFinite(asNumber);\n\n if (isNumeric) {\n return asNumber;\n }\n\n return null;\n }\n\n return value;\n },\n renderHTML: (attributes) =>\n attributes[name] !== spec.default\n ? {\n [camelToDataKebab(name)]: attributes[name],\n }\n : {},\n };\n });\n\n return tiptapAttributes;\n}\n\n// Used to figure out which block should be rendered. This block is then used to\n// create the node view.\nexport function getBlockFromPos<\n BType extends string,\n Config extends BlockConfig,\n BSchema extends BlockSchemaWithBlock<BType, Config>,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n getPos: (() => number) | boolean,\n editor: BlockNoteEditor<BSchema, I, S>,\n tipTapEditor: Editor,\n type: BType\n) {\n // Gets position of the node\n if (typeof getPos === \"boolean\") {\n throw new Error(\n \"Cannot find node position as getPos is a boolean, not a function.\"\n );\n }\n const pos = getPos();\n // Gets parent blockContainer node\n const blockContainer = tipTapEditor.state.doc.resolve(pos!).node();\n // Gets block identifier\n const blockIdentifier = blockContainer.attrs.id;\n\n if (!blockIdentifier) {\n throw new Error(\"Block doesn't have id\");\n }\n\n // Gets the block\n const block = editor.getBlock(blockIdentifier)! as SpecificBlock<\n BSchema,\n BType,\n I,\n S\n >;\n if (block.type !== type) {\n throw new Error(\"Block type does not match\");\n }\n\n return block;\n}\n\n// Function that wraps the `dom` element returned from 'blockConfig.render' in a\n// `blockContent` div, which contains the block type and props as HTML\n// attributes. If `blockConfig.render` also returns a `contentDOM`, it also adds\n// an `inlineContent` class to it.\nexport function wrapInBlockStructure<\n BType extends string,\n PSchema extends PropSchema\n>(\n element: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n destroy?: () => void;\n },\n blockType: BType,\n blockProps: Props<PSchema>,\n propSchema: PSchema,\n isFileBlock = false,\n domAttributes?: Record<string, string>\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n destroy?: () => void;\n} {\n // Creates `blockContent` element\n const blockContent = document.createElement(\"div\");\n\n // Adds custom HTML attributes\n if (domAttributes !== undefined) {\n for (const [attr, value] of Object.entries(domAttributes)) {\n if (attr !== \"class\") {\n blockContent.setAttribute(attr, value);\n }\n }\n }\n // Sets blockContent class\n blockContent.className = mergeCSSClasses(\n \"bn-block-content\",\n domAttributes?.class || \"\"\n );\n // Sets content type attribute\n blockContent.setAttribute(\"data-content-type\", blockType);\n // Adds props as HTML attributes in kebab-case with \"data-\" prefix. Skips props\n // which are already added as HTML attributes to the parent `blockContent`\n // element (inheritedProps) and props set to their default values.\n for (const [prop, value] of Object.entries(blockProps)) {\n if (!inheritedProps.includes(prop) && value !== propSchema[prop].default) {\n blockContent.setAttribute(camelToDataKebab(prop), value);\n }\n }\n // Adds file block attribute\n if (isFileBlock) {\n blockContent.setAttribute(\"data-file-block\", \"\");\n }\n\n blockContent.appendChild(element.dom);\n\n if (element.contentDOM !== undefined) {\n element.contentDOM.className = mergeCSSClasses(\n \"bn-inline-content\",\n element.contentDOM.className\n );\n element.contentDOM.setAttribute(\"data-editable\", \"\");\n }\n\n return {\n ...element,\n dom: blockContent,\n };\n}\n\n// Helper type to keep track of the `name` and `content` properties after calling Node.create.\ntype StronglyTypedTipTapNode<\n Name extends string,\n Content extends\n | \"inline*\"\n | \"tableRow+\"\n | \"blockContainer+\"\n | \"column column+\"\n | \"\"\n> = Node & { name: Name; config: { content: Content } };\n\nexport function createStronglyTypedTiptapNode<\n Name extends string,\n Content extends\n | \"inline*\"\n | \"tableRow+\"\n | \"blockContainer+\"\n | \"column column+\"\n | \"\"\n>(config: NodeConfig & { name: Name; content: Content }) {\n return Node.create(config) as StronglyTypedTipTapNode<Name, Content>; // force re-typing (should be safe as it's type-checked from the config)\n}\n\n// This helper function helps to instantiate a blockspec with a\n// config and implementation that conform to the type of Config\nexport function createInternalBlockSpec<T extends BlockConfig>(\n config: T,\n implementation: TiptapBlockImplementation<\n T,\n any,\n InlineContentSchema,\n StyleSchema\n >\n) {\n return {\n config,\n implementation,\n } satisfies BlockSpec<T, any, InlineContentSchema, StyleSchema>;\n}\n\nexport function createBlockSpecFromStronglyTypedTiptapNode<\n T extends Node,\n P extends PropSchema\n>(node: T, propSchema: P, requiredExtensions?: Array<Extension | Node>) {\n return createInternalBlockSpec(\n {\n type: node.name as T[\"name\"],\n content: (node.config.content === \"inline*\"\n ? \"inline\"\n : node.config.content === \"tableRow+\"\n ? \"table\"\n : \"none\") as T[\"config\"][\"content\"] extends \"inline*\"\n ? \"inline\"\n : T[\"config\"][\"content\"] extends \"tableRow+\"\n ? \"table\"\n : \"none\",\n propSchema,\n },\n {\n node,\n requiredExtensions,\n toInternalHTML: defaultBlockToHTML,\n toExternalHTML: defaultBlockToHTML,\n // parse: () => undefined, // parse rules are in node already\n }\n );\n}\n\nexport function getBlockSchemaFromSpecs<T extends BlockSpecs>(specs: T) {\n return Object.fromEntries(\n Object.entries(specs).map(([key, value]) => [key, value.config])\n ) as BlockSchemaFromSpecs<T>;\n}\n","import { Editor } from \"@tiptap/core\";\nimport { TagParseRule } from \"@tiptap/pm/model\";\nimport { NodeView } from \"@tiptap/pm/view\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { InlineContentSchema } from \"../inlineContent/types.js\";\nimport { StyleSchema } from \"../styles/types.js\";\nimport {\n createInternalBlockSpec,\n createStronglyTypedTiptapNode,\n getBlockFromPos,\n propsToAttributes,\n wrapInBlockStructure,\n} from \"./internal.js\";\nimport {\n BlockConfig,\n BlockFromConfig,\n BlockSchemaWithBlock,\n PartialBlockFromConfig,\n} from \"./types.js\";\n\n// restrict content to \"inline\" and \"none\" only\nexport type CustomBlockConfig = BlockConfig & {\n content: \"inline\" | \"none\";\n};\n\nexport type CustomBlockImplementation<\n T extends CustomBlockConfig,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n render: (\n /**\n * The custom block to render\n */\n block: BlockFromConfig<T, I, S>,\n /**\n * The BlockNote editor instance\n * This is typed generically. If you want an editor with your custom schema, you need to\n * cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`\n */\n editor: BlockNoteEditor<BlockSchemaWithBlock<T[\"type\"], T>, I, S>\n // (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations\n // or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics\n ) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n destroy?: () => void;\n };\n // Exports block to external HTML. If not defined, the output will be the same\n // as `render(...).dom`. Used to create clipboard data when pasting outside\n // BlockNote.\n // TODO: Maybe can return undefined to ignore when serializing?\n toExternalHTML?: (\n block: BlockFromConfig<T, I, S>,\n editor: BlockNoteEditor<BlockSchemaWithBlock<T[\"type\"], T>, I, S>\n ) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n parse?: (\n el: HTMLElement\n ) => PartialBlockFromConfig<T, I, S>[\"props\"] | undefined;\n};\n\n// Function that causes events within non-selectable blocks to be handled by the\n// browser instead of the editor.\nexport function applyNonSelectableBlockFix(nodeView: NodeView, editor: Editor) {\n nodeView.stopEvent = (event) => {\n // Blurs the editor on mouse down as the block is non-selectable. This is\n // mainly done to prevent UI elements like the formatting toolbar from being\n // visible while content within a non-selectable block is selected.\n if (event.type === \"mousedown\") {\n setTimeout(() => {\n editor.view.dom.blur();\n }, 10);\n }\n\n return true;\n };\n}\n\n// Function that uses the 'parse' function of a blockConfig to create a\n// TipTap node's `parseHTML` property. This is only used for parsing content\n// from the clipboard.\nexport function getParseRules(\n config: BlockConfig,\n customParseFunction: CustomBlockImplementation<any, any, any>[\"parse\"]\n) {\n const rules: TagParseRule[] = [\n {\n tag: \"[data-content-type=\" + config.type + \"]\",\n contentElement: \"[data-editable]\",\n },\n ];\n\n if (customParseFunction) {\n rules.push({\n tag: \"*\",\n getAttrs(node: string | HTMLElement) {\n if (typeof node === \"string\") {\n return false;\n }\n\n const props = customParseFunction?.(node);\n\n if (props === undefined) {\n return false;\n }\n\n return props;\n },\n });\n }\n // getContent(node, schema) {\n // const block = blockConfig.parse?.(node as HTMLElement);\n //\n // if (block !== undefined && block.content !== undefined) {\n // return Fragment.from(\n // typeof block.content === \"string\"\n // ? schema.text(block.content)\n // : inlineContentToNodes(block.content, schema)\n // );\n // }\n //\n // return Fragment.empty;\n // },\n // });\n // }\n\n return rules;\n}\n\n// A function to create custom block for API consumers\n// we want to hide the tiptap node from API consumers and provide a simpler API surface instead\nexport function createBlockSpec<\n T extends CustomBlockConfig,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockConfig: T,\n blockImplementation: CustomBlockImplementation<NoInfer<T>, I, S>\n) {\n const node = createStronglyTypedTiptapNode({\n name: blockConfig.type as T[\"type\"],\n content: (blockConfig.content === \"inline\"\n ? \"inline*\"\n : \"\") as T[\"content\"] extends \"inline\" ? \"inline*\" : \"\",\n group: \"blockContent\",\n selectable: blockConfig.isSelectable ?? true,\n\n addAttributes() {\n return propsToAttributes(blockConfig.propSchema);\n },\n\n parseHTML() {\n return getParseRules(blockConfig, blockImplementation.parse);\n },\n\n renderHTML({ HTMLAttributes }) {\n // renderHTML is used for copy/pasting content from the editor back into\n // the editor, so we need to make sure the `blockContent` element is\n // structured correctly as this is what's used for parsing blocks. We\n // just render a placeholder div inside as the `blockContent` element\n // already has all the information needed for proper parsing.\n const div = document.createElement(\"div\");\n return wrapInBlockStructure(\n {\n dom: div,\n contentDOM: blockConfig.content === \"inline\" ? div : undefined,\n },\n blockConfig.type,\n {},\n blockConfig.propSchema,\n blockConfig.isFileBlock,\n HTMLAttributes\n );\n },\n\n addNodeView() {\n return ({ getPos }) => {\n // Gets the BlockNote editor instance\n const editor = this.options.editor;\n // Gets the block\n const block = getBlockFromPos(\n getPos,\n editor,\n this.editor,\n blockConfig.type\n );\n // Gets the custom HTML attributes for `blockContent` nodes\n const blockContentDOMAttributes =\n this.options.domAttributes?.blockContent || {};\n\n const output = blockImplementation.render(block as any, editor);\n\n const nodeView: NodeView = wrapInBlockStructure(\n output,\n block.type,\n block.props,\n blockConfig.propSchema,\n blockContentDOMAttributes\n );\n\n if (blockConfig.isSelectable === false) {\n applyNonSelectableBlockFix(nodeView, this.editor);\n }\n\n return nodeView;\n };\n },\n });\n\n if (node.name !== blockConfig.type) {\n throw new Error(\n \"Node name does not match block type. This is a bug in BlockNote.\"\n );\n }\n\n return createInternalBlockSpec(blockConfig, {\n node,\n toInternalHTML: (block, editor) => {\n const blockContentDOMAttributes =\n node.options.domAttributes?.blockContent || {};\n\n const output = blockImplementation.render(block as any, editor as any);\n\n return wrapInBlockStructure(\n output,\n block.type,\n block.props,\n blockConfig.propSchema,\n blockConfig.isFileBlock,\n blockContentDOMAttributes\n );\n },\n // TODO: this should not have wrapInBlockStructure and generally be a lot simpler\n // post-processing in externalHTMLExporter should not be necessary\n toExternalHTML: (block, editor) => {\n const blockContentDOMAttributes =\n node.options.domAttributes?.blockContent || {};\n\n let output = blockImplementation.toExternalHTML?.(\n block as any,\n editor as any\n );\n if (output === undefined) {\n output = blockImplementation.render(block as any, editor as any);\n }\n return wrapInBlockStructure(\n output,\n block.type,\n block.props,\n blockConfig.propSchema,\n blockContentDOMAttributes\n );\n },\n });\n}\n","import { Mark, Node } from \"@tiptap/pm/model\";\n\nimport UniqueID from \"../../extensions/UniqueID/UniqueID.js\";\nimport type {\n BlockSchema,\n CustomInlineContentConfig,\n CustomInlineContentFromConfig,\n InlineContent,\n InlineContentFromConfig,\n InlineContentSchema,\n StyleSchema,\n Styles,\n TableContent,\n} from \"../../schema/index.js\";\nimport { getBlockInfoWithManualOffset } from \"../getBlockInfoFromPos.js\";\n\nimport type { Block } from \"../../blocks/defaultBlocks.js\";\nimport {\n isLinkInlineContent,\n isStyledTextInlineContent,\n} from \"../../schema/inlineContent/types.js\";\nimport { UnreachableCaseError } from \"../../util/typescript.js\";\n\n/**\n * Converts an internal (prosemirror) table node contentto a BlockNote Tablecontent\n */\nexport function contentNodeToTableContent<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(contentNode: Node, inlineContentSchema: I, styleSchema: S) {\n const ret: TableContent<I, S> = {\n type: \"tableContent\",\n columnWidths: [],\n rows: [],\n };\n\n contentNode.content.forEach((rowNode, _offset, index) => {\n const row: TableContent<I, S>[\"rows\"][0] = {\n cells: [],\n };\n\n if (index === 0) {\n rowNode.content.forEach((cellNode) => {\n // The colwidth array should have multiple values when the colspan of a\n // cell is greater than 1. However, this is not yet implemented so we\n // can always assume a length of 1.\n ret.columnWidths.push(cellNode.attrs.colwidth?.[0] || undefined);\n });\n }\n\n rowNode.content.forEach((cellNode) => {\n row.cells.push(\n contentNodeToInlineContent(\n cellNode.firstChild!,\n inlineContentSchema,\n styleSchema\n )\n );\n });\n\n ret.rows.push(row);\n });\n\n return ret;\n}\n\n/**\n * Converts an internal (prosemirror) content node to a BlockNote InlineContent array.\n */\nexport function contentNodeToInlineContent<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(contentNode: Node, inlineContentSchema: I, styleSchema: S) {\n const content: InlineContent<any, S>[] = [];\n let currentContent: InlineContent<any, S> | undefined = undefined;\n\n // Most of the logic below is for handling links because in ProseMirror links are marks\n // while in BlockNote links are a type of inline content\n contentNode.content.forEach((node) => {\n // hardBreak nodes do not have an InlineContent equivalent, instead we\n // add a newline to the previous node.\n if (node.type.name === \"hardBreak\") {\n if (currentContent) {\n // Current content exists.\n if (isStyledTextInlineContent(currentContent)) {\n // Current content is text.\n currentContent.text += \"\\n\";\n } else if (isLinkInlineContent(currentContent)) {\n // Current content is a link.\n currentContent.content[currentContent.content.length - 1].text +=\n \"\\n\";\n } else {\n throw new Error(\"unexpected\");\n }\n } else {\n // Current content does not exist.\n currentContent = {\n type: \"text\",\n text: \"\\n\",\n styles: {},\n };\n }\n\n return;\n }\n\n if (\n node.type.name !== \"link\" &&\n node.type.name !== \"text\" &&\n inlineContentSchema[node.type.name]\n ) {\n if (currentContent) {\n content.push(currentContent);\n currentContent = undefined;\n }\n\n content.push(\n nodeToCustomInlineContent(node, inlineContentSchema, styleSchema)\n );\n\n return;\n }\n\n const styles: Styles<S> = {};\n let linkMark: Mark | undefined;\n\n for (const mark of node.marks) {\n if (mark.type.name === \"link\") {\n linkMark = mark;\n } else {\n const config = styleSchema[mark.type.name];\n if (!config) {\n throw new Error(`style ${mark.type.name} not found in styleSchema`);\n }\n if (config.propSchema === \"boolean\") {\n (styles as any)[config.type] = true;\n } else if (config.propSchema === \"string\") {\n (styles as any)[config.type] = mark.attrs.stringValue;\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n }\n\n // Parsing links and text.\n // Current content exists.\n if (currentContent) {\n // Current content is text.\n if (isStyledTextInlineContent(currentContent)) {\n if (!linkMark) {\n // Node is text (same type as current content).\n if (\n JSON.stringify(currentContent.styles) === JSON.stringify(styles)\n ) {\n // Styles are the same.\n currentContent.text += node.textContent;\n } else {\n // Styles are different.\n content.push(currentContent);\n currentContent = {\n type: \"text\",\n text: node.textContent,\n styles,\n };\n }\n } else {\n // Node is a link (different type to current content).\n content.push(currentContent);\n currentContent = {\n type: \"link\",\n href: linkMark.attrs.href,\n content: [\n {\n type: \"text\",\n text: node.textContent,\n styles,\n },\n ],\n };\n }\n } else if (isLinkInlineContent(currentContent)) {\n // Current content is a link.\n if (linkMark) {\n // Node is a link (same type as current content).\n // Link URLs are the same.\n if (currentContent.href === linkMark.attrs.href) {\n // Styles are the same.\n if (\n JSON.stringify(\n currentContent.content[currentContent.content.length - 1].styles\n ) === JSON.stringify(styles)\n ) {\n currentContent.content[currentContent.content.length - 1].text +=\n node.textContent;\n } else {\n // Styles are different.\n currentContent.content.push({\n type: \"text\",\n text: node.textContent,\n styles,\n });\n }\n } else {\n // Link URLs are different.\n content.push(currentContent);\n currentContent = {\n type: \"link\",\n href: linkMark.attrs.href,\n content: [\n {\n type: \"text\",\n text: node.textContent,\n styles,\n },\n ],\n };\n }\n } else {\n // Node is text (different type to current content).\n content.push(currentContent);\n currentContent = {\n type: \"text\",\n text: node.textContent,\n styles,\n };\n }\n } else {\n // TODO\n }\n }\n // Current content does not exist.\n else {\n // Node is text.\n if (!linkMark) {\n currentContent = {\n type: \"text\",\n text: node.textContent,\n styles,\n };\n }\n // Node is a link.\n else {\n currentContent = {\n type: \"link\",\n href: linkMark.attrs.href,\n content: [\n {\n type: \"text\",\n text: node.textContent,\n styles,\n },\n ],\n };\n }\n }\n });\n\n if (currentContent) {\n content.push(currentContent);\n }\n\n return content as InlineContent<I, S>[];\n}\n\nexport function nodeToCustomInlineContent<\n I extends InlineContentSchema,\n S extends StyleSchema\n>(node: Node, inlineContentSchema: I, styleSchema: S): InlineContent<I, S> {\n if (node.type.name === \"text\" || node.type.name === \"link\") {\n throw new Error(\"unexpected\");\n }\n const props: any = {};\n const icConfig = inlineContentSchema[\n node.type.name\n ] as CustomInlineContentConfig;\n for (const [attr, value] of Object.entries(node.attrs)) {\n if (!icConfig) {\n throw Error(\"ic node is of an unrecognized type: \" + node.type.name);\n }\n\n const propSchema = icConfig.propSchema;\n\n if (attr in propSchema) {\n props[attr] = value;\n }\n }\n\n let content: CustomInlineContentFromConfig<any, any>[\"content\"];\n\n if (icConfig.content === \"styled\") {\n content = contentNodeToInlineContent(\n node,\n inlineContentSchema,\n styleSchema\n ) as any; // TODO: is this safe? could we have Links here that are undesired?\n } else {\n content = undefined;\n }\n\n const ic = {\n type: node.type.name,\n props,\n content,\n } as InlineContentFromConfig<I[keyof I], S>;\n return ic;\n}\n\n/**\n * Convert a Prosemirror node to a BlockNote block.\n *\n * TODO: test changes\n */\nexport function nodeToBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n node: Node,\n blockSchema: BSchema,\n inlineContentSchema: I,\n styleSchema: S,\n blockCache?: WeakMap<Node, Block<BSchema, I, S>>\n): Block<BSchema, I, S> {\n if (!node.type.isInGroup(\"bnBlock\")) {\n throw Error(\n \"Node must be in bnBlock group, but is of type\" + node.type.name\n );\n }\n\n const cachedBlock = blockCache?.get(node);\n\n if (cachedBlock) {\n return cachedBlock;\n }\n\n const blockInfo = getBlockInfoWithManualOffset(node, 0);\n\n let id = blockInfo.bnBlock.node.attrs.id;\n\n // Only used for blocks converted from other formats.\n if (id === null) {\n id = UniqueID.options.generateID();\n }\n\n const blockSpec = blockSchema[blockInfo.blockNoteType];\n\n if (!blockSpec) {\n throw Error(\"Block is of an unrecognized type: \" + blockInfo.blockNoteType);\n }\n\n const props: any = {};\n for (const [attr, value] of Object.entries({\n ...node.attrs,\n ...(blockInfo.isBlockContainer ? blockInfo.blockContent.node.attrs : {}),\n })) {\n const propSchema = blockSpec.propSchema;\n\n if (attr in propSchema) {\n props[attr] = value;\n }\n }\n\n const blockConfig = blockSchema[blockInfo.blockNoteType];\n\n const children: Block<BSchema, I, S>[] = [];\n blockInfo.childContainer?.node.forEach((child) => {\n children.push(\n nodeToBlock(\n child,\n blockSchema,\n inlineContentSchema,\n styleSchema,\n blockCache\n )\n );\n });\n\n let content: Block<any, any, any>[\"content\"];\n\n if (blockConfig.content === \"inline\") {\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n content = contentNodeToInlineContent(\n blockInfo.blockContent.node,\n inlineContentSchema,\n styleSchema\n );\n } else if (blockConfig.content === \"table\") {\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n content = contentNodeToTableContent(\n blockInfo.blockContent.node,\n inlineContentSchema,\n styleSchema\n );\n } else if (blockConfig.content === \"none\") {\n content = undefined;\n } else {\n throw new UnreachableCaseError(blockConfig.content);\n }\n\n const block = {\n id,\n type: blockConfig.type,\n props,\n content,\n children,\n } as Block<BSchema, I, S>;\n\n blockCache?.set(node, block);\n\n return block;\n}\n","import { KeyboardShortcutCommand, Node } from \"@tiptap/core\";\n\nimport { camelToDataKebab } from \"../../util/string.js\";\nimport { PropSchema, Props } from \"../propTypes.js\";\nimport {\n CustomInlineContentConfig,\n InlineContentConfig,\n InlineContentImplementation,\n InlineContentSchemaFromSpecs,\n InlineContentSpec,\n InlineContentSpecs,\n} from \"./types.js\";\n\n// Function that adds necessary classes and attributes to the `dom` element\n// returned from a custom inline content's 'render' function, to ensure no data\n// is lost on internal copy & paste.\nexport function addInlineContentAttributes<\n IType extends string,\n PSchema extends PropSchema\n>(\n element: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n },\n inlineContentType: IType,\n inlineContentProps: Props<PSchema>,\n propSchema: PSchema\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n} {\n // Sets content type attribute\n element.dom.setAttribute(\"data-inline-content-type\", inlineContentType);\n // Adds props as HTML attributes in kebab-case with \"data-\" prefix. Skips props\n // set to their default values.\n Object.entries(inlineContentProps)\n .filter(([prop, value]) => value !== propSchema[prop].default)\n .map(([prop, value]) => {\n return [camelToDataKebab(prop), value];\n })\n .forEach(([prop, value]) => element.dom.setAttribute(prop, value));\n\n if (element.contentDOM !== undefined) {\n element.contentDOM.setAttribute(\"data-editable\", \"\");\n }\n\n return element;\n}\n\n// see https://github.com/TypeCellOS/BlockNote/pull/435\nexport function addInlineContentKeyboardShortcuts<\n T extends CustomInlineContentConfig\n>(\n config: T\n): {\n [p: string]: KeyboardShortcutCommand;\n} {\n return {\n Backspace: ({ editor }) => {\n const resolvedPos = editor.state.selection.$from;\n\n return (\n editor.state.selection.empty &&\n resolvedPos.node().type.name === config.type &&\n resolvedPos.parentOffset === 0\n );\n },\n };\n}\n\n// This helper function helps to instantiate a InlineContentSpec with a\n// config and implementation that conform to the type of Config\nexport function createInternalInlineContentSpec<T extends InlineContentConfig>(\n config: T,\n implementation: InlineContentImplementation<T>\n) {\n return {\n config,\n implementation,\n } satisfies InlineContentSpec<T>;\n}\n\nexport function createInlineContentSpecFromTipTapNode<\n T extends Node,\n P extends PropSchema\n>(node: T, propSchema: P) {\n return createInternalInlineContentSpec(\n {\n type: node.name as T[\"name\"],\n propSchema,\n content: node.config.content === \"inline*\" ? \"styled\" : \"none\",\n },\n {\n node,\n }\n );\n}\n\nexport function getInlineContentSchemaFromSpecs<T extends InlineContentSpecs>(\n specs: T\n) {\n return Object.fromEntries(\n Object.entries(specs).map(([key, value]) => [key, value.config])\n ) as InlineContentSchemaFromSpecs<T>;\n}\n","import { Node } from \"@tiptap/core\";\n\nimport { TagParseRule } from \"@tiptap/pm/model\";\nimport { inlineContentToNodes } from \"../../api/nodeConversions/blockToNode.js\";\nimport { nodeToCustomInlineContent } from \"../../api/nodeConversions/nodeToBlock.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { propsToAttributes } from \"../blocks/internal.js\";\nimport { Props } from \"../propTypes.js\";\nimport { StyleSchema } from \"../styles/types.js\";\nimport {\n addInlineContentAttributes,\n addInlineContentKeyboardShortcuts,\n createInlineContentSpecFromTipTapNode,\n} from \"./internal.js\";\nimport {\n CustomInlineContentConfig,\n InlineContentFromConfig,\n InlineContentSpec,\n PartialCustomInlineContentFromConfig,\n} from \"./types.js\";\n\n// TODO: support serialization\n\nexport type CustomInlineContentImplementation<\n T extends CustomInlineContentConfig,\n // B extends BlockSchema,\n // I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n render: (\n /**\n * The custom inline content to render\n */\n inlineContent: InlineContentFromConfig<T, S>,\n updateInlineContent: (\n update: PartialCustomInlineContentFromConfig<T, S>\n ) => void,\n /**\n * The BlockNote editor instance\n * This is typed generically. If you want an editor with your custom schema, you need to\n * cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`\n */\n editor: BlockNoteEditor<any, any, S>\n // (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations\n // or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics\n ) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n // destroy?: () => void;\n };\n};\n\nexport function getInlineContentParseRules(\n config: CustomInlineContentConfig\n): TagParseRule[] {\n return [\n {\n tag: `[data-inline-content-type=\"${config.type}\"]`,\n contentElement: (element) => {\n const htmlElement = element as HTMLElement;\n\n if (htmlElement.matches(\"[data-editable]\")) {\n return htmlElement;\n }\n\n return htmlElement.querySelector(\"[data-editable]\") || htmlElement;\n },\n },\n ];\n}\n\nexport function createInlineContentSpec<\n T extends CustomInlineContentConfig,\n S extends StyleSchema\n>(\n inlineContentConfig: T,\n inlineContentImplementation: CustomInlineContentImplementation<T, S>\n): InlineContentSpec<T> {\n const node = Node.create({\n name: inlineContentConfig.type,\n inline: true,\n group: \"inline\",\n selectable: inlineContentConfig.content === \"styled\",\n atom: inlineContentConfig.content === \"none\",\n content: (inlineContentConfig.content === \"styled\"\n ? \"inline*\"\n : \"\") as T[\"content\"] extends \"styled\" ? \"inline*\" : \"\",\n\n addAttributes() {\n return propsToAttributes(inlineContentConfig.propSchema);\n },\n\n addKeyboardShortcuts() {\n return addInlineContentKeyboardShortcuts(inlineContentConfig);\n },\n\n parseHTML() {\n return getInlineContentParseRules(inlineContentConfig);\n },\n\n renderHTML({ node }) {\n const editor = this.options.editor;\n\n const output = inlineContentImplementation.render(\n nodeToCustomInlineContent(\n node,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n ) as any as InlineContentFromConfig<T, S>, // TODO: fix cast\n () => {\n // No-op\n },\n editor\n );\n\n return addInlineContentAttributes(\n output,\n inlineContentConfig.type,\n node.attrs as Props<T[\"propSchema\"]>,\n inlineContentConfig.propSchema\n );\n },\n\n addNodeView() {\n return ({ node, getPos }) => {\n const editor = this.options.editor;\n\n const output = inlineContentImplementation.render(\n nodeToCustomInlineContent(\n node,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n ) as any as InlineContentFromConfig<T, S>, // TODO: fix cast\n (update) => {\n if (typeof getPos === \"boolean\") {\n return;\n }\n\n const content = inlineContentToNodes(\n [update],\n editor._tiptapEditor.schema,\n editor.schema.styleSchema\n );\n\n editor._tiptapEditor.view.dispatch(\n editor._tiptapEditor.view.state.tr.replaceWith(\n getPos(),\n getPos() + node.nodeSize,\n content\n )\n );\n },\n editor\n );\n\n return addInlineContentAttributes(\n output,\n inlineContentConfig.type,\n node.attrs as Props<T[\"propSchema\"]>,\n inlineContentConfig.propSchema\n );\n };\n },\n });\n\n return createInlineContentSpecFromTipTapNode(\n node,\n inlineContentConfig.propSchema\n ) as InlineContentSpec<T>; // TODO: fix cast\n}\n","import { Attributes, Mark } from \"@tiptap/core\";\nimport {\n StyleConfig,\n StyleImplementation,\n StylePropSchema,\n StyleSchemaFromSpecs,\n StyleSpec,\n StyleSpecs,\n} from \"./types.js\";\n\nexport function stylePropsToAttributes(\n propSchema: StylePropSchema\n): Attributes {\n if (propSchema === \"boolean\") {\n return {};\n }\n return {\n stringValue: {\n default: undefined,\n keepOnSplit: true,\n parseHTML: (element) => element.getAttribute(\"data-value\"),\n renderHTML: (attributes) =>\n attributes.stringValue !== undefined\n ? {\n \"data-value\": attributes.stringValue,\n }\n : {},\n },\n };\n}\n\n// Function that adds necessary classes and attributes to the `dom` element\n// returned from a custom style's 'render' function, to ensure no data is lost\n// on internal copy & paste.\nexport function addStyleAttributes<\n SType extends string,\n PSchema extends StylePropSchema\n>(\n element: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n },\n styleType: SType,\n styleValue: PSchema extends \"boolean\" ? undefined : string,\n propSchema: PSchema\n): {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n} {\n // Sets content type attribute\n element.dom.setAttribute(\"data-style-type\", styleType);\n // Adds style value as an HTML attribute in kebab-case with \"data-\" prefix, if\n // the style takes a string value.\n if (propSchema === \"string\") {\n element.dom.setAttribute(\"data-value\", styleValue as string);\n }\n\n if (element.contentDOM !== undefined) {\n element.contentDOM.setAttribute(\"data-editable\", \"\");\n }\n\n return element;\n}\n\n// This helper function helps to instantiate a stylespec with a\n// config and implementation that conform to the type of Config\nexport function createInternalStyleSpec<T extends StyleConfig>(\n config: T,\n implementation: StyleImplementation\n) {\n return {\n config,\n implementation,\n } satisfies StyleSpec<T>;\n}\n\nexport function createStyleSpecFromTipTapMark<\n T extends Mark,\n P extends StylePropSchema\n>(mark: T, propSchema: P) {\n return createInternalStyleSpec(\n {\n type: mark.name as T[\"name\"],\n propSchema,\n },\n {\n mark,\n }\n );\n}\n\nexport function getStyleSchemaFromSpecs<T extends StyleSpecs>(specs: T) {\n return Object.fromEntries(\n Object.entries(specs).map(([key, value]) => [key, value.config])\n ) as StyleSchemaFromSpecs<T>;\n}\n","import { Mark } from \"@tiptap/core\";\n\nimport { ParseRule } from \"@tiptap/pm/model\";\nimport { UnreachableCaseError } from \"../../util/typescript.js\";\nimport {\n addStyleAttributes,\n createInternalStyleSpec,\n stylePropsToAttributes,\n} from \"./internal.js\";\nimport { StyleConfig, StyleSpec } from \"./types.js\";\n\nexport type CustomStyleImplementation<T extends StyleConfig> = {\n render: T[\"propSchema\"] extends \"boolean\"\n ? () => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n }\n : (value: string) => {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n};\n\n// TODO: support serialization\n\nexport function getStyleParseRules(config: StyleConfig): ParseRule[] {\n return [\n {\n tag: `[data-style-type=\"${config.type}\"]`,\n contentElement: (element) => {\n const htmlElement = element as HTMLElement;\n\n if (htmlElement.matches(\"[data-editable]\")) {\n return htmlElement;\n }\n\n return htmlElement.querySelector(\"[data-editable]\") || htmlElement;\n },\n },\n ];\n}\n\nexport function createStyleSpec<T extends StyleConfig>(\n styleConfig: T,\n styleImplementation: CustomStyleImplementation<T>\n): StyleSpec<T> {\n const mark = Mark.create({\n name: styleConfig.type,\n\n addAttributes() {\n return stylePropsToAttributes(styleConfig.propSchema);\n },\n\n parseHTML() {\n return getStyleParseRules(styleConfig);\n },\n\n renderHTML({ mark }) {\n let renderResult: {\n dom: HTMLElement;\n contentDOM?: HTMLElement;\n };\n\n if (styleConfig.propSchema === \"boolean\") {\n // @ts-ignore not sure why this is complaining\n renderResult = styleImplementation.render();\n } else if (styleConfig.propSchema === \"string\") {\n renderResult = styleImplementation.render(mark.attrs.stringValue);\n } else {\n throw new UnreachableCaseError(styleConfig.propSchema);\n }\n\n // const renderResult = styleImplementation.render();\n return addStyleAttributes(\n renderResult,\n styleConfig.type,\n mark.attrs.stringValue,\n styleConfig.propSchema\n );\n },\n });\n\n return createInternalStyleSpec(styleConfig, {\n mark,\n });\n}\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n BlockSchemaWithBlock,\n FileBlockConfig,\n} from \"../../schema/index.js\";\n\nexport const FILE_ICON_SVG = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>`;\nexport const createFileBlockWrapper = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n editor: BlockNoteEditor<\n BlockSchemaWithBlock<FileBlockConfig[\"type\"], FileBlockConfig>,\n any,\n any\n >,\n // TODO: Maybe make optional for default preview\n element: { dom: HTMLElement; destroy?: () => void },\n buttonText?: string,\n buttonIcon?: HTMLElement\n) => {\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"bn-file-block-content-wrapper\";\n\n if (block.props.url === \"\") {\n const addFileButton = createAddFileButton(\n block,\n editor,\n buttonText,\n buttonIcon\n );\n wrapper.appendChild(addFileButton.dom);\n\n const loading = document.createElement(\"div\");\n loading.className = \"bn-file-loading-preview\";\n loading.textContent = \"Loading...\";\n\n const destroyUploadStartHandler = editor.onUploadStart((blockId) => {\n if (blockId === block.id) {\n wrapper.removeChild(addFileButton.dom);\n wrapper.appendChild(loading);\n }\n });\n const destroyUploadEndHandler = editor.onUploadEnd((blockId) => {\n if (blockId === block.id) {\n wrapper.removeChild(loading);\n wrapper.appendChild(addFileButton.dom);\n }\n });\n\n return {\n dom: wrapper,\n destroy: () => {\n addFileButton.destroy?.();\n destroyUploadStartHandler();\n destroyUploadEndHandler();\n },\n };\n } else if (block.props.showPreview === false) {\n // TODO: Not using the wrapper element here?\n const file = createDefaultFilePreview(block).dom;\n const element = createFileAndCaptionWrapper(block, file);\n\n return {\n dom: element.dom,\n };\n } else {\n wrapper.appendChild(element.dom);\n\n return {\n dom: wrapper,\n destroy: element.destroy,\n };\n }\n};\n\n// Default file preview, displaying a file icon and file name.\nexport const createDefaultFilePreview = (\n block: BlockFromConfig<FileBlockConfig, any, any>\n): { dom: HTMLElement; destroy?: () => void } => {\n const file = document.createElement(\"div\");\n file.className = \"bn-file-default-preview\";\n\n const icon = document.createElement(\"div\");\n icon.className = \"bn-file-default-preview-icon\";\n icon.innerHTML = FILE_ICON_SVG;\n\n const fileName = document.createElement(\"p\");\n fileName.className = \"bn-file-default-preview-name\";\n fileName.textContent = block.props.name || \"\";\n\n file.appendChild(icon);\n file.appendChild(fileName);\n\n return {\n dom: file,\n };\n};\n\n// Wrapper element containing file preview and caption.\nexport const createFileAndCaptionWrapper = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n file: HTMLElement\n) => {\n const fileAndCaptionWrapper = document.createElement(\"div\");\n fileAndCaptionWrapper.className = \"bn-file-and-caption-wrapper\";\n\n const caption = document.createElement(\"p\");\n caption.className = \"bn-file-caption\";\n caption.textContent = block.props.caption;\n\n if (\n typeof block.props.previewWidth === \"number\" &&\n block.props.previewWidth > 0 &&\n block.props.caption !== undefined\n ) {\n caption.style.width = `${block.props.previewWidth}px`;\n }\n\n fileAndCaptionWrapper.appendChild(file);\n fileAndCaptionWrapper.appendChild(caption);\n\n return {\n dom: fileAndCaptionWrapper,\n };\n};\n\n// Button element that acts as a placeholder for files with no src.\nexport const createAddFileButton = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>,\n buttonText?: string,\n buttonIcon?: HTMLElement\n) => {\n const addFileButton = document.createElement(\"div\");\n addFileButton.className = \"bn-add-file-button\";\n\n const addFileButtonIcon = document.createElement(\"div\");\n addFileButtonIcon.className = \"bn-add-file-button-icon\";\n if (buttonIcon) {\n addFileButtonIcon.appendChild(buttonIcon);\n } else {\n addFileButtonIcon.innerHTML =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z\"></path></svg>';\n }\n\n const addFileButtonText = document.createElement(\"p\");\n addFileButtonText.className = \"bn-add-file-button-text\";\n addFileButtonText.innerHTML =\n buttonText || editor.dictionary.file_blocks.file.add_button_text;\n\n // Prevents focus from moving to the button.\n const addFileButtonMouseDownHandler = (event: MouseEvent) => {\n event.preventDefault();\n };\n // Opens the file toolbar.\n const addFileButtonClickHandler = () => {\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: block,\n })\n );\n };\n\n addFileButton.appendChild(addFileButtonIcon);\n addFileButton.appendChild(addFileButtonText);\n\n addFileButton.addEventListener(\n \"mousedown\",\n addFileButtonMouseDownHandler,\n true\n );\n addFileButton.addEventListener(\"click\", addFileButtonClickHandler, true);\n\n return {\n dom: addFileButton,\n destroy: () => {\n addFileButton.removeEventListener(\n \"mousedown\",\n addFileButtonMouseDownHandler,\n true\n );\n addFileButton.removeEventListener(\n \"click\",\n addFileButtonClickHandler,\n true\n );\n },\n };\n};\n\nexport const parseEmbedElement = (embedElement: HTMLEmbedElement) => {\n const url = embedElement.src || undefined;\n\n return { url };\n};\n\nexport const parseFigureElement = (\n figureElement: HTMLElement,\n targetTag: string\n) => {\n const targetElement = figureElement.querySelector(\n targetTag\n ) as HTMLElement | null;\n if (!targetElement) {\n return undefined;\n }\n\n const captionElement = figureElement.querySelector(\"figcaption\");\n const caption = captionElement?.textContent ?? undefined;\n\n return { targetElement, caption };\n};\n\n// Wrapper figure element to display file link with caption. Used for external\n// HTML\nexport const createLinkWithCaption = (\n element: HTMLElement,\n caption: string\n) => {\n const wrapper = document.createElement(\"div\");\n const fileCaption = document.createElement(\"p\");\n fileCaption.textContent = caption;\n\n wrapper.appendChild(element);\n wrapper.appendChild(fileCaption);\n\n return {\n dom: wrapper,\n };\n};\n\n// Wrapper figure element to display file preview with caption. Used for\n// external HTML.\nexport const createFigureWithCaption = (\n element: HTMLElement,\n caption: string\n) => {\n const figure = document.createElement(\"figure\");\n const captionElement = document.createElement(\"figcaption\");\n captionElement.textContent = caption;\n\n figure.appendChild(element);\n figure.appendChild(captionElement);\n\n return { dom: figure };\n};\n\n// Wrapper element which adds resize handles & logic for visual media file\n// previews.\nexport const createResizeHandlesWrapper = (\n block: BlockFromConfig<FileBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>,\n element: HTMLElement,\n getWidth: () => number,\n setWidth: (width: number) => void\n): { dom: HTMLElement; destroy: () => void } => {\n if (!block.props.previewWidth) {\n throw new Error(\"Block must have a `previewWidth` prop.\");\n }\n\n // Wrapper element for rendered element and resize handles.\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"bn-visual-media-wrapper\";\n\n // Resize handle elements.\n const leftResizeHandle = document.createElement(\"div\");\n leftResizeHandle.className = \"bn-visual-media-resize-handle\";\n leftResizeHandle.style.left = \"4px\";\n const rightResizeHandle = document.createElement(\"div\");\n rightResizeHandle.className = \"bn-visual-media-resize-handle\";\n rightResizeHandle.style.right = \"4px\";\n\n // Temporary parameters set when the user begins resizing the element, used to\n // calculate the new width of the element.\n let resizeParams:\n | {\n handleUsed: \"left\" | \"right\";\n initialWidth: number;\n initialClientX: number;\n }\n | undefined;\n\n // Updates the element width with an updated width depending on the cursor X\n // offset from when the resize began, and which resize handle is being used.\n const windowMouseMoveHandler = (event: MouseEvent) => {\n if (!resizeParams) {\n if (\n !editor.isEditable &&\n wrapper.contains(leftResizeHandle) &&\n wrapper.contains(rightResizeHandle)\n ) {\n wrapper.removeChild(leftResizeHandle);\n wrapper.removeChild(rightResizeHandle);\n }\n\n return;\n }\n\n let newWidth: number;\n\n if (block.props.textAlignment === \"center\") {\n if (resizeParams.handleUsed === \"left\") {\n newWidth =\n resizeParams.initialWidth +\n (resizeParams.initialClientX - event.clientX) * 2;\n } else {\n newWidth =\n resizeParams.initialWidth +\n (event.clientX - resizeParams.initialClientX) * 2;\n }\n } else {\n if (resizeParams.handleUsed === \"left\") {\n newWidth =\n resizeParams.initialWidth +\n resizeParams.initialClientX -\n event.clientX;\n } else {\n newWidth =\n resizeParams.initialWidth +\n event.clientX -\n resizeParams.initialClientX;\n }\n }\n\n // Min element width in px.\n const minWidth = 64;\n\n // Ensures the element is not wider than the editor and not smaller than a\n // predetermined minimum width.\n if (newWidth < minWidth) {\n setWidth(minWidth);\n } else if (newWidth > editor.domElement.firstElementChild!.clientWidth) {\n setWidth(editor.domElement.firstElementChild!.clientWidth);\n } else {\n setWidth(newWidth);\n }\n };\n // Stops mouse movements from resizing the element and updates the block's\n // `width` prop to the new value.\n const windowMouseUpHandler = (event: MouseEvent) => {\n // Hides the drag handles if the cursor is no longer over the element.\n if (\n (!event.target ||\n !wrapper.contains(event.target as Node) ||\n !editor.isEditable) &&\n wrapper.contains(leftResizeHandle) &&\n wrapper.contains(rightResizeHandle)\n ) {\n wrapper.removeChild(leftResizeHandle);\n wrapper.removeChild(rightResizeHandle);\n }\n\n if (!resizeParams) {\n return;\n }\n\n resizeParams = undefined;\n\n editor.updateBlock(block, {\n props: {\n previewWidth: getWidth(),\n },\n });\n };\n\n // Shows the resize handles when hovering over the element with the cursor.\n const elementMouseEnterHandler = () => {\n if (editor.isEditable) {\n wrapper.appendChild(leftResizeHandle);\n wrapper.appendChild(rightResizeHandle);\n }\n };\n // Hides the resize handles when the cursor leaves the element, unless the\n // cursor moves to one of the resize handles.\n const elementMouseLeaveHandler = (event: MouseEvent) => {\n if (\n event.relatedTarget === leftResizeHandle ||\n event.relatedTarget === rightResizeHandle\n ) {\n return;\n }\n\n if (resizeParams) {\n return;\n }\n\n if (\n editor.isEditable &&\n wrapper.contains(leftResizeHandle) &&\n wrapper.contains(rightResizeHandle)\n ) {\n wrapper.removeChild(leftResizeHandle);\n wrapper.removeChild(rightResizeHandle);\n }\n };\n\n // Sets the resize params, allowing the user to begin resizing the element by\n // moving the cursor left or right.\n const leftResizeHandleMouseDownHandler = (event: MouseEvent) => {\n event.preventDefault();\n\n wrapper.appendChild(leftResizeHandle);\n wrapper.appendChild(rightResizeHandle);\n\n resizeParams = {\n handleUsed: \"left\",\n initialWidth: block.props.previewWidth!,\n initialClientX: event.clientX,\n };\n };\n const rightResizeHandleMouseDownHandler = (event: MouseEvent) => {\n event.preventDefault();\n\n wrapper.appendChild(leftResizeHandle);\n wrapper.appendChild(rightResizeHandle);\n\n resizeParams = {\n handleUsed: \"right\",\n initialWidth: block.props.previewWidth!,\n initialClientX: event.clientX,\n };\n };\n\n wrapper.appendChild(element);\n\n window.addEventListener(\"mousemove\", windowMouseMoveHandler);\n window.addEventListener(\"mouseup\", windowMouseUpHandler);\n element.addEventListener(\"mouseenter\", elementMouseEnterHandler);\n element.addEventListener(\"mouseleave\", elementMouseLeaveHandler);\n leftResizeHandle.addEventListener(\n \"mousedown\",\n leftResizeHandleMouseDownHandler\n );\n rightResizeHandle.addEventListener(\n \"mousedown\",\n rightResizeHandleMouseDownHandler\n );\n\n return {\n dom: wrapper,\n destroy: () => {\n window.removeEventListener(\"mousemove\", windowMouseMoveHandler);\n window.removeEventListener(\"mouseup\", windowMouseUpHandler);\n element.removeEventListener(\"mouseenter\", elementMouseEnterHandler);\n element.removeEventListener(\"mouseleave\", elementMouseLeaveHandler);\n leftResizeHandle.removeEventListener(\n \"mousedown\",\n leftResizeHandleMouseDownHandler\n );\n rightResizeHandle.removeEventListener(\n \"mousedown\",\n rightResizeHandleMouseDownHandler\n );\n },\n };\n};\n","export const parseAudioElement = (audioElement: HTMLAudioElement) => {\n const url = audioElement.src || undefined;\n\n return { url };\n};\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n createBlockSpec,\n FileBlockConfig,\n Props,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nimport {\n createFigureWithCaption,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n parseFigureElement,\n} from \"../FileBlockContent/fileBlockHelpers.js\";\nimport { parseAudioElement } from \"./audioBlockHelpers.js\";\n\nexport const FILE_AUDIO_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z\"></path></svg>';\n\nexport const audioPropSchema = {\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n\n showPreview: {\n default: true,\n },\n} satisfies PropSchema;\n\nexport const audioBlockConfig = {\n type: \"audio\" as const,\n propSchema: audioPropSchema,\n content: \"none\",\n isFileBlock: true,\n fileBlockAccept: [\"audio/*\"],\n} satisfies FileBlockConfig;\n\nexport const audioRender = (\n block: BlockFromConfig<typeof audioBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const icon = document.createElement(\"div\");\n icon.innerHTML = FILE_AUDIO_ICON_SVG;\n\n const audio = document.createElement(\"audio\");\n audio.className = \"bn-audio\";\n editor.resolveFileUrl(block.props.url).then((downloadUrl) => {\n audio.src = downloadUrl;\n });\n audio.controls = true;\n audio.contentEditable = \"false\";\n audio.draggable = false;\n\n const element = createFileAndCaptionWrapper(block, audio);\n\n return createFileBlockWrapper(\n block,\n editor,\n element,\n editor.dictionary.file_blocks.audio.add_button_text,\n icon.firstElementChild as HTMLElement\n );\n};\n\nexport const audioParse = (\n element: HTMLElement\n): Partial<Props<typeof audioBlockConfig.propSchema>> | undefined => {\n if (element.tagName === \"AUDIO\") {\n return parseAudioElement(element as HTMLAudioElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"audio\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseAudioElement(targetElement as HTMLAudioElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const audioToExternalHTML = (\n block: BlockFromConfig<typeof audioBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add audio\";\n\n return {\n dom: div,\n };\n }\n\n let audio;\n if (block.props.showPreview) {\n audio = document.createElement(\"audio\");\n audio.src = block.props.url;\n } else {\n audio = document.createElement(\"a\");\n audio.href = block.props.url;\n audio.textContent = block.props.name || block.props.url;\n }\n\n if (block.props.caption) {\n if (block.props.showPreview) {\n return createFigureWithCaption(audio, block.props.caption);\n } else {\n return createLinkWithCaption(audio, block.props.caption);\n }\n }\n\n return {\n dom: audio,\n };\n};\n\nexport const AudioBlock = createBlockSpec(audioBlockConfig, {\n render: audioRender,\n parse: audioParse,\n toExternalHTML: audioToExternalHTML,\n});\n","import { bundledLanguagesInfo } from \"shiki/bundle/web\";\n\nexport type SupportedLanguageConfig = {\n id: string;\n name: string;\n match: string[];\n};\n\nexport const defaultSupportedLanguages: SupportedLanguageConfig[] = [\n {\n id: \"text\",\n name: \"Plain Text\",\n match: [\"text\", \"txt\", \"plain\"],\n },\n ...bundledLanguagesInfo\n .filter((lang) => {\n return ![\n \"angular-html\",\n \"angular-ts\",\n \"astro\",\n \"blade\",\n \"coffee\",\n \"handlebars\",\n \"html-derivative\",\n \"http\",\n \"imba\",\n \"jinja\",\n \"jison\",\n \"json5\",\n \"marko\",\n \"mdc\",\n \"stylus\",\n \"ts-tags\",\n ].includes(lang.id);\n })\n .map((lang) => ({\n match: [lang.id, ...(lang.aliases || [])],\n id: lang.id,\n name: lang.name,\n })),\n {\n id: \"haskell\",\n name: \"Haskell\",\n match: [\"haskell\", \"hs\"],\n },\n {\n id: \"csharp\",\n name: \"C#\",\n match: [\"c#\", \"csharp\", \"cs\"],\n },\n {\n id: \"latex\",\n name: \"LaTeX\",\n match: [\"latex\"],\n },\n {\n id: \"lua\",\n name: \"Lua\",\n match: [\"lua\"],\n },\n {\n id: \"mermaid\",\n name: \"Mermaid\",\n match: [\"mermaid\", \"mmd\"],\n },\n {\n id: \"ruby\",\n name: \"Ruby\",\n match: [\"ruby\", \"rb\"],\n },\n {\n id: \"rust\",\n name: \"Rust\",\n match: [\"rust\", \"rs\"],\n },\n {\n id: \"scala\",\n name: \"Scala\",\n match: [\"scala\"],\n },\n {\n id: \"swift\",\n name: \"Swift\",\n match: [\"swift\"],\n },\n {\n id: \"kotlin\",\n name: \"Kotlin\",\n match: [\"kotlin\", \"kt\", \"kts\"],\n },\n {\n id: \"objective-c\",\n name: \"Objective C\",\n match: [\"objective-c\", \"objc\"],\n },\n];\n","import { InputRule, isTextSelection } from \"@tiptap/core\";\nimport { TextSelection } from \"@tiptap/pm/state\";\nimport { createHighlightPlugin, Parser } from \"prosemirror-highlight\";\nimport { createParser } from \"prosemirror-highlight/shiki\";\nimport {\n BundledLanguage,\n bundledLanguagesInfo,\n createHighlighter,\n Highlighter,\n} from \"shiki\";\nimport {\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport {\n defaultSupportedLanguages,\n SupportedLanguageConfig,\n} from \"./defaultSupportedLanguages.js\";\n\ninterface CodeBlockOptions {\n defaultLanguage: string;\n indentLineWithTab: boolean;\n supportedLanguages: SupportedLanguageConfig[];\n}\n\nexport const defaultCodeBlockPropSchema = {\n language: {\n default: \"javascript\",\n values: [...defaultSupportedLanguages.map((lang) => lang.id)],\n },\n} satisfies PropSchema;\n\nconst CodeBlockContent = createStronglyTypedTiptapNode({\n name: \"codeBlock\",\n content: \"inline*\",\n group: \"blockContent\",\n marks: \"\",\n code: true,\n defining: true,\n addOptions() {\n return {\n defaultLanguage: \"javascript\",\n indentLineWithTab: true,\n supportedLanguages: defaultSupportedLanguages,\n };\n },\n addAttributes() {\n return {\n language: {\n default: this.options.defaultLanguage,\n parseHTML: (inputElement) => {\n let element = inputElement as HTMLElement | null;\n\n if (\n element?.tagName === \"DIV\" &&\n element?.dataset.contentType === \"codeBlock\"\n ) {\n element = element.children[0] as HTMLElement | null;\n }\n\n if (element?.tagName === \"PRE\") {\n element = element?.children[0] as HTMLElement | null;\n }\n\n const dataLanguage = element?.getAttribute(\"data-language\");\n\n if (dataLanguage) {\n return dataLanguage.toLowerCase();\n }\n\n const classNames = [...(element?.className.split(\" \") || [])];\n const languages = classNames\n .filter((className) => className.startsWith(\"language-\"))\n .map((className) => className.replace(\"language-\", \"\"));\n const [language] = languages;\n\n if (!language) {\n return null;\n }\n\n return language.toLowerCase();\n },\n renderHTML: (attributes) => {\n return attributes.language && attributes.language !== \"text\"\n ? {\n class: `language-${attributes.language}`,\n }\n : {};\n },\n },\n };\n },\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\",\n },\n {\n tag: \"pre\",\n preserveWhitespace: \"full\",\n },\n ];\n },\n renderHTML({ HTMLAttributes }) {\n const pre = document.createElement(\"pre\");\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"code\",\n this.options.domAttributes?.blockContent || {},\n {\n ...(this.options.domAttributes?.inlineContent || {}),\n ...HTMLAttributes,\n }\n );\n\n dom.removeChild(contentDOM);\n dom.appendChild(pre);\n pre.appendChild(contentDOM);\n\n return {\n dom,\n contentDOM,\n };\n },\n addNodeView() {\n const supportedLanguages = this.options\n .supportedLanguages as SupportedLanguageConfig[];\n\n return ({ editor, node, getPos, HTMLAttributes }) => {\n const pre = document.createElement(\"pre\");\n const select = document.createElement(\"select\");\n const selectWrapper = document.createElement(\"div\");\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"code\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n const handleLanguageChange = (event: Event) => {\n const language = (event.target as HTMLSelectElement).value;\n\n editor.commands.command(({ tr }) => {\n tr.setNodeAttribute(getPos(), \"language\", language);\n\n return true;\n });\n };\n\n supportedLanguages.forEach(({ id, name }) => {\n const option = document.createElement(\"option\");\n\n option.value = id;\n option.text = name;\n select.appendChild(option);\n });\n\n selectWrapper.contentEditable = \"false\";\n select.value = node.attrs.language || this.options.defaultLanguage;\n dom.removeChild(contentDOM);\n dom.appendChild(selectWrapper);\n dom.appendChild(pre);\n pre.appendChild(contentDOM);\n selectWrapper.appendChild(select);\n select.addEventListener(\"change\", handleLanguageChange);\n\n return {\n dom,\n contentDOM,\n update: (newNode) => {\n if (newNode.type !== this.type) {\n return false;\n }\n\n return true;\n },\n destroy: () => {\n select.removeEventListener(\"change\", handleLanguageChange);\n },\n };\n };\n },\n addProseMirrorPlugins() {\n let highlighter: Highlighter | undefined;\n let parser: Parser | undefined;\n\n const supportedLanguages = this.options\n .supportedLanguages as SupportedLanguageConfig[];\n const lazyParser: Parser = (options) => {\n if (!highlighter) {\n return createHighlighter({\n themes: [\"github-dark\"],\n langs: [],\n }).then((createdHighlighter) => {\n highlighter = createdHighlighter;\n });\n }\n\n const language = options.language;\n\n if (\n language &&\n language !== \"text\" &&\n !highlighter.getLoadedLanguages().includes(language) &&\n supportedLanguages.find(({ id }) => id === language) &&\n bundledLanguagesInfo.find(({ id }) => id === language)\n ) {\n return highlighter.loadLanguage(language as BundledLanguage);\n }\n\n if (!parser) {\n parser = createParser(highlighter);\n }\n\n return parser(options);\n };\n\n const shikiLazyPlugin = createHighlightPlugin({\n parser: lazyParser,\n languageExtractor: (node) => node.attrs.language,\n nodeTypes: [this.name],\n });\n\n return [shikiLazyPlugin];\n },\n addInputRules() {\n const supportedLanguages = this.options\n .supportedLanguages as SupportedLanguageConfig[];\n\n return [\n new InputRule({\n find: /^```(.*?)\\s$/,\n handler: ({ state, range, match }) => {\n const $start = state.doc.resolve(range.from);\n const languageName = match[1].trim();\n const attributes = {\n language:\n supportedLanguages.find(({ match }) => {\n return match.includes(languageName);\n })?.id || this.options.defaultLanguage,\n };\n\n if (\n !$start\n .node(-1)\n .canReplaceWith(\n $start.index(-1),\n $start.indexAfter(-1),\n this.type\n )\n ) {\n return null;\n }\n\n state.tr\n .delete(range.from, range.to)\n .setBlockType(range.from, range.from, this.type, attributes)\n .setSelection(TextSelection.create(state.tr.doc, range.from));\n\n return;\n },\n }),\n ];\n },\n addKeyboardShortcuts() {\n return {\n Delete: ({ editor }) => {\n const { selection } = editor.state;\n const { $from } = selection;\n\n // When inside empty codeblock, on `DELETE` key press, delete the codeblock\n if (\n editor.isActive(this.name) &&\n !$from.parent.textContent &&\n isTextSelection(selection)\n ) {\n // Get the start position of the codeblock for node selection\n const from = $from.pos - $from.parentOffset - 2;\n\n editor.chain().setNodeSelection(from).deleteSelection().run();\n\n return true;\n }\n\n return false;\n },\n Tab: ({ editor }) => {\n if (!this.options.indentLineWithTab) {\n return false;\n }\n if (editor.isActive(this.name)) {\n editor.commands.insertContent(\" \");\n return true;\n }\n\n return false;\n },\n Enter: ({ editor }) => {\n const { $from } = editor.state.selection;\n\n if (!editor.isActive(this.name)) {\n return false;\n }\n\n const isAtEnd = $from.parentOffset === $from.parent.nodeSize - 2;\n const endsWithDoubleNewline = $from.parent.textContent.endsWith(\"\\n\\n\");\n\n if (!isAtEnd || !endsWithDoubleNewline) {\n editor.commands.insertContent(\"\\n\");\n return true;\n }\n\n return editor\n .chain()\n .command(({ tr }) => {\n tr.delete($from.pos - 2, $from.pos);\n\n return true;\n })\n .exitCode()\n .run();\n },\n \"Shift-Enter\": ({ editor }) => {\n const { $from } = editor.state.selection;\n\n if (!editor.isActive(this.name)) {\n return false;\n }\n\n editor\n .chain()\n .insertContentAt(\n $from.pos - $from.parentOffset + $from.parent.nodeSize,\n {\n type: \"paragraph\",\n }\n )\n .run();\n\n return true;\n },\n };\n },\n});\n\nexport const CodeBlock = createBlockSpecFromStronglyTypedTiptapNode(\n CodeBlockContent,\n defaultCodeBlockPropSchema\n);\n\nexport function customizeCodeBlock(options: Partial<CodeBlockOptions>) {\n return createBlockSpecFromStronglyTypedTiptapNode(\n CodeBlockContent.configure(options),\n {\n language: {\n default:\n options.defaultLanguage ||\n defaultCodeBlockPropSchema.language.default,\n values:\n options.supportedLanguages?.map((lang) => lang.id) ||\n defaultCodeBlockPropSchema.language.values,\n },\n }\n );\n}\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n FileBlockConfig,\n PropSchema,\n createBlockSpec,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\nimport {\n createDefaultFilePreview,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n parseEmbedElement,\n parseFigureElement,\n} from \"./fileBlockHelpers.js\";\n\nexport const filePropSchema = {\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n} satisfies PropSchema;\n\nexport const fileBlockConfig = {\n type: \"file\" as const,\n propSchema: filePropSchema,\n content: \"none\",\n isFileBlock: true,\n} satisfies FileBlockConfig;\n\nexport const fileRender = (\n block: BlockFromConfig<typeof fileBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const file = createDefaultFilePreview(block).dom;\n const element = createFileAndCaptionWrapper(block, file);\n\n return createFileBlockWrapper(block, editor, element);\n};\n\nexport const fileParse = (element: HTMLElement) => {\n if (element.tagName === \"EMBED\") {\n return parseEmbedElement(element as HTMLEmbedElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"embed\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseEmbedElement(targetElement as HTMLEmbedElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const fileToExternalHTML = (\n block: BlockFromConfig<typeof fileBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add file\";\n\n return {\n dom: div,\n };\n }\n\n const fileSrcLink = document.createElement(\"a\");\n fileSrcLink.href = block.props.url;\n fileSrcLink.textContent = block.props.name || block.props.url;\n\n if (block.props.caption) {\n return createLinkWithCaption(fileSrcLink, block.props.caption);\n }\n\n return {\n dom: fileSrcLink,\n };\n};\n\nexport const FileBlock = createBlockSpec(fileBlockConfig, {\n render: fileRender,\n parse: fileParse,\n toExternalHTML: fileToExternalHTML,\n});\n","/**\n * Uploads a file to tmpfiles.org and returns the URL to the uploaded file.\n *\n * @warning This function should only be used for development purposes, replace with your own backend!\n */\nexport const uploadToTmpFilesDotOrg_DEV_ONLY = async (\n file: File\n): Promise<string> => {\n const body = new FormData();\n body.append(\"file\", file);\n\n const ret = await fetch(\"https://tmpfiles.org/api/v1/upload\", {\n method: \"POST\",\n body: body,\n });\n return (await ret.json()).data.url.replace(\n \"tmpfiles.org/\",\n \"tmpfiles.org/dl/\"\n );\n};\n","export const parseImageElement = (imageElement: HTMLImageElement) => {\n const url = imageElement.src || undefined;\n const previewWidth = imageElement.width || undefined;\n\n return { url, previewWidth };\n};\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n createBlockSpec,\n FileBlockConfig,\n Props,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\nimport {\n createFigureWithCaption,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n createResizeHandlesWrapper,\n parseFigureElement,\n} from \"../FileBlockContent/fileBlockHelpers.js\";\nimport { parseImageElement } from \"./imageBlockHelpers.js\";\n\nexport const FILE_IMAGE_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z\"></path></svg>';\n\nexport const imagePropSchema = {\n textAlignment: defaultProps.textAlignment,\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n\n showPreview: {\n default: true,\n },\n // File preview width in px.\n previewWidth: {\n default: 512,\n },\n} satisfies PropSchema;\n\nexport const imageBlockConfig = {\n type: \"image\" as const,\n propSchema: imagePropSchema,\n content: \"none\",\n isFileBlock: true,\n fileBlockAccept: [\"image/*\"],\n} satisfies FileBlockConfig;\n\nexport const imageRender = (\n block: BlockFromConfig<typeof imageBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const icon = document.createElement(\"div\");\n icon.innerHTML = FILE_IMAGE_ICON_SVG;\n\n const image = document.createElement(\"img\");\n image.className = \"bn-visual-media\";\n editor.resolveFileUrl(block.props.url).then((downloadUrl) => {\n image.src = downloadUrl;\n });\n image.alt = block.props.name || block.props.caption || \"BlockNote image\";\n image.contentEditable = \"false\";\n image.draggable = false;\n image.width = Math.min(\n block.props.previewWidth,\n editor.domElement.firstElementChild!.clientWidth\n );\n\n const file = createResizeHandlesWrapper(\n block,\n editor,\n image,\n () => image.width,\n (width) => (image.width = width)\n );\n\n const element = createFileAndCaptionWrapper(block, file.dom);\n\n return createFileBlockWrapper(\n block,\n editor,\n element,\n editor.dictionary.file_blocks.image.add_button_text,\n icon.firstElementChild as HTMLElement\n );\n};\n\nexport const imageParse = (\n element: HTMLElement\n): Partial<Props<typeof imageBlockConfig.propSchema>> | undefined => {\n if (element.tagName === \"IMG\") {\n return parseImageElement(element as HTMLImageElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"img\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseImageElement(targetElement as HTMLImageElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const imageToExternalHTML = (\n block: BlockFromConfig<typeof imageBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add image\";\n\n return {\n dom: div,\n };\n }\n\n let image;\n if (block.props.showPreview) {\n image = document.createElement(\"img\");\n image.src = block.props.url;\n image.alt = block.props.name || block.props.caption || \"BlockNote image\";\n image.width = block.props.previewWidth;\n } else {\n image = document.createElement(\"a\");\n image.href = block.props.url;\n image.textContent = block.props.name || block.props.url;\n }\n\n if (block.props.caption) {\n if (block.props.showPreview) {\n return createFigureWithCaption(image, block.props.caption);\n } else {\n return createLinkWithCaption(image, block.props.caption);\n }\n }\n\n return {\n dom: image,\n };\n};\n\nexport const ImageBlock = createBlockSpec(imageBlockConfig, {\n render: imageRender,\n parse: imageParse,\n toExternalHTML: imageToExternalHTML,\n});\n","import { callOrReturn, Extension, getExtensionField } from \"@tiptap/core\";\nimport { columnResizing, tableEditing } from \"prosemirror-tables\";\n\nexport const RESIZE_MIN_WIDTH = 35;\nexport const EMPTY_CELL_WIDTH = 120;\nexport const EMPTY_CELL_HEIGHT = 31;\n\nexport const TableExtension = Extension.create({\n name: \"BlockNoteTableExtension\",\n\n addProseMirrorPlugins: () => {\n return [\n columnResizing({\n cellMinWidth: RESIZE_MIN_WIDTH,\n defaultCellMinWidth: EMPTY_CELL_WIDTH,\n // We set this to null as we implement our own node view in the table\n // block content. This node view is the same as what's used by default,\n // but is wrapped in a `blockContent` HTML element.\n View: null,\n }),\n tableEditing(),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n // Makes enter create a new line within the cell.\n Enter: () => {\n if (\n this.editor.state.selection.empty &&\n this.editor.state.selection.$head.parent.type.name ===\n \"tableParagraph\"\n ) {\n this.editor.commands.setHardBreak();\n\n return true;\n }\n\n return false;\n },\n // Ensures that backspace won't delete the table if the text cursor is at\n // the start of a cell and the selection is empty.\n Backspace: () => {\n const selection = this.editor.state.selection;\n const selectionIsEmpty = selection.empty;\n const selectionIsAtStartOfNode = selection.$head.parentOffset === 0;\n const selectionIsInTableParagraphNode =\n selection.$head.node().type.name === \"tableParagraph\";\n\n return (\n selectionIsEmpty &&\n selectionIsAtStartOfNode &&\n selectionIsInTableParagraphNode\n );\n },\n };\n },\n\n extendNodeSchema(extension) {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n };\n\n return {\n tableRole: callOrReturn(\n getExtensionField(extension, \"tableRole\", context)\n ),\n };\n },\n});\n","export const parseVideoElement = (videoElement: HTMLVideoElement) => {\n const url = videoElement.src || undefined;\n const previewWidth = videoElement.width || undefined;\n\n return { url, previewWidth };\n};\n","import type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n createBlockSpec,\n FileBlockConfig,\n Props,\n PropSchema,\n} from \"../../schema/index.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nimport {\n createFigureWithCaption,\n createFileAndCaptionWrapper,\n createFileBlockWrapper,\n createLinkWithCaption,\n createResizeHandlesWrapper,\n parseFigureElement,\n} from \"../FileBlockContent/fileBlockHelpers.js\";\nimport { parseVideoElement } from \"./videoBlockHelpers.js\";\n\nexport const FILE_VIDEO_ICON_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z\"></path></svg>';\n\nexport const videoPropSchema = {\n textAlignment: defaultProps.textAlignment,\n backgroundColor: defaultProps.backgroundColor,\n // File name.\n name: {\n default: \"\" as const,\n },\n // File url.\n url: {\n default: \"\" as const,\n },\n // File caption.\n caption: {\n default: \"\" as const,\n },\n\n showPreview: {\n default: true,\n },\n // File preview width in px.\n previewWidth: {\n default: 512,\n },\n} satisfies PropSchema;\n\nexport const videoBlockConfig = {\n type: \"video\" as const,\n propSchema: videoPropSchema,\n content: \"none\",\n isFileBlock: true,\n fileBlockAccept: [\"video/*\"],\n} satisfies FileBlockConfig;\n\nexport const videoRender = (\n block: BlockFromConfig<typeof videoBlockConfig, any, any>,\n editor: BlockNoteEditor<any, any, any>\n) => {\n const icon = document.createElement(\"div\");\n icon.innerHTML = FILE_VIDEO_ICON_SVG;\n\n const video = document.createElement(\"video\");\n video.className = \"bn-visual-media\";\n video.src = block.props.url;\n video.controls = true;\n video.contentEditable = \"false\";\n video.draggable = false;\n video.width = Math.min(\n block.props.previewWidth,\n editor.domElement.firstElementChild!.clientWidth\n );\n\n const file = createResizeHandlesWrapper(\n block,\n editor,\n video,\n () => video.width,\n (width) => (video.width = width)\n );\n\n const element = createFileAndCaptionWrapper(block, file.dom);\n\n return createFileBlockWrapper(\n block,\n editor,\n element,\n editor.dictionary.file_blocks.video.add_button_text,\n icon.firstElementChild as HTMLElement\n );\n};\n\nexport const videoParse = (\n element: HTMLElement\n): Partial<Props<typeof videoBlockConfig.propSchema>> | undefined => {\n if (element.tagName === \"VIDEO\") {\n return parseVideoElement(element as HTMLVideoElement);\n }\n\n if (element.tagName === \"FIGURE\") {\n const parsedFigure = parseFigureElement(element, \"video\");\n if (!parsedFigure) {\n return undefined;\n }\n\n const { targetElement, caption } = parsedFigure;\n\n return {\n ...parseVideoElement(targetElement as HTMLVideoElement),\n caption,\n };\n }\n\n return undefined;\n};\n\nexport const videoToExternalHTML = (\n block: BlockFromConfig<typeof videoBlockConfig, any, any>\n) => {\n if (!block.props.url) {\n const div = document.createElement(\"p\");\n div.textContent = \"Add video\";\n\n return {\n dom: div,\n };\n }\n\n let video;\n if (block.props.showPreview) {\n video = document.createElement(\"video\");\n video.src = block.props.url;\n video.width = block.props.previewWidth;\n } else {\n video = document.createElement(\"a\");\n video.href = block.props.url;\n video.textContent = block.props.name || block.props.url;\n }\n\n if (block.props.caption) {\n if (block.props.showPreview) {\n return createFigureWithCaption(video, block.props.caption);\n } else {\n return createLinkWithCaption(video, block.props.caption);\n }\n }\n\n return {\n dom: video,\n };\n};\n\nexport const VideoBlock = createBlockSpec(videoBlockConfig, {\n render: videoRender,\n parse: videoParse,\n toExternalHTML: videoToExternalHTML,\n});\n","import { Mark } from \"@tiptap/core\";\nimport { createStyleSpecFromTipTapMark } from \"../../schema/index.js\";\n\nconst BackgroundColorMark = Mark.create({\n name: \"backgroundColor\",\n\n addAttributes() {\n return {\n stringValue: {\n default: undefined,\n parseHTML: (element) => element.getAttribute(\"data-background-color\"),\n renderHTML: (attributes) => ({\n \"data-background-color\": attributes.stringValue,\n }),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if (element.hasAttribute(\"data-background-color\")) {\n return {\n stringValue: element.getAttribute(\"data-background-color\"),\n };\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"span\", HTMLAttributes, 0];\n },\n});\n\nexport const BackgroundColor = createStyleSpecFromTipTapMark(\n BackgroundColorMark,\n \"string\"\n);\n","import { Mark } from \"@tiptap/core\";\nimport { createStyleSpecFromTipTapMark } from \"../../schema/index.js\";\n\nconst TextColorMark = Mark.create({\n name: \"textColor\",\n\n addAttributes() {\n return {\n stringValue: {\n default: undefined,\n parseHTML: (element) => element.getAttribute(\"data-text-color\"),\n renderHTML: (attributes) => ({\n \"data-text-color\": attributes.stringValue,\n }),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if (element.hasAttribute(\"data-text-color\")) {\n return { stringValue: element.getAttribute(\"data-text-color\") };\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"span\", HTMLAttributes, 0];\n },\n});\n\nexport const TextColor = createStyleSpecFromTipTapMark(TextColorMark, \"string\");\n","import { Fragment, NodeType, Node as PMNode, Slice } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\n\nimport { ReplaceStep } from \"prosemirror-transform\";\nimport { Block, PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport {\n BlockIdentifier,\n BlockSchema,\n} from \"../../../../schema/blocks/types.js\";\nimport { InlineContentSchema } from \"../../../../schema/inlineContent/types.js\";\nimport { StyleSchema } from \"../../../../schema/styles/types.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n BlockInfo,\n getBlockInfoFromResolvedPos,\n} from \"../../../getBlockInfoFromPos.js\";\nimport {\n blockToNode,\n inlineContentToNodes,\n tableContentToNodes,\n} from \"../../../nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\nexport const updateBlockCommand =\n <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n >(\n editor: BlockNoteEditor<BSchema, I, S>,\n posBeforeBlock: number,\n block: PartialBlock<BSchema, I, S>\n ) =>\n ({\n state,\n dispatch,\n }: {\n state: EditorState;\n dispatch: ((args?: any) => any) | undefined;\n }) => {\n const blockInfo = getBlockInfoFromResolvedPos(\n state.doc.resolve(posBeforeBlock)\n );\n\n if (dispatch) {\n // Adds blockGroup node with child blocks if necessary.\n\n const oldNodeType = state.schema.nodes[blockInfo.blockNoteType];\n const newNodeType =\n state.schema.nodes[block.type || blockInfo.blockNoteType];\n const newBnBlockNodeType = newNodeType.isInGroup(\"bnBlock\")\n ? newNodeType\n : state.schema.nodes[\"blockContainer\"];\n\n if (blockInfo.isBlockContainer && newNodeType.isInGroup(\"blockContent\")) {\n updateChildren(block, state, editor, blockInfo);\n // The code below determines the new content of the block.\n // or \"keep\" to keep as-is\n updateBlockContentNode(\n block,\n state,\n editor,\n oldNodeType,\n newNodeType,\n blockInfo\n );\n } else if (\n !blockInfo.isBlockContainer &&\n newNodeType.isInGroup(\"bnBlock\")\n ) {\n updateChildren(block, state, editor, blockInfo);\n // old node was a bnBlock type (like column or columnList) and new block as well\n // No op, we just update the bnBlock below (at end of function) and have already updated the children\n } else {\n // switching from blockContainer to non-blockContainer or v.v.\n // currently breaking for column slash menu items converting empty block\n // to column.\n\n // currently, we calculate the new node and replace the entire node with the desired new node.\n // for this, we do a nodeToBlock on the existing block to get the children.\n // it would be cleaner to use a ReplaceAroundStep, but this is a bit simpler and it's quite an edge case\n const existingBlock = nodeToBlock(\n blockInfo.bnBlock.node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n );\n state.tr.replaceWith(\n blockInfo.bnBlock.beforePos,\n blockInfo.bnBlock.afterPos,\n blockToNode(\n {\n children: existingBlock.children, // if no children are passed in, use existing children\n ...block,\n },\n state.schema,\n editor.schema.styleSchema\n )\n );\n\n return true;\n }\n\n // Adds all provided props as attributes to the parent blockContainer node too, and also preserves existing\n // attributes.\n state.tr.setNodeMarkup(blockInfo.bnBlock.beforePos, newBnBlockNodeType, {\n ...blockInfo.bnBlock.node.attrs,\n ...block.props,\n });\n }\n\n return true;\n };\n\nfunction updateBlockContentNode<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: PartialBlock<BSchema, I, S>,\n state: EditorState,\n editor: BlockNoteEditor<BSchema, I, S>,\n oldNodeType: NodeType,\n newNodeType: NodeType,\n blockInfo: {\n childContainer?:\n | { node: PMNode; beforePos: number; afterPos: number }\n | undefined;\n blockContent: { node: PMNode; beforePos: number; afterPos: number };\n }\n) {\n let content: PMNode[] | \"keep\" = \"keep\";\n\n // Has there been any custom content provided?\n if (block.content) {\n if (typeof block.content === \"string\") {\n // Adds a single text node with no marks to the content.\n content = inlineContentToNodes(\n [block.content],\n state.schema,\n editor.schema.styleSchema\n );\n } else if (Array.isArray(block.content)) {\n // Adds a text node with the provided styles converted into marks to the content,\n // for each InlineContent object.\n content = inlineContentToNodes(\n block.content,\n state.schema,\n editor.schema.styleSchema\n );\n } else if (block.content.type === \"tableContent\") {\n content = tableContentToNodes(\n block.content,\n state.schema,\n editor.schema.styleSchema\n );\n } else {\n throw new UnreachableCaseError(block.content.type);\n }\n } else {\n // no custom content has been provided, use existing content IF possible\n // Since some block types contain inline content and others don't,\n // we either need to call setNodeMarkup to just update type &\n // attributes, or replaceWith to replace the whole blockContent.\n if (oldNodeType.spec.content === \"\") {\n // keep old content, because it's empty anyway and should be compatible with\n // any newContentType\n } else if (newNodeType.spec.content !== oldNodeType.spec.content) {\n // the content type changed, replace the previous content\n content = [];\n } else {\n // keep old content, because the content type is the same and should be compatible\n }\n }\n\n // Now, changes the blockContent node type and adds the provided props\n // as attributes. Also preserves all existing attributes that are\n // compatible with the new type.\n //\n // Use either setNodeMarkup or replaceWith depending on whether the\n // content is being replaced or not.\n if (content === \"keep\") {\n // use setNodeMarkup to only update the type and attributes\n state.tr.setNodeMarkup(\n blockInfo.blockContent.beforePos,\n block.type === undefined ? undefined : state.schema.nodes[block.type],\n {\n ...blockInfo.blockContent.node.attrs,\n ...block.props,\n }\n );\n } else {\n // use replaceWith to replace the content and the block itself\n // also reset the selection since replacing the block content\n // sets it to the next block.\n state.tr.replaceWith(\n blockInfo.blockContent.beforePos,\n blockInfo.blockContent.afterPos,\n newNodeType.createChecked(\n {\n ...blockInfo.blockContent.node.attrs,\n ...block.props,\n },\n content\n )\n );\n }\n}\n\nfunction updateChildren<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: PartialBlock<BSchema, I, S>,\n state: EditorState,\n editor: BlockNoteEditor<BSchema, I, S>,\n blockInfo: BlockInfo\n) {\n if (block.children !== undefined) {\n const childNodes = block.children.map((child) => {\n return blockToNode(child, state.schema, editor.schema.styleSchema);\n });\n\n // Checks if a blockGroup node already exists.\n if (blockInfo.childContainer) {\n // Replaces all child nodes in the existing blockGroup with the ones created earlier.\n\n // use a replacestep to avoid the fitting algorithm\n state.tr.step(\n new ReplaceStep(\n blockInfo.childContainer.beforePos + 1,\n blockInfo.childContainer.afterPos - 1,\n new Slice(Fragment.from(childNodes), 0, 0)\n )\n );\n } else {\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n // Inserts a new blockGroup containing the child nodes created earlier.\n state.tr.insert(\n blockInfo.blockContent.afterPos,\n state.schema.nodes[\"blockGroup\"].createChecked({}, childNodes)\n );\n }\n }\n}\n\nexport function updateBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blockToUpdate: BlockIdentifier,\n update: PartialBlock<BSchema, I, S>\n): Block<BSchema, I, S> {\n const ttEditor = editor._tiptapEditor;\n\n const id =\n typeof blockToUpdate === \"string\" ? blockToUpdate : blockToUpdate.id;\n const { posBeforeNode } = getNodeById(id, ttEditor.state.doc);\n\n ttEditor.commands.command(({ state, dispatch }) => {\n updateBlockCommand(editor, posBeforeNode, update)({ state, dispatch });\n return true;\n });\n\n const blockContainerNode = ttEditor.state.doc\n .resolve(posBeforeNode + 1) // TODO: clean?\n .node();\n\n return nodeToBlock(\n blockContainerNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n );\n}\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nexport const headingPropSchema = {\n ...defaultProps,\n level: { default: 1, values: [1, 2, 3] as const },\n} satisfies PropSchema;\n\nconst HeadingBlockContent = createStronglyTypedTiptapNode({\n name: \"heading\",\n content: \"inline*\",\n group: \"blockContent\",\n addAttributes() {\n return {\n level: {\n default: 1,\n // instead of \"level\" attributes, use \"data-level\"\n parseHTML: (element) => {\n const attr = element.getAttribute(\"data-level\")!;\n const parsed = parseInt(attr);\n if (isFinite(parsed)) {\n return parsed;\n }\n return undefined;\n },\n renderHTML: (attributes) => {\n return {\n \"data-level\": (attributes.level as number).toString(),\n };\n },\n },\n };\n },\n\n addInputRules() {\n return [\n ...[1, 2, 3].map((level) => {\n // Creates a heading of appropriate level when starting with \"#\", \"##\", or \"###\".\n return new InputRule({\n find: new RegExp(`^(#{${level}})\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"heading\",\n props: {\n level: level as any,\n },\n }\n )\n )\n // Removes the \"#\" character(s) used to set the heading.\n .deleteRange({ from: range.from, to: range.to })\n .run();\n },\n });\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n \"Mod-Alt-1\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n // call updateBlockCommand\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"heading\",\n props: {\n level: 1 as any,\n },\n })\n );\n },\n \"Mod-Alt-2\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"heading\",\n props: {\n level: 2 as any,\n },\n })\n );\n },\n \"Mod-Alt-3\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"heading\",\n props: {\n level: 3 as any,\n },\n })\n );\n },\n };\n },\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n return {\n level: element.getAttribute(\"data-level\"),\n };\n },\n },\n {\n tag: \"h1\",\n attrs: { level: 1 },\n node: \"heading\",\n },\n {\n tag: \"h2\",\n attrs: { level: 2 },\n node: \"heading\",\n },\n {\n tag: \"h3\",\n attrs: { level: 3 },\n node: \"heading\",\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n `h${node.attrs.level}`,\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const Heading = createBlockSpecFromStronglyTypedTiptapNode(\n HeadingBlockContent,\n headingPropSchema\n);\n","import { EditorState } from \"prosemirror-state\";\n\nimport {\n getBlockInfo,\n getNearestBlockPos,\n} from \"../../../getBlockInfoFromPos.js\";\n\nexport const splitBlockCommand = (\n posInBlock: number,\n keepType?: boolean,\n keepProps?: boolean\n) => {\n return ({\n state,\n dispatch,\n }: {\n state: EditorState;\n dispatch: ((args?: any) => any) | undefined;\n }) => {\n const nearestBlockContainerPos = getNearestBlockPos(state.doc, posInBlock);\n\n const info = getBlockInfo(nearestBlockContainerPos);\n\n if (!info.isBlockContainer) {\n throw new Error(\n `BlockContainer expected when calling splitBlock, position ${posInBlock}`\n );\n }\n\n const types = [\n {\n type: info.bnBlock.node.type, // always keep blockcontainer type\n attrs: keepProps ? { ...info.bnBlock.node.attrs, id: undefined } : {},\n },\n {\n type: keepType\n ? info.blockContent.node.type\n : state.schema.nodes[\"paragraph\"],\n attrs: keepProps ? { ...info.blockContent.node.attrs } : {},\n },\n ];\n\n if (dispatch) {\n state.tr.split(posInBlock, 2, types);\n }\n\n return true;\n };\n};\n","import { splitBlockCommand } from \"../../api/blockManipulation/commands/splitBlock/splitBlock.js\";\nimport { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nexport const handleEnter = (editor: BlockNoteEditor<any, any, any>) => {\n const ttEditor = editor._tiptapEditor;\n const blockInfo = getBlockInfoFromSelection(ttEditor.state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const { bnBlock: blockContainer, blockContent } = blockInfo;\n\n const selectionEmpty =\n ttEditor.state.selection.anchor === ttEditor.state.selection.head;\n\n if (\n !(\n blockContent.node.type.name === \"bulletListItem\" ||\n blockContent.node.type.name === \"numberedListItem\" ||\n blockContent.node.type.name === \"checkListItem\"\n ) ||\n !selectionEmpty\n ) {\n return false;\n }\n\n return ttEditor.commands.first(({ state, chain, commands }) => [\n () =>\n // Changes list item block to a paragraph block if the content is empty.\n commands.command(() => {\n if (blockContent.node.childCount === 0) {\n return commands.command(\n updateBlockCommand(editor, blockContainer.beforePos, {\n type: \"paragraph\",\n props: {},\n })\n );\n }\n\n return false;\n }),\n\n () =>\n // Splits the current block, moving content inside that's after the cursor\n // to a new block of the same type below.\n commands.command(() => {\n if (blockContent.node.childCount > 0) {\n chain()\n .deleteSelection()\n .command(splitBlockCommand(state.selection.from, true))\n .run();\n\n return true;\n }\n\n return false;\n }),\n ]);\n};\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../../defaultProps.js\";\nimport { handleEnter } from \"../ListItemKeyboardShortcuts.js\";\n\nexport const bulletListItemPropSchema = {\n ...defaultProps,\n} satisfies PropSchema;\n\nconst BulletListItemBlockContent = createStronglyTypedTiptapNode({\n name: \"bulletListItem\",\n content: \"inline*\",\n group: \"blockContent\",\n // This is to make sure that check list parse rules run before, since they\n // both parse `li` elements but check lists are more specific.\n priority: 90,\n addInputRules() {\n return [\n // Creates an unordered list when starting with \"-\", \"+\", or \"*\".\n new InputRule({\n find: new RegExp(`^[-+*]\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"bulletListItem\",\n props: {},\n }\n )\n )\n // Removes the \"-\", \"+\", or \"*\" character used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => handleEnter(this.options.editor),\n \"Mod-Shift-8\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"bulletListItem\",\n props: {},\n })\n );\n },\n };\n },\n\n parseHTML() {\n return [\n // Case for regular HTML list structure.\n {\n tag: \"div[data-content-type=\" + this.name + \"]\", // TODO: remove if we can't come up with test case that needs this\n },\n {\n tag: \"li\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (\n parent.tagName === \"UL\" ||\n (parent.tagName === \"DIV\" && parent.parentElement!.tagName === \"UL\")\n ) {\n return {};\n }\n\n return false;\n },\n node: \"bulletListItem\",\n },\n // Case for BlockNote list structure.\n {\n tag: \"p\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (parent.getAttribute(\"data-content-type\") === \"bulletListItem\") {\n return {};\n }\n\n return false;\n },\n priority: 300,\n node: \"bulletListItem\",\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n // We use a <p> tag, because for <li> tags we'd need a <ul> element to put\n // them in to be semantically correct, which we can't have due to the\n // schema.\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const BulletListItem = createBlockSpecFromStronglyTypedTiptapNode(\n BulletListItemBlockContent,\n bulletListItemPropSchema\n);\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport {\n getBlockInfoFromSelection,\n getNearestBlockPos,\n} from \"../../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../../defaultProps.js\";\nimport { handleEnter } from \"../ListItemKeyboardShortcuts.js\";\n\nexport const checkListItemPropSchema = {\n ...defaultProps,\n checked: {\n default: false,\n },\n} satisfies PropSchema;\n\nconst checkListItemBlockContent = createStronglyTypedTiptapNode({\n name: \"checkListItem\",\n content: \"inline*\",\n group: \"blockContent\",\n addAttributes() {\n return {\n checked: {\n default: false,\n // instead of \"checked\" attributes, use \"data-checked\"\n parseHTML: (element) =>\n element.getAttribute(\"data-checked\") === \"true\" || undefined,\n renderHTML: (attributes) => {\n return attributes.checked\n ? {\n \"data-checked\": (attributes.checked as boolean).toString(),\n }\n : {};\n },\n },\n };\n },\n\n addInputRules() {\n return [\n // Creates a checklist when starting with \"[]\" or \"[X]\".\n new InputRule({\n find: new RegExp(`\\\\[\\\\s*\\\\]\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"checkListItem\",\n props: {\n checked: false as any,\n },\n }\n )\n )\n // Removes the characters used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n new InputRule({\n find: new RegExp(`\\\\[[Xx]\\\\]\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"checkListItem\",\n props: {\n checked: true as any,\n },\n }\n )\n )\n // Removes the characters used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => handleEnter(this.options.editor),\n \"Mod-Shift-9\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"checkListItem\",\n props: {},\n })\n );\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\", // TODO: remove if we can't come up with test case that needs this\n },\n // Checkbox only.\n {\n tag: \"input\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if ((element as HTMLInputElement).type === \"checkbox\") {\n return { checked: (element as HTMLInputElement).checked };\n }\n\n return false;\n },\n node: \"checkListItem\",\n },\n // Container element for checkbox + label.\n {\n tag: \"li\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (\n parent.tagName === \"UL\" ||\n (parent.tagName === \"DIV\" && parent.parentElement!.tagName === \"UL\")\n ) {\n const checkbox =\n (element.querySelector(\n \"input[type=checkbox]\"\n ) as HTMLInputElement) || null;\n\n if (checkbox === null) {\n return false;\n }\n\n return { checked: checkbox.checked };\n }\n\n return false;\n },\n node: \"checkListItem\",\n },\n ];\n },\n\n // Since there is no HTML checklist element, there isn't really any\n // standardization for what checklists should look like in the DOM. GDocs'\n // and Notion's aren't cross compatible, for example. This implementation\n // has a semantically correct DOM structure (though missing a label for the\n // checkbox) which is also converted correctly to Markdown by remark.\n renderHTML({ node, HTMLAttributes }) {\n const checkbox = document.createElement(\"input\");\n checkbox.type = \"checkbox\";\n checkbox.checked = node.attrs.checked;\n if (node.attrs.checked) {\n checkbox.setAttribute(\"checked\", \"\");\n }\n\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n\n dom.insertBefore(checkbox, contentDOM);\n\n return { dom, contentDOM };\n },\n\n // Need to render node view since the checkbox needs to be able to update the\n // node. This is only possible with a node view as it exposes `getPos`.\n addNodeView() {\n return ({ node, getPos, editor, HTMLAttributes }) => {\n // Need to wrap certain elements in a div or keyboard navigation gets\n // confused.\n const wrapper = document.createElement(\"div\");\n const checkboxWrapper = document.createElement(\"div\");\n checkboxWrapper.contentEditable = \"false\";\n\n const checkbox = document.createElement(\"input\");\n checkbox.type = \"checkbox\";\n checkbox.checked = node.attrs.checked;\n if (node.attrs.checked) {\n checkbox.setAttribute(\"checked\", \"\");\n }\n\n const changeHandler = () => {\n if (!editor.isEditable) {\n // This seems like the most effective way of blocking the checkbox\n // from being toggled, as event.preventDefault() does not stop it for\n // \"click\" or \"change\" events.\n checkbox.checked = !checkbox.checked;\n return;\n }\n\n // TODO: test\n if (typeof getPos !== \"boolean\") {\n const beforeBlockContainerPos = getNearestBlockPos(\n editor.state.doc,\n getPos()\n );\n\n if (beforeBlockContainerPos.node.type.name !== \"blockContainer\") {\n throw new Error(\n `Expected blockContainer node, got ${beforeBlockContainerPos.node.type.name}`\n );\n }\n\n this.editor.commands.command(\n updateBlockCommand(\n this.options.editor,\n beforeBlockContainerPos.posBeforeNode,\n {\n type: \"checkListItem\",\n props: {\n checked: checkbox.checked as any,\n },\n }\n )\n );\n }\n };\n checkbox.addEventListener(\"change\", changeHandler);\n\n const { dom, contentDOM } = createDefaultBlockDOMOutputSpec(\n this.name,\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n\n if (typeof getPos !== \"boolean\") {\n // Since `node` is a blockContent node, we have to get the block ID from\n // the parent blockContainer node. This means we can't add the label in\n // `renderHTML` as we can't use `getPos` and therefore can't get the\n // parent blockContainer node.\n const blockID = this.editor.state.doc.resolve(getPos()).node().attrs.id;\n const label = \"label-\" + blockID;\n checkbox.setAttribute(\"aria-labelledby\", label);\n contentDOM.id = label;\n }\n\n dom.removeChild(contentDOM);\n dom.appendChild(wrapper);\n wrapper.appendChild(checkboxWrapper);\n wrapper.appendChild(contentDOM);\n checkboxWrapper.appendChild(checkbox);\n\n return {\n dom,\n contentDOM,\n destroy: () => {\n checkbox.removeEventListener(\"change\", changeHandler);\n },\n };\n };\n },\n});\n\nexport const CheckListItem = createBlockSpecFromStronglyTypedTiptapNode(\n checkListItemBlockContent,\n checkListItemPropSchema\n);\n","import { Plugin, PluginKey } from \"prosemirror-state\";\nimport { getBlockInfo } from \"../../../api/getBlockInfoFromPos.js\";\n\n// ProseMirror Plugin which automatically assigns indices to ordered list items per nesting level.\nconst PLUGIN_KEY = new PluginKey(`numbered-list-indexing`);\nexport const NumberedListIndexingPlugin = () => {\n return new Plugin({\n key: PLUGIN_KEY,\n appendTransaction: (_transactions, _oldState, newState) => {\n const tr = newState.tr;\n tr.setMeta(\"numberedListIndexing\", true);\n\n let modified = false;\n\n // Traverses each node the doc using DFS, so blocks which are on the same nesting level will be traversed in the\n // same order they appear. This means the index of each list item block can be calculated by incrementing the\n // index of the previous list item block.\n newState.doc.descendants((node, pos) => {\n if (\n node.type.name === \"blockContainer\" &&\n node.firstChild!.type.name === \"numberedListItem\"\n ) {\n let newIndex = \"1\";\n\n const blockInfo = getBlockInfo({\n posBeforeNode: pos,\n node,\n });\n\n if (!blockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n\n // Checks if this block is the start of a new ordered list, i.e. if it's the first block in the document, the\n // first block in its nesting level, or the previous block is not an ordered list item.\n\n const prevBlock = tr.doc.resolve(\n blockInfo.bnBlock.beforePos\n ).nodeBefore;\n\n if (prevBlock) {\n const prevBlockInfo = getBlockInfo({\n posBeforeNode: blockInfo.bnBlock.beforePos - prevBlock.nodeSize,\n node: prevBlock,\n });\n\n const isPrevBlockOrderedListItem =\n prevBlockInfo.blockNoteType === \"numberedListItem\";\n\n if (isPrevBlockOrderedListItem) {\n if (!prevBlockInfo.isBlockContainer) {\n throw new Error(\"impossible\");\n }\n const prevBlockIndex =\n prevBlockInfo.blockContent.node.attrs[\"index\"];\n\n newIndex = (parseInt(prevBlockIndex) + 1).toString();\n }\n }\n\n const contentNode = blockInfo.blockContent.node;\n const index = contentNode.attrs[\"index\"];\n\n if (index !== newIndex) {\n modified = true;\n\n tr.setNodeMarkup(blockInfo.blockContent.beforePos, undefined, {\n ...contentNode.attrs,\n index: newIndex,\n });\n }\n }\n });\n\n return modified ? tr : null;\n },\n });\n};\n","import { InputRule } from \"@tiptap/core\";\nimport { updateBlockCommand } from \"../../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../../api/getBlockInfoFromPos.js\";\nimport {\n PropSchema,\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../../defaultProps.js\";\nimport { handleEnter } from \"../ListItemKeyboardShortcuts.js\";\nimport { NumberedListIndexingPlugin } from \"./NumberedListIndexingPlugin.js\";\n\nexport const numberedListItemPropSchema = {\n ...defaultProps,\n} satisfies PropSchema;\n\nconst NumberedListItemBlockContent = createStronglyTypedTiptapNode({\n name: \"numberedListItem\",\n content: \"inline*\",\n group: \"blockContent\",\n priority: 90,\n addAttributes() {\n return {\n index: {\n default: null,\n parseHTML: (element) => element.getAttribute(\"data-index\"),\n renderHTML: (attributes) => {\n return {\n \"data-index\": attributes.index,\n };\n },\n },\n };\n },\n\n addInputRules() {\n return [\n // Creates an ordered list when starting with \"1.\".\n new InputRule({\n find: new RegExp(`^1\\\\.\\\\s$`),\n handler: ({ state, chain, range }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return;\n }\n\n chain()\n .command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"numberedListItem\",\n props: {},\n }\n )\n )\n // Removes the \"1.\" characters used to set the list.\n .deleteRange({ from: range.from, to: range.to });\n },\n }),\n ];\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => handleEnter(this.options.editor),\n \"Mod-Shift-7\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"numberedListItem\",\n props: {},\n })\n );\n },\n };\n },\n\n addProseMirrorPlugins() {\n return [NumberedListIndexingPlugin()];\n },\n\n parseHTML() {\n return [\n {\n tag: \"div[data-content-type=\" + this.name + \"]\", // TODO: remove if we can't come up with test case that needs this\n },\n // Case for regular HTML list structure.\n // (e.g.: when pasting from other apps)\n {\n tag: \"li\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (\n parent.tagName === \"OL\" ||\n (parent.tagName === \"DIV\" && parent.parentElement!.tagName === \"OL\")\n ) {\n return {};\n }\n\n return false;\n },\n node: \"numberedListItem\",\n },\n // Case for BlockNote list structure.\n // (e.g.: when pasting from blocknote)\n {\n tag: \"p\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (parent.getAttribute(\"data-content-type\") === \"numberedListItem\") {\n return {};\n }\n\n return false;\n },\n priority: 300,\n node: \"numberedListItem\",\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n // We use a <p> tag, because for <li> tags we'd need an <ol> element to\n // put them in to be semantically correct, which we can't have due to the\n // schema.\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const NumberedListItem = createBlockSpecFromStronglyTypedTiptapNode(\n NumberedListItemBlockContent,\n numberedListItemPropSchema\n);\n","import { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport {\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../schema/index.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../defaultProps.js\";\n\nexport const paragraphPropSchema = {\n ...defaultProps,\n};\n\nexport const ParagraphBlockContent = createStronglyTypedTiptapNode({\n name: \"paragraph\",\n content: \"inline*\",\n group: \"blockContent\",\n\n addKeyboardShortcuts() {\n return {\n \"Mod-Alt-0\": () => {\n const blockInfo = getBlockInfoFromSelection(this.editor.state);\n if (\n !blockInfo.isBlockContainer ||\n blockInfo.blockContent.node.type.spec.content !== \"inline*\"\n ) {\n return true;\n }\n\n return this.editor.commands.command(\n updateBlockCommand(this.options.editor, blockInfo.bnBlock.beforePos, {\n type: \"paragraph\",\n props: {},\n })\n );\n },\n };\n },\n\n parseHTML() {\n return [\n { tag: \"div[data-content-type=\" + this.name + \"]\" },\n {\n tag: \"p\",\n priority: 200,\n getAttrs: (element) => {\n if (typeof element === \"string\" || !element.textContent?.trim()) {\n return false;\n }\n\n return {};\n },\n node: \"paragraph\",\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n \"p\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n});\n\nexport const Paragraph = createBlockSpecFromStronglyTypedTiptapNode(\n ParagraphBlockContent,\n paragraphPropSchema\n);\n","import { Node } from \"@tiptap/core\";\nimport { TableCell } from \"@tiptap/extension-table-cell\";\nimport { TableHeader } from \"@tiptap/extension-table-header\";\nimport { TableRow } from \"@tiptap/extension-table-row\";\nimport { Node as PMNode } from \"prosemirror-model\";\nimport { TableView } from \"prosemirror-tables\";\n\nimport {\n createBlockSpecFromStronglyTypedTiptapNode,\n createStronglyTypedTiptapNode,\n} from \"../../schema/index.js\";\nimport { mergeCSSClasses } from \"../../util/browser.js\";\nimport { createDefaultBlockDOMOutputSpec } from \"../defaultBlockHelpers.js\";\nimport { defaultProps } from \"../defaultProps.js\";\nimport { EMPTY_CELL_WIDTH, TableExtension } from \"./TableExtension.js\";\n\nexport const tablePropSchema = {\n textColor: defaultProps.textColor,\n};\n\nexport const TableBlockContent = createStronglyTypedTiptapNode({\n name: \"table\",\n content: \"tableRow+\",\n group: \"blockContent\",\n tableRole: \"table\",\n\n isolating: true,\n\n parseHTML() {\n return [{ tag: \"table\" }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return createDefaultBlockDOMOutputSpec(\n this.name,\n \"table\",\n {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n },\n this.options.domAttributes?.inlineContent || {}\n );\n },\n\n // This node view is needed for the `columnResizing` plugin. By default, the\n // plugin adds its own node view, which overrides how the node is rendered vs\n // `renderHTML`. This means that the wrapping `blockContent` HTML element is\n // no longer rendered. The `columnResizing` plugin uses the `TableView` as its\n // default node view. `BlockNoteTableView` extends it by wrapping it in a\n // `blockContent` element, so the DOM structure is consistent with other block\n // types.\n addNodeView() {\n return ({ node, HTMLAttributes }) => {\n class BlockNoteTableView extends TableView {\n constructor(\n public node: PMNode,\n public cellMinWidth: number,\n public blockContentHTMLAttributes: Record<string, string>\n ) {\n super(node, cellMinWidth);\n\n const blockContent = document.createElement(\"div\");\n blockContent.className = mergeCSSClasses(\n \"bn-block-content\",\n blockContentHTMLAttributes.class\n );\n blockContent.setAttribute(\"data-content-type\", \"table\");\n for (const [attribute, value] of Object.entries(\n blockContentHTMLAttributes\n )) {\n if (attribute !== \"class\") {\n blockContent.setAttribute(attribute, value);\n }\n }\n\n const tableWrapper = this.dom;\n\n const tableWrapperInner = document.createElement(\"div\");\n tableWrapperInner.className = \"tableWrapper-inner\";\n tableWrapperInner.appendChild(tableWrapper.firstChild!);\n\n tableWrapper.appendChild(tableWrapperInner);\n\n blockContent.appendChild(tableWrapper);\n const floatingContainer = document.createElement(\"div\");\n floatingContainer.className = \"table-widgets-container\";\n floatingContainer.style.position = \"relative\";\n tableWrapper.appendChild(floatingContainer);\n\n this.dom = blockContent;\n }\n\n ignoreMutation(record: MutationRecord): boolean {\n return (\n !(record.target as HTMLElement).closest(\".tableWrapper-inner\") ||\n super.ignoreMutation(record)\n );\n }\n }\n\n return new BlockNoteTableView(node, EMPTY_CELL_WIDTH, {\n ...(this.options.domAttributes?.blockContent || {}),\n ...HTMLAttributes,\n });\n };\n },\n});\n\nconst TableParagraph = Node.create({\n name: \"tableParagraph\",\n group: \"tableContent\",\n content: \"inline*\",\n\n parseHTML() {\n return [\n {\n preserveWhitespace: \"full\",\n // set this rule as high priority so it takes precedence over the default paragraph rule,\n // but only if we're in the tableContent context\n priority: 210,\n context: \"tableContent\",\n tag: \"p\",\n getAttrs: (_element) => {\n return {};\n },\n },\n {\n tag: \"p\",\n getAttrs: (element) => {\n if (typeof element === \"string\" || !element.textContent) {\n return false;\n }\n\n const parent = element.parentElement;\n\n if (parent === null) {\n return false;\n }\n\n if (parent.tagName === \"TD\") {\n return {};\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"p\", HTMLAttributes, 0];\n },\n});\n\nexport const Table = createBlockSpecFromStronglyTypedTiptapNode(\n TableBlockContent,\n tablePropSchema,\n [\n TableExtension,\n TableParagraph,\n TableHeader.extend({\n content: \"tableContent\",\n }),\n TableCell.extend({\n content: \"tableContent\",\n }),\n TableRow,\n ]\n);\n","import Bold from \"@tiptap/extension-bold\";\nimport Code from \"@tiptap/extension-code\";\nimport Italic from \"@tiptap/extension-italic\";\nimport Strike from \"@tiptap/extension-strike\";\nimport Underline from \"@tiptap/extension-underline\";\nimport { BackgroundColor } from \"../extensions/BackgroundColor/BackgroundColorMark.js\";\nimport { TextColor } from \"../extensions/TextColor/TextColorMark.js\";\nimport {\n BlockNoDefaults,\n BlockSchema,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSpecs,\n PartialBlockNoDefaults,\n StyleSchema,\n StyleSpecs,\n createStyleSpecFromTipTapMark,\n getBlockSchemaFromSpecs,\n getInlineContentSchemaFromSpecs,\n getStyleSchemaFromSpecs,\n} from \"../schema/index.js\";\n\nimport { AudioBlock } from \"./AudioBlockContent/AudioBlockContent.js\";\nimport { CodeBlock } from \"./CodeBlockContent/CodeBlockContent.js\";\nimport { FileBlock } from \"./FileBlockContent/FileBlockContent.js\";\nimport { Heading } from \"./HeadingBlockContent/HeadingBlockContent.js\";\nimport { ImageBlock } from \"./ImageBlockContent/ImageBlockContent.js\";\nimport { BulletListItem } from \"./ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.js\";\nimport { CheckListItem } from \"./ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.js\";\nimport { NumberedListItem } from \"./ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.js\";\nimport { Paragraph } from \"./ParagraphBlockContent/ParagraphBlockContent.js\";\nimport { Table } from \"./TableBlockContent/TableBlockContent.js\";\nimport { VideoBlock } from \"./VideoBlockContent/VideoBlockContent.js\";\n\nexport { customizeCodeBlock } from \"./CodeBlockContent/CodeBlockContent.js\";\n\nexport const defaultBlockSpecs = {\n paragraph: Paragraph,\n heading: Heading,\n codeBlock: CodeBlock,\n bulletListItem: BulletListItem,\n numberedListItem: NumberedListItem,\n checkListItem: CheckListItem,\n table: Table,\n file: FileBlock,\n image: ImageBlock,\n video: VideoBlock,\n audio: AudioBlock,\n} satisfies BlockSpecs;\n\nexport const defaultBlockSchema = getBlockSchemaFromSpecs(defaultBlockSpecs);\n\n// underscore is used that in case a user overrides DefaultBlockSchema,\n// they can still access the original default block schema\nexport type _DefaultBlockSchema = typeof defaultBlockSchema;\nexport type DefaultBlockSchema = _DefaultBlockSchema;\n\nexport const defaultStyleSpecs = {\n bold: createStyleSpecFromTipTapMark(Bold, \"boolean\"),\n italic: createStyleSpecFromTipTapMark(Italic, \"boolean\"),\n underline: createStyleSpecFromTipTapMark(Underline, \"boolean\"),\n strike: createStyleSpecFromTipTapMark(Strike, \"boolean\"),\n code: createStyleSpecFromTipTapMark(Code, \"boolean\"),\n textColor: TextColor,\n backgroundColor: BackgroundColor,\n} satisfies StyleSpecs;\n\nexport const defaultStyleSchema = getStyleSchemaFromSpecs(defaultStyleSpecs);\n\n// underscore is used that in case a user overrides DefaultStyleSchema,\n// they can still access the original default style schema\nexport type _DefaultStyleSchema = typeof defaultStyleSchema;\nexport type DefaultStyleSchema = _DefaultStyleSchema;\n\nexport const defaultInlineContentSpecs = {\n text: { config: \"text\", implementation: {} as any },\n link: { config: \"link\", implementation: {} as any },\n} satisfies InlineContentSpecs;\n\nexport const defaultInlineContentSchema = getInlineContentSchemaFromSpecs(\n defaultInlineContentSpecs\n);\n\n// underscore is used that in case a user overrides DefaultInlineContentSchema,\n// they can still access the original default inline content schema\nexport type _DefaultInlineContentSchema = typeof defaultInlineContentSchema;\nexport type DefaultInlineContentSchema = _DefaultInlineContentSchema;\n\nexport type PartialBlock<\n BSchema extends BlockSchema = DefaultBlockSchema,\n I extends InlineContentSchema = DefaultInlineContentSchema,\n S extends StyleSchema = DefaultStyleSchema\n> = PartialBlockNoDefaults<BSchema, I, S>;\n\nexport type Block<\n BSchema extends BlockSchema = DefaultBlockSchema,\n I extends InlineContentSchema = DefaultInlineContentSchema,\n S extends StyleSchema = DefaultStyleSchema\n> = BlockNoDefaults<BSchema, I, S>;\n","import type { BlockNoteEditor } from \"../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfig,\n BlockSchema,\n FileBlockConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"../schema/index.js\";\nimport {\n Block,\n DefaultBlockSchema,\n DefaultInlineContentSchema,\n defaultBlockSchema,\n defaultInlineContentSchema,\n} from \"./defaultBlocks.js\";\nimport { defaultProps } from \"./defaultProps.js\";\n\nexport function checkDefaultBlockTypeInSchema<\n BlockType extends keyof DefaultBlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockType: BlockType,\n editor: BlockNoteEditor<any, I, S>\n): editor is BlockNoteEditor<{ Type: DefaultBlockSchema[BlockType] }, I, S> {\n return (\n blockType in editor.schema.blockSchema &&\n editor.schema.blockSchema[blockType] === defaultBlockSchema[blockType]\n );\n}\n\nexport function checkDefaultInlineContentTypeInSchema<\n InlineContentType extends keyof DefaultInlineContentSchema,\n B extends BlockSchema,\n S extends StyleSchema\n>(\n inlineContentType: InlineContentType,\n editor: BlockNoteEditor<B, any, S>\n): editor is BlockNoteEditor<\n B,\n { Type: DefaultInlineContentSchema[InlineContentType] },\n S\n> {\n return (\n inlineContentType in editor.schema.inlineContentSchema &&\n editor.schema.inlineContentSchema[inlineContentType] ===\n defaultInlineContentSchema[inlineContentType]\n );\n}\n\nexport function checkBlockIsDefaultType<\n BlockType extends keyof DefaultBlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blockType: BlockType,\n block: Block<any, I, S>,\n editor: BlockNoteEditor<any, I, S>\n): block is BlockFromConfig<DefaultBlockSchema[BlockType], I, S> {\n return (\n block.type === blockType &&\n block.type in editor.schema.blockSchema &&\n checkDefaultBlockTypeInSchema(block.type, editor)\n );\n}\n\nexport function checkBlockIsFileBlock<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: Block<any, I, S>,\n editor: BlockNoteEditor<B, I, S>\n): block is BlockFromConfig<FileBlockConfig, I, S> {\n return (\n (block.type in editor.schema.blockSchema &&\n editor.schema.blockSchema[block.type].isFileBlock) ||\n false\n );\n}\n\nexport function checkBlockIsFileBlockWithPreview<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n block: Block<any, I, S>,\n editor: BlockNoteEditor<B, I, S>\n): block is BlockFromConfig<\n FileBlockConfig & {\n propSchema: Required<FileBlockConfig[\"propSchema\"]>;\n },\n I,\n S\n> {\n return (\n (block.type in editor.schema.blockSchema &&\n editor.schema.blockSchema[block.type].isFileBlock &&\n \"showPreview\" in editor.schema.blockSchema[block.type].propSchema) ||\n false\n );\n}\n\nexport function checkBlockIsFileBlockWithPlaceholder<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(block: Block<B, I, S>, editor: BlockNoteEditor<B, I, S>) {\n const config = editor.schema.blockSchema[block.type];\n return config.isFileBlock && !block.props.url;\n}\n\nexport function checkBlockTypeHasDefaultProp<\n Prop extends keyof typeof defaultProps,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n prop: Prop,\n blockType: string,\n editor: BlockNoteEditor<any, I, S>\n): editor is BlockNoteEditor<\n {\n [BT in string]: {\n type: BT;\n propSchema: {\n [P in Prop]: (typeof defaultProps)[P];\n };\n content: \"table\" | \"inline\" | \"none\";\n };\n },\n I,\n S\n> {\n return (\n blockType in editor.schema.blockSchema &&\n prop in editor.schema.blockSchema[blockType].propSchema &&\n editor.schema.blockSchema[blockType].propSchema[prop] === defaultProps[prop]\n );\n}\n\nexport function checkBlockHasDefaultProp<\n Prop extends keyof typeof defaultProps,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n prop: Prop,\n block: Block<any, I, S>,\n editor: BlockNoteEditor<any, I, S>\n): block is BlockFromConfig<\n {\n type: string;\n propSchema: {\n [P in Prop]: (typeof defaultProps)[P];\n };\n content: \"table\" | \"inline\" | \"none\";\n },\n I,\n S\n> {\n return checkBlockTypeHasDefaultProp(prop, block.type, editor);\n}\n","import { Node } from \"prosemirror-model\";\n\nimport { Block, PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { blockToNode } from \"../../../nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\nexport function insertBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToInsert: PartialBlock<BSchema, I, S>[],\n referenceBlock: BlockIdentifier,\n placement: \"before\" | \"after\" = \"before\"\n): Block<BSchema, I, S>[] {\n const id =\n typeof referenceBlock === \"string\" ? referenceBlock : referenceBlock.id;\n\n const nodesToInsert: Node[] = [];\n for (const blockSpec of blocksToInsert) {\n nodesToInsert.push(\n blockToNode(blockSpec, editor.pmSchema, editor.schema.styleSchema)\n );\n }\n\n const { node, posBeforeNode } = getNodeById(\n id,\n editor._tiptapEditor.state.doc\n );\n\n // TODO: we might want to use the ReplaceStep directly here instead of insert,\n // because the fitting algorithm should not be necessary and might even cause unexpected behavior\n if (placement === \"before\") {\n editor.dispatch(\n editor._tiptapEditor.state.tr.insert(posBeforeNode, nodesToInsert)\n );\n }\n\n if (placement === \"after\") {\n editor.dispatch(\n editor._tiptapEditor.state.tr.insert(\n posBeforeNode + node.nodeSize,\n nodesToInsert\n )\n );\n }\n\n // Now that the `PartialBlock`s have been converted to nodes, we can\n // re-convert them into full `Block`s.\n const insertedBlocks: Block<BSchema, I, S>[] = [];\n for (const node of nodesToInsert) {\n insertedBlocks.push(\n nodeToBlock(\n node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n )\n );\n }\n\n return insertedBlocks;\n}\n","import { NodeSelection, Selection, TextSelection } from \"prosemirror-state\";\nimport { CellSelection } from \"prosemirror-tables\";\n\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport { BlockIdentifier } from \"../../../../schema/index.js\";\nimport { getBlockInfoFromSelection } from \"../../../getBlockInfoFromPos.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\ntype BlockSelectionData = (\n | {\n type: \"text\";\n anchor: number;\n head: number;\n }\n | {\n type: \"node\";\n from: number;\n }\n | {\n type: \"cell\";\n anchorCell: number;\n headCell: number;\n }\n) & {\n blockId: string;\n blockPos: number;\n};\n\n// `getBlockSelectionData` and `updateBlockSelectionFromData` are used to save\n// and restore the selection within a block, when the block is moved.\nfunction getBlockSelectionData(\n editor: BlockNoteEditor<any, any, any>\n): BlockSelectionData {\n const { bnBlock } = getBlockInfoFromSelection(editor._tiptapEditor.state);\n\n const selectionData = {\n blockId: bnBlock.node.attrs.id,\n blockPos: bnBlock.beforePos,\n };\n\n if (editor._tiptapEditor.state.selection instanceof CellSelection) {\n return {\n ...selectionData,\n type: \"cell\" as const,\n anchorCell: (editor._tiptapEditor.state.selection as CellSelection)\n .$anchorCell.pos,\n headCell: (editor._tiptapEditor.state.selection as CellSelection)\n .$headCell.pos,\n };\n } else if (editor._tiptapEditor.state.selection instanceof NodeSelection) {\n return {\n ...selectionData,\n type: \"node\" as const,\n from: editor._tiptapEditor.state.selection.from,\n };\n } else {\n return {\n ...selectionData,\n type: \"text\" as const,\n anchor: editor._tiptapEditor.state.selection.anchor,\n head: editor._tiptapEditor.state.selection.head,\n };\n }\n}\n\nfunction updateBlockSelectionFromData(\n editor: BlockNoteEditor<any, any, any>,\n data: BlockSelectionData\n) {\n const blockPos = getNodeById(\n data.blockId,\n editor._tiptapEditor.state.doc\n ).posBeforeNode;\n\n let selection: Selection;\n if (data.type === \"cell\") {\n selection = CellSelection.create(\n editor._tiptapEditor.state.doc,\n data.anchorCell + (blockPos - data.blockPos),\n data.headCell + (blockPos - data.blockPos)\n );\n } else if (data.type === \"node\") {\n selection = NodeSelection.create(\n editor._tiptapEditor.state.doc,\n data.from + (blockPos - data.blockPos)\n );\n } else {\n selection = TextSelection.create(\n editor._tiptapEditor.state.doc,\n data.anchor + (blockPos - data.blockPos),\n data.head + (blockPos - data.blockPos)\n );\n }\n\n editor._tiptapEditor.view.dispatch(\n editor._tiptapEditor.state.tr.setSelection(selection)\n );\n}\n\nexport function moveSelectedBlockAndSelection(\n editor: BlockNoteEditor<any, any, any>,\n referenceBlock: BlockIdentifier,\n placement: \"before\" | \"after\"\n) {\n const { block } = editor.getTextCursorPosition();\n const selectionData = getBlockSelectionData(editor);\n\n editor.removeBlocks([block]);\n editor.insertBlocks([block], referenceBlock, placement);\n\n updateBlockSelectionFromData(editor, selectionData);\n}\n\nexport function moveBlockUp(editor: BlockNoteEditor<any, any, any>) {\n // This function currently only supports moving a single block.\n const editorSelection = editor.getSelection();\n if (editorSelection && editorSelection.blocks.length > 1) {\n return;\n }\n\n const { prevBlock, parentBlock } = editor.getTextCursorPosition();\n\n let referenceBlockId: string | undefined;\n let placement: \"before\" | \"after\" | undefined;\n\n if (!prevBlock) {\n if (parentBlock) {\n referenceBlockId = parentBlock.id;\n placement = \"before\";\n }\n } else if (prevBlock.children.length > 0) {\n referenceBlockId = prevBlock.children[prevBlock.children.length - 1].id;\n placement = \"after\";\n } else {\n referenceBlockId = prevBlock.id;\n placement = \"before\";\n }\n\n if (!referenceBlockId || !placement) {\n return;\n }\n\n moveSelectedBlockAndSelection(editor, referenceBlockId, placement);\n}\n\nexport function moveBlockDown(editor: BlockNoteEditor<any, any, any>) {\n // This function currently only supports moving a single block.\n const editorSelection = editor.getSelection();\n if (editorSelection && editorSelection.blocks.length > 1) {\n return;\n }\n\n const { nextBlock, parentBlock } = editor.getTextCursorPosition();\n\n let referenceBlockId: string | undefined;\n let placement: \"before\" | \"after\" | undefined;\n\n if (!nextBlock) {\n if (parentBlock) {\n referenceBlockId = parentBlock.id;\n placement = \"after\";\n }\n } else if (nextBlock.children.length > 0) {\n referenceBlockId = nextBlock.children[0].id;\n placement = \"before\";\n } else {\n referenceBlockId = nextBlock.id;\n placement = \"after\";\n }\n\n if (!referenceBlockId || !placement) {\n return;\n }\n\n moveSelectedBlockAndSelection(editor, referenceBlockId, placement);\n}\n","import { Fragment, NodeType, Slice } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\nimport { ReplaceAroundStep } from \"prosemirror-transform\";\n\nimport { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport { getBlockInfoFromSelection } from \"../../../getBlockInfoFromPos.js\";\n\n// TODO: Unit tests\n/**\n * This is a modified version of https://github.com/ProseMirror/prosemirror-schema-list/blob/569c2770cbb8092d8f11ea53ecf78cb7a4e8f15a/src/schema-list.ts#L232\n *\n * The original function derives too many information from the parentnode and itemtype\n */\nfunction sinkListItem(itemType: NodeType, groupType: NodeType) {\n return function ({ state, dispatch }: { state: EditorState; dispatch: any }) {\n const { $from, $to } = state.selection;\n const range = $from.blockRange(\n $to,\n (node) =>\n node.childCount > 0 &&\n (node.type.name === \"blockGroup\" || node.type.name === \"column\") // change necessary to not look at first item child type\n );\n if (!range) {\n return false;\n }\n const startIndex = range.startIndex;\n if (startIndex === 0) {\n return false;\n }\n const parent = range.parent;\n const nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type !== itemType) {\n return false;\n }\n if (dispatch) {\n const nestedBefore =\n nodeBefore.lastChild && nodeBefore.lastChild.type === groupType; // change necessary to check groupType instead of parent.type\n const inner = Fragment.from(nestedBefore ? itemType.create() : null);\n const slice = new Slice(\n Fragment.from(\n itemType.create(null, Fragment.from(groupType.create(null, inner))) // change necessary to create \"groupType\" instead of parent.type\n ),\n nestedBefore ? 3 : 1,\n 0\n );\n\n const before = range.start;\n const after = range.end;\n dispatch(\n state.tr\n .step(\n new ReplaceAroundStep(\n before - (nestedBefore ? 3 : 1),\n after,\n before,\n after,\n slice,\n 1,\n true\n )\n )\n .scrollIntoView()\n );\n }\n return true;\n };\n}\n\nexport function nestBlock(editor: BlockNoteEditor<any, any, any>) {\n return editor._tiptapEditor.commands.command(\n sinkListItem(\n editor._tiptapEditor.schema.nodes[\"blockContainer\"],\n editor._tiptapEditor.schema.nodes[\"blockGroup\"]\n )\n );\n}\n\nexport function unnestBlock(editor: BlockNoteEditor<any, any, any>) {\n editor._tiptapEditor.commands.liftListItem(\"blockContainer\");\n}\n\nexport function canNestBlock(editor: BlockNoteEditor<any, any, any>) {\n const { bnBlock: blockContainer } = getBlockInfoFromSelection(\n editor._tiptapEditor.state\n );\n\n return (\n editor._tiptapEditor.state.doc.resolve(blockContainer.beforePos)\n .nodeBefore !== null\n );\n}\nexport function canUnnestBlock(editor: BlockNoteEditor<any, any, any>) {\n const { bnBlock: blockContainer } = getBlockInfoFromSelection(\n editor._tiptapEditor.state\n );\n\n return (\n editor._tiptapEditor.state.doc.resolve(blockContainer.beforePos).depth > 1\n );\n}\n","import { Block, PartialBlock } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { Node } from \"prosemirror-model\";\nimport { blockToNode } from \"../../../nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\n\nexport function removeAndInsertBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToRemove: BlockIdentifier[],\n blocksToInsert: PartialBlock<BSchema, I, S>[]\n): {\n insertedBlocks: Block<BSchema, I, S>[];\n removedBlocks: Block<BSchema, I, S>[];\n} {\n const ttEditor = editor._tiptapEditor;\n let tr = ttEditor.state.tr;\n\n // Converts the `PartialBlock`s to ProseMirror nodes to insert them into the\n // document.\n const nodesToInsert: Node[] = [];\n for (const block of blocksToInsert) {\n nodesToInsert.push(\n blockToNode(block, editor.pmSchema, editor.schema.styleSchema)\n );\n }\n\n const idsOfBlocksToRemove = new Set<string>(\n blocksToRemove.map((block) =>\n typeof block === \"string\" ? block : block.id\n )\n );\n const removedBlocks: Block<BSchema, I, S>[] = [];\n\n const idOfFirstBlock =\n typeof blocksToRemove[0] === \"string\"\n ? blocksToRemove[0]\n : blocksToRemove[0].id;\n let removedSize = 0;\n\n ttEditor.state.doc.descendants((node, pos) => {\n // Skips traversing nodes after all target blocks have been removed.\n if (idsOfBlocksToRemove.size === 0) {\n return false;\n }\n\n // Keeps traversing nodes if block with target ID has not been found.\n if (\n !node.type.isInGroup(\"bnBlock\") ||\n !idsOfBlocksToRemove.has(node.attrs.id)\n ) {\n return true;\n }\n\n // Saves the block that is being deleted.\n removedBlocks.push(\n nodeToBlock(\n node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n )\n );\n idsOfBlocksToRemove.delete(node.attrs.id);\n\n if (blocksToInsert.length > 0 && node.attrs.id === idOfFirstBlock) {\n const oldDocSize = tr.doc.nodeSize;\n tr = tr.insert(pos, nodesToInsert);\n const newDocSize = tr.doc.nodeSize;\n\n removedSize += oldDocSize - newDocSize;\n }\n\n const oldDocSize = tr.doc.nodeSize;\n // Checks if the block is the only child of its parent. In this case, we\n // need to delete the parent `blockGroup` node instead of just the\n // `blockContainer`.\n const $pos = tr.doc.resolve(pos - removedSize);\n if (\n $pos.node().type.name === \"blockGroup\" &&\n $pos.node($pos.depth - 1).type.name !== \"doc\" &&\n $pos.node().childCount === 1\n ) {\n tr = tr.delete($pos.before(), $pos.after());\n } else {\n tr = tr.delete(pos - removedSize, pos - removedSize + node.nodeSize);\n }\n const newDocSize = tr.doc.nodeSize;\n removedSize += oldDocSize - newDocSize;\n\n return false;\n });\n\n // Throws an error if now all blocks could be found.\n if (idsOfBlocksToRemove.size > 0) {\n const notFoundIds = [...idsOfBlocksToRemove].join(\"\\n\");\n\n throw Error(\n \"Blocks with the following IDs could not be found in the editor: \" +\n notFoundIds\n );\n }\n\n editor.dispatch(tr);\n\n // Converts the nodes created from `blocksToInsert` into full `Block`s.\n const insertedBlocks: Block<BSchema, I, S>[] = [];\n for (const node of nodesToInsert) {\n insertedBlocks.push(\n nodeToBlock(\n node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n )\n );\n }\n\n return { insertedBlocks, removedBlocks };\n}\n\nexport function replaceBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToRemove: BlockIdentifier[],\n blocksToInsert: PartialBlock<BSchema, I, S>[]\n): {\n insertedBlocks: Block<BSchema, I, S>[];\n removedBlocks: Block<BSchema, I, S>[];\n} {\n return removeAndInsertBlocks(editor, blocksToRemove, blocksToInsert);\n}\n","import { Block } from \"../../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { removeAndInsertBlocks } from \"../replaceBlocks/replaceBlocks.js\";\n\nexport function removeBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n blocksToRemove: BlockIdentifier[]\n): Block<BSchema, I, S>[] {\n return removeAndInsertBlocks(editor, blocksToRemove, []).removedBlocks;\n}\n","import { selectionToInsertionEnd } from \"@tiptap/core\";\nimport { Node } from \"prosemirror-model\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\n\n// similar to tiptap insertContentAt\nexport function insertContentAt<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n position: any,\n nodes: Node[],\n editor: BlockNoteEditor<BSchema, I, S>,\n options: {\n updateSelection: boolean;\n } = { updateSelection: true }\n) {\n const tr = editor._tiptapEditor.state.tr;\n\n // don’t dispatch an empty fragment because this can lead to strange errors\n // if (content.toString() === \"<>\") {\n // return true;\n // }\n\n let { from, to } =\n typeof position === \"number\"\n ? { from: position, to: position }\n : { from: position.from, to: position.to };\n\n let isOnlyTextContent = true;\n let isOnlyBlockContent = true;\n // const nodes = isFragment(content) ? content : [content];\n\n let text = \"\";\n\n nodes.forEach((node) => {\n // check if added node is valid\n node.check();\n\n if (isOnlyTextContent && node.isText && node.marks.length === 0) {\n text += node.text;\n } else {\n isOnlyTextContent = false;\n }\n\n isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n });\n\n // check if we can replace the wrapping node by\n // the newly inserted content\n // example:\n // replace an empty paragraph by an inserted image\n // instead of inserting the image below the paragraph\n if (from === to && isOnlyBlockContent) {\n const { parent } = tr.doc.resolve(from);\n const isEmptyTextBlock =\n parent.isTextblock && !parent.type.spec.code && !parent.childCount;\n\n if (isEmptyTextBlock) {\n from -= 1;\n to += 1;\n }\n }\n\n // if there is only plain text we have to use `insertText`\n // because this will keep the current marks\n if (isOnlyTextContent) {\n // if value is string, we can use it directly\n // otherwise if it is an array, we have to join it\n // if (Array.isArray(value)) {\n // tr.insertText(value.map((v) => v.text || \"\").join(\"\"), from, to);\n // } else if (typeof value === \"object\" && !!value && !!value.text) {\n // tr.insertText(value.text, from, to);\n // } else {\n // tr.insertText(value as string, from, to);\n // }\n tr.insertText(text, from, to);\n } else {\n tr.replaceWith(from, to, nodes);\n }\n\n // set cursor at end of inserted content\n if (options.updateSelection) {\n selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n }\n\n editor.dispatch(tr);\n\n return true;\n}\n","import { Node } from \"prosemirror-model\";\n\nimport type { BlockNoteEditor } from \"../../../../editor/BlockNoteEditor.js\";\nimport { TextCursorPosition } from \"../../../../editor/cursorPositionTypes.js\";\nimport {\n BlockIdentifier,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../../schema/index.js\";\nimport { UnreachableCaseError } from \"../../../../util/typescript.js\";\nimport {\n getBlockInfo,\n getBlockInfoFromSelection,\n} from \"../../../getBlockInfoFromPos.js\";\nimport { nodeToBlock } from \"../../../nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../../nodeUtil.js\";\n\nexport function getTextCursorPosition<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>): TextCursorPosition<BSchema, I, S> {\n const { bnBlock } = getBlockInfoFromSelection(editor._tiptapEditor.state);\n\n const resolvedPos = editor._tiptapEditor.state.doc.resolve(bnBlock.beforePos);\n // Gets previous blockContainer node at the same nesting level, if the current node isn't the first child.\n const prevNode = resolvedPos.nodeBefore;\n\n // Gets next blockContainer node at the same nesting level, if the current node isn't the last child.\n const nextNode = editor._tiptapEditor.state.doc.resolve(\n bnBlock.afterPos\n ).nodeAfter;\n\n // Gets parent blockContainer node, if the current node is nested.\n let parentNode: Node | undefined = undefined;\n if (resolvedPos.depth > 1) {\n // for nodes nested in bnBlocks\n parentNode = resolvedPos.node();\n if (!parentNode.type.isInGroup(\"bnBlock\")) {\n // for blockGroups, we need to go one level up\n parentNode = resolvedPos.node(resolvedPos.depth - 1);\n }\n }\n\n return {\n block: nodeToBlock(\n bnBlock.node,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n prevBlock:\n prevNode === null\n ? undefined\n : nodeToBlock(\n prevNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n nextBlock:\n nextNode === null\n ? undefined\n : nodeToBlock(\n nextNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n parentBlock:\n parentNode === undefined\n ? undefined\n : nodeToBlock(\n parentNode,\n editor.schema.blockSchema,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema,\n editor.blockCache\n ),\n };\n}\n\nexport function setTextCursorPosition<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n targetBlock: BlockIdentifier,\n placement: \"start\" | \"end\" = \"start\"\n) {\n const id = typeof targetBlock === \"string\" ? targetBlock : targetBlock.id;\n\n const posInfo = getNodeById(id, editor._tiptapEditor.state.doc);\n const info = getBlockInfo(posInfo);\n\n const contentType: \"none\" | \"inline\" | \"table\" =\n editor.schema.blockSchema[info.blockNoteType]!.content;\n\n if (info.isBlockContainer) {\n const blockContent = info.blockContent;\n if (contentType === \"none\") {\n editor._tiptapEditor.commands.setNodeSelection(blockContent.beforePos);\n return;\n }\n\n if (contentType === \"inline\") {\n if (placement === \"start\") {\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.beforePos + 1\n );\n } else {\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.afterPos - 1\n );\n }\n } else if (contentType === \"table\") {\n if (placement === \"start\") {\n // Need to offset the position as we have to get through the `tableRow`\n // and `tableCell` nodes to get to the `tableParagraph` node we want to\n // set the selection in.\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.beforePos + 4\n );\n } else {\n editor._tiptapEditor.commands.setTextSelection(\n blockContent.afterPos - 4\n );\n }\n } else {\n throw new UnreachableCaseError(contentType);\n }\n } else {\n const child =\n placement === \"start\"\n ? info.childContainer.node.firstChild!\n : info.childContainer.node.lastChild!;\n\n setTextCursorPosition(editor, child.attrs.id, placement);\n }\n}\n","// some dependencies only export as ESM modules. This makes them incompatible with Node CJS.\n// To work around this, we load these dependencies as dynamic imports in a function that initializes them.\n\n// (to reproduce this issue, run ts-node on a file that users server-util)\nexport let esmDependencies:\n | undefined\n | {\n rehypeParse: typeof import(\"rehype-parse\");\n rehypeStringify: typeof import(\"rehype-stringify\");\n unified: typeof import(\"unified\");\n hastUtilFromDom: typeof import(\"hast-util-from-dom\");\n rehypeRemark: typeof import(\"rehype-remark\");\n remarkGfm: typeof import(\"remark-gfm\");\n remarkStringify: typeof import(\"remark-stringify\");\n remarkParse: typeof import(\"remark-parse\");\n remarkRehype: typeof import(\"remark-rehype\");\n rehypeFormat: typeof import(\"rehype-format\");\n };\n\nexport async function initializeESMDependencies() {\n if (esmDependencies) {\n return esmDependencies;\n }\n const vals = await Promise.all([\n import(\"rehype-parse\"),\n import(\"rehype-stringify\"),\n import(\"unified\"),\n import(\"hast-util-from-dom\"),\n import(\"rehype-remark\"),\n import(\"remark-gfm\"),\n import(\"remark-stringify\"),\n import(\"remark-parse\"),\n import(\"remark-rehype\"),\n import(\"rehype-format\"),\n ]);\n\n esmDependencies = {\n rehypeParse: vals[0],\n rehypeStringify: vals[1],\n unified: vals[2],\n hastUtilFromDom: vals[3],\n rehypeRemark: vals[4],\n remarkGfm: vals[5],\n remarkStringify: vals[6],\n remarkParse: vals[7],\n remarkRehype: vals[8],\n rehypeFormat: vals[9],\n };\n\n return esmDependencies;\n}\n","import { Element as HASTElement, Parent as HASTParent } from \"hast\";\n\n/**\n * Rehype plugin which removes <u> tags. Used to remove underlines before converting HTML to markdown, as Markdown\n * doesn't support underlines.\n */\nexport function removeUnderlines() {\n const removeUnderlinesHelper = (tree: HASTParent) => {\n let numChildElements = tree.children.length;\n\n for (let i = 0; i < numChildElements; i++) {\n const node = tree.children[i];\n\n if (node.type === \"element\") {\n // Recursively removes underlines from child elements.\n removeUnderlinesHelper(node);\n\n if ((node as HASTElement).tagName === \"u\") {\n // Lifts child nodes outside underline element, deletes the underline element, and updates current index &\n // the number of child elements.\n if (node.children.length > 0) {\n tree.children.splice(i, 1, ...node.children);\n\n const numElementsAdded = node.children.length - 1;\n numChildElements += numElementsAdded;\n i += numElementsAdded;\n } else {\n tree.children.splice(i, 1);\n\n numChildElements--;\n i--;\n }\n }\n }\n }\n };\n\n return removeUnderlinesHelper;\n}\n","import { Element as HASTElement, Parent as HASTParent } from \"hast\";\nimport { esmDependencies } from \"../../../../util/esmDependencies.js\";\n\n/**\n * Rehype plugin which adds a space after each checkbox input element. This is\n * because remark doesn't add any spaces between the checkbox input and the text\n * itself, but these are needed for correct Markdown syntax.\n */\nexport function addSpacesToCheckboxes() {\n const deps = esmDependencies;\n\n if (!deps) {\n throw new Error(\n \"addSpacesToCheckboxes requires ESM dependencies to be initialized\"\n );\n }\n\n const helper = (tree: HASTParent) => {\n if (tree.children && \"length\" in tree.children && tree.children.length) {\n for (let i = tree.children.length - 1; i >= 0; i--) {\n const child = tree.children[i];\n const nextChild =\n i + 1 < tree.children.length ? tree.children[i + 1] : undefined;\n\n // Checks for paragraph element after checkbox input element.\n if (\n child.type === \"element\" &&\n child.tagName === \"input\" &&\n child.properties?.type === \"checkbox\" &&\n nextChild?.type === \"element\" &&\n nextChild.tagName === \"p\"\n ) {\n // Converts paragraph to span, otherwise remark will think it needs to\n // be on a new line.\n nextChild.tagName = \"span\";\n // Adds a space after the checkbox input element.\n nextChild.children.splice(\n 0,\n 0,\n deps.hastUtilFromDom.fromDom(\n document.createTextNode(\" \")\n ) as HASTElement\n );\n } else {\n helper(child as HASTParent);\n }\n }\n }\n };\n\n return helper;\n}\n","import { Schema } from \"prosemirror-model\";\nimport { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport {\n esmDependencies,\n initializeESMDependencies,\n} from \"../../../util/esmDependencies.js\";\nimport { createExternalHTMLExporter } from \"../html/externalHTMLExporter.js\";\nimport { removeUnderlines } from \"./removeUnderlinesRehypePlugin.js\";\nimport { addSpacesToCheckboxes } from \"./util/addSpacesToCheckboxesRehypePlugin.js\";\n\n// Needs to be sync because it's used in drag handler event (SideMenuPlugin)\n// Ideally, call `await initializeESMDependencies()` before calling this function\nexport function cleanHTMLToMarkdown(cleanHTMLString: string) {\n const deps = esmDependencies;\n\n if (!deps) {\n throw new Error(\n \"cleanHTMLToMarkdown requires ESM dependencies to be initialized\"\n );\n }\n\n const markdownString = deps.unified\n .unified()\n .use(deps.rehypeParse.default, { fragment: true })\n .use(removeUnderlines)\n .use(addSpacesToCheckboxes)\n .use(deps.rehypeRemark.default)\n .use(deps.remarkGfm.default)\n .use(deps.remarkStringify.default, {\n handlers: { text: (node) => node.value },\n })\n .processSync(cleanHTMLString);\n\n return markdownString.value as string;\n}\n\nexport async function blocksToMarkdown<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n blocks: PartialBlock<BSchema, I, S>[],\n schema: Schema,\n editor: BlockNoteEditor<BSchema, I, S>,\n options: { document?: Document }\n): Promise<string> {\n await initializeESMDependencies();\n const exporter = createExternalHTMLExporter(schema, editor);\n const externalHTML = exporter.exportBlocks(blocks, options);\n\n return cleanHTMLToMarkdown(externalHTML);\n}\n","function getChildIndex(node: Element) {\n return Array.prototype.indexOf.call(node.parentElement!.childNodes, node);\n}\n\nfunction isWhitespaceNode(node: Node) {\n return node.nodeType === 3 && !/\\S/.test(node.nodeValue || \"\");\n}\n\n/**\n * Step 1, Turns:\n *\n * <ul>\n * <li>item</li>\n * <li>\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n * </li>\n *\n * Into:\n * <ul>\n * <li>item</li>\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n * </ul>\n *\n */\nfunction liftNestedListsToParent(element: HTMLElement) {\n element.querySelectorAll(\"li > ul, li > ol\").forEach((list) => {\n const index = getChildIndex(list);\n const parentListItem = list.parentElement!;\n const siblingsAfter = Array.from(parentListItem.childNodes).slice(\n index + 1\n );\n list.remove();\n siblingsAfter.forEach((sibling) => {\n sibling.remove();\n });\n\n parentListItem.insertAdjacentElement(\"afterend\", list);\n\n siblingsAfter.reverse().forEach((sibling) => {\n if (isWhitespaceNode(sibling)) {\n return;\n }\n const siblingContainer = document.createElement(\"li\");\n siblingContainer.append(sibling);\n list.insertAdjacentElement(\"afterend\", siblingContainer);\n });\n if (parentListItem.childNodes.length === 0) {\n parentListItem.remove();\n }\n });\n}\n\n/**\n * Step 2, Turns (output of liftNestedListsToParent):\n *\n * <li>item</li>\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n *\n * Into:\n * <div>\n * <li>item</li>\n * <div data-node-type=\"blockGroup\">\n * <ul>\n * <li>...</li>\n * <li>...</li>\n * </ul>\n * </div>\n * </div>\n *\n * This resulting format is parsed\n */\nfunction createGroups(element: HTMLElement) {\n element.querySelectorAll(\"li + ul, li + ol\").forEach((list) => {\n const listItem = list.previousElementSibling as HTMLElement;\n const blockContainer = document.createElement(\"div\");\n\n listItem.insertAdjacentElement(\"afterend\", blockContainer);\n blockContainer.append(listItem);\n\n const blockGroup = document.createElement(\"div\");\n blockGroup.setAttribute(\"data-node-type\", \"blockGroup\");\n blockContainer.append(blockGroup);\n\n while (\n blockContainer.nextElementSibling?.nodeName === \"UL\" ||\n blockContainer.nextElementSibling?.nodeName === \"OL\"\n ) {\n blockGroup.append(blockContainer.nextElementSibling);\n }\n });\n}\n\n// prevent XSS, similar to https://github.com/ProseMirror/prosemirror-view/blob/1251b2b412656a2a06263e4187574beb43651273/src/clipboard.ts#L204\n// https://github.com/TypeCellOS/BlockNote/issues/601\nlet _detachedDoc: Document | null = null;\nfunction detachedDoc() {\n return (\n _detachedDoc ||\n (_detachedDoc = document.implementation.createHTMLDocument(\"title\"))\n );\n}\n\nexport function nestedListsToBlockNoteStructure(\n elementOrHTML: HTMLElement | string\n) {\n if (typeof elementOrHTML === \"string\") {\n const element = detachedDoc().createElement(\"div\");\n element.innerHTML = elementOrHTML;\n elementOrHTML = element;\n }\n liftNestedListsToParent(elementOrHTML);\n createGroups(elementOrHTML);\n return elementOrHTML;\n}\n","import { DOMParser, Schema } from \"prosemirror-model\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\n\nimport { Block } from \"../../../blocks/defaultBlocks.js\";\nimport { nodeToBlock } from \"../../nodeConversions/nodeToBlock.js\";\nimport { nestedListsToBlockNoteStructure } from \"./util/nestedLists.js\";\nexport async function HTMLToBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n html: string,\n blockSchema: BSchema,\n icSchema: I,\n styleSchema: S,\n pmSchema: Schema\n): Promise<Block<BSchema, I, S>[]> {\n const htmlNode = nestedListsToBlockNoteStructure(html);\n const parser = DOMParser.fromSchema(pmSchema);\n\n // Other approach might be to use\n // const doc = pmSchema.nodes[\"doc\"].createAndFill()!;\n // and context: doc.resolve(3),\n\n const parentNode = parser.parse(htmlNode, {\n topNode: pmSchema.nodes[\"blockGroup\"].create(),\n });\n\n const blocks: Block<BSchema, I, S>[] = [];\n\n for (let i = 0; i < parentNode.childCount; i++) {\n blocks.push(\n nodeToBlock(parentNode.child(i), blockSchema, icSchema, styleSchema)\n );\n }\n\n return blocks;\n}\n","import { Schema } from \"prosemirror-model\";\n\nimport { Block } from \"../../../blocks/defaultBlocks.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { initializeESMDependencies } from \"../../../util/esmDependencies.js\";\nimport { HTMLToBlocks } from \"../html/parseHTML.js\";\n\n// modified version of https://github.com/syntax-tree/mdast-util-to-hast/blob/main/lib/handlers/code.js\n// that outputs a data-language attribute instead of a CSS class (e.g.: language-typescript)\nfunction code(state: any, node: any) {\n const value = node.value ? node.value : \"\";\n /** @type {Properties} */\n const properties: any = {};\n\n if (node.lang) {\n // changed line\n properties[\"data-language\"] = node.lang;\n }\n\n // Create `<code>`.\n /** @type {Element} */\n let result: any = {\n type: \"element\",\n tagName: \"code\",\n properties,\n children: [{ type: \"text\", value }],\n };\n\n if (node.meta) {\n result.data = { meta: node.meta };\n }\n\n state.patch(node, result);\n result = state.applyData(node, result);\n\n // Create `<pre>`.\n result = {\n type: \"element\",\n tagName: \"pre\",\n properties: {},\n children: [result],\n };\n state.patch(node, result);\n return result;\n}\n\nexport async function markdownToBlocks<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n markdown: string,\n blockSchema: BSchema,\n icSchema: I,\n styleSchema: S,\n pmSchema: Schema\n): Promise<Block<BSchema, I, S>[]> {\n const deps = await initializeESMDependencies();\n const htmlString = deps.unified\n .unified()\n .use(deps.remarkParse.default)\n .use(deps.remarkGfm.default)\n .use(deps.remarkRehype.default, {\n handlers: {\n ...(deps.remarkRehype.defaultHandlers as any),\n code,\n },\n })\n .use(deps.rehypeStringify.default)\n .processSync(markdown);\n\n return HTMLToBlocks(\n htmlString.value as string,\n blockSchema,\n icSchema,\n styleSchema,\n pmSchema\n );\n}\n","export const acceptedMIMETypes = [\n \"vscode-editor-data\",\n \"blocknote/html\",\n \"text/html\",\n \"text/plain\",\n \"Files\",\n] as const;\n","import { PartialBlock } from \"../../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor\";\nimport {\n BlockSchema,\n FileBlockConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { getBlockInfo, getNearestBlockPos } from \"../../getBlockInfoFromPos.js\";\nimport { acceptedMIMETypes } from \"./acceptedMIMETypes.js\";\n\nfunction checkFileExtensionsMatch(\n fileExtension1: string,\n fileExtension2: string\n) {\n if (!fileExtension1.startsWith(\".\") || !fileExtension2.startsWith(\".\")) {\n throw new Error(`The strings provided are not valid file extensions.`);\n }\n\n return fileExtension1 === fileExtension2;\n}\n\nfunction checkMIMETypesMatch(mimeType1: string, mimeType2: string) {\n const types1 = mimeType1.split(\"/\");\n const types2 = mimeType2.split(\"/\");\n\n if (types1.length !== 2) {\n throw new Error(`The string ${mimeType1} is not a valid MIME type.`);\n }\n if (types2.length !== 2) {\n throw new Error(`The string ${mimeType2} is not a valid MIME type.`);\n }\n\n if (types1[1] === \"*\" || types2[1] === \"*\") {\n return types1[0] === types2[0];\n }\n if (types1[0] === \"*\" || types2[0] === \"*\") {\n return types1[1] === types2[1];\n }\n\n return types1[0] === types2[0] && types1[1] === types2[1];\n}\n\nexport async function handleFileInsertion<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(event: DragEvent | ClipboardEvent, editor: BlockNoteEditor<BSchema, I, S>) {\n if (!editor.uploadFile) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Attempted ot insert file, but uploadFile is not set in the BlockNote editor options\"\n );\n return;\n }\n\n const dataTransfer =\n \"dataTransfer\" in event ? event.dataTransfer : event.clipboardData;\n if (dataTransfer === null) {\n return;\n }\n\n let format: (typeof acceptedMIMETypes)[number] | null = null;\n for (const mimeType of acceptedMIMETypes) {\n if (dataTransfer.types.includes(mimeType)) {\n format = mimeType;\n break;\n }\n }\n if (format !== \"Files\") {\n return;\n }\n\n const items = dataTransfer.items;\n if (!items) {\n return;\n }\n\n event.preventDefault();\n\n const fileBlockConfigs = Object.values(editor.schema.blockSchema).filter(\n (blockConfig) => blockConfig.isFileBlock\n ) as FileBlockConfig[];\n\n for (let i = 0; i < items.length; i++) {\n // Gets file block corresponding to MIME type.\n let fileBlockType = \"file\";\n for (const fileBlockConfig of fileBlockConfigs) {\n for (const mimeType of fileBlockConfig.fileBlockAccept || []) {\n const isFileExtension = mimeType.startsWith(\".\");\n const file = items[i].getAsFile();\n\n if (file) {\n if (\n (!isFileExtension &&\n file.type &&\n checkMIMETypesMatch(items[i].type, mimeType)) ||\n (isFileExtension &&\n checkFileExtensionsMatch(\n \".\" + file.name.split(\".\").pop(),\n mimeType\n ))\n ) {\n fileBlockType = fileBlockConfig.type;\n break;\n }\n }\n }\n }\n\n const file = items[i].getAsFile();\n if (file) {\n const fileBlock = {\n type: fileBlockType,\n props: {\n name: file.name,\n },\n } as PartialBlock<BSchema, I, S>;\n\n let insertedBlockId: string | undefined = undefined;\n\n if (event.type === \"paste\") {\n insertedBlockId = editor.insertBlocks(\n [fileBlock],\n editor.getTextCursorPosition().block,\n \"after\"\n )[0].id;\n } else if (event.type === \"drop\") {\n const coords = {\n left: (event as DragEvent).clientX,\n top: (event as DragEvent).clientY,\n };\n\n const pos = editor._tiptapEditor.view.posAtCoords(coords);\n if (!pos) {\n return;\n }\n\n const posInfo = getNearestBlockPos(\n editor._tiptapEditor.state.doc,\n pos.pos\n );\n\n const blockInfo = getBlockInfo(posInfo);\n\n insertedBlockId = editor.insertBlocks(\n [fileBlock],\n blockInfo.bnBlock.node.attrs.id,\n \"after\"\n )[0].id;\n } else {\n return;\n }\n\n const updateData = await editor.uploadFile(file, insertedBlockId);\n\n const updatedFileBlock =\n typeof updateData === \"string\"\n ? ({\n props: {\n url: updateData,\n },\n } as PartialBlock<BSchema, I, S>)\n : { ...updateData };\n\n editor.updateBlock(insertedBlockId, updatedFileBlock);\n }\n }\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"prosemirror-state\";\n\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { acceptedMIMETypes } from \"./acceptedMIMETypes.js\";\nimport { handleFileInsertion } from \"./handleFileInsertion.js\";\n\nexport const createDropFileExtension = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>\n) =>\n Extension.create<{ editor: BlockNoteEditor<BSchema, I, S> }, undefined>({\n name: \"dropFile\",\n addProseMirrorPlugins() {\n return [\n new Plugin({\n props: {\n handleDOMEvents: {\n drop(_view, event) {\n if (!editor.isEditable) {\n return;\n }\n\n let format: (typeof acceptedMIMETypes)[number] | null = null;\n for (const mimeType of acceptedMIMETypes) {\n if (event.dataTransfer!.types.includes(mimeType)) {\n format = mimeType;\n break;\n }\n }\n if (format === null) {\n return true;\n }\n\n if (format === \"Files\") {\n handleFileInsertion(event, editor);\n return true;\n }\n\n return false;\n },\n },\n },\n }),\n ];\n },\n });\n","import { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\n\nexport async function handleVSCodePaste<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(event: ClipboardEvent, editor: BlockNoteEditor<BSchema, I, S>) {\n const view = editor.prosemirrorView;\n const { schema } = view.state;\n\n if (!event.clipboardData) {\n return false;\n }\n\n const text = event.clipboardData!.getData(\"text/plain\");\n const vscode = event.clipboardData!.getData(\"vscode-editor-data\");\n const vscodeData = vscode ? JSON.parse(vscode) : undefined;\n const language = vscodeData?.mode;\n\n if (!text) {\n return false;\n }\n\n if (!schema.nodes.codeBlock) {\n view.pasteText(text);\n\n return true;\n }\n\n if (!language) {\n return false;\n }\n\n // strip carriage return chars from text pasted as code\n // see: https://github.com/ProseMirror/prosemirror-view/commit/a50a6bcceb4ce52ac8fcc6162488d8875613aacd\n editor._tiptapEditor.view.pasteHTML(\n `<pre><code class=\"language-${language}\">${text.replace(\n /\\r\\n?/g,\n \"\\n\"\n )}</code></pre>`\n );\n\n return true;\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin } from \"prosemirror-state\";\n\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { nestedListsToBlockNoteStructure } from \"../../parsers/html/util/nestedLists.js\";\nimport { acceptedMIMETypes } from \"./acceptedMIMETypes.js\";\nimport { handleFileInsertion } from \"./handleFileInsertion.js\";\nimport { handleVSCodePaste } from \"./handleVSCodePaste.js\";\n\nexport const createPasteFromClipboardExtension = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>\n) =>\n Extension.create<{ editor: BlockNoteEditor<BSchema, I, S> }, undefined>({\n name: \"pasteFromClipboard\",\n addProseMirrorPlugins() {\n return [\n new Plugin({\n props: {\n handleDOMEvents: {\n paste(_view, event) {\n event.preventDefault();\n\n if (!editor.isEditable) {\n return;\n }\n\n let format: (typeof acceptedMIMETypes)[number] | undefined;\n for (const mimeType of acceptedMIMETypes) {\n if (event.clipboardData!.types.includes(mimeType)) {\n format = mimeType;\n break;\n }\n }\n if (!format) {\n return true;\n }\n\n if (format === \"vscode-editor-data\") {\n handleVSCodePaste(event, editor);\n return true;\n }\n\n if (format === \"Files\") {\n handleFileInsertion(event, editor);\n return true;\n }\n\n let data = event.clipboardData!.getData(format);\n\n if (format === \"blocknote/html\") {\n editor._tiptapEditor.view.pasteHTML(data);\n return true;\n }\n\n if (format === \"text/html\") {\n const htmlNode = nestedListsToBlockNoteStructure(data.trim());\n data = htmlNode.innerHTML;\n editor._tiptapEditor.view.pasteHTML(data);\n return true;\n }\n\n editor._tiptapEditor.view.pasteText(data);\n\n return true;\n },\n },\n },\n }),\n ];\n },\n });\n","import { Fragment } from \"@tiptap/pm/model\";\nimport { BlockNoteSchema } from \"../../editor/BlockNoteSchema.js\";\nimport {\n BlockNoDefaults,\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { nodeToBlock } from \"./nodeToBlock.js\";\n\n/**\n * Converts all Blocks within a fragment to BlockNote blocks.\n */\nexport function fragmentToBlocks<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(fragment: Fragment, schema: BlockNoteSchema<B, I, S>) {\n // first convert selection to blocknote-style blocks, and then\n // pass these to the exporter\n const blocks: BlockNoDefaults<B, I, S>[] = [];\n fragment.descendants((node) => {\n if (node.type.name === \"blockContainer\") {\n if (node.firstChild?.type.name === \"blockGroup\") {\n // selection started within a block group\n // in this case the fragment starts with:\n // <blockContainer>\n // <blockGroup>\n // <blockContainer ... />\n // <blockContainer ... />\n // </blockGroup>\n // </blockContainer>\n //\n // instead of:\n // <blockContainer>\n // <blockContent ... />\n // <blockGroup>\n // <blockContainer ... />\n // <blockContainer ... />\n // </blockGroup>\n // </blockContainer>\n //\n // so we don't need to serialize this block, just descend into the children of the blockGroup\n return true;\n }\n }\n\n if (node.type.name === \"columnList\" && node.childCount === 1) {\n // column lists with a single column should be flattened (not the entire column list has been selected)\n node.firstChild?.forEach((child) => {\n blocks.push(\n nodeToBlock(\n child,\n schema.blockSchema,\n schema.inlineContentSchema,\n schema.styleSchema\n )\n );\n });\n return false;\n }\n\n if (node.type.isInGroup(\"bnBlock\")) {\n blocks.push(\n nodeToBlock(\n node,\n schema.blockSchema,\n schema.inlineContentSchema,\n schema.styleSchema\n )\n );\n // don't descend into children, as they're already included in the block returned by nodeToBlock\n return false;\n }\n return true;\n });\n return blocks;\n}\n","import { Extension } from \"@tiptap/core\";\nimport { Fragment, Node } from \"prosemirror-model\";\nimport { NodeSelection, Plugin } from \"prosemirror-state\";\nimport { CellSelection } from \"prosemirror-tables\";\nimport * as pmView from \"prosemirror-view\";\n\nimport { EditorView } from \"prosemirror-view\";\nimport type { BlockNoteEditor } from \"../../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../../schema/index.js\";\nimport { createExternalHTMLExporter } from \"../../exporters/html/externalHTMLExporter.js\";\nimport { cleanHTMLToMarkdown } from \"../../exporters/markdown/markdownExporter.js\";\nimport { fragmentToBlocks } from \"../../nodeConversions/fragmentToBlocks.js\";\nimport {\n contentNodeToInlineContent,\n contentNodeToTableContent,\n} from \"../../nodeConversions/nodeToBlock.js\";\n\nfunction fragmentToExternalHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n view: pmView.EditorView,\n selectedFragment: Fragment,\n editor: BlockNoteEditor<BSchema, I, S>\n) {\n let isWithinBlockContent = false;\n const isWithinTable = view.state.selection instanceof CellSelection;\n\n if (!isWithinTable) {\n // Checks whether block ancestry should be included when creating external\n // HTML. If the selection is within a block content node, the block ancestry\n // is excluded as we only care about the inline content.\n const fragmentWithoutParents = view.state.doc.slice(\n view.state.selection.from,\n view.state.selection.to,\n false\n ).content;\n\n const children = [];\n for (let i = 0; i < fragmentWithoutParents.childCount; i++) {\n children.push(fragmentWithoutParents.child(i));\n }\n\n isWithinBlockContent =\n children.find(\n (child) =>\n child.type.isInGroup(\"bnBlock\") ||\n child.type.name === \"blockGroup\" ||\n child.type.spec.group === \"blockContent\"\n ) === undefined;\n if (isWithinBlockContent) {\n selectedFragment = fragmentWithoutParents;\n }\n }\n\n let externalHTML: string;\n\n const externalHTMLExporter = createExternalHTMLExporter(\n view.state.schema,\n editor\n );\n\n if (isWithinTable) {\n if (selectedFragment.firstChild?.type.name === \"table\") {\n // contentNodeToTableContent expects the fragment of the content of a table, not the table node itself\n // but cellselection.content() returns the table node itself if all cells and columns are selected\n selectedFragment = selectedFragment.firstChild.content;\n }\n\n // first convert selection to blocknote-style table content, and then\n // pass this to the exporter\n const ic = contentNodeToTableContent(\n selectedFragment as any,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n );\n\n externalHTML = externalHTMLExporter.exportInlineContent(ic as any, {});\n } else if (isWithinBlockContent) {\n // first convert selection to blocknote-style inline content, and then\n // pass this to the exporter\n const ic = contentNodeToInlineContent(\n selectedFragment as any,\n editor.schema.inlineContentSchema,\n editor.schema.styleSchema\n );\n externalHTML = externalHTMLExporter.exportInlineContent(ic, {});\n } else {\n const blocks = fragmentToBlocks(selectedFragment, editor.schema);\n externalHTML = externalHTMLExporter.exportBlocks(blocks, {});\n }\n return externalHTML;\n}\n\nexport function selectedFragmentToHTML<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n view: EditorView,\n editor: BlockNoteEditor<BSchema, I, S>\n): {\n clipboardHTML: string;\n externalHTML: string;\n markdown: string;\n} {\n // Checks if a `blockContent` node is being copied and expands\n // the selection to the parent `blockContainer` node. This is\n // for the use-case in which only a block without content is\n // selected, e.g. an image block.\n if (\n \"node\" in view.state.selection &&\n (view.state.selection.node as Node).type.spec.group === \"blockContent\"\n ) {\n editor.dispatch(\n editor._tiptapEditor.state.tr.setSelection(\n new NodeSelection(view.state.doc.resolve(view.state.selection.from - 1))\n )\n );\n }\n\n // Uses default ProseMirror clipboard serialization.\n const clipboardHTML: string = (pmView as any).__serializeForClipboard(\n view,\n view.state.selection.content()\n ).dom.innerHTML;\n\n const selectedFragment = view.state.selection.content().content;\n\n const externalHTML = fragmentToExternalHTML<BSchema, I, S>(\n view,\n selectedFragment,\n editor\n );\n\n const markdown = cleanHTMLToMarkdown(externalHTML);\n\n return { clipboardHTML, externalHTML, markdown };\n}\n\nconst copyToClipboard = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n view: EditorView,\n event: ClipboardEvent\n) => {\n // Stops the default browser copy behaviour.\n event.preventDefault();\n event.clipboardData!.clearData();\n\n const { clipboardHTML, externalHTML, markdown } = selectedFragmentToHTML(\n view,\n editor\n );\n\n // TODO: Writing to other MIME types not working in Safari for\n // some reason.\n event.clipboardData!.setData(\"blocknote/html\", clipboardHTML);\n event.clipboardData!.setData(\"text/html\", externalHTML);\n event.clipboardData!.setData(\"text/plain\", markdown);\n};\n\nexport const createCopyToClipboardExtension = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>\n) =>\n Extension.create<{ editor: BlockNoteEditor<BSchema, I, S> }, undefined>({\n name: \"copyToClipboard\",\n addProseMirrorPlugins() {\n return [\n new Plugin({\n props: {\n handleDOMEvents: {\n copy(view, event) {\n copyToClipboard(editor, view, event);\n // Prevent default PM handler to be called\n return true;\n },\n cut(view, event) {\n copyToClipboard(editor, view, event);\n view.dispatch(view.state.tr.deleteSelection());\n // Prevent default PM handler to be called\n return true;\n },\n // This is for the use-case in which only a block without content\n // is selected, e.g. an image block, and dragged (not using the\n // drag handle).\n dragstart(view, event) {\n // Checks if a `NodeSelection` is active.\n if (!(\"node\" in view.state.selection)) {\n return;\n }\n\n // Checks if a `blockContent` node is being dragged.\n if (\n (view.state.selection.node as Node).type.spec.group !==\n \"blockContent\"\n ) {\n return;\n }\n\n // Expands the selection to the parent `blockContainer` node.\n editor.dispatch(\n editor._tiptapEditor.state.tr.setSelection(\n new NodeSelection(\n view.state.doc.resolve(view.state.selection.from - 1)\n )\n )\n );\n\n // Stops the default browser drag start behaviour.\n event.preventDefault();\n event.dataTransfer!.clearData();\n\n const { clipboardHTML, externalHTML, markdown } =\n selectedFragmentToHTML(view, editor);\n\n // TODO: Writing to other MIME types not working in Safari for\n // some reason.\n event.dataTransfer!.setData(\"blocknote/html\", clipboardHTML);\n event.dataTransfer!.setData(\"text/html\", externalHTML);\n event.dataTransfer!.setData(\"text/plain\", markdown);\n\n // Prevent default PM handler to be called\n return true;\n },\n },\n },\n }),\n ];\n },\n });\n","import { Extension } from \"@tiptap/core\";\nimport { defaultProps } from \"../../blocks/defaultProps.js\";\n\nexport const BackgroundColorExtension = Extension.create({\n name: \"blockBackgroundColor\",\n\n addGlobalAttributes() {\n return [\n {\n types: [\"blockContainer\"],\n attributes: {\n backgroundColor: {\n default: defaultProps.backgroundColor.default,\n parseHTML: (element) =>\n element.hasAttribute(\"data-background-color\")\n ? element.getAttribute(\"data-background-color\")\n : defaultProps.backgroundColor.default,\n renderHTML: (attributes) => {\n if (\n attributes.backgroundColor ===\n defaultProps.backgroundColor.default\n ) {\n return {};\n }\n return {\n \"data-background-color\": attributes.backgroundColor,\n };\n },\n },\n },\n },\n ];\n },\n});\n","// from https://raw.githubusercontent.com/ueberdosis/tiptap/develop/packages/core/src/EventEmitter.ts (MIT)\n\ntype StringKeyOf<T> = Extract<keyof T, string>;\ntype CallbackType<\n T extends Record<string, any>,\n EventName extends StringKeyOf<T>\n> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];\ntype CallbackFunction<\n T extends Record<string, any>,\n EventName extends StringKeyOf<T>\n> = (...props: CallbackType<T, EventName>) => any;\n\nexport class EventEmitter<T extends Record<string, any>> {\n // eslint-disable-next-line @typescript-eslint/ban-types\n private callbacks: { [key: string]: Function[] } = {};\n\n public on<EventName extends StringKeyOf<T>>(\n event: EventName,\n fn: CallbackFunction<T, EventName>\n ) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n\n this.callbacks[event].push(fn);\n\n return () => this.off(event, fn);\n }\n\n protected emit<EventName extends StringKeyOf<T>>(\n event: EventName,\n ...args: CallbackType<T, EventName>\n ) {\n const callbacks = this.callbacks[event];\n\n if (callbacks) {\n callbacks.forEach((callback) => callback.apply(this, args));\n }\n }\n\n public off<EventName extends StringKeyOf<T>>(\n event: EventName,\n fn?: CallbackFunction<T, EventName>\n ) {\n const callbacks = this.callbacks[event];\n\n if (callbacks) {\n if (fn) {\n this.callbacks[event] = callbacks.filter((callback) => callback !== fn);\n } else {\n delete this.callbacks[event];\n }\n }\n }\n\n protected removeAllListeners(): void {\n this.callbacks = {};\n }\n}\n","import { EditorState, Plugin, PluginKey, PluginView } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport type {\n BlockFromConfig,\n FileBlockConfig,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nexport type FilePanelState<\n I extends InlineContentSchema,\n S extends StyleSchema\n> = UiElementPosition & {\n // TODO: This typing is not quite right (children should be from BSchema)\n block: BlockFromConfig<FileBlockConfig, I, S>;\n};\n\nexport class FilePanelView<I extends InlineContentSchema, S extends StyleSchema>\n implements PluginView\n{\n public state?: FilePanelState<I, S>;\n public emitUpdate: () => void;\n\n constructor(\n private readonly editor: BlockNoteEditor<\n Record<string, FileBlockConfig>,\n I,\n S\n >,\n private readonly pluginKey: PluginKey,\n private readonly pmView: EditorView,\n emitUpdate: (state: FilePanelState<I, S>) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized file panel\");\n }\n\n emitUpdate(this.state);\n };\n\n pmView.dom.addEventListener(\"mousedown\", this.mouseDownHandler);\n pmView.dom.addEventListener(\"dragstart\", this.dragstartHandler);\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n pmView.root.addEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n mouseDownHandler = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n // For dragging the whole editor.\n dragstartHandler = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n scrollHandler = () => {\n if (this.state?.show) {\n const blockElement = this.pmView.root.querySelector(\n `[data-node-type=\"blockContainer\"][data-id=\"${this.state.block.id}\"]`\n );\n if (!blockElement) {\n return;\n }\n this.state.referencePos = blockElement.getBoundingClientRect();\n this.emitUpdate();\n }\n };\n\n update(view: EditorView, prevState: EditorState) {\n const pluginState: {\n block: BlockFromConfig<FileBlockConfig, I, S>;\n } = this.pluginKey.getState(view.state);\n\n if (!this.state?.show && pluginState.block && this.editor.isEditable) {\n const blockElement = this.pmView.root.querySelector(\n `[data-node-type=\"blockContainer\"][data-id=\"${pluginState.block.id}\"]`\n );\n if (!blockElement) {\n return;\n }\n this.state = {\n show: true,\n referencePos: blockElement.getBoundingClientRect(),\n block: pluginState.block,\n };\n\n this.emitUpdate();\n\n return;\n }\n\n if (\n !view.state.selection.eq(prevState.selection) ||\n !view.state.doc.eq(prevState.doc) ||\n !this.editor.isEditable\n ) {\n if (this.state?.show) {\n this.state.show = false;\n\n this.emitUpdate();\n }\n }\n }\n\n closeMenu = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mousedown\", this.mouseDownHandler);\n\n this.pmView.dom.removeEventListener(\"dragstart\", this.dragstartHandler);\n\n this.pmView.root.removeEventListener(\"scroll\", this.scrollHandler, true);\n }\n}\n\nconst filePanelPluginKey = new PluginKey(\"FilePanelPlugin\");\n\nexport class FilePanelProsemirrorPlugin<\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: FilePanelView<I, S> | undefined;\n public readonly plugin: Plugin;\n\n constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>) {\n super();\n this.plugin = new Plugin<{\n block: BlockFromConfig<FileBlockConfig, I, S> | undefined;\n }>({\n key: filePanelPluginKey,\n view: (editorView) => {\n this.view = new FilePanelView<I, S>(\n editor,\n filePanelPluginKey,\n editorView,\n (state) => {\n this.emit(\"update\", state);\n }\n );\n return this.view;\n },\n props: {\n handleKeyDown: (_view, event: KeyboardEvent) => {\n if (event.key === \"Escape\" && this.shown) {\n this.view?.closeMenu();\n return true;\n }\n return false;\n },\n },\n state: {\n init: () => {\n return {\n block: undefined,\n };\n },\n apply: (transaction) => {\n const block: BlockFromConfig<FileBlockConfig, I, S> | undefined =\n transaction.getMeta(filePanelPluginKey)?.block;\n\n return {\n block,\n };\n },\n },\n });\n }\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n\n public onUpdate(callback: (state: FilePanelState<I, S>) => void) {\n return this.on(\"update\", callback);\n }\n\n public closeMenu = () => this.view?.closeMenu();\n}\n","import { isNodeSelection, isTextSelection, posToDOMRect } from \"@tiptap/core\";\nimport { EditorState, Plugin, PluginKey, PluginView } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nexport type FormattingToolbarState = UiElementPosition;\n\nexport class FormattingToolbarView implements PluginView {\n public state?: FormattingToolbarState;\n public emitUpdate: () => void;\n\n public preventHide = false;\n public preventShow = false;\n\n public shouldShow: (props: {\n view: EditorView;\n state: EditorState;\n from: number;\n to: number;\n }) => boolean = ({ state, from, to, view }) => {\n const { doc, selection } = state;\n const { empty } = selection;\n\n // Sometime check for `empty` is not enough.\n // Doubleclick an empty paragraph returns a node size of 2.\n // So we check also for an empty text size.\n const isEmptyTextBlock =\n !doc.textBetween(from, to).length && isTextSelection(state.selection);\n\n // Don't show toolbar inside code blocks\n if (\n selection.$from.parent.type.spec.code ||\n (isNodeSelection(selection) && selection.node.type.spec.code)\n ) {\n return false;\n }\n\n // check view.hasFocus so that the toolbar doesn't show up when the editor is not focused or when for example a code block is focused\n return !(!view.hasFocus() || empty || isEmptyTextBlock);\n };\n\n constructor(\n private readonly editor: BlockNoteEditor<\n BlockSchema,\n InlineContentSchema,\n StyleSchema\n >,\n private readonly pmView: EditorView,\n emitUpdate: (state: FormattingToolbarState) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\n \"Attempting to update uninitialized formatting toolbar\"\n );\n }\n\n emitUpdate(this.state);\n };\n\n pmView.dom.addEventListener(\"mousedown\", this.viewMousedownHandler);\n pmView.dom.addEventListener(\"mouseup\", this.viewMouseupHandler);\n pmView.dom.addEventListener(\"dragstart\", this.dragHandler);\n pmView.dom.addEventListener(\"dragover\", this.dragHandler);\n pmView.dom.addEventListener(\"blur\", this.blurHandler);\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n pmView.root.addEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n blurHandler = (event: FocusEvent) => {\n if (this.preventHide) {\n this.preventHide = false;\n\n return;\n }\n\n const editorWrapper = this.pmView.dom.parentElement!;\n\n // Checks if the focus is moving to an element outside the editor. If it is,\n // the toolbar is hidden.\n if (\n // An element is clicked.\n event &&\n event.relatedTarget &&\n // Element is inside the editor.\n (editorWrapper === (event.relatedTarget as Node) ||\n editorWrapper.contains(event.relatedTarget as Node) ||\n (event.relatedTarget as HTMLElement).matches(\n \".bn-ui-container, .bn-ui-container *\"\n ))\n ) {\n return;\n }\n\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n viewMousedownHandler = () => {\n this.preventShow = true;\n };\n\n viewMouseupHandler = () => {\n this.preventShow = false;\n setTimeout(() => this.update(this.pmView));\n };\n\n // For dragging the whole editor.\n dragHandler = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n scrollHandler = () => {\n if (this.state?.show) {\n this.state.referencePos = this.getSelectionBoundingBox();\n this.emitUpdate();\n }\n };\n\n update(view: EditorView, oldState?: EditorState) {\n // Delays the update to handle edge case with drag and drop, where the view\n // is blurred asynchronously and happens only after the state update.\n // Wrapping in a setTimeout gives enough time to wait for the blur event to\n // occur before updating the toolbar.\n const { state, composing } = view;\n const { doc, selection } = state;\n const isSame =\n oldState && oldState.doc.eq(doc) && oldState.selection.eq(selection);\n\n if (composing || isSame) {\n return;\n }\n\n // support for CellSelections\n const { ranges } = selection;\n const from = Math.min(...ranges.map((range) => range.$from.pos));\n const to = Math.max(...ranges.map((range) => range.$to.pos));\n\n const shouldShow = this.shouldShow?.({\n view,\n state,\n from,\n to,\n });\n\n // Checks if menu should be shown/updated.\n if (!this.preventShow && (shouldShow || this.preventHide)) {\n // Unlike other UI elements, we don't prevent the formatting toolbar from\n // showing when the editor is not editable. This is because some buttons,\n // e.g. the download file button, should still be accessible. Therefore,\n // logic for hiding when the editor is non-editable is handled\n // individually in each button.\n this.state = {\n show: true,\n referencePos: this.getSelectionBoundingBox(),\n };\n\n this.emitUpdate();\n\n return;\n }\n\n // Checks if menu should be hidden.\n if (\n this.state?.show &&\n !this.preventHide &&\n (!shouldShow || this.preventShow || !this.editor.isEditable)\n ) {\n this.state.show = false;\n this.emitUpdate();\n\n return;\n }\n }\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mousedown\", this.viewMousedownHandler);\n this.pmView.dom.removeEventListener(\"mouseup\", this.viewMouseupHandler);\n this.pmView.dom.removeEventListener(\"dragstart\", this.dragHandler);\n this.pmView.dom.removeEventListener(\"dragover\", this.dragHandler);\n this.pmView.dom.removeEventListener(\"blur\", this.blurHandler);\n\n this.pmView.root.removeEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n closeMenu = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n getSelectionBoundingBox() {\n const { state } = this.pmView;\n const { selection } = state;\n\n // support for CellSelections\n const { ranges } = selection;\n const from = Math.min(...ranges.map((range) => range.$from.pos));\n const to = Math.max(...ranges.map((range) => range.$to.pos));\n\n if (isNodeSelection(selection)) {\n const node = this.pmView.nodeDOM(from) as HTMLElement;\n if (node) {\n return node.getBoundingClientRect();\n }\n }\n\n return posToDOMRect(this.pmView, from, to);\n }\n}\n\nexport const formattingToolbarPluginKey = new PluginKey(\n \"FormattingToolbarPlugin\"\n);\n\nexport class FormattingToolbarProsemirrorPlugin extends EventEmitter<any> {\n private view: FormattingToolbarView | undefined;\n public readonly plugin: Plugin;\n\n constructor(editor: BlockNoteEditor<any, any, any>) {\n super();\n this.plugin = new Plugin({\n key: formattingToolbarPluginKey,\n view: (editorView) => {\n this.view = new FormattingToolbarView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n props: {\n handleKeyDown: (_view, event: KeyboardEvent) => {\n if (event.key === \"Escape\" && this.shown) {\n this.view!.closeMenu();\n return true;\n }\n return false;\n },\n },\n });\n }\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n\n public onUpdate(callback: (state: FormattingToolbarState) => void) {\n return this.on(\"update\", callback);\n }\n\n public closeMenu = () => this.view!.closeMenu();\n}\n","import { Node } from \"prosemirror-model\";\nimport { EditorState } from \"prosemirror-state\";\n\nimport {\n BlockInfo,\n getBlockInfoFromResolvedPos,\n} from \"../../../getBlockInfoFromPos.js\";\n\n/**\n * Returns the block info from the parent block\n * or undefined if we're at the root\n */\nexport const getParentBlockInfo = (doc: Node, beforePos: number) => {\n const $pos = doc.resolve(beforePos);\n\n if ($pos.depth <= 1) {\n return undefined;\n }\n\n // get start pos of parent\n const parentBeforePos = $pos.posAtIndex(\n $pos.index($pos.depth - 1),\n $pos.depth - 1\n );\n\n const parentBlockInfo = getBlockInfoFromResolvedPos(\n doc.resolve(parentBeforePos)\n );\n return parentBlockInfo;\n};\n\n/**\n * Returns the block info from the sibling block before (above) the given block,\n * or undefined if the given block is the first sibling.\n */\nexport const getPrevBlockInfo = (doc: Node, beforePos: number) => {\n const $pos = doc.resolve(beforePos);\n\n const indexInParent = $pos.index();\n\n if (indexInParent === 0) {\n return undefined;\n }\n\n const prevBlockBeforePos = $pos.posAtIndex(indexInParent - 1);\n\n const prevBlockInfo = getBlockInfoFromResolvedPos(\n doc.resolve(prevBlockBeforePos)\n );\n return prevBlockInfo;\n};\n\n/**\n * If a block has children like this:\n * A\n * - B\n * - C\n * -- D\n *\n * Then the bottom nested block returned is D.\n */\nexport const getBottomNestedBlockInfo = (doc: Node, blockInfo: BlockInfo) => {\n while (blockInfo.childContainer) {\n const group = blockInfo.childContainer.node;\n\n const newPos = doc\n .resolve(blockInfo.childContainer.beforePos + 1)\n .posAtIndex(group.childCount - 1);\n blockInfo = getBlockInfoFromResolvedPos(doc.resolve(newPos));\n }\n\n return blockInfo;\n};\n\nconst canMerge = (prevBlockInfo: BlockInfo, nextBlockInfo: BlockInfo) => {\n return (\n prevBlockInfo.isBlockContainer &&\n prevBlockInfo.blockContent.node.type.spec.content === \"inline*\" &&\n prevBlockInfo.blockContent.node.childCount > 0 &&\n nextBlockInfo.isBlockContainer &&\n nextBlockInfo.blockContent.node.type.spec.content === \"inline*\"\n );\n};\n\nconst mergeBlocks = (\n state: EditorState,\n dispatch: ((args?: any) => any) | undefined,\n prevBlockInfo: BlockInfo,\n nextBlockInfo: BlockInfo\n) => {\n // Un-nests all children of the next block.\n if (!nextBlockInfo.isBlockContainer) {\n throw new Error(\n `Attempted to merge block at position ${nextBlockInfo.bnBlock.beforePos} into previous block at position ${prevBlockInfo.bnBlock.beforePos}, but next block is not a block container`\n );\n }\n\n // Removes a level of nesting all children of the next block by 1 level, if it contains both content and block\n // group nodes.\n if (nextBlockInfo.childContainer) {\n const childBlocksStart = state.doc.resolve(\n nextBlockInfo.childContainer.beforePos + 1\n );\n const childBlocksEnd = state.doc.resolve(\n nextBlockInfo.childContainer.afterPos - 1\n );\n const childBlocksRange = childBlocksStart.blockRange(childBlocksEnd);\n\n if (dispatch) {\n const pos = state.doc.resolve(nextBlockInfo.bnBlock.beforePos);\n state.tr.lift(childBlocksRange!, pos.depth);\n }\n }\n\n // Deletes the boundary between the two blocks. Can be thought of as\n // removing the closing tags of the first block and the opening tags of the\n // second one to stitch them together.\n if (dispatch) {\n if (!prevBlockInfo.isBlockContainer) {\n throw new Error(\n `Attempted to merge block at position ${nextBlockInfo.bnBlock.beforePos} into previous block at position ${prevBlockInfo.bnBlock.beforePos}, but previous block is not a block container`\n );\n }\n\n // TODO: test merging between a columnList and paragraph, between two columnLists, and v.v.\n dispatch(\n state.tr.delete(\n prevBlockInfo.blockContent.afterPos - 1,\n nextBlockInfo.blockContent.beforePos + 1\n )\n );\n }\n\n return true;\n};\n\nexport const mergeBlocksCommand =\n (posBetweenBlocks: number) =>\n ({\n state,\n dispatch,\n }: {\n state: EditorState;\n dispatch: ((args?: any) => any) | undefined;\n }) => {\n const $pos = state.doc.resolve(posBetweenBlocks);\n const nextBlockInfo = getBlockInfoFromResolvedPos($pos);\n\n const prevBlockInfo = getPrevBlockInfo(\n state.doc,\n nextBlockInfo.bnBlock.beforePos\n );\n\n if (!prevBlockInfo) {\n return false;\n }\n\n const bottomNestedBlockInfo = getBottomNestedBlockInfo(\n state.doc,\n prevBlockInfo\n );\n\n if (!canMerge(bottomNestedBlockInfo, nextBlockInfo)) {\n return false;\n }\n\n return mergeBlocks(state, dispatch, bottomNestedBlockInfo, nextBlockInfo);\n };\n","import { Extension } from \"@tiptap/core\";\n\nimport { TextSelection } from \"prosemirror-state\";\nimport { ReplaceAroundStep } from \"prosemirror-transform\";\nimport {\n getBottomNestedBlockInfo,\n getParentBlockInfo,\n getPrevBlockInfo,\n mergeBlocksCommand,\n} from \"../../api/blockManipulation/commands/mergeBlocks/mergeBlocks.js\";\nimport { nestBlock } from \"../../api/blockManipulation/commands/nestBlock/nestBlock.js\";\nimport { splitBlockCommand } from \"../../api/blockManipulation/commands/splitBlock/splitBlock.js\";\nimport { updateBlockCommand } from \"../../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { getBlockInfoFromSelection } from \"../../api/getBlockInfoFromPos.js\";\nimport { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nexport const KeyboardShortcutsExtension = Extension.create<{\n editor: BlockNoteEditor<any, any, any>;\n}>({\n priority: 50,\n\n // TODO: The shortcuts need a refactor. Do we want to use a command priority\n // design as there is now, or clump the logic into a single function?\n addKeyboardShortcuts() {\n // handleBackspace is partially adapted from https://github.com/ueberdosis/tiptap/blob/ed56337470efb4fd277128ab7ef792b37cfae992/packages/core/src/extensions/keymap.ts\n const handleBackspace = () =>\n this.editor.commands.first(({ chain, commands }) => [\n // Deletes the selection if it's not empty.\n () => commands.deleteSelection(),\n // Undoes an input rule if one was triggered in the last editor state change.\n () => commands.undoInputRule(),\n // Reverts block content type to a paragraph if the selection is at the start of the block.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n\n const selectionAtBlockStart =\n state.selection.from === blockInfo.blockContent.beforePos + 1;\n const isParagraph =\n blockInfo.blockContent.node.type.name === \"paragraph\";\n\n if (selectionAtBlockStart && !isParagraph) {\n return commands.command(\n updateBlockCommand(\n this.options.editor,\n blockInfo.bnBlock.beforePos,\n {\n type: \"paragraph\",\n props: {},\n }\n )\n );\n }\n\n return false;\n }),\n // Removes a level of nesting if the block is indented if the selection is at the start of the block.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const { blockContent } = blockInfo;\n\n const selectionAtBlockStart =\n state.selection.from === blockContent.beforePos + 1;\n\n if (selectionAtBlockStart) {\n return commands.liftListItem(\"blockContainer\");\n }\n\n return false;\n }),\n // Merges block with the previous one if it isn't indented, and the selection is at the start of the\n // block. The target block for merging must contain inline content.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const { bnBlock: blockContainer, blockContent } = blockInfo;\n\n const selectionAtBlockStart =\n state.selection.from === blockContent.beforePos + 1;\n const selectionEmpty = state.selection.empty;\n\n const posBetweenBlocks = blockContainer.beforePos;\n\n if (selectionAtBlockStart && selectionEmpty) {\n return chain()\n .command(mergeBlocksCommand(posBetweenBlocks))\n .scrollIntoView()\n .run();\n }\n\n return false;\n }),\n () =>\n commands.command(({ state, dispatch }) => {\n // when at the start of a first block in a column\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n\n const selectionAtBlockStart =\n state.selection.from === blockInfo.blockContent.beforePos + 1;\n\n if (!selectionAtBlockStart) {\n return false;\n }\n\n const prevBlockInfo = getPrevBlockInfo(\n state.doc,\n blockInfo.bnBlock.beforePos\n );\n\n if (prevBlockInfo) {\n // should be no previous block\n return false;\n }\n\n const parentBlockInfo = getParentBlockInfo(\n state.doc,\n blockInfo.bnBlock.beforePos\n );\n\n if (parentBlockInfo?.blockNoteType !== \"column\") {\n return false;\n }\n\n const column = parentBlockInfo;\n\n const columnList = getParentBlockInfo(\n state.doc,\n column.bnBlock.beforePos\n );\n if (columnList?.blockNoteType !== \"columnList\") {\n throw new Error(\"parent of column is not a column list\");\n }\n\n const shouldRemoveColumn =\n column.childContainer!.node.childCount === 1;\n\n const shouldRemoveColumnList =\n shouldRemoveColumn &&\n columnList.childContainer!.node.childCount === 2;\n\n const isFirstColumn =\n columnList.childContainer!.node.firstChild ===\n column.bnBlock.node;\n\n if (dispatch) {\n const blockToMove = state.doc.slice(\n blockInfo.bnBlock.beforePos,\n blockInfo.bnBlock.afterPos,\n false\n );\n\n /*\n There are 3 different cases:\n a) remove entire column list (if no columns would be remaining)\n b) remove just a column (if no blocks inside a column would be remaining)\n c) keep columns (if there are blocks remaining inside a column)\n\n Each of these 3 cases has 2 sub-cases, depending on whether the backspace happens at the start of the first (most-left) column,\n or at the start of a non-first column.\n */\n if (shouldRemoveColumnList) {\n if (isFirstColumn) {\n state.tr.step(\n new ReplaceAroundStep(\n // replace entire column list\n columnList.bnBlock.beforePos,\n columnList.bnBlock.afterPos,\n // select content of remaining column:\n column.bnBlock.afterPos + 1,\n columnList.bnBlock.afterPos - 2,\n blockToMove,\n blockToMove.size, // append existing content to blockToMove\n false\n )\n );\n const pos = state.tr.doc.resolve(column.bnBlock.beforePos);\n state.tr.setSelection(TextSelection.between(pos, pos));\n } else {\n // replaces the column list with the blockToMove slice, prepended with the content of the remaining column\n state.tr.step(\n new ReplaceAroundStep(\n // replace entire column list\n columnList.bnBlock.beforePos,\n columnList.bnBlock.afterPos,\n // select content of existing column:\n columnList.bnBlock.beforePos + 2,\n column.bnBlock.beforePos - 1,\n blockToMove,\n 0, // prepend existing content to blockToMove\n false\n )\n );\n const pos = state.tr.doc.resolve(\n state.tr.mapping.map(column.bnBlock.beforePos - 1)\n );\n state.tr.setSelection(TextSelection.between(pos, pos));\n }\n } else if (shouldRemoveColumn) {\n if (isFirstColumn) {\n // delete column\n state.tr.delete(\n column.bnBlock.beforePos,\n column.bnBlock.afterPos\n );\n\n // move before columnlist\n state.tr.insert(\n columnList.bnBlock.beforePos,\n blockToMove.content\n );\n\n const pos = state.tr.doc.resolve(\n columnList.bnBlock.beforePos\n );\n state.tr.setSelection(TextSelection.between(pos, pos));\n } else {\n // just delete the </column><column> closing and opening tags to merge the columns\n state.tr.delete(\n column.bnBlock.beforePos - 1,\n column.bnBlock.beforePos + 1\n );\n }\n } else {\n // delete block\n state.tr.delete(\n blockInfo.bnBlock.beforePos,\n blockInfo.bnBlock.afterPos\n );\n if (isFirstColumn) {\n // move before columnlist\n state.tr.insert(\n columnList.bnBlock.beforePos - 1,\n blockToMove.content\n );\n } else {\n // append block to previous column\n state.tr.insert(\n column.bnBlock.beforePos - 1,\n blockToMove.content\n );\n }\n const pos = state.tr.doc.resolve(column.bnBlock.beforePos - 1);\n state.tr.setSelection(TextSelection.between(pos, pos));\n }\n }\n\n return true;\n }),\n // Deletes previous block if it contains no content and isn't a table,\n // when the selection is empty and at the start of the block. Moves the\n // current block into the deleted block's place.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n\n if (!blockInfo.isBlockContainer) {\n // TODO\n throw new Error(`todo`);\n }\n\n const selectionAtBlockStart =\n state.selection.from === blockInfo.blockContent.beforePos + 1;\n const selectionEmpty = state.selection.empty;\n\n const prevBlockInfo = getPrevBlockInfo(\n state.doc,\n blockInfo.bnBlock.beforePos\n );\n\n if (prevBlockInfo && selectionAtBlockStart && selectionEmpty) {\n const bottomBlock = getBottomNestedBlockInfo(\n state.doc,\n prevBlockInfo\n );\n\n if (!bottomBlock.isBlockContainer) {\n // TODO\n throw new Error(`todo`);\n }\n\n const prevBlockNotTableAndNoContent =\n bottomBlock.blockContent.node.type.spec.content === \"\" ||\n (bottomBlock.blockContent.node.type.spec.content ===\n \"inline*\" &&\n bottomBlock.blockContent.node.childCount === 0);\n\n if (prevBlockNotTableAndNoContent) {\n return chain()\n .cut(\n {\n from: blockInfo.bnBlock.beforePos,\n to: blockInfo.bnBlock.afterPos,\n },\n bottomBlock.bnBlock.afterPos\n )\n .deleteRange({\n from: bottomBlock.bnBlock.beforePos,\n to: bottomBlock.bnBlock.afterPos,\n })\n .run();\n }\n }\n\n return false;\n }),\n ]);\n\n const handleDelete = () =>\n this.editor.commands.first(({ commands }) => [\n // Deletes the selection if it's not empty.\n () => commands.deleteSelection(),\n // Merges block with the next one (at the same nesting level or lower),\n // if one exists, the block has no children, and the selection is at the\n // end of the block.\n () =>\n commands.command(({ state }) => {\n // TODO: Change this to not rely on offsets & schema assumptions\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const {\n bnBlock: blockContainer,\n blockContent,\n childContainer,\n } = blockInfo;\n\n const { depth } = state.doc.resolve(blockContainer.beforePos);\n const blockAtDocEnd =\n blockContainer.afterPos === state.doc.nodeSize - 3;\n const selectionAtBlockEnd =\n state.selection.from === blockContent.afterPos - 1;\n const selectionEmpty = state.selection.empty;\n const hasChildBlocks = childContainer !== undefined;\n\n if (\n !blockAtDocEnd &&\n selectionAtBlockEnd &&\n selectionEmpty &&\n !hasChildBlocks\n ) {\n let oldDepth = depth;\n let newPos = blockContainer.afterPos + 1;\n let newDepth = state.doc.resolve(newPos).depth;\n\n while (newDepth < oldDepth) {\n oldDepth = newDepth;\n newPos += 2;\n newDepth = state.doc.resolve(newPos).depth;\n }\n\n return commands.command(mergeBlocksCommand(newPos - 1));\n }\n\n return false;\n }),\n ]);\n\n const handleEnter = () =>\n this.editor.commands.first(({ commands }) => [\n // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start\n // of the block.\n () =>\n commands.command(({ state }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const { bnBlock: blockContainer, blockContent } = blockInfo;\n\n const { depth } = state.doc.resolve(blockContainer.beforePos);\n\n const selectionAtBlockStart =\n state.selection.$anchor.parentOffset === 0;\n const selectionEmpty =\n state.selection.anchor === state.selection.head;\n const blockEmpty = blockContent.node.childCount === 0;\n const blockIndented = depth > 1;\n\n if (\n selectionAtBlockStart &&\n selectionEmpty &&\n blockEmpty &&\n blockIndented\n ) {\n return commands.liftListItem(\"blockContainer\");\n }\n\n return false;\n }),\n // Creates a new block and moves the selection to it if the current one is empty, while the selection is also\n // empty & at the start of the block.\n () =>\n commands.command(({ state, dispatch }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const { bnBlock: blockContainer, blockContent } = blockInfo;\n\n const selectionAtBlockStart =\n state.selection.$anchor.parentOffset === 0;\n const selectionEmpty =\n state.selection.anchor === state.selection.head;\n const blockEmpty = blockContent.node.childCount === 0;\n\n if (selectionAtBlockStart && selectionEmpty && blockEmpty) {\n const newBlockInsertionPos = blockContainer.afterPos;\n const newBlockContentPos = newBlockInsertionPos + 2;\n\n if (dispatch) {\n const newBlock =\n state.schema.nodes[\"blockContainer\"].createAndFill()!;\n\n state.tr\n .insert(newBlockInsertionPos, newBlock)\n .scrollIntoView();\n state.tr.setSelection(\n new TextSelection(state.doc.resolve(newBlockContentPos))\n );\n }\n\n return true;\n }\n\n return false;\n }),\n // Splits the current block, moving content inside that's after the cursor to a new text block below. Also\n // deletes the selection beforehand, if it's not empty.\n () =>\n commands.command(({ state, chain }) => {\n const blockInfo = getBlockInfoFromSelection(state);\n if (!blockInfo.isBlockContainer) {\n return false;\n }\n const { blockContent } = blockInfo;\n\n const selectionAtBlockStart =\n state.selection.$anchor.parentOffset === 0;\n const blockEmpty = blockContent.node.childCount === 0;\n\n if (!blockEmpty) {\n chain()\n .deleteSelection()\n .command(\n splitBlockCommand(\n state.selection.from,\n selectionAtBlockStart,\n selectionAtBlockStart\n )\n )\n .run();\n\n return true;\n }\n\n return false;\n }),\n ]);\n\n return {\n Backspace: handleBackspace,\n Delete: handleDelete,\n Enter: handleEnter,\n // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the\n // editor since the browser will try to use tab for keyboard navigation.\n Tab: () => {\n if (\n this.options.editor.formattingToolbar?.shown ||\n this.options.editor.linkToolbar?.shown ||\n this.options.editor.filePanel?.shown\n ) {\n // don't handle tabs if a toolbar is shown, so we can tab into / out of it\n return false;\n }\n return nestBlock(this.options.editor);\n // return true;\n },\n \"Shift-Tab\": () => {\n if (\n this.options.editor.formattingToolbar?.shown ||\n this.options.editor.linkToolbar?.shown ||\n this.options.editor.filePanel?.shown\n ) {\n // don't handle tabs if a toolbar is shown, so we can tab into / out of it\n return false;\n }\n this.editor.commands.liftListItem(\"blockContainer\");\n return true;\n },\n \"Shift-Mod-ArrowUp\": () => {\n this.options.editor.moveBlockUp();\n return true;\n },\n \"Shift-Mod-ArrowDown\": () => {\n this.options.editor.moveBlockDown();\n return true;\n },\n };\n },\n});\n","import { getMarkRange, posToDOMRect, Range } from \"@tiptap/core\";\n\nimport { EditorView } from \"@tiptap/pm/view\";\nimport { Mark } from \"prosemirror-model\";\nimport { Plugin, PluginKey, PluginView } from \"prosemirror-state\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nexport type LinkToolbarState = UiElementPosition & {\n // The hovered link's URL, and the text it's displayed with in the\n // editor.\n url: string;\n text: string;\n};\n\nclass LinkToolbarView implements PluginView {\n public state?: LinkToolbarState;\n public emitUpdate: () => void;\n\n menuUpdateTimer: ReturnType<typeof setTimeout> | undefined;\n startMenuUpdateTimer: () => void;\n stopMenuUpdateTimer: () => void;\n\n mouseHoveredLinkMark: Mark | undefined;\n mouseHoveredLinkMarkRange: Range | undefined;\n\n keyboardHoveredLinkMark: Mark | undefined;\n keyboardHoveredLinkMarkRange: Range | undefined;\n\n linkMark: Mark | undefined;\n linkMarkRange: Range | undefined;\n\n constructor(\n private readonly editor: BlockNoteEditor<any, any, any>,\n private readonly pmView: EditorView,\n emitUpdate: (state: LinkToolbarState) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized link toolbar\");\n }\n\n emitUpdate(this.state);\n };\n\n this.startMenuUpdateTimer = () => {\n this.menuUpdateTimer = setTimeout(() => {\n this.update();\n }, 250);\n };\n\n this.stopMenuUpdateTimer = () => {\n if (this.menuUpdateTimer) {\n clearTimeout(this.menuUpdateTimer);\n this.menuUpdateTimer = undefined;\n }\n\n return false;\n };\n\n this.pmView.dom.addEventListener(\"mouseover\", this.mouseOverHandler);\n this.pmView.root.addEventListener(\n \"click\",\n this.clickHandler as EventListener,\n true\n );\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n this.pmView.root.addEventListener(\"scroll\", this.scrollHandler, true);\n }\n\n mouseOverHandler = (event: MouseEvent) => {\n // Resets the link mark currently hovered by the mouse cursor.\n this.mouseHoveredLinkMark = undefined;\n this.mouseHoveredLinkMarkRange = undefined;\n\n this.stopMenuUpdateTimer();\n\n if (\n event.target instanceof HTMLAnchorElement &&\n event.target.nodeName === \"A\"\n ) {\n // Finds link mark at the hovered element's position to update mouseHoveredLinkMark and\n // mouseHoveredLinkMarkRange.\n const hoveredLinkElement = event.target;\n const posInHoveredLinkMark =\n this.pmView.posAtDOM(hoveredLinkElement, 0) + 1;\n const resolvedPosInHoveredLinkMark =\n this.pmView.state.doc.resolve(posInHoveredLinkMark);\n const marksAtPos = resolvedPosInHoveredLinkMark.marks();\n\n for (const mark of marksAtPos) {\n if (\n mark.type.name === this.pmView.state.schema.mark(\"link\").type.name\n ) {\n this.mouseHoveredLinkMark = mark;\n this.mouseHoveredLinkMarkRange =\n getMarkRange(resolvedPosInHoveredLinkMark, mark.type, mark.attrs) ||\n undefined;\n\n break;\n }\n }\n }\n\n this.startMenuUpdateTimer();\n\n return false;\n };\n\n clickHandler = (event: MouseEvent) => {\n const editorWrapper = this.pmView.dom.parentElement!;\n\n if (\n // Toolbar is open.\n this.linkMark &&\n // An element is clicked.\n event &&\n event.target &&\n // The clicked element is not the editor.\n !(\n editorWrapper === (event.target as Node) ||\n editorWrapper.contains(event.target as Node)\n )\n ) {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n }\n };\n\n scrollHandler = () => {\n if (this.linkMark !== undefined) {\n if (this.state?.show) {\n this.state.referencePos = posToDOMRect(\n this.pmView,\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n );\n this.emitUpdate();\n }\n }\n };\n\n editLink(url: string, text: string) {\n const tr = this.pmView.state.tr.insertText(\n text,\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n );\n tr.addMark(\n this.linkMarkRange!.from,\n this.linkMarkRange!.from + text.length,\n this.pmView.state.schema.mark(\"link\", { href: url })\n );\n this.editor.dispatch(tr);\n this.pmView.focus();\n\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n }\n\n deleteLink() {\n this.editor.dispatch(\n this.pmView.state.tr\n .removeMark(\n this.linkMarkRange!.from,\n this.linkMarkRange!.to,\n this.linkMark!.type\n )\n .setMeta(\"preventAutolink\", true)\n );\n this.pmView.focus();\n\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n }\n\n update() {\n if (!this.pmView.hasFocus()) {\n return;\n }\n\n // Saves the currently hovered link mark before it's updated.\n const prevLinkMark = this.linkMark;\n\n // Resets the currently hovered link mark.\n this.linkMark = undefined;\n this.linkMarkRange = undefined;\n\n // Resets the link mark currently hovered by the keyboard cursor.\n this.keyboardHoveredLinkMark = undefined;\n this.keyboardHoveredLinkMarkRange = undefined;\n\n // Finds link mark at the editor selection's position to update keyboardHoveredLinkMark and\n // keyboardHoveredLinkMarkRange.\n if (this.pmView.state.selection.empty) {\n const marksAtPos = this.pmView.state.selection.$from.marks();\n\n for (const mark of marksAtPos) {\n if (\n mark.type.name === this.pmView.state.schema.mark(\"link\").type.name\n ) {\n this.keyboardHoveredLinkMark = mark;\n this.keyboardHoveredLinkMarkRange =\n getMarkRange(\n this.pmView.state.selection.$from,\n mark.type,\n mark.attrs\n ) || undefined;\n\n break;\n }\n }\n }\n\n if (this.mouseHoveredLinkMark) {\n this.linkMark = this.mouseHoveredLinkMark;\n this.linkMarkRange = this.mouseHoveredLinkMarkRange;\n }\n\n // Keyboard cursor position takes precedence over mouse hovered link.\n if (this.keyboardHoveredLinkMark) {\n this.linkMark = this.keyboardHoveredLinkMark;\n this.linkMarkRange = this.keyboardHoveredLinkMarkRange;\n }\n\n if (this.linkMark && this.editor.isEditable) {\n this.state = {\n show: true,\n referencePos: posToDOMRect(\n this.pmView,\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n ),\n url: this.linkMark!.attrs.href,\n text: this.pmView.state.doc.textBetween(\n this.linkMarkRange!.from,\n this.linkMarkRange!.to\n ),\n };\n this.emitUpdate();\n\n return;\n }\n\n // Hides menu.\n if (\n this.state?.show &&\n prevLinkMark &&\n (!this.linkMark || !this.editor.isEditable)\n ) {\n this.state.show = false;\n this.emitUpdate();\n\n return;\n }\n }\n\n closeMenu = () => {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate();\n }\n };\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mouseover\", this.mouseOverHandler);\n this.pmView.root.removeEventListener(\"scroll\", this.scrollHandler, true);\n this.pmView.root.removeEventListener(\n \"click\",\n this.clickHandler as EventListener,\n true\n );\n }\n}\n\nexport const linkToolbarPluginKey = new PluginKey(\"LinkToolbarPlugin\");\n\nexport class LinkToolbarProsemirrorPlugin<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: LinkToolbarView | undefined;\n public readonly plugin: Plugin;\n\n constructor(editor: BlockNoteEditor<BSchema, I, S>) {\n super();\n this.plugin = new Plugin({\n key: linkToolbarPluginKey,\n view: (editorView) => {\n this.view = new LinkToolbarView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n props: {\n handleKeyDown: (_view, event: KeyboardEvent) => {\n if (event.key === \"Escape\" && this.shown) {\n this.view!.closeMenu();\n return true;\n }\n return false;\n },\n },\n });\n }\n\n public onUpdate(callback: (state: LinkToolbarState) => void) {\n return this.on(\"update\", callback);\n }\n\n /**\n * Edit the currently hovered link.\n */\n public editLink = (url: string, text: string) => {\n this.view!.editLink(url, text);\n };\n\n /**\n * Delete the currently hovered link.\n */\n public deleteLink = () => {\n this.view!.deleteLink();\n };\n\n /**\n * When hovering on/off links using the mouse cursor, the link toolbar will\n * open & close with a delay.\n *\n * This function starts the delay timer, and should be used for when the mouse\n * cursor enters the link toolbar.\n */\n public startHideTimer = () => {\n this.view!.startMenuUpdateTimer();\n };\n\n /**\n * When hovering on/off links using the mouse cursor, the link toolbar will\n * open & close with a delay.\n *\n * This function stops the delay timer, and should be used for when the mouse\n * cursor exits the link toolbar.\n */\n public stopHideTimer = () => {\n this.view!.stopMenuUpdateTimer();\n };\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n\n public closeMenu = () => this.view!.closeMenu();\n}\n","import { Plugin, PluginKey, TextSelection } from \"prosemirror-state\";\n\nconst PLUGIN_KEY = new PluginKey(\"node-selection-keyboard\");\n// By default, typing with a node selection active will cause ProseMirror to\n// replace the node with one that contains editable content. This plugin blocks\n// this behaviour without also blocking things like keyboard shortcuts:\n//\n// - Lets through key presses that do not include alphanumeric characters. This\n// includes things like backspace/delete/home/end/etc.\n// - Lets through any key presses that include ctrl/meta keys. These will be\n// shortcuts of some kind like ctrl+C/mod+C.\n// - Special case for Enter key which creates a new paragraph block below and\n// sets the selection to it. This is just to bring the UX closer to Notion\n//\n// While a more elegant solution would probably process transactions instead of\n// keystrokes, this brings us most of the way to Notion's UX without much added\n// complexity.\nexport class NodeSelectionKeyboardPlugin {\n public readonly plugin: Plugin;\n constructor() {\n this.plugin = new Plugin({\n key: PLUGIN_KEY,\n props: {\n handleKeyDown: (view, event) => {\n // Checks for node selection\n if (\"node\" in view.state.selection) {\n // Checks if key press uses ctrl/meta modifier\n if (event.ctrlKey || event.metaKey) {\n return false;\n }\n // Checks if key press is alphanumeric\n if (event.key.length === 1) {\n event.preventDefault();\n\n return true;\n }\n // Checks if key press is Enter\n if (\n event.key === \"Enter\" &&\n !event.shiftKey &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n const tr = view.state.tr;\n view.dispatch(\n tr\n .insert(\n view.state.tr.selection.$to.after(),\n view.state.schema.nodes[\"paragraph\"].createChecked()\n )\n .setSelection(\n new TextSelection(\n tr.doc.resolve(view.state.tr.selection.$to.after() + 1)\n )\n )\n );\n\n return true;\n }\n }\n\n return false;\n },\n },\n });\n }\n}\n","import { Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nconst PLUGIN_KEY = new PluginKey(`blocknote-placeholder`);\n\nexport class PlaceholderPlugin {\n public readonly plugin: Plugin;\n constructor(\n editor: BlockNoteEditor<any, any, any>,\n placeholders: Record<string | \"default\", string>\n ) {\n this.plugin = new Plugin({\n key: PLUGIN_KEY,\n view: () => {\n const styleEl = document.createElement(\"style\");\n const nonce = editor._tiptapEditor.options.injectNonce;\n if (nonce) {\n styleEl.setAttribute(\"nonce\", nonce);\n }\n if (editor._tiptapEditor.view.root instanceof ShadowRoot) {\n editor._tiptapEditor.view.root.append(styleEl);\n } else {\n editor._tiptapEditor.view.root.head.appendChild(styleEl);\n }\n\n const styleSheet = styleEl.sheet!;\n\n const getBaseSelector = (additionalSelectors = \"\") =>\n `.bn-block-content${additionalSelectors} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`;\n\n const getSelector = (\n blockType: string | \"default\",\n mustBeFocused = true\n ) => {\n const mustBeFocusedSelector = mustBeFocused\n ? `[data-is-empty-and-focused]`\n : ``;\n\n if (blockType === \"default\") {\n return getBaseSelector(mustBeFocusedSelector);\n }\n\n const blockTypeSelector = `[data-content-type=\"${blockType}\"]`;\n return getBaseSelector(mustBeFocusedSelector + blockTypeSelector);\n };\n\n for (const [blockType, placeholder] of Object.entries(placeholders)) {\n const mustBeFocused = blockType === \"default\";\n\n styleSheet.insertRule(\n `${getSelector(\n blockType,\n mustBeFocused\n )}{ content: ${JSON.stringify(placeholder)}; }`\n );\n\n // For some reason, the placeholders which show when the block is focused\n // take priority over ones which show depending on block type, so we need\n // to make sure the block specific ones are also used when the block is\n // focused.\n if (!mustBeFocused) {\n styleSheet.insertRule(\n `${getSelector(blockType, true)}{ content: ${JSON.stringify(\n placeholder\n )}; }`\n );\n }\n }\n\n return {\n destroy: () => {\n if (editor._tiptapEditor.view.root instanceof ShadowRoot) {\n editor._tiptapEditor.view.root.removeChild(styleEl);\n } else {\n editor._tiptapEditor.view.root.head.removeChild(styleEl);\n }\n },\n };\n },\n props: {\n // TODO: maybe also add placeholder for empty document (\"e.g.: start writing..\")\n decorations: (state) => {\n const { doc, selection } = state;\n\n if (!editor.isEditable) {\n return;\n }\n\n if (!selection.empty) {\n return;\n }\n\n // Don't show placeholder when the cursor is inside a code block\n if (selection.$from.parent.type.spec.code) {\n return;\n }\n\n const $pos = selection.$anchor;\n const node = $pos.parent;\n\n if (node.content.size > 0) {\n return null;\n }\n\n const before = $pos.before();\n\n const dec = Decoration.node(before, before + node.nodeSize, {\n \"data-is-empty-and-focused\": \"true\",\n });\n\n return DecorationSet.create(doc, [dec]);\n },\n },\n });\n }\n}\n","import { findChildren } from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\n\nconst PLUGIN_KEY = new PluginKey(`previous-blocks`);\n\nconst nodeAttributes: Record<string, string> = {\n // Numbered List Items\n index: \"index\",\n // Headings\n level: \"level\",\n // All Blocks\n type: \"type\",\n depth: \"depth\",\n \"depth-change\": \"depth-change\",\n};\n\n/**\n * This plugin tracks transformation of Block node attributes, so we can support CSS transitions.\n *\n * Problem it solves: ProseMirror recreates the DOM when transactions happen. So when a transaction changes a Node attribute,\n * it results in a completely new DOM element. This means CSS transitions don't work.\n *\n * Solution: When attributes change on a node, this plugin sets a data-* attribute with the \"previous\" value. This way we can still use CSS transitions. (See block.module.css)\n */\nexport class PreviousBlockTypePlugin {\n public readonly plugin: Plugin;\n constructor() {\n let timeout: ReturnType<typeof setTimeout>;\n this.plugin = new Plugin({\n key: PLUGIN_KEY,\n view(_editorView) {\n return {\n update: async (view, _prevState) => {\n if (this.key?.getState(view.state).updatedBlocks.size > 0) {\n // use setTimeout 0 to clear the decorations so that at least\n // for one DOM-render the decorations have been applied\n timeout = setTimeout(() => {\n view.dispatch(\n view.state.tr.setMeta(PLUGIN_KEY, { clearUpdate: true })\n );\n }, 0);\n }\n },\n destroy: () => {\n if (timeout) {\n clearTimeout(timeout);\n }\n },\n };\n },\n state: {\n init() {\n return {\n // Block attributes, by block ID, from just before the previous transaction.\n prevTransactionOldBlockAttrs: {} as any,\n // Block attributes, by block ID, from just before the current transaction.\n currentTransactionOldBlockAttrs: {} as any,\n // Set of IDs of blocks whose attributes changed from the current transaction.\n updatedBlocks: new Set<string>(),\n };\n },\n\n apply(transaction, prev, oldState, newState) {\n prev.currentTransactionOldBlockAttrs = {};\n prev.updatedBlocks.clear();\n\n if (!transaction.docChanged || oldState.doc.eq(newState.doc)) {\n return prev;\n }\n\n // TODO: Instead of iterating through the entire document, only check nodes affected by the transactions. Will\n // also probably require checking nodes affected by the previous transaction too.\n // We didn't get this to work yet:\n // const transform = combineTransactionSteps(oldState.doc, [transaction]);\n // // const { mapping } = transform;\n // const changes = getChangedRanges(transform);\n //\n // changes.forEach(({ oldRange, newRange }) => {\n // const oldNodes = findChildrenInRange(\n // oldState.doc,\n // oldRange,\n // (node) => node.attrs.id\n // );\n //\n // const newNodes = findChildrenInRange(\n // newState.doc,\n // newRange,\n // (node) => node.attrs.id\n // );\n\n const currentTransactionOriginalOldBlockAttrs = {} as any;\n\n const oldNodes = findChildren(oldState.doc, (node) => node.attrs.id);\n const oldNodesById = new Map(\n oldNodes.map((node) => [node.node.attrs.id, node])\n );\n const newNodes = findChildren(newState.doc, (node) => node.attrs.id);\n\n // Traverses all block containers in the new editor state.\n for (const node of newNodes) {\n const oldNode = oldNodesById.get(node.node.attrs.id);\n\n const oldContentNode = oldNode?.node.firstChild;\n const newContentNode = node.node.firstChild;\n\n if (oldNode && oldContentNode && newContentNode) {\n const newAttrs = {\n index: newContentNode.attrs.index,\n level: newContentNode.attrs.level,\n type: newContentNode.type.name,\n depth: newState.doc.resolve(node.pos).depth,\n };\n\n let oldAttrs = {\n index: oldContentNode.attrs.index,\n level: oldContentNode.attrs.level,\n type: oldContentNode.type.name,\n depth: oldState.doc.resolve(oldNode.pos).depth,\n };\n\n currentTransactionOriginalOldBlockAttrs[node.node.attrs.id] =\n oldAttrs;\n\n // Whenever a transaction is appended by the OrderedListItemIndexPlugin, it's given the metadata:\n // { \"orderedListIndexing\": true }\n // These appended transactions happen immediately after any transaction which causes ordered list item\n // indices to require updating, including those which trigger animations. Therefore, these animations are\n // immediately overridden when the PreviousBlockTypePlugin processes the appended transaction, despite only\n // the listItemIndex attribute changing. To solve this, oldAttrs must be edited for transactions with the\n // \"orderedListIndexing\" metadata, so the correct animation can be re-triggered.\n if (transaction.getMeta(\"numberedListIndexing\")) {\n // If the block existed before the transaction, gets the attributes from before the previous transaction\n // (i.e. the transaction that caused list item indices to need updating).\n if (node.node.attrs.id in prev.prevTransactionOldBlockAttrs) {\n oldAttrs =\n prev.prevTransactionOldBlockAttrs[node.node.attrs.id];\n }\n\n // Stops list item indices themselves being animated (looks smoother), unless the block's content type is\n // changing from a numbered list item to something else.\n if (newAttrs.type === \"numberedListItem\") {\n oldAttrs.index = newAttrs.index;\n }\n }\n\n prev.currentTransactionOldBlockAttrs[node.node.attrs.id] =\n oldAttrs;\n\n // TODO: faster deep equal?\n if (JSON.stringify(oldAttrs) !== JSON.stringify(newAttrs)) {\n (oldAttrs as any)[\"depth-change\"] =\n oldAttrs.depth - newAttrs.depth;\n\n // for debugging:\n // console.log(\n // \"id:\",\n // node.node.attrs.id,\n // \"previousBlockTypePlugin changes detected, oldAttrs\",\n // oldAttrs,\n // \"new\",\n // newAttrs\n // );\n\n prev.updatedBlocks.add(node.node.attrs.id);\n }\n }\n }\n\n prev.prevTransactionOldBlockAttrs =\n currentTransactionOriginalOldBlockAttrs;\n\n return prev;\n },\n },\n props: {\n decorations(state) {\n const pluginState = (this as Plugin).getState(state);\n if (pluginState.updatedBlocks.size === 0) {\n return undefined;\n }\n\n const decorations: Decoration[] = [];\n\n state.doc.descendants((node, pos) => {\n if (!node.attrs.id) {\n return;\n }\n\n if (!pluginState.updatedBlocks.has(node.attrs.id)) {\n return;\n }\n\n const prevAttrs =\n pluginState.currentTransactionOldBlockAttrs[node.attrs.id];\n const decorationAttrs: any = {};\n\n for (const [nodeAttr, val] of Object.entries(prevAttrs)) {\n decorationAttrs[\"data-prev-\" + nodeAttributes[nodeAttr]] =\n val || \"none\";\n }\n\n // for debugging:\n // console.log(\n // \"previousBlockTypePlugin committing decorations\",\n // decorationAttrs\n // );\n\n const decoration = Decoration.node(pos, pos + node.nodeSize, {\n ...decorationAttrs,\n });\n\n decorations.push(decoration);\n });\n\n return DecorationSet.create(state.doc, decorations);\n },\n },\n });\n }\n}\n","import { EditorView } from \"prosemirror-view\";\n\nexport function getDraggableBlockFromElement(\n element: Element,\n view: EditorView\n) {\n while (\n element &&\n element.parentElement &&\n element.parentElement !== view.dom &&\n element.getAttribute?.(\"data-node-type\") !== \"blockContainer\"\n ) {\n element = element.parentElement;\n }\n if (element.getAttribute?.(\"data-node-type\") !== \"blockContainer\") {\n return undefined;\n }\n return { node: element as HTMLElement, id: element.getAttribute(\"data-id\")! };\n}\n","import { Fragment, Node, ResolvedPos, Slice } from \"prosemirror-model\";\nimport { Selection } from \"prosemirror-state\";\nimport { Mappable } from \"prosemirror-transform\";\n\n/**\n * This class represents an editor selection which spans multiple nodes/blocks. It's currently only used to allow users\n * to drag multiple blocks at the same time. Expects the selection anchor and head to be between nodes, i.e. just before\n * the first target node and just after the last, and that anchor and head are at the same nesting level.\n *\n * Partially based on ProseMirror's NodeSelection implementation:\n * (https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.ts)\n * MultipleNodeSelection differs from NodeSelection in the following ways:\n * 1. Stores which nodes are included in the selection instead of just a single node.\n * 2. Already expects the selection to start just before the first target node and ends just after the last, while a\n * NodeSelection automatically sets both anchor and head to just before the single target node.\n */\nexport class MultipleNodeSelection extends Selection {\n nodes: Array<Node>;\n\n constructor($anchor: ResolvedPos, $head: ResolvedPos) {\n super($anchor, $head);\n\n // Parent is at the same nesting level as anchor/head since they are just before/ just after target nodes.\n const parentNode = $anchor.node();\n\n this.nodes = [];\n $anchor.doc.nodesBetween($anchor.pos, $head.pos, (node, _pos, parent) => {\n if (parent !== null && parent.eq(parentNode)) {\n this.nodes.push(node);\n return false;\n }\n return;\n });\n }\n\n static create(doc: Node, from: number, to = from): MultipleNodeSelection {\n return new MultipleNodeSelection(doc.resolve(from), doc.resolve(to));\n }\n\n content(): Slice {\n return new Slice(Fragment.from(this.nodes), 0, 0);\n }\n\n eq(selection: Selection): boolean {\n if (!(selection instanceof MultipleNodeSelection)) {\n return false;\n }\n\n if (this.nodes.length !== selection.nodes.length) {\n return false;\n }\n\n if (this.from !== selection.from || this.to !== selection.to) {\n return false;\n }\n\n for (let i = 0; i < this.nodes.length; i++) {\n if (!this.nodes[i].eq(selection.nodes[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n map(doc: Node, mapping: Mappable): Selection {\n const fromResult = mapping.mapResult(this.from);\n const toResult = mapping.mapResult(this.to);\n\n if (toResult.deleted) {\n return Selection.near(doc.resolve(fromResult.pos));\n }\n\n if (fromResult.deleted) {\n return Selection.near(doc.resolve(toResult.pos));\n }\n\n return new MultipleNodeSelection(\n doc.resolve(fromResult.pos),\n doc.resolve(toResult.pos)\n );\n }\n\n toJSON(): any {\n return { type: \"node\", anchor: this.anchor, head: this.head };\n }\n}\n","import { Node } from \"prosemirror-model\";\nimport { NodeSelection, Selection } from \"prosemirror-state\";\nimport * as pmView from \"prosemirror-view\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport { createExternalHTMLExporter } from \"../../api/exporters/html/externalHTMLExporter.js\";\nimport { cleanHTMLToMarkdown } from \"../../api/exporters/markdown/markdownExporter.js\";\nimport { fragmentToBlocks } from \"../../api/nodeConversions/fragmentToBlocks.js\";\nimport { getNodeById } from \"../../api/nodeUtil.js\";\nimport { Block } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { MultipleNodeSelection } from \"./MultipleNodeSelection.js\";\n\nlet dragImageElement: Element | undefined;\n\nexport type SideMenuState<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = UiElementPosition & {\n // The block that the side menu is attached to.\n block: Block<BSchema, I, S>;\n};\n\nfunction blockPositionsFromSelection(selection: Selection, doc: Node) {\n // Absolute positions just before the first block spanned by the selection, and just after the last block. Having the\n // selection start and end just before and just after the target blocks ensures no whitespace/line breaks are left\n // behind after dragging & dropping them.\n let beforeFirstBlockPos: number;\n let afterLastBlockPos: number;\n\n // Even the user starts dragging blocks but drops them in the same place, the selection will still be moved just\n // before & just after the blocks spanned by the selection, and therefore doesn't need to change if they try to drag\n // the same blocks again. If this happens, the anchor & head move out of the block content node they were originally\n // in. If the anchor should update but the head shouldn't and vice versa, it means the user selection is outside a\n // block content node, which should never happen.\n const selectionStartInBlockContent =\n doc.resolve(selection.from).node().type.spec.group === \"blockContent\";\n const selectionEndInBlockContent =\n doc.resolve(selection.to).node().type.spec.group === \"blockContent\";\n\n // Ensures that entire outermost nodes are selected if the selection spans multiple nesting levels.\n const minDepth = Math.min(selection.$anchor.depth, selection.$head.depth);\n\n if (selectionStartInBlockContent && selectionEndInBlockContent) {\n // Absolute positions at the start of the first block in the selection and at the end of the last block. User\n // selections will always start and end in block content nodes, but we want the start and end positions of their\n // parent block nodes, which is why minDepth - 1 is used.\n const startFirstBlockPos = selection.$from.start(minDepth - 1);\n const endLastBlockPos = selection.$to.end(minDepth - 1);\n\n // Shifting start and end positions by one moves them just outside the first and last selected blocks.\n beforeFirstBlockPos = doc.resolve(startFirstBlockPos - 1).pos;\n afterLastBlockPos = doc.resolve(endLastBlockPos + 1).pos;\n } else {\n beforeFirstBlockPos = selection.from;\n afterLastBlockPos = selection.to;\n }\n\n return { from: beforeFirstBlockPos, to: afterLastBlockPos };\n}\n\nfunction setDragImage(view: EditorView, from: number, to = from) {\n if (from === to) {\n // Moves to position to be just after the first (and only) selected block.\n to += view.state.doc.resolve(from + 1).node().nodeSize;\n }\n\n // Parent element is cloned to remove all unselected children without affecting the editor content.\n const parentClone = view.domAtPos(from).node.cloneNode(true) as Element;\n const parent = view.domAtPos(from).node as Element;\n\n const getElementIndex = (parentElement: Element, targetElement: Element) =>\n Array.prototype.indexOf.call(parentElement.children, targetElement);\n\n const firstSelectedBlockIndex = getElementIndex(\n parent,\n // Expects from position to be just before the first selected block.\n view.domAtPos(from + 1).node.parentElement!\n );\n const lastSelectedBlockIndex = getElementIndex(\n parent,\n // Expects to position to be just after the last selected block.\n view.domAtPos(to - 1).node.parentElement!\n );\n\n for (let i = parent.childElementCount - 1; i >= 0; i--) {\n if (i > lastSelectedBlockIndex || i < firstSelectedBlockIndex) {\n parentClone.removeChild(parentClone.children[i]);\n }\n }\n\n // dataTransfer.setDragImage(element) only works if element is attached to the DOM.\n unsetDragImage(view.root);\n dragImageElement = parentClone;\n\n // TODO: This is hacky, need a better way of assigning classes to the editor so that they can also be applied to the\n // drag preview.\n const classes = view.dom.className.split(\" \");\n const inheritedClasses = classes\n .filter(\n (className) =>\n className !== \"ProseMirror\" &&\n className !== \"bn-root\" &&\n className !== \"bn-editor\"\n )\n .join(\" \");\n\n dragImageElement.className =\n dragImageElement.className + \" bn-drag-preview \" + inheritedClasses;\n\n if (view.root instanceof ShadowRoot) {\n view.root.appendChild(dragImageElement);\n } else {\n view.root.body.appendChild(dragImageElement);\n }\n}\n\nexport function unsetDragImage(rootEl: Document | ShadowRoot) {\n if (dragImageElement !== undefined) {\n if (rootEl instanceof ShadowRoot) {\n rootEl.removeChild(dragImageElement);\n } else {\n rootEl.body.removeChild(dragImageElement);\n }\n\n dragImageElement = undefined;\n }\n}\n\nexport function dragStart<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n e: { dataTransfer: DataTransfer | null; clientY: number },\n block: Block<BSchema, I, S>,\n editor: BlockNoteEditor<BSchema, I, S>\n) {\n if (!e.dataTransfer) {\n return;\n }\n\n const view = editor.prosemirrorView;\n\n const pos = getNodeById(block.id, view.state.doc).posBeforeNode;\n\n if (pos != null) {\n const selection = view.state.selection;\n const doc = view.state.doc;\n\n const { from, to } = blockPositionsFromSelection(selection, doc);\n\n const draggedBlockInSelection = from <= pos && pos < to;\n const multipleBlocksSelected =\n selection.$anchor.node() !== selection.$head.node() ||\n selection instanceof MultipleNodeSelection;\n\n if (draggedBlockInSelection && multipleBlocksSelected) {\n view.dispatch(\n view.state.tr.setSelection(MultipleNodeSelection.create(doc, from, to))\n );\n setDragImage(view, from, to);\n } else {\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos))\n );\n setDragImage(view, pos);\n }\n\n const selectedSlice = view.state.selection.content();\n const schema = editor.pmSchema;\n\n const clipboardHTML = (pmView as any).__serializeForClipboard(\n view,\n selectedSlice\n ).dom.innerHTML;\n\n const externalHTMLExporter = createExternalHTMLExporter(schema, editor);\n\n const blocks = fragmentToBlocks(selectedSlice.content, editor.schema);\n const externalHTML = externalHTMLExporter.exportBlocks(blocks, {});\n\n const plainText = cleanHTMLToMarkdown(externalHTML);\n\n e.dataTransfer.clearData();\n e.dataTransfer.setData(\"blocknote/html\", clipboardHTML);\n e.dataTransfer.setData(\"text/html\", externalHTML);\n e.dataTransfer.setData(\"text/plain\", plainText);\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.setDragImage(dragImageElement!, 0, 0);\n view.dragging = { slice: selectedSlice, move: true };\n }\n}\n","import { PluginView } from \"@tiptap/pm/state\";\nimport { EditorState, Plugin, PluginKey } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nimport { Block } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\nimport { initializeESMDependencies } from \"../../util/esmDependencies.js\";\nimport { getDraggableBlockFromElement } from \"../getDraggableBlockFromElement.js\";\nimport { dragStart, unsetDragImage } from \"./dragging.js\";\nexport type SideMenuState<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = UiElementPosition & {\n // The block that the side menu is attached to.\n block: Block<BSchema, I, S>;\n};\n\nconst PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP = 0.1;\n\nfunction getBlockFromCoords(\n view: EditorView,\n coords: { left: number; top: number },\n adjustForColumns = true\n) {\n const elements = view.root.elementsFromPoint(coords.left, coords.top);\n\n for (const element of elements) {\n if (!view.dom.contains(element)) {\n // probably a ui overlay like formatting toolbar etc\n continue;\n }\n if (adjustForColumns) {\n const column = element.closest(\"[data-node-type=columnList]\");\n if (column) {\n return getBlockFromCoords(\n view,\n {\n left: coords.left + 50, // bit hacky, but if we're inside a column, offset x position to right to account for the width of sidemenu itself\n top: coords.top,\n },\n false\n );\n }\n }\n return getDraggableBlockFromElement(element, view);\n }\n return undefined;\n}\n\nfunction getBlockFromMousePos(\n mousePos: {\n x: number;\n y: number;\n },\n view: EditorView\n): { node: HTMLElement; id: string } | undefined {\n // Editor itself may have padding or other styling which affects\n // size/position, so we get the boundingRect of the first child (i.e. the\n // blockGroup that wraps all blocks in the editor) for more accurate side\n // menu placement.\n if (!view.dom.firstChild) {\n return;\n }\n\n const editorBoundingBox = (\n view.dom.firstChild as HTMLElement\n ).getBoundingClientRect();\n\n // this.horizontalPosAnchor = editorBoundingBox.x;\n\n // Gets block at mouse cursor's vertical position.\n const coords = {\n left: mousePos.x,\n top: mousePos.y,\n };\n\n const mouseLeftOfEditor = coords.left < editorBoundingBox.left;\n const mouseRightOfEditor = coords.left > editorBoundingBox.right;\n\n if (mouseLeftOfEditor) {\n coords.left = editorBoundingBox.left + 10;\n }\n\n if (mouseRightOfEditor) {\n coords.left = editorBoundingBox.right - 10;\n }\n\n let block = getBlockFromCoords(view, coords);\n\n if (!mouseRightOfEditor && block) {\n // note: this case is not necessary when we're on the right side of the editor\n\n /* Now, because blocks can be nested\n | BlockA |\n x | BlockB y|\n \n hovering over position x (the \"margin of block B\") will return block A instead of block B.\n to fix this, we get the block from the right side of block A (position y, which will fall in BlockB correctly)\n */\n\n const rect = block.node.getBoundingClientRect();\n coords.left = rect.right - 10;\n block = getBlockFromCoords(view, coords, false);\n }\n\n return block;\n}\n\n/**\n * With the sidemenu plugin we can position a menu next to a hovered block.\n */\nexport class SideMenuView<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> implements PluginView\n{\n public state?: SideMenuState<BSchema, I, S>;\n public readonly emitUpdate: (state: SideMenuState<BSchema, I, S>) => void;\n\n private mousePos: { x: number; y: number } | undefined;\n\n private hoveredBlock: HTMLElement | undefined;\n\n public menuFrozen = false;\n\n constructor(\n private readonly editor: BlockNoteEditor<BSchema, I, S>,\n private readonly pmView: EditorView,\n emitUpdate: (state: SideMenuState<BSchema, I, S>) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized side menu\");\n }\n\n emitUpdate(this.state);\n };\n\n this.pmView.root.addEventListener(\n \"drop\",\n this.onDrop as EventListener,\n true\n );\n this.pmView.root.addEventListener(\n \"dragover\",\n this.onDragOver as EventListener\n );\n initializeESMDependencies();\n\n // Shows or updates menu position whenever the cursor moves, if the menu isn't frozen.\n this.pmView.root.addEventListener(\n \"mousemove\",\n this.onMouseMove as EventListener,\n true\n );\n\n // Hides and unfreezes the menu whenever the user presses a key.\n this.pmView.root.addEventListener(\n \"keydown\",\n this.onKeyDown as EventListener,\n true\n );\n }\n\n updateState = (state: SideMenuState<BSchema, I, S>) => {\n this.state = state;\n this.emitUpdate(this.state);\n };\n\n updateStateFromMousePos = () => {\n if (this.menuFrozen || !this.mousePos) {\n return;\n }\n\n const block = getBlockFromMousePos(this.mousePos, this.pmView);\n\n // Closes the menu if the mouse cursor is beyond the editor vertically.\n if (!block || !this.editor.isEditable) {\n if (this.state?.show) {\n this.state.show = false;\n this.updateState(this.state);\n }\n\n return;\n }\n\n // Doesn't update if the menu is already open and the mouse cursor is still hovering the same block.\n if (\n this.state?.show &&\n this.hoveredBlock?.hasAttribute(\"data-id\") &&\n this.hoveredBlock?.getAttribute(\"data-id\") === block.id\n ) {\n return;\n }\n\n this.hoveredBlock = block.node;\n\n // Gets the block's content node, which lets to ignore child blocks when determining the block menu's position.\n // TODO: needed?\n const blockContent = block.node.firstChild as HTMLElement;\n\n if (!blockContent) {\n return;\n }\n\n // TODO: needed?\n\n // Shows or updates elements.\n if (this.editor.isEditable) {\n const blockContentBoundingBox = blockContent.getBoundingClientRect();\n const column = block.node.closest(\"[data-node-type=column]\");\n this.updateState({\n show: true,\n referencePos: new DOMRect(\n column\n ? // We take the first child as column elements have some default\n // padding. This is a little weird since this child element will\n // be the first block, but since it's always non-nested and we\n // only take the x coordinate, it's ok.\n column.firstElementChild!.getBoundingClientRect().x\n : (\n this.pmView.dom.firstChild as HTMLElement\n ).getBoundingClientRect().x,\n blockContentBoundingBox.y,\n blockContentBoundingBox.width,\n blockContentBoundingBox.height\n ),\n block: this.editor.getBlock(\n this.hoveredBlock!.getAttribute(\"data-id\")!\n )!,\n });\n }\n };\n\n /**\n * If the event is outside the editor contents,\n * we dispatch a fake event, so that we can still drop the content\n * when dragging / dropping to the side of the editor\n */\n onDrop = (event: DragEvent) => {\n this.editor._tiptapEditor.commands.blur();\n\n if (\n (event as any).synthetic ||\n !event.dataTransfer?.types.includes(\"blocknote/html\")\n ) {\n return;\n }\n\n const pos = this.pmView.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n });\n\n if (!pos || pos.inside === -1) {\n const evt = this.createSyntheticEvent(event);\n // console.log(\"dispatch fake drop\");\n this.pmView.dom.dispatchEvent(evt);\n }\n };\n\n /**\n * If the event is outside the editor contents,\n * we dispatch a fake event, so that we can still drop the content\n * when dragging / dropping to the side of the editor\n */\n onDragOver = (event: DragEvent) => {\n if (\n (event as any).synthetic ||\n !event.dataTransfer?.types.includes(\"blocknote/html\")\n ) {\n return;\n }\n const pos = this.pmView.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n });\n\n if (!pos || (pos.inside === -1 && this.pmView.dom.firstChild)) {\n const evt = this.createSyntheticEvent(event);\n // console.log(\"dispatch fake dragover\");\n this.pmView.dom.dispatchEvent(evt);\n }\n };\n\n onKeyDown = (_event: KeyboardEvent) => {\n if (this.state?.show && this.editor.isFocused()) {\n // Typing in editor should hide side menu\n this.state.show = false;\n this.emitUpdate(this.state);\n }\n };\n\n onMouseMove = (event: MouseEvent) => {\n if (this.menuFrozen) {\n return;\n }\n\n this.mousePos = { x: event.clientX, y: event.clientY };\n\n // We want the full area of the editor to check if the cursor is hovering\n // above it though.\n const editorOuterBoundingBox = this.pmView.dom.getBoundingClientRect();\n const cursorWithinEditor =\n this.mousePos.x > editorOuterBoundingBox.left &&\n this.mousePos.x < editorOuterBoundingBox.right &&\n this.mousePos.y > editorOuterBoundingBox.top &&\n this.mousePos.y < editorOuterBoundingBox.bottom;\n\n // TODO: remove parentElement, but then we need to remove padding from boundingbox or find a different solution\n const editorWrapper = this.pmView.dom!.parentElement!;\n\n // Doesn't update if the mouse hovers an element that's over the editor but\n // isn't a part of it or the side menu.\n if (\n // Cursor is within the editor area\n cursorWithinEditor &&\n // An element is hovered\n event &&\n event.target &&\n // Element is outside the editor\n !(\n editorWrapper === event.target ||\n editorWrapper.contains(event.target as HTMLElement)\n )\n ) {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate(this.state);\n }\n\n return;\n }\n\n this.updateStateFromMousePos();\n };\n\n private createSyntheticEvent(event: DragEvent) {\n const evt = new Event(event.type, event) as any;\n const editorBoundingBox = (\n this.pmView.dom.firstChild as HTMLElement\n ).getBoundingClientRect();\n evt.clientX = event.clientX;\n evt.clientY = event.clientY;\n if (\n event.clientX < editorBoundingBox.left &&\n event.clientX >\n editorBoundingBox.left -\n editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP\n ) {\n // when we're slightly left of the editor, we can drop to the side of the block\n evt.clientX =\n editorBoundingBox.left +\n (editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) /\n 2;\n } else if (\n event.clientX > editorBoundingBox.right &&\n event.clientX <\n editorBoundingBox.right +\n editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP\n ) {\n // when we're slightly right of the editor, we can drop to the side of the block\n evt.clientX =\n editorBoundingBox.right -\n (editorBoundingBox.width *\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP) /\n 2;\n } else if (\n event.clientX < editorBoundingBox.left ||\n event.clientX > editorBoundingBox.right\n ) {\n // when mouse is outside of the editor on x axis, drop it somewhere safe (but not to the side of a block)\n evt.clientX =\n editorBoundingBox.left +\n PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP *\n editorBoundingBox.width *\n 2; // put it somewhere in first block, but safe outside of the PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP margin\n }\n\n evt.clientY = Math.min(\n Math.max(event.clientY, editorBoundingBox.top),\n editorBoundingBox.top + editorBoundingBox.height\n );\n\n evt.dataTransfer = event.dataTransfer;\n evt.preventDefault = () => event.preventDefault();\n evt.synthetic = true; // prevent recursion\n return evt;\n }\n\n // Needed in cases where the editor state updates without the mouse cursor\n // moving, as some state updates can require a side menu update. For example,\n // adding a button to the side menu which removes the block can cause the\n // block below to jump up into the place of the removed block when clicked,\n // allowing the user to click the button again without moving the cursor. This\n // would otherwise not update the side menu, and so clicking the button again\n // would attempt to remove the same block again, causing an error.\n update(_view: EditorView, prevState: EditorState) {\n const docChanged = !prevState.doc.eq(this.pmView.state.doc);\n if (docChanged && this.state?.show) {\n this.updateStateFromMousePos();\n }\n }\n\n destroy() {\n if (this.state?.show) {\n this.state.show = false;\n this.emitUpdate(this.state);\n }\n this.pmView.root.removeEventListener(\n \"mousemove\",\n this.onMouseMove as EventListener,\n true\n );\n this.pmView.root.removeEventListener(\n \"dragover\",\n this.onDragOver as EventListener\n );\n\n this.pmView.root.removeEventListener(\n \"drop\",\n this.onDrop as EventListener,\n true\n );\n this.pmView.root.removeEventListener(\n \"keydown\",\n this.onKeyDown as EventListener,\n true\n );\n }\n}\n\nexport const sideMenuPluginKey = new PluginKey(\"SideMenuPlugin\");\n\nexport class SideMenuProsemirrorPlugin<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n public view: SideMenuView<BSchema, I, S> | undefined;\n public readonly plugin: Plugin;\n\n constructor(private readonly editor: BlockNoteEditor<BSchema, I, S>) {\n super();\n this.plugin = new Plugin({\n key: sideMenuPluginKey,\n view: (editorView) => {\n this.view = new SideMenuView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n });\n }\n\n public onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void) {\n return this.on(\"update\", callback);\n }\n\n /**\n * Handles drag & drop events for blocks.\n */\n blockDragStart = (\n event: {\n dataTransfer: DataTransfer | null;\n clientY: number;\n },\n block: Block<BSchema, I, S>\n ) => {\n dragStart(event, block, this.editor);\n };\n\n /**\n * Handles drag & drop events for blocks.\n */\n blockDragEnd = () => unsetDragImage(this.editor.prosemirrorView.root);\n /**\n * Freezes the side menu. When frozen, the side menu will stay\n * attached to the same block regardless of which block is hovered by the\n * mouse cursor.\n */\n freezeMenu = () => (this.view!.menuFrozen = true);\n /**\n * Unfreezes the side menu. When frozen, the side menu will stay\n * attached to the same block regardless of which block is hovered by the\n * mouse cursor.\n */\n unfreezeMenu = () => {\n this.view!.menuFrozen = false;\n this.view!.state!.show = false;\n this.view!.emitUpdate(this.view!.state!);\n };\n}\n","import { findParentNode } from \"@tiptap/core\";\nimport { EditorState, Plugin, PluginKey } from \"prosemirror-state\";\nimport { Decoration, DecorationSet, EditorView } from \"prosemirror-view\";\n\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport { UiElementPosition } from \"../../extensions-shared/UiElementPosition.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\n\nconst findBlock = findParentNode((node) => node.type.name === \"blockContainer\");\n\nexport type SuggestionMenuState = UiElementPosition & {\n query: string;\n ignoreQueryLength?: boolean;\n};\n\nclass SuggestionMenuView<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> {\n public state?: SuggestionMenuState;\n public emitUpdate: (triggerCharacter: string) => void;\n private rootEl?: Document | ShadowRoot;\n pluginState: SuggestionPluginState;\n\n constructor(\n private readonly editor: BlockNoteEditor<BSchema, I, S>,\n emitUpdate: (menuName: string, state: SuggestionMenuState) => void\n ) {\n this.pluginState = undefined;\n\n this.emitUpdate = (menuName: string) => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized suggestions menu\");\n }\n\n emitUpdate(menuName, {\n ...this.state,\n ignoreQueryLength: this.pluginState?.ignoreQueryLength,\n });\n };\n\n this.rootEl = this.editor._tiptapEditor.view.root;\n\n // Setting capture=true ensures that any parent container of the editor that\n // gets scrolled will trigger the scroll event. Scroll events do not bubble\n // and so won't propagate to the document by default.\n this.rootEl.addEventListener(\"scroll\", this.handleScroll, true);\n }\n\n handleScroll = () => {\n if (this.state?.show) {\n const decorationNode = this.rootEl?.querySelector(\n `[data-decoration-id=\"${this.pluginState!.decorationId}\"]`\n );\n if (!decorationNode) {\n return;\n }\n this.state.referencePos = decorationNode.getBoundingClientRect();\n this.emitUpdate(this.pluginState!.triggerCharacter!);\n }\n };\n\n update(view: EditorView, prevState: EditorState) {\n const prev: SuggestionPluginState =\n suggestionMenuPluginKey.getState(prevState);\n const next: SuggestionPluginState = suggestionMenuPluginKey.getState(\n view.state\n );\n\n // See how the state changed\n const started = prev === undefined && next !== undefined;\n const stopped = prev !== undefined && next === undefined;\n const changed = prev !== undefined && next !== undefined;\n\n // Cancel when suggestion isn't active\n if (!started && !changed && !stopped) {\n return;\n }\n\n this.pluginState = stopped ? prev : next;\n\n if (stopped || !this.editor.isEditable) {\n this.state!.show = false;\n this.emitUpdate(this.pluginState!.triggerCharacter);\n\n return;\n }\n\n const decorationNode = this.rootEl?.querySelector(\n `[data-decoration-id=\"${this.pluginState!.decorationId}\"]`\n );\n\n if (this.editor.isEditable && decorationNode) {\n this.state = {\n show: true,\n referencePos: decorationNode.getBoundingClientRect(),\n query: this.pluginState!.query,\n };\n\n this.emitUpdate(this.pluginState!.triggerCharacter!);\n }\n }\n\n destroy() {\n this.rootEl?.removeEventListener(\"scroll\", this.handleScroll, true);\n }\n\n closeMenu = () => {\n this.editor.dispatch(\n this.editor._tiptapEditor.view.state.tr.setMeta(\n suggestionMenuPluginKey,\n null\n )\n );\n };\n\n clearQuery = () => {\n if (this.pluginState === undefined) {\n return;\n }\n\n this.editor._tiptapEditor\n .chain()\n .focus()\n .deleteRange({\n from:\n this.pluginState.queryStartPos! -\n (this.pluginState.deleteTriggerCharacter\n ? this.pluginState.triggerCharacter!.length\n : 0),\n to: this.editor._tiptapEditor.state.selection.from,\n })\n .run();\n };\n}\n\ntype SuggestionPluginState =\n | {\n triggerCharacter: string;\n deleteTriggerCharacter: boolean;\n queryStartPos: number;\n query: string;\n decorationId: string;\n ignoreQueryLength?: boolean;\n }\n | undefined;\n\nconst suggestionMenuPluginKey = new PluginKey(\"SuggestionMenuPlugin\");\n\n/**\n * A ProseMirror plugin for suggestions, designed to make '/'-commands possible as well as mentions.\n *\n * This is basically a simplified version of TipTap's [Suggestions](https://github.com/ueberdosis/tiptap/tree/db92a9b313c5993b723c85cd30256f1d4a0b65e1/packages/suggestion) plugin.\n *\n * This version is adapted from the aforementioned version in the following ways:\n * - This version supports generic items instead of only strings (to allow for more advanced filtering for example)\n * - This version hides some unnecessary complexity from the user of the plugin.\n * - This version handles key events differently\n */\nexport class SuggestionMenuProseMirrorPlugin<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: SuggestionMenuView<BSchema, I, S> | undefined;\n public readonly plugin: Plugin;\n\n private triggerCharacters: string[] = [];\n\n constructor(editor: BlockNoteEditor<BSchema, I, S>) {\n super();\n const triggerCharacters = this.triggerCharacters;\n this.plugin = new Plugin({\n key: suggestionMenuPluginKey,\n\n view: () => {\n this.view = new SuggestionMenuView<BSchema, I, S>(\n editor,\n (triggerCharacter, state) => {\n this.emit(`update ${triggerCharacter}`, state);\n }\n );\n return this.view;\n },\n\n state: {\n // Initialize the plugin's internal state.\n init(): SuggestionPluginState {\n return undefined;\n },\n\n // Apply changes to the plugin state from an editor transaction.\n apply(transaction, prev, _oldState, newState): SuggestionPluginState {\n // TODO: More clearly define which transactions should be ignored.\n if (transaction.getMeta(\"orderedListIndexing\") !== undefined) {\n return prev;\n }\n\n // Ignore transactions in code blocks.\n if (transaction.selection.$from.parent.type.spec.code) {\n return prev;\n }\n\n // Either contains the trigger character if the menu should be shown,\n // or null if it should be hidden.\n const suggestionPluginTransactionMeta: {\n triggerCharacter: string;\n deleteTriggerCharacter?: boolean;\n ignoreQueryLength?: boolean;\n } | null = transaction.getMeta(suggestionMenuPluginKey);\n\n // Only opens a menu of no menu is already open\n if (\n typeof suggestionPluginTransactionMeta === \"object\" &&\n suggestionPluginTransactionMeta !== null &&\n prev === undefined\n ) {\n return {\n triggerCharacter:\n suggestionPluginTransactionMeta.triggerCharacter,\n deleteTriggerCharacter:\n suggestionPluginTransactionMeta.deleteTriggerCharacter !==\n false,\n queryStartPos: newState.selection.from,\n query: \"\",\n decorationId: `id_${Math.floor(Math.random() * 0xffffffff)}`,\n ignoreQueryLength:\n suggestionPluginTransactionMeta?.ignoreQueryLength,\n };\n }\n\n // Checks if the menu is hidden, in which case it doesn't need to be hidden or updated.\n if (prev === undefined) {\n return prev;\n }\n\n // Checks if the menu should be hidden.\n if (\n // Highlighting text should hide the menu.\n newState.selection.from !== newState.selection.to ||\n // Transactions with plugin metadata should hide the menu.\n suggestionPluginTransactionMeta === null ||\n // Certain mouse events should hide the menu.\n // TODO: Change to global mousedown listener.\n transaction.getMeta(\"focus\") ||\n transaction.getMeta(\"blur\") ||\n transaction.getMeta(\"pointer\") ||\n // Moving the caret before the character which triggered the menu should hide it.\n (prev.triggerCharacter !== undefined &&\n newState.selection.from < prev.queryStartPos!)\n ) {\n return undefined;\n }\n\n const next = { ...prev };\n\n // Updates the current query.\n next.query = newState.doc.textBetween(\n prev.queryStartPos!,\n newState.selection.from\n );\n\n return next;\n },\n },\n\n props: {\n handleTextInput(view, _from, _to, text) {\n const suggestionPluginState: SuggestionPluginState = (\n this as Plugin\n ).getState(view.state);\n\n if (\n triggerCharacters.includes(text) &&\n suggestionPluginState === undefined\n ) {\n view.dispatch(\n view.state.tr\n .insertText(text)\n .scrollIntoView()\n .setMeta(suggestionMenuPluginKey, {\n triggerCharacter: text,\n })\n );\n\n return true;\n }\n return false;\n },\n\n // Setup decorator on the currently active suggestion.\n decorations(state) {\n const suggestionPluginState: SuggestionPluginState = (\n this as Plugin\n ).getState(state);\n\n if (suggestionPluginState === undefined) {\n return null;\n }\n\n // If the menu was opened programmatically by another extension, it may not use a trigger character. In this\n // case, the decoration is set on the whole block instead, as the decoration range would otherwise be empty.\n if (!suggestionPluginState.deleteTriggerCharacter) {\n const blockNode = findBlock(state.selection);\n if (blockNode) {\n return DecorationSet.create(state.doc, [\n Decoration.node(\n blockNode.pos,\n blockNode.pos + blockNode.node.nodeSize,\n {\n nodeName: \"span\",\n class: \"bn-suggestion-decorator\",\n \"data-decoration-id\": suggestionPluginState.decorationId,\n }\n ),\n ]);\n }\n }\n // Creates an inline decoration around the trigger character.\n return DecorationSet.create(state.doc, [\n Decoration.inline(\n suggestionPluginState.queryStartPos! -\n suggestionPluginState.triggerCharacter!.length,\n suggestionPluginState.queryStartPos!,\n {\n nodeName: \"span\",\n class: \"bn-suggestion-decorator\",\n \"data-decoration-id\": suggestionPluginState.decorationId,\n }\n ),\n ]);\n },\n },\n });\n }\n\n public onUpdate(\n triggerCharacter: string,\n callback: (state: SuggestionMenuState) => void\n ) {\n if (!this.triggerCharacters.includes(triggerCharacter)) {\n this.addTriggerCharacter(triggerCharacter);\n }\n // TODO: be able to remove the triggerCharacter\n return this.on(`update ${triggerCharacter}`, callback);\n }\n\n addTriggerCharacter = (triggerCharacter: string) => {\n this.triggerCharacters.push(triggerCharacter);\n };\n\n // TODO: Should this be called automatically when listeners are removed?\n removeTriggerCharacter = (triggerCharacter: string) => {\n this.triggerCharacters = this.triggerCharacters.filter(\n (c) => c !== triggerCharacter\n );\n };\n\n closeMenu = () => this.view!.closeMenu();\n\n clearQuery = () => this.view!.clearQuery();\n\n public get shown() {\n return this.view?.state?.show || false;\n }\n}\n\nexport function createSuggestionMenu<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>, triggerCharacter: string) {\n editor.suggestionMenus.addTriggerCharacter(triggerCharacter);\n}\n","import { Plugin, PluginKey, PluginView } from \"prosemirror-state\";\nimport { Decoration, DecorationSet, EditorView } from \"prosemirror-view\";\nimport { nodeToBlock } from \"../../api/nodeConversions/nodeToBlock.js\";\nimport { getNodeById } from \"../../api/nodeUtil.js\";\nimport { checkBlockIsDefaultType } from \"../../blocks/defaultBlockTypeGuards.js\";\nimport { DefaultBlockSchema } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockFromConfigNoChildren,\n BlockSchemaWithBlock,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { EventEmitter } from \"../../util/EventEmitter.js\";\nimport { getDraggableBlockFromElement } from \"../getDraggableBlockFromElement.js\";\n\nlet dragImageElement: HTMLElement | undefined;\n\nexport type TableHandlesState<\n I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n show: boolean;\n showAddOrRemoveRowsButton: boolean;\n showAddOrRemoveColumnsButton: boolean;\n referencePosCell: DOMRect | undefined;\n referencePosTable: DOMRect;\n\n block: BlockFromConfigNoChildren<DefaultBlockSchema[\"table\"], I, S>;\n colIndex: number | undefined;\n rowIndex: number | undefined;\n\n draggingState:\n | {\n draggedCellOrientation: \"row\" | \"col\";\n originalIndex: number;\n mousePos: number;\n }\n | undefined;\n\n widgetContainer: HTMLElement | undefined;\n};\n\nfunction setHiddenDragImage(rootEl: Document | ShadowRoot) {\n if (dragImageElement) {\n return;\n }\n\n dragImageElement = document.createElement(\"div\");\n dragImageElement.innerHTML = \"_\";\n dragImageElement.style.opacity = \"0\";\n dragImageElement.style.height = \"1px\";\n dragImageElement.style.width = \"1px\";\n if (rootEl instanceof Document) {\n rootEl.body.appendChild(dragImageElement);\n } else {\n rootEl.appendChild(dragImageElement);\n }\n}\n\nfunction unsetHiddenDragImage(rootEl: Document | ShadowRoot) {\n if (dragImageElement) {\n if (rootEl instanceof Document) {\n rootEl.body.removeChild(dragImageElement);\n } else {\n rootEl.removeChild(dragImageElement);\n }\n dragImageElement = undefined;\n }\n}\n\nfunction getChildIndex(node: Element) {\n return Array.prototype.indexOf.call(node.parentElement!.childNodes, node);\n}\n\n// Finds the DOM element corresponding to the table cell that the target element\n// is currently in. If the target element is not in a table cell, returns null.\nfunction domCellAround(target: Element) {\n let currentTarget: Element | undefined = target;\n while (\n currentTarget &&\n currentTarget.nodeName !== \"TD\" &&\n currentTarget.nodeName !== \"TH\" &&\n !currentTarget.classList.contains(\"tableWrapper\")\n ) {\n if (currentTarget.classList.contains(\"ProseMirror\")) {\n return undefined;\n }\n const parent: ParentNode | null = currentTarget.parentNode;\n\n if (!parent || !(parent instanceof Element)) {\n return undefined;\n }\n currentTarget = parent;\n }\n\n return currentTarget.nodeName === \"TD\" || currentTarget.nodeName === \"TH\"\n ? {\n type: \"cell\",\n domNode: currentTarget,\n tbodyNode: currentTarget.closest(\"tbody\"),\n }\n : {\n type: \"wrapper\",\n domNode: currentTarget,\n tbodyNode: currentTarget.querySelector(\"tbody\"),\n };\n}\n\n// Hides elements in the DOMwith the provided class names.\nfunction hideElements(selector: string, rootEl: Document | ShadowRoot) {\n const elementsToHide = rootEl.querySelectorAll(selector);\n\n for (let i = 0; i < elementsToHide.length; i++) {\n (elementsToHide[i] as HTMLElement).style.visibility = \"hidden\";\n }\n}\n\nexport class TableHandlesView<\n I extends InlineContentSchema,\n S extends StyleSchema\n> implements PluginView\n{\n public state?: TableHandlesState<I, S>;\n public emitUpdate: () => void;\n\n public tableId: string | undefined;\n public tablePos: number | undefined;\n public tableElement: HTMLElement | undefined;\n\n public menuFrozen = false;\n\n public mouseState: \"up\" | \"down\" | \"selecting\" = \"up\";\n\n public prevWasEditable: boolean | null = null;\n\n constructor(\n private readonly editor: BlockNoteEditor<\n BlockSchemaWithBlock<\"table\", DefaultBlockSchema[\"table\"]>,\n I,\n S\n >,\n private readonly pmView: EditorView,\n emitUpdate: (state: TableHandlesState<I, S>) => void\n ) {\n this.emitUpdate = () => {\n if (!this.state) {\n throw new Error(\"Attempting to update uninitialized image toolbar\");\n }\n\n emitUpdate(this.state);\n };\n\n pmView.dom.addEventListener(\"mousemove\", this.mouseMoveHandler);\n pmView.dom.addEventListener(\"mousedown\", this.viewMousedownHandler);\n window.addEventListener(\"mouseup\", this.mouseUpHandler);\n\n pmView.root.addEventListener(\n \"dragover\",\n this.dragOverHandler as EventListener\n );\n pmView.root.addEventListener(\"drop\", this.dropHandler as EventListener);\n }\n\n viewMousedownHandler = () => {\n this.mouseState = \"down\";\n };\n\n mouseUpHandler = (event: MouseEvent) => {\n this.mouseState = \"up\";\n this.mouseMoveHandler(event);\n };\n\n mouseMoveHandler = (event: MouseEvent) => {\n if (this.menuFrozen) {\n return;\n }\n\n if (this.mouseState === \"selecting\") {\n return;\n }\n\n if (\n !(event.target instanceof Element) ||\n !this.pmView.dom.contains(event.target)\n ) {\n return;\n }\n\n const target = domCellAround(event.target);\n\n if (\n target?.type === \"cell\" &&\n this.mouseState === \"down\" &&\n !this.state?.draggingState\n ) {\n // hide draghandles when selecting text as they could be in the way of the user\n this.mouseState = \"selecting\";\n\n if (this.state?.show) {\n this.state.show = false;\n this.state.showAddOrRemoveRowsButton = false;\n this.state.showAddOrRemoveColumnsButton = false;\n this.emitUpdate();\n }\n return;\n }\n\n if (!target || !this.editor.isEditable) {\n if (this.state?.show) {\n this.state.show = false;\n this.state.showAddOrRemoveRowsButton = false;\n this.state.showAddOrRemoveColumnsButton = false;\n this.emitUpdate();\n }\n return;\n }\n\n if (!target.tbodyNode) {\n return;\n }\n\n const tableRect = target.tbodyNode.getBoundingClientRect();\n\n const blockEl = getDraggableBlockFromElement(target.domNode, this.pmView);\n if (!blockEl) {\n return;\n }\n this.tableElement = blockEl.node;\n\n let tableBlock:\n | BlockFromConfigNoChildren<DefaultBlockSchema[\"table\"], I, S>\n | undefined;\n\n const pmNodeInfo = getNodeById(\n blockEl.id,\n this.editor._tiptapEditor.state.doc\n );\n\n const block = nodeToBlock(\n pmNodeInfo.node,\n this.editor.schema.blockSchema,\n this.editor.schema.inlineContentSchema,\n this.editor.schema.styleSchema,\n this.editor.blockCache\n );\n\n if (checkBlockIsDefaultType(\"table\", block, this.editor)) {\n this.tablePos = pmNodeInfo.posBeforeNode + 1;\n tableBlock = block;\n }\n\n if (!tableBlock) {\n return;\n }\n\n this.tableId = blockEl.id;\n const widgetContainer = target.domNode\n .closest(\".tableWrapper\")\n ?.querySelector(\".table-widgets-container\") as HTMLElement;\n\n if (target?.type === \"wrapper\") {\n // if we're just to the right or below the table, show the extend buttons\n // (this is a bit hacky. It would probably be cleaner to render the extend buttons in the Table NodeView instead)\n const belowTable =\n event.clientY >= tableRect.bottom - 1 && // -1 to account for fractions of pixels in \"bottom\"\n event.clientY < tableRect.bottom + 20;\n const toRightOfTable =\n event.clientX >= tableRect.right - 1 &&\n event.clientX < tableRect.right + 20;\n\n // without this check, we'd also hide draghandles when hovering over them\n const hideHandles =\n event.clientX > tableRect.right || event.clientY > tableRect.bottom;\n\n this.state = {\n ...this.state!,\n show: true,\n showAddOrRemoveRowsButton: belowTable,\n showAddOrRemoveColumnsButton: toRightOfTable,\n referencePosTable: tableRect,\n block: tableBlock,\n widgetContainer,\n colIndex: hideHandles ? undefined : this.state!.colIndex,\n rowIndex: hideHandles ? undefined : this.state!.rowIndex,\n referencePosCell: hideHandles\n ? undefined\n : this.state!.referencePosCell,\n };\n } else {\n const colIndex = getChildIndex(target.domNode);\n const rowIndex = getChildIndex(target.domNode.parentElement!);\n const cellRect = target.domNode.getBoundingClientRect();\n\n if (\n this.state !== undefined &&\n this.state.show &&\n this.tableId === blockEl.id &&\n this.state.rowIndex === rowIndex &&\n this.state.colIndex === colIndex\n ) {\n // no update needed\n return;\n }\n\n this.state = {\n show: true,\n showAddOrRemoveColumnsButton:\n colIndex === tableBlock.content.rows[0].cells.length - 1,\n showAddOrRemoveRowsButton:\n rowIndex === tableBlock.content.rows.length - 1,\n referencePosTable: tableRect,\n\n block: tableBlock,\n draggingState: undefined,\n referencePosCell: cellRect,\n colIndex: colIndex,\n rowIndex: rowIndex,\n\n widgetContainer,\n };\n }\n this.emitUpdate();\n\n return false;\n };\n\n dragOverHandler = (event: DragEvent) => {\n if (this.state?.draggingState === undefined) {\n return;\n }\n\n event.preventDefault();\n event.dataTransfer!.dropEffect = \"move\";\n\n hideElements(\n \".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline\",\n this.pmView.root\n );\n\n // The mouse cursor coordinates, bounded to the table's bounding box. The\n // bounding box is shrunk by 1px on each side to ensure that the bounded\n // coordinates are always inside a table cell.\n const boundedMouseCoords = {\n left: Math.min(\n Math.max(event.clientX, this.state.referencePosTable.left + 1),\n this.state.referencePosTable.right - 1\n ),\n top: Math.min(\n Math.max(event.clientY, this.state.referencePosTable.top + 1),\n this.state.referencePosTable.bottom - 1\n ),\n };\n\n // Gets the table cell element that the bounded mouse cursor coordinates lie\n // in.\n const tableCellElements = this.pmView.root\n .elementsFromPoint(boundedMouseCoords.left, boundedMouseCoords.top)\n .filter(\n (element) => element.tagName === \"TD\" || element.tagName === \"TH\"\n );\n if (tableCellElements.length === 0) {\n throw new Error(\n \"Could not find table cell element that the mouse cursor is hovering over.\"\n );\n }\n const tableCellElement = tableCellElements[0];\n\n let emitStateUpdate = false;\n\n // Gets current row and column index.\n const rowIndex = getChildIndex(tableCellElement.parentElement!);\n const colIndex = getChildIndex(tableCellElement);\n\n // Checks if the drop cursor needs to be updated. This affects decorations\n // only so it doesn't trigger a state update.\n const oldIndex =\n this.state.draggingState.draggedCellOrientation === \"row\"\n ? this.state.rowIndex\n : this.state.colIndex;\n const newIndex =\n this.state.draggingState.draggedCellOrientation === \"row\"\n ? rowIndex\n : colIndex;\n const dispatchDecorationsTransaction = newIndex !== oldIndex;\n\n // Checks if either the hovered cell has changed and updates the row and\n // column index. Also updates the reference DOMRect.\n if (this.state.rowIndex !== rowIndex || this.state.colIndex !== colIndex) {\n this.state.rowIndex = rowIndex;\n this.state.colIndex = colIndex;\n\n this.state.referencePosCell = tableCellElement.getBoundingClientRect();\n\n emitStateUpdate = true;\n }\n\n // Checks if the mouse cursor position along the axis that the user is\n // dragging on has changed and updates it.\n const mousePos =\n this.state.draggingState.draggedCellOrientation === \"row\"\n ? boundedMouseCoords.top\n : boundedMouseCoords.left;\n if (this.state.draggingState.mousePos !== mousePos) {\n this.state.draggingState.mousePos = mousePos;\n\n emitStateUpdate = true;\n }\n\n // Emits a state update if any of the fields have changed.\n if (emitStateUpdate) {\n this.emitUpdate();\n }\n\n // Dispatches a dummy transaction to force a decorations update if\n // necessary.\n if (dispatchDecorationsTransaction) {\n this.editor.dispatch(\n this.pmView.state.tr.setMeta(tableHandlesPluginKey, true)\n );\n }\n };\n\n dropHandler = (event: DragEvent) => {\n this.mouseState = \"up\";\n if (this.state === undefined || this.state.draggingState === undefined) {\n return;\n }\n\n if (\n this.state.rowIndex === undefined ||\n this.state.colIndex === undefined\n ) {\n throw new Error(\n \"Attempted to drop table row or column, but no table block was hovered prior.\"\n );\n }\n\n event.preventDefault();\n\n const { draggingState, colIndex, rowIndex } = this.state;\n\n const rows = this.state.block.content.rows;\n\n if (draggingState.draggedCellOrientation === \"row\") {\n const rowToMove = rows[draggingState.originalIndex];\n rows.splice(draggingState.originalIndex, 1);\n rows.splice(rowIndex, 0, rowToMove);\n } else {\n const cellsToMove = rows.map(\n (row) => row.cells[draggingState.originalIndex]\n );\n rows.forEach((row, rowIndex) => {\n row.cells.splice(draggingState.originalIndex, 1);\n row.cells.splice(colIndex, 0, cellsToMove[rowIndex]);\n });\n }\n\n this.editor.updateBlock(this.state.block, {\n type: \"table\",\n content: {\n type: \"tableContent\",\n rows: rows,\n },\n });\n\n // Have to reset text cursor position to the block as `updateBlock` moves\n // the existing selection out of the block.\n this.editor.setTextCursorPosition(this.state.block.id);\n };\n // Updates drag handle positions on table content updates.\n update() {\n if (!this.state || !this.state.show) {\n return;\n }\n\n const tableBody = this.tableElement!.querySelector(\"tbody\");\n if (!tableBody) {\n return;\n }\n\n if (\n this.state.rowIndex !== undefined &&\n this.state.colIndex !== undefined\n ) {\n // If rows or columns are deleted in the update, the hovered indices for\n // those may now be out of bounds. If this is the case, they are moved to\n // the new last row or column.\n if (this.state.rowIndex >= tableBody.children.length) {\n this.state.rowIndex = tableBody.children.length - 1;\n }\n if (this.state.colIndex >= tableBody.children[0].children.length) {\n this.state.colIndex = tableBody.children[0].children.length - 1;\n }\n\n const row = tableBody.children[this.state.rowIndex];\n const cell = row.children[this.state.colIndex];\n this.state.referencePosCell = cell.getBoundingClientRect();\n }\n\n this.state.block = this.editor.getBlock(this.state.block.id)!;\n this.state.referencePosTable = tableBody.getBoundingClientRect();\n this.emitUpdate();\n }\n\n destroy() {\n this.pmView.dom.removeEventListener(\"mousemove\", this.mouseMoveHandler);\n window.removeEventListener(\"mouseup\", this.mouseUpHandler);\n this.pmView.dom.removeEventListener(\"mousedown\", this.viewMousedownHandler);\n this.pmView.root.removeEventListener(\n \"dragover\",\n this.dragOverHandler as EventListener\n );\n this.pmView.root.removeEventListener(\n \"drop\",\n this.dropHandler as EventListener\n );\n }\n}\n\nexport const tableHandlesPluginKey = new PluginKey(\"TableHandlesPlugin\");\n\nexport class TableHandlesProsemirrorPlugin<\n I extends InlineContentSchema,\n S extends StyleSchema\n> extends EventEmitter<any> {\n private view: TableHandlesView<I, S> | undefined;\n public readonly plugin: Plugin;\n\n constructor(\n private readonly editor: BlockNoteEditor<\n BlockSchemaWithBlock<\"table\", DefaultBlockSchema[\"table\"]>,\n I,\n S\n >\n ) {\n super();\n this.plugin = new Plugin({\n key: tableHandlesPluginKey,\n view: (editorView) => {\n this.view = new TableHandlesView(editor, editorView, (state) => {\n this.emit(\"update\", state);\n });\n return this.view;\n },\n // We use decorations to render the drop cursor when dragging a table row\n // or column. The decorations are updated in the `dragOverHandler` method.\n props: {\n decorations: (state) => {\n if (\n this.view === undefined ||\n this.view.state === undefined ||\n this.view.state.draggingState === undefined ||\n this.view.tablePos === undefined\n ) {\n return;\n }\n\n const newIndex =\n this.view.state.draggingState.draggedCellOrientation === \"row\"\n ? this.view.state.rowIndex\n : this.view.state.colIndex;\n\n if (newIndex === undefined) {\n return;\n }\n\n const decorations: Decoration[] = [];\n\n if (newIndex === this.view.state.draggingState.originalIndex) {\n return DecorationSet.create(state.doc, decorations);\n }\n\n // Gets the table to show the drop cursor in.\n const tableResolvedPos = state.doc.resolve(this.view.tablePos + 1);\n const tableNode = tableResolvedPos.node();\n\n if (this.view.state.draggingState.draggedCellOrientation === \"row\") {\n // Gets the row at the new index.\n const rowResolvedPos = state.doc.resolve(\n tableResolvedPos.posAtIndex(newIndex) + 1\n );\n const rowNode = rowResolvedPos.node();\n\n // Iterates over all cells in the row.\n for (let i = 0; i < rowNode.childCount; i++) {\n // Gets each cell in the row.\n const cellResolvedPos = state.doc.resolve(\n rowResolvedPos.posAtIndex(i) + 1\n );\n const cellNode = cellResolvedPos.node();\n\n // Creates a decoration at the start or end of each cell,\n // depending on whether the new index is before or after the\n // original index.\n const decorationPos =\n cellResolvedPos.pos +\n (newIndex > this.view.state.draggingState.originalIndex\n ? cellNode.nodeSize - 2\n : 0);\n decorations.push(\n // The widget is a small bar which spans the width of the cell.\n Decoration.widget(decorationPos, () => {\n const widget = document.createElement(\"div\");\n widget.className = \"bn-table-drop-cursor\";\n widget.style.left = \"0\";\n widget.style.right = \"0\";\n // This is only necessary because the drop indicator's height\n // is an even number of pixels, whereas the border between\n // table cells is an odd number of pixels. So this makes the\n // positioning slightly more consistent regardless of where\n // the row is being dropped.\n if (\n newIndex > this.view!.state!.draggingState!.originalIndex\n ) {\n widget.style.bottom = \"-2px\";\n } else {\n widget.style.top = \"-3px\";\n }\n widget.style.height = \"4px\";\n\n return widget;\n })\n );\n }\n } else {\n // Iterates over all rows in the table.\n for (let i = 0; i < tableNode.childCount; i++) {\n // Gets each row in the table.\n const rowResolvedPos = state.doc.resolve(\n tableResolvedPos.posAtIndex(i) + 1\n );\n\n // Gets the cell at the new index in the row.\n const cellResolvedPos = state.doc.resolve(\n rowResolvedPos.posAtIndex(newIndex) + 1\n );\n const cellNode = cellResolvedPos.node();\n\n // Creates a decoration at the start or end of each cell,\n // depending on whether the new index is before or after the\n // original index.\n const decorationPos =\n cellResolvedPos.pos +\n (newIndex > this.view.state.draggingState.originalIndex\n ? cellNode.nodeSize - 2\n : 0);\n\n decorations.push(\n // The widget is a small bar which spans the height of the cell.\n Decoration.widget(decorationPos, () => {\n const widget = document.createElement(\"div\");\n widget.className = \"bn-table-drop-cursor\";\n widget.style.top = \"0\";\n widget.style.bottom = \"0\";\n // This is only necessary because the drop indicator's width\n // is an even number of pixels, whereas the border between\n // table cells is an odd number of pixels. So this makes the\n // positioning slightly more consistent regardless of where\n // the column is being dropped.\n if (\n newIndex > this.view!.state!.draggingState!.originalIndex\n ) {\n widget.style.right = \"-2px\";\n } else {\n widget.style.left = \"-3px\";\n }\n widget.style.width = \"4px\";\n\n return widget;\n })\n );\n }\n }\n\n return DecorationSet.create(state.doc, decorations);\n },\n },\n });\n }\n\n public onUpdate(callback: (state: TableHandlesState<I, S>) => void) {\n return this.on(\"update\", callback);\n }\n\n /**\n * Callback that should be set on the `dragStart` event for whichever element\n * is used as the column drag handle.\n */\n colDragStart = (event: {\n dataTransfer: DataTransfer | null;\n clientX: number;\n }) => {\n if (\n this.view!.state === undefined ||\n this.view!.state.colIndex === undefined\n ) {\n throw new Error(\n \"Attempted to drag table column, but no table block was hovered prior.\"\n );\n }\n\n this.view!.state.draggingState = {\n draggedCellOrientation: \"col\",\n originalIndex: this.view!.state.colIndex,\n mousePos: event.clientX,\n };\n this.view!.emitUpdate();\n\n this.editor.dispatch(\n this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, {\n draggedCellOrientation:\n this.view!.state.draggingState.draggedCellOrientation,\n originalIndex: this.view!.state.colIndex,\n newIndex: this.view!.state.colIndex,\n tablePos: this.view!.tablePos,\n })\n );\n\n setHiddenDragImage(this.editor._tiptapEditor.view.root);\n event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);\n event.dataTransfer!.effectAllowed = \"move\";\n };\n\n /**\n * Callback that should be set on the `dragStart` event for whichever element\n * is used as the row drag handle.\n */\n rowDragStart = (event: {\n dataTransfer: DataTransfer | null;\n clientY: number;\n }) => {\n if (\n this.view!.state === undefined ||\n this.view!.state.rowIndex === undefined\n ) {\n throw new Error(\n \"Attempted to drag table row, but no table block was hovered prior.\"\n );\n }\n\n this.view!.state.draggingState = {\n draggedCellOrientation: \"row\",\n originalIndex: this.view!.state.rowIndex,\n mousePos: event.clientY,\n };\n this.view!.emitUpdate();\n\n this.editor.dispatch(\n this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, {\n draggedCellOrientation:\n this.view!.state.draggingState.draggedCellOrientation,\n originalIndex: this.view!.state.rowIndex,\n newIndex: this.view!.state.rowIndex,\n tablePos: this.view!.tablePos,\n })\n );\n\n setHiddenDragImage(this.editor._tiptapEditor.view.root);\n event.dataTransfer!.setDragImage(dragImageElement!, 0, 0);\n event.dataTransfer!.effectAllowed = \"copyMove\";\n };\n\n /**\n * Callback that should be set on the `dragEnd` event for both the element\n * used as the row drag handle, and the one used as the column drag handle.\n */\n dragEnd = () => {\n if (this.view!.state === undefined) {\n throw new Error(\n \"Attempted to drag table row, but no table block was hovered prior.\"\n );\n }\n\n this.view!.state.draggingState = undefined;\n this.view!.emitUpdate();\n\n this.editor.dispatch(\n this.editor._tiptapEditor.state.tr.setMeta(tableHandlesPluginKey, null)\n );\n\n unsetHiddenDragImage(this.editor._tiptapEditor.view.root);\n };\n\n /**\n * Freezes the drag handles. When frozen, they will stay attached to the same\n * cell regardless of which cell is hovered by the mouse cursor.\n */\n freezeHandles = () => {\n this.view!.menuFrozen = true;\n };\n\n /**\n * Unfreezes the drag handles. When frozen, they will stay attached to the\n * same cell regardless of which cell is hovered by the mouse cursor.\n */\n unfreezeHandles = () => {\n this.view!.menuFrozen = false;\n };\n}\n","import { Extension } from \"@tiptap/core\";\n\nexport const TextAlignmentExtension = Extension.create({\n name: \"textAlignment\",\n\n addGlobalAttributes() {\n return [\n {\n // Attribute is applied to block content instead of container so that child blocks don't inherit the text\n // alignment styling.\n types: [\n \"paragraph\",\n \"heading\",\n \"bulletListItem\",\n \"numberedListItem\",\n \"checkListItem\",\n ],\n attributes: {\n textAlignment: {\n default: \"left\",\n parseHTML: (element) => {\n return element.getAttribute(\"data-text-alignment\");\n },\n renderHTML: (attributes) => {\n if (attributes.textAlignment === \"left\") {\n return {};\n }\n return {\n \"data-text-alignment\": attributes.textAlignment,\n };\n },\n },\n },\n },\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport { defaultProps } from \"../../blocks/defaultProps.js\";\n\nexport const TextColorExtension = Extension.create({\n name: \"blockTextColor\",\n\n addGlobalAttributes() {\n return [\n {\n types: [\"blockContainer\"],\n attributes: {\n textColor: {\n default: defaultProps.textColor.default,\n parseHTML: (element) =>\n element.hasAttribute(\"data-text-color\")\n ? element.getAttribute(\"data-text-color\")\n : defaultProps.textColor.default,\n renderHTML: (attributes) => {\n if (attributes.textColor === defaultProps.textColor.default) {\n return {};\n }\n return {\n \"data-text-color\": attributes.textColor,\n };\n },\n },\n },\n },\n ];\n },\n});\n","import { Extension } from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"prosemirror-state\";\n\n// based on https://github.com/ueberdosis/tiptap/blob/40a9404c94c7fef7900610c195536384781ae101/demos/src/Experiments/TrailingNode/Vue/trailing-node.ts\n\n/**\n * Extension based on:\n * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js\n * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts\n */\n\nexport interface TrailingNodeOptions {\n node: string;\n}\n\n/**\n * Add a trailing node to the document so the user can always click at the bottom of the document and start typing\n */\nexport const TrailingNode = Extension.create<TrailingNodeOptions>({\n name: \"trailingNode\",\n\n addProseMirrorPlugins() {\n const plugin = new PluginKey(this.name);\n // const disabledNodes = Object.entries(this.editor.schema.nodes)\n // .map(([, value]) => value)\n // .filter((node) => this.options.notAfter.includes(node.name));\n\n return [\n new Plugin({\n key: plugin,\n appendTransaction: (_, __, state) => {\n const { doc, tr, schema } = state;\n const shouldInsertNodeAtEnd = plugin.getState(state);\n const endPosition = doc.content.size - 2;\n const type = schema.nodes[\"blockContainer\"];\n const contentType = schema.nodes[\"paragraph\"];\n if (!shouldInsertNodeAtEnd) {\n return;\n }\n\n return tr.insert(\n endPosition,\n type.create(undefined, contentType.create())\n );\n },\n state: {\n init: (_, _state) => {\n // (maybe fix): use same logic as apply() here\n // so it works when initializing\n },\n apply: (tr, value) => {\n if (!tr.docChanged) {\n return value;\n }\n\n let lastNode = tr.doc.lastChild;\n\n if (!lastNode || lastNode.type.name !== \"blockGroup\") {\n throw new Error(\"Expected blockGroup\");\n }\n\n lastNode = lastNode.lastChild;\n\n if (!lastNode || lastNode.type.name !== \"blockContainer\") {\n return true; // not a blockContainer, but for example Columns. Insert trailing node\n }\n\n const lastContentNode = lastNode.firstChild;\n\n if (!lastContentNode) {\n throw new Error(\"Expected blockContent\");\n }\n\n // If last node is not empty (size > 4) or it doesn't contain\n // inline content, we need to add a trailing node.\n return (\n lastNode.nodeSize > 4 ||\n lastContentNode.type.spec.content !== \"inline*\"\n );\n },\n },\n }),\n ];\n },\n});\n","import { Node } from \"@tiptap/core\";\n\nimport type { BlockNoteEditor } from \"../editor/BlockNoteEditor.js\";\nimport { BlockNoteDOMAttributes } from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\n\n// Object containing all possible block attributes.\nconst BlockAttributes: Record<string, string> = {\n blockColor: \"data-block-color\",\n blockStyle: \"data-block-style\",\n id: \"data-id\",\n depth: \"data-depth\",\n depthChange: \"data-depth-change\",\n};\n\n/**\n * The main \"Block node\" documents consist of\n */\nexport const BlockContainer = Node.create<{\n domAttributes?: BlockNoteDOMAttributes;\n editor: BlockNoteEditor<any, any, any>;\n}>({\n name: \"blockContainer\",\n group: \"blockGroupChild bnBlock\",\n // A block always contains content, and optionally a blockGroup which contains nested blocks\n content: \"blockContent blockGroup?\",\n // Ensures content-specific keyboard handlers trigger first.\n priority: 50,\n defining: true,\n\n parseHTML() {\n return [\n {\n tag: \"div\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n const attrs: Record<string, string> = {};\n for (const [nodeAttr, HTMLAttr] of Object.entries(BlockAttributes)) {\n if (element.getAttribute(HTMLAttr)) {\n attrs[nodeAttr] = element.getAttribute(HTMLAttr)!;\n }\n }\n\n if (element.getAttribute(\"data-node-type\") === \"blockContainer\") {\n return attrs;\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n const blockOuter = document.createElement(\"div\");\n blockOuter.className = \"bn-block-outer\";\n blockOuter.setAttribute(\"data-node-type\", \"blockOuter\");\n for (const [attribute, value] of Object.entries(HTMLAttributes)) {\n if (attribute !== \"class\") {\n blockOuter.setAttribute(attribute, value);\n }\n }\n\n const blockHTMLAttributes = {\n ...(this.options.domAttributes?.block || {}),\n ...HTMLAttributes,\n };\n const block = document.createElement(\"div\");\n block.className = mergeCSSClasses(\"bn-block\", blockHTMLAttributes.class);\n block.setAttribute(\"data-node-type\", this.name);\n for (const [attribute, value] of Object.entries(blockHTMLAttributes)) {\n if (attribute !== \"class\") {\n block.setAttribute(attribute, value);\n }\n }\n\n blockOuter.appendChild(block);\n\n return {\n dom: blockOuter,\n contentDOM: block,\n };\n },\n});\n","import { Node } from \"@tiptap/core\";\nimport { BlockNoteDOMAttributes } from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\n\nexport const BlockGroup = Node.create<{\n domAttributes?: BlockNoteDOMAttributes;\n}>({\n name: \"blockGroup\",\n group: \"childContainer\",\n content: \"blockGroupChild+\",\n\n parseHTML() {\n return [\n {\n tag: \"div\",\n getAttrs: (element) => {\n if (typeof element === \"string\") {\n return false;\n }\n\n if (element.getAttribute(\"data-node-type\") === \"blockGroup\") {\n // Null means the element matches, but we don't want to add any attributes to the node.\n return null;\n }\n\n return false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n const blockGroupHTMLAttributes = {\n ...(this.options.domAttributes?.blockGroup || {}),\n ...HTMLAttributes,\n };\n const blockGroup = document.createElement(\"div\");\n blockGroup.className = mergeCSSClasses(\n \"bn-block-group\",\n blockGroupHTMLAttributes.class\n );\n blockGroup.setAttribute(\"data-node-type\", \"blockGroup\");\n for (const [attribute, value] of Object.entries(blockGroupHTMLAttributes)) {\n if (attribute !== \"class\") {\n blockGroup.setAttribute(attribute, value);\n }\n }\n\n return {\n dom: blockGroup,\n contentDOM: blockGroup,\n };\n },\n});\n","import {Node} from \"@tiptap/core\";\n\nexport const Doc = Node.create({\n name: \"doc\",\n topNode: true,\n content: \"blockGroup\",\n});\n","import { AnyExtension, Extension, extensions } from \"@tiptap/core\";\n\nimport type { BlockNoteEditor, BlockNoteExtension } from \"./BlockNoteEditor.js\";\n\nimport Collaboration from \"@tiptap/extension-collaboration\";\nimport CollaborationCursor from \"@tiptap/extension-collaboration-cursor\";\nimport { Gapcursor } from \"@tiptap/extension-gapcursor\";\nimport { HardBreak } from \"@tiptap/extension-hard-break\";\nimport { History } from \"@tiptap/extension-history\";\nimport { Link } from \"@tiptap/extension-link\";\nimport { Text } from \"@tiptap/extension-text\";\nimport { Plugin } from \"prosemirror-state\";\nimport * as Y from \"yjs\";\nimport { createDropFileExtension } from \"../api/clipboard/fromClipboard/fileDropExtension.js\";\nimport { createPasteFromClipboardExtension } from \"../api/clipboard/fromClipboard/pasteExtension.js\";\nimport { createCopyToClipboardExtension } from \"../api/clipboard/toClipboard/copyExtension.js\";\nimport { BackgroundColorExtension } from \"../extensions/BackgroundColor/BackgroundColorExtension.js\";\nimport { FilePanelProsemirrorPlugin } from \"../extensions/FilePanel/FilePanelPlugin.js\";\nimport { FormattingToolbarProsemirrorPlugin } from \"../extensions/FormattingToolbar/FormattingToolbarPlugin.js\";\nimport { KeyboardShortcutsExtension } from \"../extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js\";\nimport { LinkToolbarProsemirrorPlugin } from \"../extensions/LinkToolbar/LinkToolbarPlugin.js\";\nimport { NodeSelectionKeyboardPlugin } from \"../extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.js\";\nimport { PlaceholderPlugin } from \"../extensions/Placeholder/PlaceholderPlugin.js\";\nimport { PreviousBlockTypePlugin } from \"../extensions/PreviousBlockType/PreviousBlockTypePlugin.js\";\nimport { SideMenuProsemirrorPlugin } from \"../extensions/SideMenu/SideMenuPlugin.js\";\nimport { SuggestionMenuProseMirrorPlugin } from \"../extensions/SuggestionMenu/SuggestionPlugin.js\";\nimport { TableHandlesProsemirrorPlugin } from \"../extensions/TableHandles/TableHandlesPlugin.js\";\nimport { TextAlignmentExtension } from \"../extensions/TextAlignment/TextAlignmentExtension.js\";\nimport { TextColorExtension } from \"../extensions/TextColor/TextColorExtension.js\";\nimport { TrailingNode } from \"../extensions/TrailingNode/TrailingNodeExtension.js\";\nimport UniqueID from \"../extensions/UniqueID/UniqueID.js\";\nimport { BlockContainer, BlockGroup, Doc } from \"../pm-nodes/index.js\";\nimport {\n BlockNoteDOMAttributes,\n BlockSchema,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSpecs,\n StyleSchema,\n StyleSpecs,\n} from \"../schema/index.js\";\n\ntype ExtensionOptions<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n> = {\n editor: BlockNoteEditor<BSchema, I, S>;\n domAttributes: Partial<BlockNoteDOMAttributes>;\n blockSpecs: BlockSpecs;\n inlineContentSpecs: InlineContentSpecs;\n styleSpecs: StyleSpecs;\n trailingBlock: boolean | undefined;\n collaboration?: {\n fragment: Y.XmlFragment;\n user: {\n name: string;\n color: string;\n [key: string]: string;\n };\n provider: any;\n renderCursor?: (user: any) => HTMLElement;\n };\n disableExtensions: string[] | undefined;\n setIdAttribute?: boolean;\n animations: boolean;\n tableHandles: boolean;\n dropCursor: (opts: any) => Plugin;\n placeholders: Record<string | \"default\", string>;\n};\n\n/**\n * Get all the Tiptap extensions BlockNote is configured with by default\n */\nexport const getBlockNoteExtensions = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n opts: ExtensionOptions<BSchema, I, S>\n) => {\n const ret: Record<string, BlockNoteExtension> = {};\n const tiptapExtensions = getTipTapExtensions(opts);\n\n for (const ext of tiptapExtensions) {\n ret[ext.name] = ext;\n }\n\n // Note: this is pretty hardcoded and will break when user provides plugins with same keys.\n // Define name on plugins instead and not make this a map?\n ret[\"formattingToolbar\"] = new FormattingToolbarProsemirrorPlugin(\n opts.editor\n );\n ret[\"linkToolbar\"] = new LinkToolbarProsemirrorPlugin(opts.editor);\n ret[\"sideMenu\"] = new SideMenuProsemirrorPlugin(opts.editor);\n ret[\"suggestionMenus\"] = new SuggestionMenuProseMirrorPlugin(opts.editor);\n ret[\"filePanel\"] = new FilePanelProsemirrorPlugin(opts.editor as any);\n ret[\"placeholder\"] = new PlaceholderPlugin(opts.editor, opts.placeholders);\n\n if (opts.animations ?? true) {\n ret[\"animations\"] = new PreviousBlockTypePlugin();\n }\n\n if (opts.tableHandles) {\n ret[\"tableHandles\"] = new TableHandlesProsemirrorPlugin(opts.editor as any);\n }\n\n ret[\"dropCursor\"] = {\n plugin: opts.dropCursor({\n width: 5,\n color: \"#ddeeff\",\n editor: opts.editor,\n }),\n };\n\n ret[\"nodeSelectionKeyboard\"] = new NodeSelectionKeyboardPlugin();\n\n const disableExtensions: string[] = opts.disableExtensions || [];\n for (const ext of Object.keys(disableExtensions)) {\n delete ret[ext];\n }\n\n return ret;\n};\n\n/**\n * Get all the Tiptap extensions BlockNote is configured with by default\n */\nconst getTipTapExtensions = <\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n opts: ExtensionOptions<BSchema, I, S>\n) => {\n const tiptapExtensions: AnyExtension[] = [\n extensions.ClipboardTextSerializer,\n extensions.Commands,\n extensions.Editable,\n extensions.FocusEvents,\n extensions.Tabindex,\n\n // DevTools,\n Gapcursor,\n\n // DropCursor,\n UniqueID.configure({\n // everything from bnBlock group (nodes that represent a BlockNote block should have an id)\n types: [\"blockContainer\", \"columnList\", \"column\"],\n setIdAttribute: opts.setIdAttribute,\n }),\n HardBreak.extend({ priority: 10 }),\n // Comments,\n\n // basics:\n Text,\n\n // marks:\n Link.extend({\n inclusive: false,\n addKeyboardShortcuts() {\n return {\n \"Mod-k\": () => {\n this.editor.commands.toggleLink({ href: \"\" });\n return true;\n },\n };\n },\n }),\n ...Object.values(opts.styleSpecs).map((styleSpec) => {\n return styleSpec.implementation.mark;\n }),\n\n TextColorExtension,\n\n BackgroundColorExtension,\n TextAlignmentExtension,\n\n // make sure escape blurs editor, so that we can tab to other elements in the host page (accessibility)\n Extension.create({\n name: \"OverrideEscape\",\n addKeyboardShortcuts() {\n return {\n Escape: () => {\n if (opts.editor.suggestionMenus.shown) {\n // escape is handled by suggestionmenu\n return false;\n }\n return this.editor.commands.blur();\n },\n };\n },\n }),\n\n // nodes\n Doc,\n BlockContainer.configure({\n editor: opts.editor,\n domAttributes: opts.domAttributes,\n }),\n KeyboardShortcutsExtension.configure({\n editor: opts.editor,\n }),\n BlockGroup.configure({\n domAttributes: opts.domAttributes,\n }),\n ...Object.values(opts.inlineContentSpecs)\n .filter((a) => a.config !== \"link\" && a.config !== \"text\")\n .map((inlineContentSpec) => {\n return inlineContentSpec.implementation!.node.configure({\n editor: opts.editor as any,\n });\n }),\n\n ...Object.values(opts.blockSpecs).flatMap((blockSpec) => {\n return [\n // dependent nodes (e.g.: tablecell / row)\n ...(blockSpec.implementation.requiredExtensions || []).map((ext) =>\n ext.configure({\n editor: opts.editor,\n domAttributes: opts.domAttributes,\n })\n ),\n // the actual node itself\n blockSpec.implementation.node.configure({\n editor: opts.editor,\n domAttributes: opts.domAttributes,\n }),\n ];\n }),\n createCopyToClipboardExtension(opts.editor),\n createPasteFromClipboardExtension(opts.editor),\n createDropFileExtension(opts.editor),\n\n // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),\n // should be handled before Enter handlers in other components like splitListItem\n ...(opts.trailingBlock === undefined || opts.trailingBlock\n ? [TrailingNode]\n : []),\n ];\n\n if (opts.collaboration) {\n tiptapExtensions.push(\n Collaboration.configure({\n fragment: opts.collaboration.fragment,\n })\n );\n if (opts.collaboration.provider?.awareness) {\n const defaultRender = (user: { color: string; name: string }) => {\n const cursor = document.createElement(\"span\");\n\n cursor.classList.add(\"collaboration-cursor__caret\");\n cursor.setAttribute(\"style\", `border-color: ${user.color}`);\n\n const label = document.createElement(\"span\");\n\n label.classList.add(\"collaboration-cursor__label\");\n label.setAttribute(\"style\", `background-color: ${user.color}`);\n label.insertBefore(document.createTextNode(user.name), null);\n\n const nonbreakingSpace1 = document.createTextNode(\"\\u2060\");\n const nonbreakingSpace2 = document.createTextNode(\"\\u2060\");\n cursor.insertBefore(nonbreakingSpace1, null);\n cursor.insertBefore(label, null);\n cursor.insertBefore(nonbreakingSpace2, null);\n return cursor;\n };\n tiptapExtensions.push(\n CollaborationCursor.configure({\n user: opts.collaboration.user,\n render: opts.collaboration.renderCursor || defaultRender,\n provider: opts.collaboration.provider,\n })\n );\n }\n } else {\n // disable history extension when collaboration is enabled as Yjs takes care of undo / redo\n tiptapExtensions.push(History);\n }\n\n return tiptapExtensions;\n};\n","import { Fragment, Schema, Slice } from \"@tiptap/pm/model\";\nimport { EditorView } from \"@tiptap/pm/view\";\n\n// helper function to remove a child from a fragment\nfunction removeChild(node: Fragment, n: number) {\n const children: any[] = [];\n node.forEach((child, _, i) => {\n if (i !== n) {\n children.push(child);\n }\n });\n return Fragment.from(children);\n}\n\n/**\n * Wrap adjacent tableRow items in a table.\n *\n * This makes sure the content that we paste is always a table (and not a tableRow)\n * A table works better for the remaing paste handling logic, as it's actually a blockContent node\n */\nexport function wrapTableRows(f: Fragment, schema: Schema) {\n const newItems: any[] = [];\n for (let i = 0; i < f.childCount; i++) {\n if (f.child(i).type.name === \"tableRow\") {\n if (\n newItems.length > 0 &&\n newItems[newItems.length - 1].type.name === \"table\"\n ) {\n // append to existing table\n const prevTable = newItems[newItems.length - 1];\n const newTable = prevTable.copy(prevTable.content.addToEnd(f.child(i)));\n newItems[newItems.length - 1] = newTable;\n } else {\n // create new table to wrap tableRow with\n const newTable = schema.nodes.table.createChecked(\n undefined,\n f.child(i)\n );\n newItems.push(newTable);\n }\n } else {\n newItems.push(f.child(i));\n }\n }\n f = Fragment.from(newItems);\n return f;\n}\n\n/**\n * fix for https://github.com/ProseMirror/prosemirror/issues/1430#issuecomment-1822570821\n *\n * Without this fix, pasting two paragraphs would cause the second one to be indented in the other\n * this fix wraps every element in the slice in it's own blockContainer, to prevent Prosemirror from nesting the\n * elements on paste.\n *\n * The exception is when we encounter blockGroups with listitems, because those actually should be nested\n */\nexport function transformPasted(slice: Slice, view: EditorView) {\n let f = Fragment.from(slice.content);\n f = wrapTableRows(f, view.state.schema);\n\n for (let i = 0; i < f.childCount; i++) {\n if (f.child(i).type.spec.group === \"blockContent\") {\n const content = [f.child(i)];\n\n // when there is a blockGroup with lists, it should be nested in the new blockcontainer\n // (if we remove this if-block, the nesting bug will be fixed, but lists won't be nested correctly)\n if (\n i + 1 < f.childCount &&\n f.child(i + 1).type.name === \"blockGroup\" // TODO\n ) {\n const nestedChild = f\n .child(i + 1)\n .child(0)\n .child(0);\n\n if (\n nestedChild.type.name === \"bulletListItem\" ||\n nestedChild.type.name === \"numberedListItem\" ||\n nestedChild.type.name === \"checkListItem\"\n ) {\n content.push(f.child(i + 1));\n f = removeChild(f, i + 1);\n }\n }\n const container = view.state.schema.nodes.blockContainer.createChecked(\n undefined,\n content\n );\n f = f.replaceChild(i, container);\n }\n }\n return new Slice(f, slice.openStart, slice.openEnd);\n}\n","import {\n defaultBlockSpecs,\n defaultInlineContentSpecs,\n defaultStyleSpecs,\n} from \"../blocks/defaultBlocks.js\";\nimport type {\n BlockNoDefaults,\n PartialBlockNoDefaults,\n} from \"../schema/blocks/types.js\";\nimport {\n BlockSchema,\n BlockSchemaFromSpecs,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSchemaFromSpecs,\n InlineContentSpecs,\n StyleSchema,\n StyleSchemaFromSpecs,\n StyleSpecs,\n getBlockSchemaFromSpecs,\n getInlineContentSchemaFromSpecs,\n getStyleSchemaFromSpecs,\n} from \"../schema/index.js\";\nimport type { BlockNoteEditor } from \"./BlockNoteEditor.js\";\n\nfunction removeUndefined<T extends Record<string, any> | undefined>(obj: T): T {\n if (!obj) {\n return obj;\n }\n return Object.fromEntries(\n Object.entries(obj).filter(([, value]) => value !== undefined)\n ) as T;\n}\n\nexport class BlockNoteSchema<\n BSchema extends BlockSchema,\n ISchema extends InlineContentSchema,\n SSchema extends StyleSchema\n> {\n public readonly blockSpecs: BlockSpecs;\n public readonly inlineContentSpecs: InlineContentSpecs;\n public readonly styleSpecs: StyleSpecs;\n\n public readonly blockSchema: BSchema;\n public readonly inlineContentSchema: ISchema;\n public readonly styleSchema: SSchema;\n\n // Helper so that you can use typeof schema.BlockNoteEditor\n public readonly BlockNoteEditor: BlockNoteEditor<BSchema, ISchema, SSchema> =\n \"only for types\" as any;\n\n public readonly Block: BlockNoDefaults<BSchema, ISchema, SSchema> =\n \"only for types\" as any;\n\n public readonly PartialBlock: PartialBlockNoDefaults<\n BSchema,\n ISchema,\n SSchema\n > = \"only for types\" as any;\n\n public static create<\n BSpecs extends BlockSpecs = typeof defaultBlockSpecs,\n ISpecs extends InlineContentSpecs = typeof defaultInlineContentSpecs,\n SSpecs extends StyleSpecs = typeof defaultStyleSpecs\n >(options?: {\n /**\n * A list of custom block types that should be available in the editor.\n */\n blockSpecs?: BSpecs;\n /**\n * A list of custom InlineContent types that should be available in the editor.\n */\n inlineContentSpecs?: ISpecs;\n /**\n * A list of custom Styles that should be available in the editor.\n */\n styleSpecs?: SSpecs;\n }) {\n return new BlockNoteSchema<\n BlockSchemaFromSpecs<BSpecs>,\n InlineContentSchemaFromSpecs<ISpecs>,\n StyleSchemaFromSpecs<SSpecs>\n >(options);\n // as BlockNoteSchema<\n // BlockSchemaFromSpecs<BSpecs>,\n // InlineContentSchemaFromSpecs<ISpecs>,\n // StyleSchemaFromSpecs<SSpecs>\n // >;\n }\n\n constructor(opts?: {\n blockSpecs?: BlockSpecs;\n inlineContentSpecs?: InlineContentSpecs;\n styleSpecs?: StyleSpecs;\n }) {\n this.blockSpecs = removeUndefined(opts?.blockSpecs) || defaultBlockSpecs;\n this.inlineContentSpecs =\n removeUndefined(opts?.inlineContentSpecs) || defaultInlineContentSpecs;\n this.styleSpecs = removeUndefined(opts?.styleSpecs) || defaultStyleSpecs;\n\n this.blockSchema = getBlockSchemaFromSpecs(this.blockSpecs) as any;\n this.inlineContentSchema = getInlineContentSchemaFromSpecs(\n this.inlineContentSpecs\n ) as any;\n this.styleSchema = getStyleSchemaFromSpecs(this.styleSpecs) as any;\n }\n}\n","import { EditorOptions, createDocument } from \"@tiptap/core\";\n// import \"./blocknote.css\";\nimport { Editor as TiptapEditor } from \"@tiptap/core\";\n\nimport { Node } from \"@tiptap/pm/model\";\n\nimport { EditorView } from \"@tiptap/pm/view\";\n\nimport { EditorState, Transaction } from \"@tiptap/pm/state\";\nimport { blockToNode } from \"../api/nodeConversions/blockToNode.js\";\nimport { PartialBlock } from \"../blocks/defaultBlocks.js\";\nimport { StyleSchema } from \"../schema/index.js\";\n\nexport type BlockNoteTipTapEditorOptions = Partial<\n Omit<EditorOptions, \"content\">\n> & {\n content: PartialBlock<any, any, any>[];\n};\n\n/**\n * Custom Editor class that extends TiptapEditor and separates\n * the creation of the view from the constructor.\n */\n// @ts-ignore\nexport class BlockNoteTipTapEditor extends TiptapEditor {\n private _state: EditorState;\n private _creating = false;\n public static create = (\n options: BlockNoteTipTapEditorOptions,\n styleSchema: StyleSchema\n ) => {\n // because we separate the constructor from the creation of the view,\n // we need to patch setTimeout to prevent this code from having any effect:\n // https://github.com/ueberdosis/tiptap/blob/45bac803283446795ad1b03f43d3746fa54a68ff/packages/core/src/Editor.ts#L117\n const oldSetTimeout = globalThis?.window?.setTimeout;\n if (typeof globalThis?.window?.setTimeout !== \"undefined\") {\n globalThis.window.setTimeout = (() => {\n return 0;\n }) as any;\n }\n try {\n return new BlockNoteTipTapEditor(options, styleSchema);\n } finally {\n if (oldSetTimeout) {\n globalThis.window.setTimeout = oldSetTimeout;\n }\n }\n };\n\n protected constructor(\n options: BlockNoteTipTapEditorOptions,\n styleSchema: StyleSchema\n ) {\n // possible fix for next.js server side rendering\n // const d = globalThis.document;\n // const w = globalThis.window;\n // if (!globalThis.document) {\n // globalThis.document = {\n // createElement: () => {},\n // };\n // }\n\n // options.injectCSS = false\n\n super({ ...options, content: undefined });\n // try {\n // globalThis.window = w;\n // } catch(e) {}\n // try {\n // globalThis.document = d;\n // } catch(e) {}\n\n // This is a hack to make \"initial content detection\" by y-prosemirror (and also tiptap isEmpty)\n // properly detect whether or not the document has changed.\n // We change the doc.createAndFill function to make sure the initial block id is set, instead of null\n const schema = this.schema;\n let cache: any;\n const oldCreateAndFill = schema.nodes.doc.createAndFill;\n (schema.nodes.doc as any).createAndFill = (...args: any) => {\n if (cache) {\n return cache;\n }\n const ret = oldCreateAndFill.apply(schema.nodes.doc, args);\n\n // create a copy that we can mutate (otherwise, assigning attrs is not safe and corrupts the pm state)\n const jsonNode = JSON.parse(JSON.stringify(ret!.toJSON()));\n jsonNode.content[0].content[0].attrs.id = \"initialBlockId\";\n\n cache = Node.fromJSON(schema, jsonNode);\n return cache;\n };\n\n let doc: Node;\n\n try {\n const pmNodes = options?.content.map((b) =>\n blockToNode(b, this.schema, styleSchema).toJSON()\n );\n doc = createDocument(\n {\n type: \"doc\",\n content: [\n {\n type: \"blockGroup\",\n content: pmNodes,\n },\n ],\n },\n this.schema,\n this.options.parseOptions\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Error creating document from blocks passed as `initialContent`. Caused by exception: \",\n e\n );\n throw new Error(\n \"Error creating document from blocks passed as `initialContent`:\\n\" +\n +JSON.stringify(options.content)\n );\n }\n\n // Create state immediately, so that it's available independently from the View,\n // the way Prosemirror \"intends it to be\". This also makes sure that we can access\n // the state before the view is created / mounted.\n this._state = EditorState.create({\n doc,\n schema: this.schema,\n // selection: selection || undefined,\n });\n }\n\n get state() {\n if (this.view) {\n this._state = this.view.state;\n }\n return this._state;\n }\n\n dispatch(tr: Transaction) {\n if (this.view) {\n this.view.dispatch(tr);\n } else {\n // before view has been initialized\n this._state = this.state.apply(tr);\n }\n }\n\n /**\n * Replace the default `createView` method with a custom one - which we call on mount\n */\n private createViewAlternative() {\n this._creating = true;\n // Without queueMicrotask, custom IC / styles will give a React FlushSync error\n queueMicrotask(() => {\n if (!this._creating) {\n return;\n }\n this.view = new EditorView(\n { mount: this.options.element as any }, // use mount option so that we reuse the existing element instead of creating a new one\n {\n ...this.options.editorProps,\n // @ts-ignore\n dispatchTransaction: this.dispatchTransaction.bind(this),\n state: this.state,\n }\n );\n\n // `editor.view` is not yet available at this time.\n // Therefore we will add all plugins and node views directly afterwards.\n const newState = this.state.reconfigure({\n plugins: this.extensionManager.plugins,\n });\n\n this.view.updateState(newState);\n\n this.createNodeViews();\n\n // emit the created event, call here manually because we blocked the default call in the constructor\n // (https://github.com/ueberdosis/tiptap/blob/45bac803283446795ad1b03f43d3746fa54a68ff/packages/core/src/Editor.ts#L117)\n this.commands.focus(this.options.autofocus);\n this.emit(\"create\", { editor: this });\n this.isInitialized = true;\n this._creating = false;\n });\n }\n\n /**\n * Mounts / unmounts the editor to a dom element\n *\n * @param element DOM element to mount to, ur null / undefined to destroy\n */\n public mount = (element?: HTMLElement | null) => {\n if (!element) {\n this.destroy();\n // cancel pending microtask\n this._creating = false;\n } else {\n this.options.element = element;\n // @ts-ignore\n this.createViewAlternative();\n }\n };\n}\n\n(BlockNoteTipTapEditor.prototype as any).createView = function () {\n // no-op\n // Disable default call to `createView` in the Editor constructor.\n // We should call `createView` manually only when a DOM element is available\n\n // additional fix because onPaste and onDrop depend on installing plugins in constructor which we don't support\n this.options.onPaste = this.options.onDrop = undefined;\n};\n","import {\n AnyExtension,\n EditorOptions,\n Extension,\n getSchema,\n Mark,\n Node as TipTapNode,\n} from \"@tiptap/core\";\nimport { Node, Schema } from \"prosemirror-model\";\n// import \"./blocknote.css\";\nimport * as Y from \"yjs\";\nimport { insertBlocks } from \"../api/blockManipulation/commands/insertBlocks/insertBlocks.js\";\nimport {\n moveBlockDown,\n moveBlockUp,\n} from \"../api/blockManipulation/commands/moveBlock/moveBlock.js\";\nimport {\n canNestBlock,\n canUnnestBlock,\n nestBlock,\n unnestBlock,\n} from \"../api/blockManipulation/commands/nestBlock/nestBlock.js\";\nimport { removeBlocks } from \"../api/blockManipulation/commands/removeBlocks/removeBlocks.js\";\nimport { replaceBlocks } from \"../api/blockManipulation/commands/replaceBlocks/replaceBlocks.js\";\nimport { updateBlock } from \"../api/blockManipulation/commands/updateBlock/updateBlock.js\";\nimport { insertContentAt } from \"../api/blockManipulation/insertContentAt.js\";\nimport {\n getTextCursorPosition,\n setTextCursorPosition,\n} from \"../api/blockManipulation/selections/textCursorPosition/textCursorPosition.js\";\nimport { createExternalHTMLExporter } from \"../api/exporters/html/externalHTMLExporter.js\";\nimport { blocksToMarkdown } from \"../api/exporters/markdown/markdownExporter.js\";\nimport { HTMLToBlocks } from \"../api/parsers/html/parseHTML.js\";\nimport { markdownToBlocks } from \"../api/parsers/markdown/parseMarkdown.js\";\nimport {\n Block,\n DefaultBlockSchema,\n DefaultInlineContentSchema,\n DefaultStyleSchema,\n PartialBlock,\n} from \"../blocks/defaultBlocks.js\";\nimport { FilePanelProsemirrorPlugin } from \"../extensions/FilePanel/FilePanelPlugin.js\";\nimport { FormattingToolbarProsemirrorPlugin } from \"../extensions/FormattingToolbar/FormattingToolbarPlugin.js\";\nimport { LinkToolbarProsemirrorPlugin } from \"../extensions/LinkToolbar/LinkToolbarPlugin.js\";\nimport { SideMenuProsemirrorPlugin } from \"../extensions/SideMenu/SideMenuPlugin.js\";\nimport { SuggestionMenuProseMirrorPlugin } from \"../extensions/SuggestionMenu/SuggestionPlugin.js\";\nimport { TableHandlesProsemirrorPlugin } from \"../extensions/TableHandles/TableHandlesPlugin.js\";\nimport { UniqueID } from \"../extensions/UniqueID/UniqueID.js\";\nimport {\n BlockIdentifier,\n BlockNoteDOMAttributes,\n BlockSchema,\n BlockSpecs,\n InlineContentSchema,\n InlineContentSpecs,\n PartialInlineContent,\n Styles,\n StyleSchema,\n StyleSpecs,\n} from \"../schema/index.js\";\nimport { mergeCSSClasses } from \"../util/browser.js\";\nimport { NoInfer, UnreachableCaseError } from \"../util/typescript.js\";\n\nimport { getBlockNoteExtensions } from \"./BlockNoteExtensions.js\";\nimport { TextCursorPosition } from \"./cursorPositionTypes.js\";\n\nimport { Selection } from \"./selectionTypes.js\";\nimport { transformPasted } from \"./transformPasted.js\";\n\nimport { checkDefaultBlockTypeInSchema } from \"../blocks/defaultBlockTypeGuards.js\";\nimport { BlockNoteSchema } from \"./BlockNoteSchema.js\";\nimport {\n BlockNoteTipTapEditor,\n BlockNoteTipTapEditorOptions,\n} from \"./BlockNoteTipTapEditor.js\";\n\nimport { Dictionary } from \"../i18n/dictionary.js\";\nimport { en } from \"../i18n/locales/index.js\";\n\nimport { Plugin, Transaction } from \"@tiptap/pm/state\";\nimport { dropCursor } from \"prosemirror-dropcursor\";\nimport { createInternalHTMLSerializer } from \"../api/exporters/html/internalHTMLSerializer.js\";\nimport { inlineContentToNodes } from \"../api/nodeConversions/blockToNode.js\";\nimport { nodeToBlock } from \"../api/nodeConversions/nodeToBlock.js\";\nimport \"../style.css\";\n\nexport type BlockNoteExtension =\n | AnyExtension\n | {\n plugin: Plugin;\n };\n\nexport type BlockNoteEditorOptions<\n BSchema extends BlockSchema,\n ISchema extends InlineContentSchema,\n SSchema extends StyleSchema\n> = {\n /**\n * Whether changes to blocks (like indentation, creating lists, changing headings) should be animated or not. Defaults to `true`.\n *\n * @default true\n */\n animations?: boolean;\n\n /**\n * Disable internal extensions (based on keys / extension name)\n */\n disableExtensions: string[];\n\n /**\n * A dictionary object containing translations for the editor.\n */\n dictionary?: Dictionary & Record<string, any>;\n\n /**\n * @deprecated, provide placeholders via dictionary instead\n */\n placeholders: Record<string | \"default\", string>;\n\n /**\n * An object containing attributes that should be added to HTML elements of the editor.\n *\n * @example { editor: { class: \"my-editor-class\" } }\n */\n domAttributes: Partial<BlockNoteDOMAttributes>;\n\n /**\n * The content that should be in the editor when it's created, represented as an array of partial block objects.\n */\n initialContent: PartialBlock<\n NoInfer<BSchema>,\n NoInfer<ISchema>,\n NoInfer<SSchema>\n >[];\n /**\n * Use default BlockNote font and reset the styles of <p> <li> <h1> elements etc., that are used in BlockNote.\n *\n * @default true\n */\n defaultStyles: boolean;\n\n schema: BlockNoteSchema<BSchema, ISchema, SSchema>;\n\n /**\n * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).\n * This method should set when creating the editor as this is application-specific.\n *\n * `undefined` means the application doesn't support file uploads.\n *\n * @param file The file that should be uploaded.\n * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)\n */\n uploadFile: (\n file: File,\n blockId?: string\n ) => Promise<string | Record<string, any>>;\n\n /**\n * Resolve a URL of a file block to one that can be displayed or downloaded. This can be used for creating authenticated URL or\n * implementing custom protocols / schemes\n * @returns The URL that's\n */\n resolveFileUrl: (url: string) => Promise<string>;\n\n /**\n * When enabled, allows for collaboration between multiple users.\n */\n collaboration: {\n /**\n * The Yjs XML fragment that's used for collaboration.\n */\n fragment: Y.XmlFragment;\n /**\n * The user info for the current user that's shown to other collaborators.\n */\n user: {\n name: string;\n color: string;\n };\n /**\n * A Yjs provider (used for awareness / cursor information)\n */\n provider: any;\n /**\n * Optional function to customize how cursors of users are rendered\n */\n renderCursor?: (user: any) => HTMLElement;\n };\n\n /**\n * additional tiptap options, undocumented\n */\n _tiptapOptions: Partial<EditorOptions>;\n\n /**\n * (experimental) add extra prosemirror plugins or tiptap extensions to the editor\n */\n _extensions: Record<string, BlockNoteExtension>;\n\n trailingBlock?: boolean;\n\n /**\n * Boolean indicating whether the editor is in headless mode.\n * Headless mode means we can use features like importing / exporting blocks,\n * but there's no underlying editor (UI) instantiated.\n *\n * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally\n */\n _headless: boolean;\n\n /**\n * A flag indicating whether to set an HTML ID for every block\n *\n * When set to `true`, on each block an id attribute will be set with the block id\n * Otherwise, the HTML ID attribute will not be set.\n *\n * (note that the id is always set on the `data-id` attribute)\n */\n setIdAttribute?: boolean;\n\n dropCursor?: (opts: any) => Plugin;\n};\n\nconst blockNoteTipTapOptions = {\n enableInputRules: true,\n enablePasteRules: true,\n enableCoreExtensions: false,\n};\n\nexport class BlockNoteEditor<\n BSchema extends BlockSchema = DefaultBlockSchema,\n ISchema extends InlineContentSchema = DefaultInlineContentSchema,\n SSchema extends StyleSchema = DefaultStyleSchema\n> {\n private readonly _pmSchema: Schema;\n\n /**\n * extensions that are added to the editor, can be tiptap extensions or prosemirror plugins\n */\n public readonly extensions: Record<string, BlockNoteExtension> = {};\n\n /**\n * Boolean indicating whether the editor is in headless mode.\n * Headless mode means we can use features like importing / exporting blocks,\n * but there's no underlying editor (UI) instantiated.\n *\n * You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally\n */\n public readonly headless: boolean = false;\n\n public readonly _tiptapEditor:\n | BlockNoteTipTapEditor & {\n contentComponent: any;\n } = undefined as any; // TODO: Type should actually reflect that it can be `undefined` in headless mode\n\n /**\n * Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements\n * in the correct context (used by `ReactRenderUtil`)\n */\n public elementRenderer: ((node: any, container: HTMLElement) => void) | null =\n null;\n\n /**\n * Cache of all blocks. This makes sure we don't have to \"recompute\" blocks if underlying Prosemirror Nodes haven't changed.\n * This is especially useful when we want to keep track of the same block across multiple operations,\n * with this cache, blocks stay the same object reference (referential equality with ===).\n */\n public blockCache = new WeakMap<Node, Block<any, any, any>>();\n\n /**\n * The dictionary contains translations for the editor.\n */\n public readonly dictionary: Dictionary & Record<string, any>;\n\n /**\n * The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.\n */\n public readonly schema: BlockNoteSchema<BSchema, ISchema, SSchema>;\n\n public readonly blockImplementations: BlockSpecs;\n public readonly inlineContentImplementations: InlineContentSpecs;\n public readonly styleImplementations: StyleSpecs;\n\n public readonly formattingToolbar: FormattingToolbarProsemirrorPlugin;\n public readonly linkToolbar: LinkToolbarProsemirrorPlugin<\n BSchema,\n ISchema,\n SSchema\n >;\n public readonly sideMenu: SideMenuProsemirrorPlugin<\n BSchema,\n ISchema,\n SSchema\n >;\n public readonly suggestionMenus: SuggestionMenuProseMirrorPlugin<\n BSchema,\n ISchema,\n SSchema\n >;\n public readonly filePanel?: FilePanelProsemirrorPlugin<ISchema, SSchema>;\n public readonly tableHandles?: TableHandlesProsemirrorPlugin<\n ISchema,\n SSchema\n >;\n\n /**\n * The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).\n * This method should set when creating the editor as this is application-specific.\n *\n * `undefined` means the application doesn't support file uploads.\n *\n * @param file The file that should be uploaded.\n * @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)\n */\n public readonly uploadFile:\n | ((file: File, blockId?: string) => Promise<string | Record<string, any>>)\n | undefined;\n\n private onUploadStartCallbacks: ((blockId?: string) => void)[] = [];\n private onUploadEndCallbacks: ((blockId?: string) => void)[] = [];\n\n public readonly resolveFileUrl: (url: string) => Promise<string>;\n\n public get pmSchema() {\n return this._pmSchema;\n }\n\n public static create<\n BSchema extends BlockSchema = DefaultBlockSchema,\n ISchema extends InlineContentSchema = DefaultInlineContentSchema,\n SSchema extends StyleSchema = DefaultStyleSchema\n >(options: Partial<BlockNoteEditorOptions<BSchema, ISchema, SSchema>> = {}) {\n return new BlockNoteEditor<BSchema, ISchema, SSchema>(options);\n }\n\n protected constructor(\n protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>\n ) {\n const anyOpts = options as any;\n if (anyOpts.onEditorContentChange) {\n throw new Error(\n \"onEditorContentChange initialization option is deprecated, use <BlockNoteView onChange={...} />, the useEditorChange(...) hook, or editor.onChange(...)\"\n );\n }\n\n if (anyOpts.onTextCursorPositionChange) {\n throw new Error(\n \"onTextCursorPositionChange initialization option is deprecated, use <BlockNoteView onSelectionChange={...} />, the useEditorSelectionChange(...) hook, or editor.onSelectionChange(...)\"\n );\n }\n\n if (anyOpts.onEditorReady) {\n throw new Error(\n \"onEditorReady is deprecated. Editor is immediately ready for use after creation.\"\n );\n }\n\n if (anyOpts.editable) {\n throw new Error(\n \"editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false\"\n );\n }\n\n this.dictionary = options.dictionary || en;\n\n // apply defaults\n const newOptions = {\n defaultStyles: true,\n schema: options.schema || BlockNoteSchema.create(),\n _headless: false,\n ...options,\n placeholders: {\n ...this.dictionary.placeholders,\n ...options.placeholders,\n },\n };\n\n // @ts-ignore\n this.schema = newOptions.schema;\n this.blockImplementations = newOptions.schema.blockSpecs;\n this.inlineContentImplementations = newOptions.schema.inlineContentSpecs;\n this.styleImplementations = newOptions.schema.styleSpecs;\n\n this.extensions = getBlockNoteExtensions({\n editor: this,\n domAttributes: newOptions.domAttributes || {},\n blockSpecs: this.schema.blockSpecs,\n styleSpecs: this.schema.styleSpecs,\n inlineContentSpecs: this.schema.inlineContentSpecs,\n collaboration: newOptions.collaboration,\n trailingBlock: newOptions.trailingBlock,\n disableExtensions: newOptions.disableExtensions,\n setIdAttribute: newOptions.setIdAttribute,\n animations: newOptions.animations ?? true,\n tableHandles: checkDefaultBlockTypeInSchema(\"table\", this),\n dropCursor: this.options.dropCursor ?? dropCursor,\n placeholders: newOptions.placeholders,\n });\n\n // add extensions from _tiptapOptions\n (newOptions._tiptapOptions?.extensions || []).forEach((ext) => {\n this.extensions[ext.name] = ext;\n });\n\n // add extensions from options\n Object.entries(newOptions._extensions || {}).forEach(([key, ext]) => {\n this.extensions[key] = ext;\n });\n\n this.formattingToolbar = this.extensions[\"formattingToolbar\"] as any;\n this.linkToolbar = this.extensions[\"linkToolbar\"] as any;\n this.sideMenu = this.extensions[\"sideMenu\"] as any;\n this.suggestionMenus = this.extensions[\"suggestionMenus\"] as any;\n this.filePanel = this.extensions[\"filePanel\"] as any;\n this.tableHandles = this.extensions[\"tableHandles\"] as any;\n\n if (newOptions.uploadFile) {\n const uploadFile = newOptions.uploadFile;\n this.uploadFile = async (file, block) => {\n this.onUploadStartCallbacks.forEach((callback) =>\n callback.apply(this, [block])\n );\n try {\n return await uploadFile(file, block);\n } finally {\n this.onUploadEndCallbacks.forEach((callback) =>\n callback.apply(this, [block])\n );\n }\n };\n }\n\n this.resolveFileUrl = newOptions.resolveFileUrl || (async (url) => url);\n this.headless = newOptions._headless;\n\n if (newOptions.collaboration && newOptions.initialContent) {\n // eslint-disable-next-line no-console\n console.warn(\n \"When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider\"\n );\n }\n\n const initialContent =\n newOptions.initialContent ||\n (options.collaboration\n ? [\n {\n type: \"paragraph\",\n id: \"initialBlockId\",\n },\n ]\n : [\n {\n type: \"paragraph\",\n id: UniqueID.options.generateID(),\n },\n ]);\n\n if (!Array.isArray(initialContent) || initialContent.length === 0) {\n throw new Error(\n \"initialContent must be a non-empty array of blocks, received: \" +\n initialContent\n );\n }\n\n const tiptapExtensions = [\n ...Object.entries(this.extensions).map(([key, ext]) => {\n if (\n ext instanceof Extension ||\n ext instanceof TipTapNode ||\n ext instanceof Mark\n ) {\n // tiptap extension\n return ext;\n }\n\n // \"blocknote\" extensions (prosemirror plugins)\n return Extension.create({\n name: key,\n addProseMirrorPlugins: () => [ext.plugin],\n });\n }),\n ];\n const tiptapOptions: BlockNoteTipTapEditorOptions = {\n ...blockNoteTipTapOptions,\n ...newOptions._tiptapOptions,\n content: initialContent,\n extensions: tiptapExtensions,\n editorProps: {\n ...newOptions._tiptapOptions?.editorProps,\n attributes: {\n // As of TipTap v2.5.0 the tabIndex is removed when the editor is not\n // editable, so you can't focus it. We want to revert this as we have\n // UI behaviour that relies on it.\n tabIndex: \"0\",\n ...newOptions._tiptapOptions?.editorProps?.attributes,\n ...newOptions.domAttributes?.editor,\n class: mergeCSSClasses(\n \"bn-editor\",\n newOptions.defaultStyles ? \"bn-default-styles\" : \"\",\n newOptions.domAttributes?.editor?.class || \"\"\n ),\n },\n transformPasted,\n },\n };\n\n if (!this.headless) {\n this._tiptapEditor = BlockNoteTipTapEditor.create(\n tiptapOptions,\n this.schema.styleSchema\n ) as BlockNoteTipTapEditor & {\n contentComponent: any;\n };\n this._pmSchema = this._tiptapEditor.schema;\n } else {\n // In headless mode, we don't instantiate an underlying TipTap editor,\n // but we still need the schema\n this._pmSchema = getSchema(tiptapOptions.extensions!);\n }\n }\n\n dispatch(tr: Transaction) {\n this._tiptapEditor.dispatch(tr);\n }\n\n /**\n * Mount the editor to a parent DOM element. Call mount(undefined) to clean up\n *\n * @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting\n */\n public mount = (parentElement?: HTMLElement | null) => {\n this._tiptapEditor.mount(parentElement);\n };\n\n public get prosemirrorView() {\n return this._tiptapEditor.view;\n }\n\n public get domElement() {\n return this._tiptapEditor.view.dom as HTMLDivElement;\n }\n\n public isFocused() {\n return this._tiptapEditor.view.hasFocus();\n }\n\n public focus() {\n this._tiptapEditor.view.focus();\n }\n\n public onUploadStart(callback: (blockId?: string) => void) {\n this.onUploadStartCallbacks.push(callback);\n\n return () => {\n const index = this.onUploadStartCallbacks.indexOf(callback);\n if (index > -1) {\n this.onUploadStartCallbacks.splice(index, 1);\n }\n };\n }\n\n public onUploadEnd(callback: (blockId?: string) => void) {\n this.onUploadEndCallbacks.push(callback);\n\n return () => {\n const index = this.onUploadEndCallbacks.indexOf(callback);\n if (index > -1) {\n this.onUploadEndCallbacks.splice(index, 1);\n }\n };\n }\n\n /**\n * @deprecated, use `editor.document` instead\n */\n public get topLevelBlocks(): Block<BSchema, ISchema, SSchema>[] {\n return this.document;\n }\n\n /**\n * Gets a snapshot of all top-level (non-nested) blocks in the editor.\n * @returns A snapshot of all top-level (non-nested) blocks in the editor.\n */\n public get document(): Block<BSchema, ISchema, SSchema>[] {\n const blocks: Block<BSchema, ISchema, SSchema>[] = [];\n\n this._tiptapEditor.state.doc.firstChild!.descendants((node) => {\n blocks.push(\n nodeToBlock(\n node,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.blockCache\n )\n );\n\n return false;\n });\n\n return blocks;\n }\n\n /**\n * Gets a snapshot of an existing block from the editor.\n * @param blockIdentifier The identifier of an existing block that should be retrieved.\n * @returns The block that matches the identifier, or `undefined` if no matching block was found.\n */\n public getBlock(\n blockIdentifier: BlockIdentifier\n ): Block<BSchema, ISchema, SSchema> | undefined {\n const id =\n typeof blockIdentifier === \"string\"\n ? blockIdentifier\n : blockIdentifier.id;\n let newBlock: Block<BSchema, ISchema, SSchema> | undefined = undefined;\n\n this._tiptapEditor.state.doc.firstChild!.descendants((node) => {\n if (typeof newBlock !== \"undefined\") {\n return false;\n }\n\n if (node.type.name !== \"blockContainer\" || node.attrs.id !== id) {\n return true;\n }\n\n newBlock = nodeToBlock(\n node,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.blockCache\n );\n\n return false;\n });\n\n return newBlock;\n }\n\n /**\n * Traverses all blocks in the editor depth-first, and executes a callback for each.\n * @param callback The callback to execute for each block. Returning `false` stops the traversal.\n * @param reverse Whether the blocks should be traversed in reverse order.\n */\n public forEachBlock(\n callback: (block: Block<BSchema, ISchema, SSchema>) => boolean,\n reverse = false\n ): void {\n const blocks = this.document.slice();\n\n if (reverse) {\n blocks.reverse();\n }\n\n function traverseBlockArray(\n blockArray: Block<BSchema, ISchema, SSchema>[]\n ): boolean {\n for (const block of blockArray) {\n if (callback(block) === false) {\n return false;\n }\n\n const children = reverse\n ? block.children.slice().reverse()\n : block.children;\n\n if (!traverseBlockArray(children)) {\n return false;\n }\n }\n\n return true;\n }\n\n traverseBlockArray(blocks);\n }\n\n /**\n * Executes a callback whenever the editor's contents change.\n * @param callback The callback to execute.\n */\n public onEditorContentChange(callback: () => void) {\n this._tiptapEditor.on(\"update\", callback);\n }\n\n /**\n * Executes a callback whenever the editor's selection changes.\n * @param callback The callback to execute.\n */\n public onEditorSelectionChange(callback: () => void) {\n this._tiptapEditor.on(\"selectionUpdate\", callback);\n }\n\n /**\n * Gets a snapshot of the current text cursor position.\n * @returns A snapshot of the current text cursor position.\n */\n public getTextCursorPosition(): TextCursorPosition<\n BSchema,\n ISchema,\n SSchema\n > {\n return getTextCursorPosition(this);\n }\n\n /**\n * Sets the text cursor position to the start or end of an existing block. Throws an error if the target block could\n * not be found.\n * @param targetBlock The identifier of an existing block that the text cursor should be moved to.\n * @param placement Whether the text cursor should be placed at the start or end of the block.\n */\n public setTextCursorPosition(\n targetBlock: BlockIdentifier,\n placement: \"start\" | \"end\" = \"start\"\n ) {\n setTextCursorPosition(this, targetBlock, placement);\n }\n\n /**\n * Gets a snapshot of the current selection.\n */\n public getSelection(): Selection<BSchema, ISchema, SSchema> | undefined {\n // Either the TipTap selection is empty, or it's a node selection. In either\n // case, it only spans one block, so we return undefined.\n if (\n this._tiptapEditor.state.selection.from ===\n this._tiptapEditor.state.selection.to ||\n \"node\" in this._tiptapEditor.state.selection\n ) {\n return undefined;\n }\n\n const blocks: Block<BSchema, ISchema, SSchema>[] = [];\n\n // TODO: This adds all child blocks to the same array. Needs to find min\n // depth and only add blocks at that depth.\n this._tiptapEditor.state.doc.descendants((node, pos) => {\n if (node.type.spec.group !== \"blockContent\") {\n return true;\n }\n\n // Fixed the block pos and size\n // all block is wrapped with a blockContent wrapper\n // and blockContent wrapper pos = inner block pos - 1\n // blockContent wrapper end = inner block pos + nodeSize + 1\n // need to add 1 to start and -1 to end\n const end = pos + node.nodeSize - 1;\n const start = pos + 1;\n if (\n end <= this._tiptapEditor.state.selection.from ||\n start >= this._tiptapEditor.state.selection.to\n ) {\n return true;\n }\n\n blocks.push(\n nodeToBlock(\n this._tiptapEditor.state.doc.resolve(pos).node(),\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.blockCache\n )\n );\n\n return false;\n });\n\n return { blocks: blocks };\n }\n\n /**\n * Checks if the editor is currently editable, or if it's locked.\n * @returns True if the editor is editable, false otherwise.\n */\n public get isEditable(): boolean {\n if (!this._tiptapEditor) {\n if (!this.headless) {\n throw new Error(\"no editor, but also not headless?\");\n }\n return false;\n }\n return this._tiptapEditor.isEditable === undefined\n ? true\n : this._tiptapEditor.isEditable;\n }\n\n /**\n * Makes the editor editable or locks it, depending on the argument passed.\n * @param editable True to make the editor editable, or false to lock it.\n */\n public set isEditable(editable: boolean) {\n if (!this._tiptapEditor) {\n if (!this.headless) {\n throw new Error(\"no editor, but also not headless?\");\n }\n // not relevant on headless\n return;\n }\n if (this._tiptapEditor.options.editable !== editable) {\n this._tiptapEditor.setEditable(editable);\n }\n }\n\n /**\n * Inserts new blocks into the editor. If a block's `id` is undefined, BlockNote generates one automatically. Throws an\n * error if the reference block could not be found.\n * @param blocksToInsert An array of partial blocks that should be inserted.\n * @param referenceBlock An identifier for an existing block, at which the new blocks should be inserted.\n * @param placement Whether the blocks should be inserted just before, just after, or nested inside the\n * `referenceBlock`.\n */\n public insertBlocks(\n blocksToInsert: PartialBlock<BSchema, ISchema, SSchema>[],\n referenceBlock: BlockIdentifier,\n placement: \"before\" | \"after\" = \"before\"\n ) {\n return insertBlocks(this, blocksToInsert, referenceBlock, placement);\n }\n\n /**\n * Updates an existing block in the editor. Since updatedBlock is a PartialBlock object, some fields might not be\n * defined. These undefined fields are kept as-is from the existing block. Throws an error if the block to update could\n * not be found.\n * @param blockToUpdate The block that should be updated.\n * @param update A partial block which defines how the existing block should be changed.\n */\n public updateBlock(\n blockToUpdate: BlockIdentifier,\n update: PartialBlock<BSchema, ISchema, SSchema>\n ) {\n return updateBlock(this, blockToUpdate, update);\n }\n\n /**\n * Removes existing blocks from the editor. Throws an error if any of the blocks could not be found.\n * @param blocksToRemove An array of identifiers for existing blocks that should be removed.\n */\n public removeBlocks(blocksToRemove: BlockIdentifier[]) {\n return removeBlocks(this, blocksToRemove);\n }\n\n /**\n * Replaces existing blocks in the editor with new blocks. If the blocks that should be removed are not adjacent or\n * are at different nesting levels, `blocksToInsert` will be inserted at the position of the first block in\n * `blocksToRemove`. Throws an error if any of the blocks to remove could not be found.\n * @param blocksToRemove An array of blocks that should be replaced.\n * @param blocksToInsert An array of partial blocks to replace the old ones with.\n */\n public replaceBlocks(\n blocksToRemove: BlockIdentifier[],\n blocksToInsert: PartialBlock<BSchema, ISchema, SSchema>[]\n ) {\n return replaceBlocks(this, blocksToRemove, blocksToInsert);\n }\n\n /**\n * Insert a piece of content at the current cursor position.\n *\n * @param content can be a string, or array of partial inline content elements\n */\n public insertInlineContent(content: PartialInlineContent<ISchema, SSchema>) {\n const nodes = inlineContentToNodes(\n content,\n this.pmSchema,\n this.schema.styleSchema\n );\n\n insertContentAt(\n {\n from: this._tiptapEditor.state.selection.from,\n to: this._tiptapEditor.state.selection.to,\n },\n nodes,\n this\n );\n }\n\n /**\n * Gets the active text styles at the text cursor position or at the end of the current selection if it's active.\n */\n public getActiveStyles() {\n const styles: Styles<SSchema> = {};\n const marks = this._tiptapEditor.state.selection.$to.marks();\n\n for (const mark of marks) {\n const config = this.schema.styleSchema[mark.type.name];\n if (!config) {\n if (mark.type.name !== \"link\") {\n // eslint-disable-next-line no-console\n console.warn(\"mark not found in styleschema\", mark.type.name);\n }\n\n continue;\n }\n if (config.propSchema === \"boolean\") {\n (styles as any)[config.type] = true;\n } else {\n (styles as any)[config.type] = mark.attrs.stringValue;\n }\n }\n\n return styles;\n }\n\n /**\n * Adds styles to the currently selected content.\n * @param styles The styles to add.\n */\n public addStyles(styles: Styles<SSchema>) {\n for (const [style, value] of Object.entries(styles)) {\n const config = this.schema.styleSchema[style];\n if (!config) {\n throw new Error(`style ${style} not found in styleSchema`);\n }\n if (config.propSchema === \"boolean\") {\n this._tiptapEditor.commands.setMark(style);\n } else if (config.propSchema === \"string\") {\n this._tiptapEditor.commands.setMark(style, { stringValue: value });\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n }\n\n /**\n * Removes styles from the currently selected content.\n * @param styles The styles to remove.\n */\n public removeStyles(styles: Styles<SSchema>) {\n for (const style of Object.keys(styles)) {\n this._tiptapEditor.commands.unsetMark(style);\n }\n }\n\n /**\n * Toggles styles on the currently selected content.\n * @param styles The styles to toggle.\n */\n public toggleStyles(styles: Styles<SSchema>) {\n for (const [style, value] of Object.entries(styles)) {\n const config = this.schema.styleSchema[style];\n if (!config) {\n throw new Error(`style ${style} not found in styleSchema`);\n }\n if (config.propSchema === \"boolean\") {\n this._tiptapEditor.commands.toggleMark(style);\n } else if (config.propSchema === \"string\") {\n this._tiptapEditor.commands.toggleMark(style, { stringValue: value });\n } else {\n throw new UnreachableCaseError(config.propSchema);\n }\n }\n }\n\n /**\n * Gets the currently selected text.\n */\n public getSelectedText() {\n return this._tiptapEditor.state.doc.textBetween(\n this._tiptapEditor.state.selection.from,\n this._tiptapEditor.state.selection.to\n );\n }\n\n /**\n * Gets the URL of the last link in the current selection, or `undefined` if there are no links in the selection.\n */\n public getSelectedLinkUrl() {\n return this._tiptapEditor.getAttributes(\"link\").href as string | undefined;\n }\n\n /**\n * Creates a new link to replace the selected content.\n * @param url The link URL.\n * @param text The text to display the link with.\n */\n public createLink(url: string, text?: string) {\n if (url === \"\") {\n return;\n }\n\n const { from, to } = this._tiptapEditor.state.selection;\n\n if (!text) {\n text = this._tiptapEditor.state.doc.textBetween(from, to);\n }\n\n const mark = this.pmSchema.mark(\"link\", { href: url });\n\n this.dispatch(\n this._tiptapEditor.state.tr\n .insertText(text, from, to)\n .addMark(from, from + text.length, mark)\n );\n }\n\n /**\n * Checks if the block containing the text cursor can be nested.\n */\n public canNestBlock() {\n return canNestBlock(this);\n }\n\n /**\n * Nests the block containing the text cursor into the block above it.\n */\n public nestBlock() {\n nestBlock(this);\n }\n\n /**\n * Checks if the block containing the text cursor is nested.\n */\n public canUnnestBlock() {\n return canUnnestBlock(this);\n }\n\n /**\n * Lifts the block containing the text cursor out of its parent.\n */\n public unnestBlock() {\n unnestBlock(this);\n }\n\n /**\n * Moves the block containing the text cursor up. If the previous block has\n * children, moves it to the end of its children. If there is no previous\n * block, but the current block is nested, moves it out of & before its parent.\n */\n public moveBlockUp() {\n moveBlockUp(this);\n }\n\n /**\n * Moves the block containing the text cursor down. If the next block has\n * children, moves it to the start of its children. If there is no next block,\n * but the current block is nested, moves it out of & after its parent.\n */\n public moveBlockDown() {\n moveBlockDown(this);\n }\n\n /**\n * Exports blocks into a simplified HTML string. To better conform to HTML standards, children of blocks which aren't list\n * items are un-nested in the output HTML.\n *\n * @param blocks An array of blocks that should be serialized into HTML.\n * @returns The blocks, serialized as an HTML string.\n */\n public async blocksToHTMLLossy(\n blocks: PartialBlock<BSchema, ISchema, SSchema>[] = this.document\n ): Promise<string> {\n const exporter = createExternalHTMLExporter(this.pmSchema, this);\n return exporter.exportBlocks(blocks, {});\n }\n\n /**\n * Serializes blocks into an HTML string in the format that would normally be rendered by the editor.\n *\n * Use this method if you want to server-side render HTML (for example, a blog post that has been edited in BlockNote)\n * and serve it to users without loading the editor on the client (i.e.: displaying the blog post)\n *\n * @param blocks An array of blocks that should be serialized into HTML.\n * @returns The blocks, serialized as an HTML string.\n */\n public async blocksToFullHTML(\n blocks: PartialBlock<BSchema, ISchema, SSchema>[]\n ): Promise<string> {\n const exporter = createInternalHTMLSerializer(this.pmSchema, this);\n return exporter.serializeBlocks(blocks, {});\n }\n /**\n * Parses blocks from an HTML string. Tries to create `Block` objects out of any HTML block-level elements, and\n * `InlineNode` objects from any HTML inline elements, though not all element types are recognized. If BlockNote\n * doesn't recognize an HTML element's tag, it will parse it as a paragraph or plain text.\n * @param html The HTML string to parse blocks from.\n * @returns The blocks parsed from the HTML string.\n */\n public async tryParseHTMLToBlocks(\n html: string\n ): Promise<Block<BSchema, ISchema, SSchema>[]> {\n return HTMLToBlocks(\n html,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.pmSchema\n );\n }\n\n /**\n * Serializes blocks into a Markdown string. The output is simplified as Markdown does not support all features of\n * BlockNote - children of blocks which aren't list items are un-nested and certain styles are removed.\n * @param blocks An array of blocks that should be serialized into Markdown.\n * @returns The blocks, serialized as a Markdown string.\n */\n public async blocksToMarkdownLossy(\n blocks: PartialBlock<BSchema, ISchema, SSchema>[] = this.document\n ): Promise<string> {\n return blocksToMarkdown(blocks, this.pmSchema, this, {});\n }\n\n /**\n * Creates a list of blocks from a Markdown string. Tries to create `Block` and `InlineNode` objects based on\n * Markdown syntax, though not all symbols are recognized. If BlockNote doesn't recognize a symbol, it will parse it\n * as text.\n * @param markdown The Markdown string to parse blocks from.\n * @returns The blocks parsed from the Markdown string.\n */\n public async tryParseMarkdownToBlocks(\n markdown: string\n ): Promise<Block<BSchema, ISchema, SSchema>[]> {\n return markdownToBlocks(\n markdown,\n this.schema.blockSchema,\n this.schema.inlineContentSchema,\n this.schema.styleSchema,\n this.pmSchema\n );\n }\n\n /**\n * Updates the user info for the current user that's shown to other collaborators.\n */\n public updateCollaborationUserInfo(user: { name: string; color: string }) {\n if (!this.options.collaboration) {\n throw new Error(\n \"Cannot update collaboration user info when collaboration is disabled.\"\n );\n }\n this._tiptapEditor.commands.updateUser(user);\n }\n\n /**\n * A callback function that runs whenever the editor's contents change.\n *\n * @param callback The callback to execute.\n * @returns A function to remove the callback.\n */\n public onChange(\n callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void\n ) {\n if (this.headless) {\n // Note: would be nice if this is possible in headless mode as well\n return;\n }\n\n const cb = () => {\n callback(this);\n };\n\n this._tiptapEditor.on(\"update\", cb);\n\n return () => {\n this._tiptapEditor.off(\"update\", cb);\n };\n }\n\n /**\n * A callback function that runs whenever the text cursor position or selection changes.\n *\n * @param callback The callback to execute.\n * @returns A function to remove the callback.\n */\n public onSelectionChange(\n callback: (editor: BlockNoteEditor<BSchema, ISchema, SSchema>) => void\n ) {\n if (this.headless) {\n return;\n }\n\n const cb = () => {\n callback(this);\n };\n\n this._tiptapEditor.on(\"selectionUpdate\", cb);\n\n return () => {\n this._tiptapEditor.off(\"selectionUpdate\", cb);\n };\n }\n\n public openSuggestionMenu(\n triggerCharacter: string,\n pluginState?: {\n deleteTriggerCharacter?: boolean;\n ignoreQueryLength?: boolean;\n }\n ) {\n const tr = this.prosemirrorView.state.tr;\n const transaction =\n pluginState && pluginState.deleteTriggerCharacter\n ? tr.insertText(triggerCharacter)\n : tr;\n\n this.prosemirrorView.focus();\n this.prosemirrorView.dispatch(\n transaction.scrollIntoView().setMeta(this.suggestionMenus.plugin, {\n triggerCharacter: triggerCharacter,\n deleteTriggerCharacter: pluginState?.deleteTriggerCharacter || false,\n ignoreQueryLength: pluginState?.ignoreQueryLength || false,\n })\n );\n }\n}\n","export const COLORS_DEFAULT = {\n gray: {\n text: \"#9b9a97\",\n background: \"#ebeced\",\n },\n brown: {\n text: \"#64473a\",\n background: \"#e9e5e3\",\n },\n red: {\n text: \"#e03e3e\",\n background: \"#fbe4e4\",\n },\n orange: {\n text: \"#d9730d\",\n background: \"#f6e9d9\",\n },\n yellow: {\n text: \"#dfab01\",\n background: \"#fbf3db\",\n },\n green: {\n text: \"#4d6461\",\n background: \"#ddedea\",\n },\n blue: {\n text: \"#0b6e99\",\n background: \"#ddebf1\",\n },\n purple: {\n text: \"#6940a5\",\n background: \"#eae4f2\",\n },\n pink: {\n text: \"#ad1a72\",\n background: \"#f4dfeb\",\n },\n};\n\nexport const COLORS_DARK_MODE_DEFAULT = {\n gray: {\n text: \"#bebdb8\",\n background: \"#9b9a97\",\n },\n brown: {\n text: \"#8e6552\",\n background: \"#64473a\",\n },\n red: {\n text: \"#ec4040\",\n background: \"#be3434\",\n },\n orange: {\n text: \"#e3790d\",\n background: \"#b7600a\",\n },\n yellow: {\n text: \"#dfab01\",\n background: \"#b58b00\",\n },\n green: {\n text: \"#6b8b87\",\n background: \"#4d6461\",\n },\n blue: {\n text: \"#0e87bc\",\n background: \"#0b6e99\",\n },\n purple: {\n text: \"#8552d7\",\n background: \"#6940a5\",\n },\n pink: {\n text: \"#da208f\",\n background: \"#ad1a72\",\n },\n};\n","import { BlockNoteSchema } from \"../editor/BlockNoteSchema.js\";\nimport { COLORS_DEFAULT } from \"../editor/defaultColors.js\";\nimport {\n BlockFromConfig,\n BlockSchema,\n InlineContent,\n InlineContentSchema,\n StyleSchema,\n StyledText,\n Styles,\n} from \"../schema/index.js\";\n\nimport type {\n BlockMapping,\n InlineContentMapping,\n StyleMapping,\n} from \"./mapping.js\";\n\nexport type ExporterOptions = {\n /**\n * A function that can be used to resolve files, images, etc.\n * Exporters might need the binary contents of files like images,\n * which might not always be available from the same origin as the main page.\n * You can use this option to proxy requests through a server you control\n * to avoid cross-origin (CORS) issues.\n *\n * @default uses a BlockNote hosted proxy (https://corsproxy.api.blocknotejs.org/)\n * @param url - The URL of the file to resolve\n * @returns A Promise that resolves to a string (the URL to use instead of the original)\n * or a Blob (you can return the Blob directly if you have already fetched it)\n */\n resolveFileUrl?: (url: string) => Promise<string | Blob>;\n /**\n * Colors to use for background of blocks, font colors, and highlight colors\n */\n colors: typeof COLORS_DEFAULT;\n};\nexport abstract class Exporter<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n RB,\n RI,\n RS,\n TS\n> {\n public constructor(\n _schema: BlockNoteSchema<B, I, S>, // only used for type inference\n protected readonly mappings: {\n blockMapping: BlockMapping<B, I, S, RB, RI>;\n inlineContentMapping: InlineContentMapping<I, S, RI, TS>;\n styleMapping: StyleMapping<S, RS>;\n },\n public readonly options: ExporterOptions\n ) {}\n\n public async resolveFile(url: string) {\n if (!this.options?.resolveFileUrl) {\n return (await fetch(url)).blob();\n }\n const ret = await this.options.resolveFileUrl(url);\n if (ret instanceof Blob) {\n return ret;\n }\n return (await fetch(ret)).blob();\n }\n\n public mapStyles(styles: Styles<S>) {\n const stylesArray = Object.entries(styles).map(([key, value]) => {\n const mappedStyle = this.mappings.styleMapping[key](value, this);\n return mappedStyle;\n });\n return stylesArray;\n }\n\n public mapInlineContent(inlineContent: InlineContent<I, S>) {\n return this.mappings.inlineContentMapping[inlineContent.type](\n inlineContent,\n this\n );\n }\n\n public transformInlineContent(inlineContentArray: InlineContent<I, S>[]) {\n return inlineContentArray.map((ic) => this.mapInlineContent(ic));\n }\n\n public abstract transformStyledText(styledText: StyledText<S>): TS;\n\n public async mapBlock(\n block: BlockFromConfig<B[keyof B], I, S>,\n nestingLevel: number,\n numberedListIndex: number\n ) {\n return this.mappings.blockMapping[block.type](\n block,\n this,\n nestingLevel,\n numberedListIndex\n );\n }\n}\n","import { BlockNoteSchema } from \"../editor/BlockNoteSchema.js\";\nimport {\n BlockFromConfigNoChildren,\n BlockSchema,\n InlineContentFromConfig,\n InlineContentSchema,\n StyleSchema,\n Styles,\n} from \"../schema/index.js\";\nimport type { Exporter } from \"./Exporter.js\";\n\n/**\n * Defines a mapping from all block types with a schema to a result type `R`.\n */\nexport type BlockMapping<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema,\n RB,\n RI\n> = {\n [K in keyof B]: (\n block: BlockFromConfigNoChildren<B[K], I, S>,\n // we don't know the exact types that are supported by the exporter at this point,\n // because the mapping only knows about converting certain types (which might be a subset of the supported types)\n // this is why there are many `any` types here (same for types below)\n exporter: Exporter<any, any, any, RB, RI, any, any>,\n nestingLevel: number,\n numberedListIndex?: number\n ) => RB | Promise<RB>;\n};\n\n/**\n * Defines a mapping from all inline content types with a schema to a result type R.\n */\nexport type InlineContentMapping<\n I extends InlineContentSchema,\n S extends StyleSchema,\n RI,\n TS\n> = {\n [K in keyof I]: (\n inlineContent: InlineContentFromConfig<I[K], S>,\n exporter: Exporter<any, I, S, any, RI, any, TS>\n ) => RI;\n};\n\n/**\n * Defines a mapping from all style types with a schema to a result type R.\n */\nexport type StyleMapping<S extends StyleSchema, RS> = {\n [K in keyof S]: (\n style: Styles<S>[K],\n exporter: Exporter<any, any, any, any, any, RS, any>\n ) => RS;\n};\n\n/**\n * The mapping factory is a utility function to easily create mappings for\n * a BlockNoteSchema. Using the factory makes it easier to get typescript code completion etc.\n */\nexport function mappingFactory<\n B extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(_schema: BlockNoteSchema<B, I, S>) {\n return {\n createBlockMapping: <R, RI>(mapping: BlockMapping<B, I, S, R, RI>) =>\n mapping,\n createInlineContentMapping: <R, RS>(\n mapping: InlineContentMapping<I, S, R, RS>\n ) => mapping,\n createStyleMapping: <R>(mapping: StyleMapping<S, R>) => mapping,\n };\n}\n","import type { Emoji, EmojiMartData } from \"@emoji-mart/data\";\n\nimport { checkDefaultInlineContentTypeInSchema } from \"../../blocks/defaultBlockTypeGuards.js\";\nimport { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n} from \"../../schema/index.js\";\nimport { DefaultGridSuggestionItem } from \"./DefaultGridSuggestionItem.js\";\n\nlet data:\n | Promise<{\n default: EmojiMartData;\n }>\n | undefined;\n\nlet emojiMart: typeof import(\"emoji-mart\") | undefined;\n\nexport async function getDefaultEmojiPickerItems<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n query: string\n): Promise<DefaultGridSuggestionItem[]> {\n if (!checkDefaultInlineContentTypeInSchema(\"text\", editor)) {\n return [];\n }\n\n if (!data) {\n // use a dynamic import to encourage bundle-splitting\n // and a smaller initial client bundle size\n\n data = import(\"@emoji-mart/data\") as any;\n\n // load dynamically because emoji-mart doesn't specify type: module and breaks in nodejs\n emojiMart = await import(\"emoji-mart\");\n const emojiMartData = (await data)!.default;\n await emojiMart.init({ data: emojiMartData });\n }\n\n const emojiMartData = (await data)!.default;\n\n const emojisToShow =\n query.trim() === \"\"\n ? Object.values(emojiMartData.emojis)\n : ((await emojiMart!.SearchIndex.search(query)) as Emoji[]);\n\n return emojisToShow.map((emoji) => ({\n id: emoji.skins[0].native,\n onItemClick: () => editor.insertInlineContent(emoji.skins[0].native + \" \"),\n }));\n}\n","import { Block, PartialBlock } from \"../../blocks/defaultBlocks.js\";\nimport type { BlockNoteEditor } from \"../../editor/BlockNoteEditor.js\";\n\nimport { checkDefaultBlockTypeInSchema } from \"../../blocks/defaultBlockTypeGuards.js\";\nimport {\n BlockSchema,\n InlineContentSchema,\n StyleSchema,\n isStyledTextInlineContent,\n} from \"../../schema/index.js\";\nimport { formatKeyboardShortcut } from \"../../util/browser.js\";\nimport { DefaultSuggestionItem } from \"./DefaultSuggestionItem.js\";\n\n// Sets the editor's text cursor position to the next content editable block,\n// so either a block with inline content or a table. The last block is always a\n// paragraph, so this function won't try to set the cursor position past the\n// last block.\nfunction setSelectionToNextContentEditableBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>) {\n let block = editor.getTextCursorPosition().block;\n let contentType = editor.schema.blockSchema[block.type].content;\n\n while (contentType === \"none\") {\n block = editor.getTextCursorPosition().nextBlock!;\n contentType = editor.schema.blockSchema[block.type].content as\n | \"inline\"\n | \"table\"\n | \"none\";\n editor.setTextCursorPosition(block, \"end\");\n }\n}\n\n// Checks if the current block is empty or only contains a slash, and if so,\n// updates the current block instead of inserting a new one below. If the new\n// block doesn't contain editable content, the cursor is moved to the next block\n// that does.\nexport function insertOrUpdateBlock<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n editor: BlockNoteEditor<BSchema, I, S>,\n block: PartialBlock<BSchema, I, S>\n): Block<BSchema, I, S> {\n const currentBlock = editor.getTextCursorPosition().block;\n\n if (currentBlock.content === undefined) {\n throw new Error(\"Slash Menu open in a block that doesn't contain content.\");\n }\n\n let newBlock: Block<BSchema, I, S>;\n\n if (\n Array.isArray(currentBlock.content) &&\n ((currentBlock.content.length === 1 &&\n isStyledTextInlineContent(currentBlock.content[0]) &&\n currentBlock.content[0].type === \"text\" &&\n currentBlock.content[0].text === \"/\") ||\n currentBlock.content.length === 0)\n ) {\n newBlock = editor.updateBlock(currentBlock, block);\n // We make sure to reset the cursor position to the new block as calling\n // `updateBlock` may move it out. This generally happens when the content\n // changes, or the update makes the block multi-column.\n editor.setTextCursorPosition(newBlock);\n } else {\n newBlock = editor.insertBlocks([block], currentBlock, \"after\")[0];\n editor.setTextCursorPosition(editor.getTextCursorPosition().nextBlock!);\n }\n\n setSelectionToNextContentEditableBlock(editor);\n\n return newBlock;\n}\n\nexport function getDefaultSlashMenuItems<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(editor: BlockNoteEditor<BSchema, I, S>) {\n const items: DefaultSuggestionItem[] = [];\n\n if (checkDefaultBlockTypeInSchema(\"heading\", editor)) {\n items.push(\n {\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"heading\",\n props: { level: 1 },\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-1\"),\n key: \"heading\",\n ...editor.dictionary.slash_menu.heading,\n },\n {\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"heading\",\n props: { level: 2 },\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-2\"),\n key: \"heading_2\",\n ...editor.dictionary.slash_menu.heading_2,\n },\n {\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"heading\",\n props: { level: 3 },\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-3\"),\n key: \"heading_3\",\n ...editor.dictionary.slash_menu.heading_3,\n }\n );\n }\n\n if (checkDefaultBlockTypeInSchema(\"numberedListItem\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"numberedListItem\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Shift-7\"),\n key: \"numbered_list\",\n ...editor.dictionary.slash_menu.numbered_list,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"bulletListItem\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"bulletListItem\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Shift-8\"),\n key: \"bullet_list\",\n ...editor.dictionary.slash_menu.bullet_list,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"checkListItem\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"checkListItem\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Shift-9\"),\n key: \"check_list\",\n ...editor.dictionary.slash_menu.check_list,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"paragraph\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"paragraph\",\n });\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-0\"),\n key: \"paragraph\",\n ...editor.dictionary.slash_menu.paragraph,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"codeBlock\", editor)) {\n items.push({\n onItemClick: () => {\n const pos = editor._tiptapEditor.state.selection.from;\n\n insertOrUpdateBlock(editor, {\n type: \"codeBlock\",\n });\n\n // Move the cursor inside the code block\n editor._tiptapEditor.commands.setTextSelection(pos);\n },\n badge: formatKeyboardShortcut(\"Mod-Alt-c\"),\n key: \"code_block\",\n ...editor.dictionary.slash_menu.code_block,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"table\", editor)) {\n items.push({\n onItemClick: () => {\n insertOrUpdateBlock(editor, {\n type: \"table\",\n content: {\n type: \"tableContent\",\n rows: [\n {\n cells: [\"\", \"\", \"\"],\n },\n {\n cells: [\"\", \"\", \"\"],\n },\n ],\n },\n });\n },\n badge: undefined,\n key: \"table\",\n ...editor.dictionary.slash_menu.table,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"image\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"image\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"image\",\n ...editor.dictionary.slash_menu.image,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"video\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"video\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"video\",\n ...editor.dictionary.slash_menu.video,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"audio\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"audio\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"audio\",\n ...editor.dictionary.slash_menu.audio,\n });\n }\n\n if (checkDefaultBlockTypeInSchema(\"file\", editor)) {\n items.push({\n onItemClick: () => {\n const insertedBlock = insertOrUpdateBlock(editor, {\n type: \"file\",\n });\n\n // Immediately open the file toolbar\n editor.dispatch(\n editor._tiptapEditor.state.tr.setMeta(editor.filePanel!.plugin, {\n block: insertedBlock,\n })\n );\n },\n key: \"file\",\n ...editor.dictionary.slash_menu.file,\n });\n }\n\n items.push({\n onItemClick: () => {\n editor.openSuggestionMenu(\":\", {\n deleteTriggerCharacter: true,\n ignoreQueryLength: true,\n });\n },\n key: \"emoji\",\n ...editor.dictionary.slash_menu.emoji,\n });\n\n return items;\n}\n\nexport function filterSuggestionItems<\n T extends { title: string; aliases?: readonly string[] }\n>(items: T[], query: string) {\n return items.filter(\n ({ title, aliases }) =>\n title.toLowerCase().includes(query.toLowerCase()) ||\n (aliases &&\n aliases.filter((alias) =>\n alias.toLowerCase().includes(query.toLowerCase())\n ).length !== 0)\n );\n}\n","/**\n * Combines items by group. This can be used to combine multiple slash menu item arrays,\n * while making sure that items from the same group are adjacent to each other.\n */\nexport function combineByGroup<T extends { group?: string }>(\n items: T[],\n ...additionalItemsArray: {\n group?: string;\n }[][]\n) {\n const combinedItems = [...items];\n for (const additionalItems of additionalItemsArray) {\n for (const additionalItem of additionalItems) {\n const lastItemWithSameGroup = combinedItems.findLastIndex(\n (item) => item.group === additionalItem.group\n );\n if (lastItemWithSameGroup === -1) {\n combinedItems.push(additionalItem as T);\n } else {\n combinedItems.splice(lastItemWithSameGroup + 1, 0, additionalItem as T);\n }\n }\n }\n return combinedItems;\n}\n","import { Block, PartialBlock } from \"../../blocks/defaultBlocks.js\";\nimport { BlockNoteSchema } from \"../../editor/BlockNoteSchema.js\";\nimport UniqueID from \"../../extensions/UniqueID/UniqueID.js\";\nimport { BlockSchema, TableContent } from \"../../schema/blocks/types.js\";\nimport {\n InlineContent,\n InlineContentSchema,\n PartialInlineContent,\n StyledText,\n isPartialLinkInlineContent,\n isStyledTextInlineContent,\n} from \"../../schema/inlineContent/types.js\";\nimport { StyleSchema } from \"../../schema/styles/types.js\";\n\nfunction textShorthandToStyledText(\n content: string | StyledText<any>[] = \"\"\n): StyledText<any>[] {\n if (typeof content === \"string\") {\n return [\n {\n type: \"text\",\n text: content,\n styles: {},\n },\n ];\n }\n return content;\n}\n\nfunction partialContentToInlineContent(\n content: PartialInlineContent<any, any> | TableContent<any> | undefined\n): InlineContent<any, any>[] | TableContent<any> | undefined {\n if (typeof content === \"string\") {\n return textShorthandToStyledText(content);\n }\n\n if (Array.isArray(content)) {\n return content.flatMap((partialContent) => {\n if (typeof partialContent === \"string\") {\n return textShorthandToStyledText(partialContent);\n } else if (isPartialLinkInlineContent(partialContent)) {\n return {\n ...partialContent,\n content: textShorthandToStyledText(partialContent.content),\n };\n } else if (isStyledTextInlineContent(partialContent)) {\n return partialContent;\n } else {\n // custom inline content\n\n return {\n props: {},\n ...partialContent,\n content: partialContentToInlineContent(partialContent.content),\n } as any;\n }\n });\n } else if (content?.type === \"tableContent\") {\n return {\n type: \"tableContent\",\n columnWidths: content.columnWidths,\n rows: content.rows.map((row) => ({\n ...row,\n cells: row.cells.map(\n (cell) => partialContentToInlineContent(cell) as any\n ),\n })),\n };\n }\n\n return content;\n}\n\nexport function partialBlocksToBlocksForTesting<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: BlockNoteSchema<BSchema, I, S>,\n partialBlocks: Array<PartialBlock<NoInfer<BSchema>, NoInfer<I>, NoInfer<S>>>\n): Array<Block<BSchema, I, S>> {\n return partialBlocks.map((partialBlock) =>\n partialBlockToBlockForTesting(schema.blockSchema, partialBlock)\n );\n}\n\nexport function partialBlockToBlockForTesting<\n BSchema extends BlockSchema,\n I extends InlineContentSchema,\n S extends StyleSchema\n>(\n schema: BSchema,\n partialBlock: PartialBlock<BSchema, I, S>\n): Block<BSchema, I, S> {\n const contentType: \"inline\" | \"table\" | \"none\" =\n schema[partialBlock.type!].content;\n\n const withDefaults: Block<BSchema, I, S> = {\n id: \"\",\n type: partialBlock.type!,\n props: {} as any,\n content:\n contentType === \"inline\"\n ? []\n : contentType === \"table\"\n ? { type: \"tableContent\", columnWidths: [], rows: [] }\n : (undefined as any),\n children: [] as any,\n ...partialBlock,\n };\n\n Object.entries(schema[partialBlock.type!].propSchema).forEach(\n ([propKey, propValue]) => {\n if (withDefaults.props[propKey] === undefined) {\n (withDefaults.props as any)[propKey] = propValue.default;\n }\n }\n );\n\n if (contentType === \"inline\") {\n const content = withDefaults.content as InlineContent<I, S>[] | undefined;\n withDefaults.content = partialContentToInlineContent(content) as any;\n } else if (contentType === \"table\") {\n const content = withDefaults.content as TableContent<I, S> | undefined;\n withDefaults.content = {\n type: \"tableContent\",\n columnWidths:\n content?.columnWidths ||\n content?.rows[0]?.cells.map(() => undefined) ||\n [],\n rows:\n content?.rows.map((row) => ({\n cells: row.cells.map((cell) => partialContentToInlineContent(cell)),\n })) || [],\n } as any;\n }\n\n return {\n ...withDefaults,\n content: partialContentToInlineContent(withDefaults.content),\n children: withDefaults.children.map((c) => {\n return partialBlockToBlockForTesting(schema, c);\n }),\n } as any;\n}\n\nexport function addIdsToBlock(block: PartialBlock<any, any, any>) {\n if (!block.id) {\n block.id = UniqueID.options.generateID();\n }\n if (block.children) {\n addIdsToBlocks(block.children);\n }\n}\n\nexport function addIdsToBlocks(blocks: PartialBlock<any, any, any>[]) {\n for (const block of blocks) {\n addIdsToBlock(block);\n }\n}\n"],"names":["ar","de","en","es","fr","hr","is","ja","ko","nl","pl","pt","ru","vi","zh","UnreachableCaseError","val","assertEmpty","obj","throwError","dataTest","rest","removeDuplicates","array","by","seen","item","key","findDuplicates","items","filtered","el","index","UniqueID","Extension","testOptions","v4","element","attributes","defaultIdAttributes","dragSourceElement","transformPasted","Plugin","PluginKey","transactions","oldState","newState","docChanges","transaction","filterTransactions","tr","_a","_b","types","attributeName","generateID","transform","combineTransactionSteps","mapping","getChangedRanges","newRange","newNodes","findChildrenInRange","node","newIds","id","duplicatedNewIds","pos","initialDoc","jsonNode","deleted","view","handleDragstart","event","slice","removeId","fragment","list","nodeWithoutId","Fragment","Slice","isLinkInlineContent","content","isPartialLinkInlineContent","isStyledTextInlineContent","styledTextToNodes","styledText","schema","styleSchema","marks","style","value","config","text","linkToNodes","link","linkMark","styledTextArrayToNodes","nodes","inlineContentToNodes","blockContent","blockOrInlineContentToContentNode","tableContentToNodes","tableContent","rowNodes","row","columnNodes","i","cell","pNode","textNodes","cellNode","rowNode","block","contentNode","type","blockToNode","children","child","nodeTypeCorrespondingToBlock","groupNode","addAttributesAndRemoveClasses","className","serializeInlineContentExternalHTML","editor","serializer","options","dom","serializeBlock","orderedListItemBlockTypes","unorderedListItemBlockTypes","doc","BC_NODE","props","name","spec","attrs","ret","elementFragment","blockContentDataAttributes","attr","ic","listType","_c","li","childFragment","serializeBlocksToFragment","_d","_e","_f","_g","_h","blocks","serializeBlocksExternalHTML","createExternalHTMLExporter","DOMSerializer","html","div","inlineContent","domFragment","parent","serializeInlineContentInternalHTML","listIndex","serializeBlocks","bc","serializeBlocksInternalHTML","blockDOM","BG_NODE","bg","createInternalHTMLSerializer","getNearestBlockPos","$pos","depth","allBlockContainerPositions","resolvedPos","position","getBlockInfoWithManualOffset","bnBlockBeforePosOffset","bnBlockNode","bnBlockBeforePos","bnBlockAfterPos","bnBlock","blockGroup","offset","blockContentNode","blockContentBeforePos","blockContentAfterPos","blockGroupNode","blockGroupBeforePos","blockGroupAfterPos","getBlockInfo","posInfo","getBlockInfoFromResolvedPos","getBlockInfoFromSelection","state","getNodeById","targetNode","posBeforeNode","isAppleOS","formatKeyboardShortcut","shortcut","ctrlText","mergeCSSClasses","classes","c","isSafari","createDefaultBlockDOMOutputSpec","blockName","htmlTag","blockContentHTMLAttributes","inlineContentHTMLAttributes","attribute","defaultBlockToHTML","toDOM","renderSpec","defaultProps","inheritedProps","camelToDataKebab","str","filenameFromURL","url","parts","propsToAttributes","propSchema","tiptapAttributes","_spec","asNumber","getBlockFromPos","getPos","tipTapEditor","blockIdentifier","wrapInBlockStructure","blockType","blockProps","isFileBlock","domAttributes","prop","createStronglyTypedTiptapNode","Node","createInternalBlockSpec","implementation","createBlockSpecFromStronglyTypedTiptapNode","requiredExtensions","getBlockSchemaFromSpecs","specs","applyNonSelectableBlockFix","nodeView","getParseRules","customParseFunction","rules","createBlockSpec","blockConfig","blockImplementation","HTMLAttributes","blockContentDOMAttributes","output","contentNodeToTableContent","inlineContentSchema","_offset","contentNodeToInlineContent","currentContent","nodeToCustomInlineContent","styles","mark","icConfig","nodeToBlock","blockSchema","blockCache","cachedBlock","blockInfo","blockSpec","addInlineContentAttributes","inlineContentType","inlineContentProps","addInlineContentKeyboardShortcuts","createInternalInlineContentSpec","createInlineContentSpecFromTipTapNode","getInlineContentSchemaFromSpecs","getInlineContentParseRules","htmlElement","createInlineContentSpec","inlineContentConfig","inlineContentImplementation","update","stylePropsToAttributes","addStyleAttributes","styleType","styleValue","createInternalStyleSpec","createStyleSpecFromTipTapMark","getStyleSchemaFromSpecs","getStyleParseRules","createStyleSpec","styleConfig","styleImplementation","Mark","renderResult","FILE_ICON_SVG","createFileBlockWrapper","buttonText","buttonIcon","wrapper","addFileButton","createAddFileButton","loading","destroyUploadStartHandler","blockId","destroyUploadEndHandler","file","createDefaultFilePreview","createFileAndCaptionWrapper","icon","fileName","fileAndCaptionWrapper","caption","addFileButtonIcon","addFileButtonText","addFileButtonMouseDownHandler","addFileButtonClickHandler","parseEmbedElement","embedElement","parseFigureElement","figureElement","targetTag","targetElement","captionElement","createLinkWithCaption","fileCaption","createFigureWithCaption","figure","createResizeHandlesWrapper","getWidth","setWidth","leftResizeHandle","rightResizeHandle","resizeParams","windowMouseMoveHandler","newWidth","minWidth","windowMouseUpHandler","elementMouseEnterHandler","elementMouseLeaveHandler","leftResizeHandleMouseDownHandler","rightResizeHandleMouseDownHandler","parseAudioElement","audioElement","FILE_AUDIO_ICON_SVG","audioPropSchema","audioBlockConfig","audioRender","audio","downloadUrl","audioParse","parsedFigure","audioToExternalHTML","AudioBlock","defaultSupportedLanguages","bundledLanguagesInfo","lang","defaultCodeBlockPropSchema","CodeBlockContent","inputElement","dataLanguage","languages","language","pre","contentDOM","supportedLanguages","select","selectWrapper","handleLanguageChange","option","newNode","highlighter","parser","createHighlightPlugin","createHighlighter","createdHighlighter","createParser","InputRule","range","match","$start","languageName","TextSelection","selection","$from","isTextSelection","from","isAtEnd","endsWithDoubleNewline","CodeBlock","customizeCodeBlock","filePropSchema","fileBlockConfig","fileRender","fileParse","fileToExternalHTML","fileSrcLink","FileBlock","uploadToTmpFilesDotOrg_DEV_ONLY","body","parseImageElement","imageElement","previewWidth","FILE_IMAGE_ICON_SVG","imagePropSchema","imageBlockConfig","imageRender","image","width","imageParse","imageToExternalHTML","ImageBlock","RESIZE_MIN_WIDTH","EMPTY_CELL_WIDTH","EMPTY_CELL_HEIGHT","TableExtension","columnResizing","tableEditing","selectionIsEmpty","selectionIsAtStartOfNode","selectionIsInTableParagraphNode","extension","context","callOrReturn","getExtensionField","parseVideoElement","videoElement","FILE_VIDEO_ICON_SVG","videoPropSchema","videoBlockConfig","videoRender","video","videoParse","videoToExternalHTML","VideoBlock","BackgroundColorMark","BackgroundColor","TextColorMark","TextColor","updateBlockCommand","posBeforeBlock","dispatch","oldNodeType","newNodeType","newBnBlockNodeType","updateChildren","updateBlockContentNode","existingBlock","childNodes","ReplaceStep","updateBlock","blockToUpdate","ttEditor","blockContainerNode","headingPropSchema","HeadingBlockContent","parsed","level","chain","Heading","splitBlockCommand","posInBlock","keepType","keepProps","nearestBlockContainerPos","info","handleEnter","blockContainer","selectionEmpty","commands","bulletListItemPropSchema","BulletListItemBlockContent","BulletListItem","checkListItemPropSchema","checkListItemBlockContent","checkbox","checkboxWrapper","changeHandler","beforeBlockContainerPos","label","CheckListItem","PLUGIN_KEY","NumberedListIndexingPlugin","_transactions","_oldState","modified","newIndex","prevBlock","prevBlockInfo","prevBlockIndex","numberedListItemPropSchema","NumberedListItemBlockContent","NumberedListItem","paragraphPropSchema","ParagraphBlockContent","Paragraph","tablePropSchema","TableBlockContent","BlockNoteTableView","TableView","cellMinWidth","tableWrapper","tableWrapperInner","floatingContainer","record","TableParagraph","_element","Table","TableHeader","TableCell","TableRow","defaultBlockSpecs","defaultBlockSchema","defaultStyleSpecs","Bold","Italic","Underline","Strike","Code","defaultStyleSchema","defaultInlineContentSpecs","defaultInlineContentSchema","checkDefaultBlockTypeInSchema","checkDefaultInlineContentTypeInSchema","checkBlockIsDefaultType","checkBlockIsFileBlock","checkBlockIsFileBlockWithPreview","checkBlockIsFileBlockWithPlaceholder","checkBlockTypeHasDefaultProp","checkBlockHasDefaultProp","insertBlocks","blocksToInsert","referenceBlock","placement","nodesToInsert","insertedBlocks","getBlockSelectionData","selectionData","CellSelection","NodeSelection","updateBlockSelectionFromData","data","blockPos","moveSelectedBlockAndSelection","moveBlockUp","editorSelection","parentBlock","referenceBlockId","moveBlockDown","nextBlock","sinkListItem","itemType","groupType","$to","startIndex","nodeBefore","nestedBefore","inner","before","after","ReplaceAroundStep","nestBlock","unnestBlock","canNestBlock","canUnnestBlock","removeAndInsertBlocks","blocksToRemove","idsOfBlocksToRemove","removedBlocks","idOfFirstBlock","removedSize","oldDocSize","newDocSize","notFoundIds","replaceBlocks","removeBlocks","insertContentAt","to","isOnlyTextContent","isOnlyBlockContent","selectionToInsertionEnd","getTextCursorPosition","prevNode","nextNode","parentNode","setTextCursorPosition","targetBlock","contentType","esmDependencies","initializeESMDependencies","vals","removeUnderlines","removeUnderlinesHelper","tree","numChildElements","numElementsAdded","addSpacesToCheckboxes","deps","helper","nextChild","cleanHTMLToMarkdown","cleanHTMLString","blocksToMarkdown","externalHTML","getChildIndex","isWhitespaceNode","liftNestedListsToParent","parentListItem","siblingsAfter","sibling","siblingContainer","createGroups","listItem","_detachedDoc","detachedDoc","nestedListsToBlockNoteStructure","elementOrHTML","HTMLToBlocks","icSchema","pmSchema","htmlNode","DOMParser","code","properties","result","markdownToBlocks","markdown","htmlString","acceptedMIMETypes","checkFileExtensionsMatch","fileExtension1","fileExtension2","checkMIMETypesMatch","mimeType1","mimeType2","types1","types2","handleFileInsertion","dataTransfer","format","mimeType","fileBlockConfigs","fileBlockType","isFileExtension","fileBlock","insertedBlockId","coords","updateData","updatedFileBlock","createDropFileExtension","_view","handleVSCodePaste","vscode","vscodeData","createPasteFromClipboardExtension","fragmentToBlocks","fragmentToExternalHTML","selectedFragment","isWithinBlockContent","isWithinTable","fragmentWithoutParents","externalHTMLExporter","selectedFragmentToHTML","clipboardHTML","pmView","copyToClipboard","createCopyToClipboardExtension","BackgroundColorExtension","EventEmitter","__publicField","fn","args","callbacks","callback","FilePanelView","pluginKey","emitUpdate","blockElement","prevState","pluginState","filePanelPluginKey","FilePanelProsemirrorPlugin","editorView","FormattingToolbarView","empty","isEmptyTextBlock","isNodeSelection","editorWrapper","composing","isSame","ranges","shouldShow","posToDOMRect","formattingToolbarPluginKey","FormattingToolbarProsemirrorPlugin","getParentBlockInfo","beforePos","parentBeforePos","getPrevBlockInfo","indexInParent","prevBlockBeforePos","getBottomNestedBlockInfo","group","newPos","canMerge","nextBlockInfo","mergeBlocks","childBlocksStart","childBlocksEnd","childBlocksRange","mergeBlocksCommand","posBetweenBlocks","bottomNestedBlockInfo","KeyboardShortcutsExtension","selectionAtBlockStart","isParagraph","parentBlockInfo","column","columnList","shouldRemoveColumn","shouldRemoveColumnList","isFirstColumn","blockToMove","bottomBlock","childContainer","blockAtDocEnd","selectionAtBlockEnd","oldDepth","newDepth","blockEmpty","blockIndented","newBlockInsertionPos","newBlockContentPos","newBlock","LinkToolbarView","hoveredLinkElement","posInHoveredLinkMark","resolvedPosInHoveredLinkMark","marksAtPos","getMarkRange","prevLinkMark","linkToolbarPluginKey","LinkToolbarProsemirrorPlugin","NodeSelectionKeyboardPlugin","PlaceholderPlugin","placeholders","styleEl","nonce","styleSheet","getBaseSelector","additionalSelectors","getSelector","mustBeFocused","mustBeFocusedSelector","blockTypeSelector","placeholder","dec","Decoration","DecorationSet","nodeAttributes","PreviousBlockTypePlugin","timeout","_editorView","_prevState","prev","currentTransactionOriginalOldBlockAttrs","oldNodes","findChildren","oldNodesById","oldNode","oldContentNode","newContentNode","newAttrs","oldAttrs","decorations","prevAttrs","decorationAttrs","nodeAttr","decoration","getDraggableBlockFromElement","MultipleNodeSelection","Selection","$anchor","$head","_pos","fromResult","toResult","dragImageElement","blockPositionsFromSelection","beforeFirstBlockPos","afterLastBlockPos","selectionStartInBlockContent","selectionEndInBlockContent","minDepth","startFirstBlockPos","endLastBlockPos","setDragImage","parentClone","getElementIndex","parentElement","firstSelectedBlockIndex","lastSelectedBlockIndex","unsetDragImage","inheritedClasses","rootEl","dragStart","draggedBlockInSelection","multipleBlocksSelected","selectedSlice","plainText","PERCENTAGE_OF_BLOCK_WIDTH_CONSIDERED_SIDE_DROP","getBlockFromCoords","adjustForColumns","elements","getBlockFromMousePos","mousePos","editorBoundingBox","mouseLeftOfEditor","mouseRightOfEditor","rect","SideMenuView","blockContentBoundingBox","evt","_event","editorOuterBoundingBox","cursorWithinEditor","sideMenuPluginKey","SideMenuProsemirrorPlugin","findBlock","findParentNode","SuggestionMenuView","decorationNode","suggestionMenuPluginKey","menuName","next","started","stopped","SuggestionMenuProseMirrorPlugin","triggerCharacter","triggerCharacters","suggestionPluginTransactionMeta","_from","_to","suggestionPluginState","blockNode","createSuggestionMenu","setHiddenDragImage","unsetHiddenDragImage","domCellAround","target","currentTarget","hideElements","selector","elementsToHide","TableHandlesView","tableRect","blockEl","tableBlock","pmNodeInfo","widgetContainer","belowTable","toRightOfTable","hideHandles","colIndex","rowIndex","cellRect","boundedMouseCoords","tableCellElements","tableCellElement","emitStateUpdate","oldIndex","dispatchDecorationsTransaction","tableHandlesPluginKey","draggingState","rows","rowToMove","cellsToMove","tableBody","TableHandlesProsemirrorPlugin","tableResolvedPos","tableNode","rowResolvedPos","cellResolvedPos","decorationPos","widget","TextAlignmentExtension","TextColorExtension","TrailingNode","plugin","_","__","shouldInsertNodeAtEnd","endPosition","_state","lastNode","lastContentNode","BlockAttributes","BlockContainer","HTMLAttr","blockOuter","blockHTMLAttributes","BlockGroup","blockGroupHTMLAttributes","Doc","getBlockNoteExtensions","opts","tiptapExtensions","getTipTapExtensions","ext","disableExtensions","extensions","Gapcursor","HardBreak","Text","Link","styleSpec","a","inlineContentSpec","Collaboration","defaultRender","user","cursor","nonbreakingSpace1","nonbreakingSpace2","CollaborationCursor","History","removeChild","n","wrapTableRows","f","newItems","prevTable","newTable","nestedChild","container","removeUndefined","BlockNoteSchema","_BlockNoteTipTapEditor","TiptapEditor","cache","oldCreateAndFill","pmNodes","b","createDocument","e","EditorState","EditorView","oldSetTimeout","BlockNoteTipTapEditor","blockNoteTipTapOptions","BlockNoteEditor","anyOpts","newOptions","dropCursor","uploadFile","initialContent","TipTapNode","tiptapOptions","getSchema","reverse","traverseBlockArray","blockArray","end","start","editable","cb","COLORS_DEFAULT","COLORS_DARK_MODE_DEFAULT","Exporter","_schema","mappings","inlineContentArray","nestingLevel","numberedListIndex","mappingFactory","emojiMart","getDefaultEmojiPickerItems","query","emojiMartData","emoji","setSelectionToNextContentEditableBlock","insertOrUpdateBlock","currentBlock","getDefaultSlashMenuItems","insertedBlock","filterSuggestionItems","title","aliases","alias","combineByGroup","additionalItemsArray","combinedItems","additionalItems","additionalItem","lastItemWithSameGroup","textShorthandToStyledText","partialContentToInlineContent","partialContent","partialBlocksToBlocksForTesting","partialBlocks","partialBlock","partialBlockToBlockForTesting","withDefaults","propKey","propValue","addIdsToBlock","addIdsToBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,KAAiB;AAAA,EAC5B,YAAY;AAAA,IACV,SAAS;AAAA,MACP,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,KAAK,UAAU,IAAI;AAAA,MAC7B,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,UAAU,YAAY;AAAA,MACtC,OAAO;AAAA,IACT;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,MAAM,UAAU,YAAY;AAAA,MACtC,OAAO;AAAA,IACT;AAAA,IACA,eAAe;AAAA,MACb,OAAO;AAAA,MACP,SAAS;AAAA,MACT,SAAS,CAAC,KAAK,eAAe,SAAS,aAAa;A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