@witchcraft/editor 0.0.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/@types/@tiptap/core/index.d.ts +3 -0
- package/README.md +111 -0
- package/dist/module.d.mts +15 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +68 -0
- package/dist/runtime/assets/base.css +1 -0
- package/dist/runtime/assets/handle-arrow.svg +16 -0
- package/dist/runtime/assets/handle-border-circles-single.svg +44 -0
- package/dist/runtime/assets/handle-border-circles.svg +27 -0
- package/dist/runtime/assets/handle-temp.svg +1 -0
- package/dist/runtime/assets/utils.css +1 -0
- package/dist/runtime/components/CodeBlockThemePicker.d.vue.ts +12 -0
- package/dist/runtime/components/CodeBlockThemePicker.vue +123 -0
- package/dist/runtime/components/CodeBlockThemePicker.vue.d.ts +12 -0
- package/dist/runtime/components/Commands.d.vue.ts +10 -0
- package/dist/runtime/components/Commands.vue +60 -0
- package/dist/runtime/components/Commands.vue.d.ts +10 -0
- package/dist/runtime/components/Editor.d.vue.ts +40 -0
- package/dist/runtime/components/Editor.vue +208 -0
- package/dist/runtime/components/Editor.vue.d.ts +40 -0
- package/dist/runtime/components/EditorDemoApp.d.vue.ts +2 -0
- package/dist/runtime/components/EditorDemoApp.vue +104 -0
- package/dist/runtime/components/EditorDemoApp.vue.d.ts +2 -0
- package/dist/runtime/components/EditorDemoControls.d.vue.ts +12 -0
- package/dist/runtime/components/EditorDemoControls.vue +36 -0
- package/dist/runtime/components/EditorDemoControls.vue.d.ts +12 -0
- package/dist/runtime/components/TestWrapper.d.vue.ts +11 -0
- package/dist/runtime/components/TestWrapper.vue +63 -0
- package/dist/runtime/components/TestWrapper.vue.d.ts +11 -0
- package/dist/runtime/composables/useEditor.d.ts +9 -0
- package/dist/runtime/composables/useEditor.js +17 -0
- package/dist/runtime/composables/useWindowDebugging.d.ts +3 -0
- package/dist/runtime/composables/useWindowDebugging.js +16 -0
- package/dist/runtime/demo/App.d.vue.ts +2 -0
- package/dist/runtime/demo/App.vue +101 -0
- package/dist/runtime/demo/App.vue.d.ts +2 -0
- package/dist/runtime/demo/README.md +1 -0
- package/dist/runtime/demo/main.d.ts +1 -0
- package/dist/runtime/demo/main.js +4 -0
- package/dist/runtime/demo/tailwind.css +1 -0
- package/dist/runtime/env.d.ts +2 -0
- package/dist/runtime/injectionKeys.d.ts +6 -0
- package/dist/runtime/injectionKeys.js +3 -0
- package/dist/runtime/main.lib.d.ts +2 -0
- package/dist/runtime/main.lib.js +2 -0
- package/dist/runtime/pm/commands/backspace.d.ts +12 -0
- package/dist/runtime/pm/commands/backspace.js +26 -0
- package/dist/runtime/pm/commands/changeAttrs.d.ts +9 -0
- package/dist/runtime/pm/commands/changeAttrs.js +15 -0
- package/dist/runtime/pm/commands/deleteSelection.d.ts +9 -0
- package/dist/runtime/pm/commands/deleteSelection.js +8 -0
- package/dist/runtime/pm/commands/enter.d.ts +14 -0
- package/dist/runtime/pm/commands/enter.js +9 -0
- package/dist/runtime/pm/commands/insertBreak.d.ts +9 -0
- package/dist/runtime/pm/commands/insertBreak.js +22 -0
- package/dist/runtime/pm/features/Base/Base.d.ts +4 -0
- package/dist/runtime/pm/features/Base/Base.js +32 -0
- package/dist/runtime/pm/features/Base/commands/deleteNodes.d.ts +10 -0
- package/dist/runtime/pm/features/Base/commands/deleteNodes.js +29 -0
- package/dist/runtime/pm/features/Base/commands/setCursorVisible.d.ts +12 -0
- package/dist/runtime/pm/features/Base/commands/setCursorVisible.js +7 -0
- package/dist/runtime/pm/features/Base/plugins/debugSelectionPlugin.d.ts +9 -0
- package/dist/runtime/pm/features/Base/plugins/debugSelectionPlugin.js +48 -0
- package/dist/runtime/pm/features/Base/plugins/isCursorVisiblePlugin.d.ts +3 -0
- package/dist/runtime/pm/features/Base/plugins/isCursorVisiblePlugin.js +26 -0
- package/dist/runtime/pm/features/Base/plugins/isUsingTouchPlugin.d.ts +3 -0
- package/dist/runtime/pm/features/Base/plugins/isUsingTouchPlugin.js +38 -0
- package/dist/runtime/pm/features/Base/plugins/selectingIndicator.d.ts +5 -0
- package/dist/runtime/pm/features/Base/plugins/selectingIndicator.js +35 -0
- package/dist/runtime/pm/features/Base/plugins/unfocusedSelectionIndicatorPlugin.d.ts +33 -0
- package/dist/runtime/pm/features/Base/plugins/unfocusedSelectionIndicatorPlugin.js +66 -0
- package/dist/runtime/pm/features/Base/types.d.ts +3 -0
- package/dist/runtime/pm/features/Base/types.js +0 -0
- package/dist/runtime/pm/features/BaseShortcuts/BaseShortcuts.d.ts +3 -0
- package/dist/runtime/pm/features/BaseShortcuts/BaseShortcuts.js +34 -0
- package/dist/runtime/pm/features/Blockquote/Blockquote.d.ts +5 -0
- package/dist/runtime/pm/features/Blockquote/Blockquote.js +65 -0
- package/dist/runtime/pm/features/Blockquote/commands/blockquoteEnter.d.ts +11 -0
- package/dist/runtime/pm/features/Blockquote/commands/blockquoteEnter.js +31 -0
- package/dist/runtime/pm/features/Blockquote/commands/blockquoteShiftEnter.d.ts +11 -0
- package/dist/runtime/pm/features/Blockquote/commands/blockquoteShiftEnter.js +12 -0
- package/dist/runtime/pm/features/Blocks/Blocks.d.ts +2 -0
- package/dist/runtime/pm/features/Blocks/Blocks.js +2 -0
- package/dist/runtime/pm/features/Blocks/Item.d.ts +11 -0
- package/dist/runtime/pm/features/Blocks/Item.js +157 -0
- package/dist/runtime/pm/features/Blocks/List.d.ts +4 -0
- package/dist/runtime/pm/features/Blocks/List.js +59 -0
- package/dist/runtime/pm/features/Blocks/commands/changeItemType.d.ts +20 -0
- package/dist/runtime/pm/features/Blocks/commands/changeItemType.js +40 -0
- package/dist/runtime/pm/features/Blocks/commands/changeTypeAttr.d.ts +14 -0
- package/dist/runtime/pm/features/Blocks/commands/changeTypeAttr.js +28 -0
- package/dist/runtime/pm/features/Blocks/commands/copyOrMoveItem.d.ts +23 -0
- package/dist/runtime/pm/features/Blocks/commands/copyOrMoveItem.js +124 -0
- package/dist/runtime/pm/features/Blocks/commands/deleteItem.d.ts +12 -0
- package/dist/runtime/pm/features/Blocks/commands/deleteItem.js +8 -0
- package/dist/runtime/pm/features/Blocks/commands/indentItem.d.ts +12 -0
- package/dist/runtime/pm/features/Blocks/commands/indentItem.js +58 -0
- package/dist/runtime/pm/features/Blocks/commands/itemMenuCommands.d.ts +18 -0
- package/dist/runtime/pm/features/Blocks/commands/itemMenuCommands.js +40 -0
- package/dist/runtime/pm/features/Blocks/commands/moveItem.d.ts +12 -0
- package/dist/runtime/pm/features/Blocks/commands/moveItem.js +80 -0
- package/dist/runtime/pm/features/Blocks/commands/setNode.d.ts +20 -0
- package/dist/runtime/pm/features/Blocks/commands/setNode.js +87 -0
- package/dist/runtime/pm/features/Blocks/commands/splitItem.d.ts +17 -0
- package/dist/runtime/pm/features/Blocks/commands/splitItem.js +87 -0
- package/dist/runtime/pm/features/Blocks/commands/unindentItem.d.ts +12 -0
- package/dist/runtime/pm/features/Blocks/commands/unindentItem.js +42 -0
- package/dist/runtime/pm/features/Blocks/components/DragTreeHandle.d.vue.ts +0 -0
- package/dist/runtime/pm/features/Blocks/components/DragTreeHandle.vue +122 -0
- package/dist/runtime/pm/features/Blocks/components/DragTreeHandle.vue.d.ts +0 -0
- package/dist/runtime/pm/features/Blocks/components/ItemMenu.d.vue.ts +6 -0
- package/dist/runtime/pm/features/Blocks/components/ItemMenu.vue +78 -0
- package/dist/runtime/pm/features/Blocks/components/ItemMenu.vue.d.ts +6 -0
- package/dist/runtime/pm/features/Blocks/components/ItemNodeView.d.vue.ts +92 -0
- package/dist/runtime/pm/features/Blocks/components/ItemNodeView.vue +350 -0
- package/dist/runtime/pm/features/Blocks/components/ItemNodeView.vue.d.ts +92 -0
- package/dist/runtime/pm/features/Blocks/components/defaultItemMenu.d.ts +5 -0
- package/dist/runtime/pm/features/Blocks/components/defaultItemMenu.js +42 -0
- package/dist/runtime/pm/features/Blocks/composables/useDragWithThreshold.d.ts +1 -0
- package/dist/runtime/pm/features/Blocks/composables/useDragWithThreshold.js +0 -0
- package/dist/runtime/pm/features/Blocks/composables/useHandleHeight.d.ts +5 -0
- package/dist/runtime/pm/features/Blocks/composables/useHandleHeight.js +22 -0
- package/dist/runtime/pm/features/Blocks/composables/useHasChildren.d.ts +5 -0
- package/dist/runtime/pm/features/Blocks/composables/useHasChildren.js +10 -0
- package/dist/runtime/pm/features/Blocks/composables/useNodeStates.d.ts +7 -0
- package/dist/runtime/pm/features/Blocks/composables/useNodeStates.js +20 -0
- package/dist/runtime/pm/features/Blocks/itemMenuMenuItems.d.ts +20 -0
- package/dist/runtime/pm/features/Blocks/itemMenuMenuItems.js +138 -0
- package/dist/runtime/pm/features/Blocks/plugins/ensureLastItemIsContentPlugin.d.ts +11 -0
- package/dist/runtime/pm/features/Blocks/plugins/ensureLastItemIsContentPlugin.js +36 -0
- package/dist/runtime/pm/features/Blocks/plugins/itemBlockIdPlugin.d.ts +8 -0
- package/dist/runtime/pm/features/Blocks/plugins/itemBlockIdPlugin.js +30 -0
- package/dist/runtime/pm/features/Blocks/plugins/itemHasSingularSelectionPlugin.d.ts +3 -0
- package/dist/runtime/pm/features/Blocks/plugins/itemHasSingularSelectionPlugin.js +30 -0
- package/dist/runtime/pm/features/Blocks/plugins/itemMenuPlugin.d.ts +4 -0
- package/dist/runtime/pm/features/Blocks/plugins/itemMenuPlugin.js +17 -0
- package/dist/runtime/pm/features/Blocks/states/stateful.d.ts +2 -0
- package/dist/runtime/pm/features/Blocks/states/stateful.js +37 -0
- package/dist/runtime/pm/features/Blocks/states/task/cancelled.svg +32 -0
- package/dist/runtime/pm/features/Blocks/states/task/checked.svg +27 -0
- package/dist/runtime/pm/features/Blocks/states/task/checked2.svg +24 -0
- package/dist/runtime/pm/features/Blocks/states/task/partial.svg +24 -0
- package/dist/runtime/pm/features/Blocks/states/task/partial2.svg +31 -0
- package/dist/runtime/pm/features/Blocks/states/task/unchecked.svg +20 -0
- package/dist/runtime/pm/features/Blocks/types.d.ts +43 -0
- package/dist/runtime/pm/features/Blocks/types.js +2 -0
- package/dist/runtime/pm/features/Blocks/utils/createItemMenuCommandExecuter.d.ts +3 -0
- package/dist/runtime/pm/features/Blocks/utils/createItemMenuCommandExecuter.js +24 -0
- package/dist/runtime/pm/features/Blocks/utils/fixBlockIds.d.ts +4 -0
- package/dist/runtime/pm/features/Blocks/utils/fixBlockIds.js +23 -0
- package/dist/runtime/pm/features/Blocks/utils/isValidId.d.ts +2 -0
- package/dist/runtime/pm/features/Blocks/utils/isValidId.js +7 -0
- package/dist/runtime/pm/features/CodeBlock/CodeBlock.d.ts +16 -0
- package/dist/runtime/pm/features/CodeBlock/CodeBlock.js +91 -0
- package/dist/runtime/pm/features/CodeBlock/build/generateHighlightJsInfo.d.ts +1 -0
- package/dist/runtime/pm/features/CodeBlock/build/generateHighlightJsInfo.js +63 -0
- package/dist/runtime/pm/features/CodeBlock/commands/codeBlockEnterOrSplit.d.ts +9 -0
- package/dist/runtime/pm/features/CodeBlock/commands/codeBlockEnterOrSplit.js +28 -0
- package/dist/runtime/pm/features/CodeBlock/commands/codeBlockIndent.d.ts +9 -0
- package/dist/runtime/pm/features/CodeBlock/commands/codeBlockIndent.js +39 -0
- package/dist/runtime/pm/features/CodeBlock/commands/codeBlockUnindent.d.ts +9 -0
- package/dist/runtime/pm/features/CodeBlock/commands/codeBlockUnindent.js +50 -0
- package/dist/runtime/pm/features/CodeBlock/commands/focusCodeBlockLanguage.d.ts +9 -0
- package/dist/runtime/pm/features/CodeBlock/commands/focusCodeBlockLanguage.js +27 -0
- package/dist/runtime/pm/features/CodeBlock/components/CodeBlockView.d.vue.ts +92 -0
- package/dist/runtime/pm/features/CodeBlock/components/CodeBlockView.vue +112 -0
- package/dist/runtime/pm/features/CodeBlock/components/CodeBlockView.vue.d.ts +92 -0
- package/dist/runtime/pm/features/CodeBlock/composables/useAsyncCodeBlockHighlighting.d.ts +28 -0
- package/dist/runtime/pm/features/CodeBlock/composables/useAsyncCodeBlockHighlighting.js +137 -0
- package/dist/runtime/pm/features/CodeBlock/composables/useHighlightJsTheme.d.ts +37 -0
- package/dist/runtime/pm/features/CodeBlock/composables/useHighlightJsTheme.js +101 -0
- package/dist/runtime/pm/features/CodeBlock/highlightJsInfo.d.ts +17 -0
- package/dist/runtime/pm/features/CodeBlock/highlightJsInfo.js +711 -0
- package/dist/runtime/pm/features/CodeBlock/types.d.ts +4 -0
- package/dist/runtime/pm/features/CodeBlock/types.js +2 -0
- package/dist/runtime/pm/features/Collaboration/Collaboration.d.ts +66 -0
- package/dist/runtime/pm/features/Collaboration/Collaboration.js +169 -0
- package/dist/runtime/pm/features/CommandsMenus/CommandBar.d.ts +19 -0
- package/dist/runtime/pm/features/CommandsMenus/CommandBar.js +97 -0
- package/dist/runtime/pm/features/CommandsMenus/commandBarMenuItems.d.ts +20 -0
- package/dist/runtime/pm/features/CommandsMenus/commandBarMenuItems.js +188 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandBar.d.vue.ts +8 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandBar.vue +58 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandBar.vue.d.ts +8 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandBarItem.d.vue.ts +12 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandBarItem.vue +42 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandBarItem.vue.d.ts +12 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuGroup.d.vue.ts +10 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuGroup.vue +55 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuGroup.vue.d.ts +10 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuItem.d.vue.ts +11 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuItem.vue +58 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuItem.vue.d.ts +11 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuList.d.vue.ts +11 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuList.vue +54 -0
- package/dist/runtime/pm/features/CommandsMenus/components/CommandMenuList.vue.d.ts +11 -0
- package/dist/runtime/pm/features/CommandsMenus/components/TextIcon.d.vue.ts +5 -0
- package/dist/runtime/pm/features/CommandsMenus/components/TextIcon.vue +13 -0
- package/dist/runtime/pm/features/CommandsMenus/components/TextIcon.vue.d.ts +5 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/HighlightIcon.d.vue.ts +8 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/HighlightIcon.vue +45 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/HighlightIcon.vue.d.ts +8 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/SubscriptIcon.d.vue.ts +2 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/SubscriptIcon.vue +5 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/SubscriptIcon.vue.d.ts +2 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/SuperscriptIcon.d.vue.ts +2 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/SuperscriptIcon.vue +5 -0
- package/dist/runtime/pm/features/CommandsMenus/icons/SuperscriptIcon.vue.d.ts +2 -0
- package/dist/runtime/pm/features/CommandsMenus/types.d.ts +61 -0
- package/dist/runtime/pm/features/CommandsMenus/types.js +5 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/defaultCommandExecutor.d.ts +3 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/defaultCommandExecutor.js +11 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/findCommand.d.ts +10 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/findCommand.js +16 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/popupPositionModifier.d.ts +5 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/popupPositionModifier.js +9 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/popupVerticalPositioner.d.ts +5 -0
- package/dist/runtime/pm/features/CommandsMenus/utils/popupVerticalPositioner.js +11 -0
- package/dist/runtime/pm/features/Document/Document.d.ts +3 -0
- package/dist/runtime/pm/features/Document/Document.js +6 -0
- package/dist/runtime/pm/features/DocumentApi/DocumentApi.d.ts +85 -0
- package/dist/runtime/pm/features/DocumentApi/DocumentApi.js +161 -0
- package/dist/runtime/pm/features/DocumentApi/composables/useEditorContent.d.ts +13 -0
- package/dist/runtime/pm/features/DocumentApi/composables/useEditorContent.js +76 -0
- package/dist/runtime/pm/features/DocumentApi/composables/useTestDocumentApi.d.ts +23 -0
- package/dist/runtime/pm/features/DocumentApi/composables/useTestDocumentApi.js +70 -0
- package/dist/runtime/pm/features/DocumentApi/types.d.ts +133 -0
- package/dist/runtime/pm/features/DocumentApi/types.js +1 -0
- package/dist/runtime/pm/features/DocumentApi/utils/convertFullTransactionForPartialState.d.ts +3 -0
- package/dist/runtime/pm/features/DocumentApi/utils/convertFullTransactionForPartialState.js +37 -0
- package/dist/runtime/pm/features/DocumentApi/utils/convertTrForInstance.d.ts +4 -0
- package/dist/runtime/pm/features/DocumentApi/utils/convertTrForInstance.js +13 -0
- package/dist/runtime/pm/features/DocumentApi/utils/convertTransactionForFullState.d.ts +2 -0
- package/dist/runtime/pm/features/DocumentApi/utils/convertTransactionForFullState.js +22 -0
- package/dist/runtime/pm/features/DocumentApi/utils/copyMeta.d.ts +2 -0
- package/dist/runtime/pm/features/DocumentApi/utils/copyMeta.js +6 -0
- package/dist/runtime/pm/features/DocumentApi/utils/getEmbedJson.d.ts +1 -0
- package/dist/runtime/pm/features/DocumentApi/utils/getEmbedJson.js +14 -0
- package/dist/runtime/pm/features/DocumentApi/utils/getEmbedNodeFromDoc.d.ts +1 -0
- package/dist/runtime/pm/features/DocumentApi/utils/getEmbedNodeFromDoc.js +14 -0
- package/dist/runtime/pm/features/DocumentApi/utils/getStateEmbedRange.d.ts +9 -0
- package/dist/runtime/pm/features/DocumentApi/utils/getStateEmbedRange.js +19 -0
- package/dist/runtime/pm/features/DocumentApi/utils/isEmbedId.d.ts +2 -0
- package/dist/runtime/pm/features/DocumentApi/utils/isEmbedId.js +3 -0
- package/dist/runtime/pm/features/EmbeddedDocument/Embedded.d.ts +24 -0
- package/dist/runtime/pm/features/EmbeddedDocument/Embedded.js +73 -0
- package/dist/runtime/pm/features/EmbeddedDocument/EmbeddedDocument.d.ts +23 -0
- package/dist/runtime/pm/features/EmbeddedDocument/EmbeddedDocument.js +70 -0
- package/dist/runtime/pm/features/EmbeddedDocument/components/EmbeddedDocumentPicker.d.vue.ts +14 -0
- package/dist/runtime/pm/features/EmbeddedDocument/components/EmbeddedDocumentPicker.vue +171 -0
- package/dist/runtime/pm/features/EmbeddedDocument/components/EmbeddedDocumentPicker.vue.d.ts +14 -0
- package/dist/runtime/pm/features/EmbeddedDocument/components/EmbeddedNodeView.d.vue.ts +92 -0
- package/dist/runtime/pm/features/EmbeddedDocument/components/EmbeddedNodeView.vue +172 -0
- package/dist/runtime/pm/features/EmbeddedDocument/components/EmbeddedNodeView.vue.d.ts +92 -0
- package/dist/runtime/pm/features/EmbeddedDocument/composables/useEmbeddedEditor.d.ts +31 -0
- package/dist/runtime/pm/features/EmbeddedDocument/composables/useEmbeddedEditor.js +199 -0
- package/dist/runtime/pm/features/EmbeddedDocument/types.d.ts +49 -0
- package/dist/runtime/pm/features/EmbeddedDocument/types.js +6 -0
- package/dist/runtime/pm/features/EmbeddedDocument/utils/isEmbeddedBlock.d.ts +9 -0
- package/dist/runtime/pm/features/EmbeddedDocument/utils/isEmbeddedBlock.js +3 -0
- package/dist/runtime/pm/features/EmbeddedDocument/utils/redirectFromEmbedded.d.ts +28 -0
- package/dist/runtime/pm/features/EmbeddedDocument/utils/redirectFromEmbedded.js +17 -0
- package/dist/runtime/pm/features/FileLoader/FileLoader.d.ts +16 -0
- package/dist/runtime/pm/features/FileLoader/FileLoader.js +99 -0
- package/dist/runtime/pm/features/FileLoader/FileLoaderHandler/FileLoaderHandler.d.ts +28 -0
- package/dist/runtime/pm/features/FileLoader/FileLoaderHandler/FileLoaderHandler.js +69 -0
- package/dist/runtime/pm/features/FileLoader/FileLoaderHandler/TestFileLoaderHandler.d.ts +11 -0
- package/dist/runtime/pm/features/FileLoader/FileLoaderHandler/TestFileLoaderHandler.js +49 -0
- package/dist/runtime/pm/features/FileLoader/commands/insertFile.d.ts +17 -0
- package/dist/runtime/pm/features/FileLoader/commands/insertFile.js +39 -0
- package/dist/runtime/pm/features/FileLoader/components/FileLoaderNodeView.d.vue.ts +92 -0
- package/dist/runtime/pm/features/FileLoader/components/FileLoaderNodeView.vue +38 -0
- package/dist/runtime/pm/features/FileLoader/components/FileLoaderNodeView.vue.d.ts +92 -0
- package/dist/runtime/pm/features/FileLoader/plugins/fileLoaderPlugin.d.ts +5 -0
- package/dist/runtime/pm/features/FileLoader/plugins/fileLoaderPlugin.js +61 -0
- package/dist/runtime/pm/features/FileLoader/types.d.ts +73 -0
- package/dist/runtime/pm/features/FileLoader/types.js +0 -0
- package/dist/runtime/pm/features/FileLoader/utils/cleanupFileLoaderNode.d.ts +4 -0
- package/dist/runtime/pm/features/FileLoader/utils/cleanupFileLoaderNode.js +27 -0
- package/dist/runtime/pm/features/FileLoader/utils/cleanupFileLoaderNodes.d.ts +9 -0
- package/dist/runtime/pm/features/FileLoader/utils/cleanupFileLoaderNodes.js +22 -0
- package/dist/runtime/pm/features/FileLoader/utils/findLoadingNodePos.d.ts +2 -0
- package/dist/runtime/pm/features/FileLoader/utils/findLoadingNodePos.js +11 -0
- package/dist/runtime/pm/features/FileLoader/utils/optionsCheck.d.ts +3 -0
- package/dist/runtime/pm/features/FileLoader/utils/optionsCheck.js +8 -0
- package/dist/runtime/pm/features/FileLoader/utils/readAsDataUrl.d.ts +1 -0
- package/dist/runtime/pm/features/FileLoader/utils/readAsDataUrl.js +12 -0
- package/dist/runtime/pm/features/HardBreak/HardBreak.d.ts +5 -0
- package/dist/runtime/pm/features/HardBreak/HardBreak.js +14 -0
- package/dist/runtime/pm/features/Heading/Heading.d.ts +24 -0
- package/dist/runtime/pm/features/Heading/Heading.js +85 -0
- package/dist/runtime/pm/features/Heading/commands/changeLevelAttr.d.ts +16 -0
- package/dist/runtime/pm/features/Heading/commands/changeLevelAttr.js +33 -0
- package/dist/runtime/pm/features/Heading/types.d.ts +14 -0
- package/dist/runtime/pm/features/Heading/types.js +0 -0
- package/dist/runtime/pm/features/Highlight/Highlight.d.ts +72 -0
- package/dist/runtime/pm/features/Highlight/Highlight.js +163 -0
- package/dist/runtime/pm/features/Highlight/retyped/tiptapHighlight.d.ts +3 -0
- package/dist/runtime/pm/features/Highlight/retyped/tiptapHighlight.js +5 -0
- package/dist/runtime/pm/features/Highlight/types.d.ts +27 -0
- package/dist/runtime/pm/features/Highlight/types.js +2 -0
- package/dist/runtime/pm/features/History/History.d.ts +35 -0
- package/dist/runtime/pm/features/History/History.js +63 -0
- package/dist/runtime/pm/features/Iframe/Iframe.d.ts +21 -0
- package/dist/runtime/pm/features/Iframe/Iframe.js +127 -0
- package/dist/runtime/pm/features/Iframe/IframeParsers.d.ts +37 -0
- package/dist/runtime/pm/features/Iframe/IframeParsers.js +88 -0
- package/dist/runtime/pm/features/Iframe/components/IframeNodeView.d.vue.ts +92 -0
- package/dist/runtime/pm/features/Iframe/components/IframeNodeView.vue +82 -0
- package/dist/runtime/pm/features/Iframe/components/IframeNodeView.vue.d.ts +92 -0
- package/dist/runtime/pm/features/Iframe/types.d.ts +5 -0
- package/dist/runtime/pm/features/Iframe/types.js +0 -0
- package/dist/runtime/pm/features/Image/Image.d.ts +2 -0
- package/dist/runtime/pm/features/Image/Image.js +13 -0
- package/dist/runtime/pm/features/Link/Link.d.ts +38 -0
- package/dist/runtime/pm/features/Link/Link.js +241 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuExternalLink.d.vue.ts +28 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuExternalLink.vue +114 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuExternalLink.vue.d.ts +28 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuInternalLink.d.vue.ts +29 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuInternalLink.vue +107 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuInternalLink.vue.d.ts +29 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuLink.d.vue.ts +11 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuLink.vue +126 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuLink.vue.d.ts +11 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuLinkActions.d.vue.ts +18 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuLinkActions.vue +57 -0
- package/dist/runtime/pm/features/Link/components/BubbleMenuLinkActions.vue.d.ts +18 -0
- package/dist/runtime/pm/features/Link/types.d.ts +44 -0
- package/dist/runtime/pm/features/Link/types.js +3 -0
- package/dist/runtime/pm/features/Menus/Menus.d.ts +45 -0
- package/dist/runtime/pm/features/Menus/Menus.js +142 -0
- package/dist/runtime/pm/features/Menus/components/MarkMenuManager.d.vue.ts +6 -0
- package/dist/runtime/pm/features/Menus/components/MarkMenuManager.vue +166 -0
- package/dist/runtime/pm/features/Menus/components/MarkMenuManager.vue.d.ts +6 -0
- package/dist/runtime/pm/features/Menus/types.d.ts +51 -0
- package/dist/runtime/pm/features/Menus/types.js +3 -0
- package/dist/runtime/pm/features/Menus/utils/isMarkMenu.d.ts +2 -0
- package/dist/runtime/pm/features/Menus/utils/isMarkMenu.js +3 -0
- package/dist/runtime/pm/features/Tables/commands/tableEnter.d.ts +15 -0
- package/dist/runtime/pm/features/Tables/commands/tableEnter.js +19 -0
- package/dist/runtime/pm/features/Tables/index.d.ts +9 -0
- package/dist/runtime/pm/features/Tables/index.js +44 -0
- package/dist/runtime/pm/schema.d.ts +4 -0
- package/dist/runtime/pm/schema.js +80 -0
- package/dist/runtime/pm/testSchema.d.ts +5 -0
- package/dist/runtime/pm/testSchema.js +30 -0
- package/dist/runtime/pm/utils/createDropIndicator.d.ts +23 -0
- package/dist/runtime/pm/utils/createDropIndicator.js +32 -0
- package/dist/runtime/pm/utils/createStateOnlyPluginApply.d.ts +2 -0
- package/dist/runtime/pm/utils/createStateOnlyPluginApply.js +9 -0
- package/dist/runtime/pm/utils/createStateOnlyPluginObjApply.d.ts +2 -0
- package/dist/runtime/pm/utils/createStateOnlyPluginObjApply.js +14 -0
- package/dist/runtime/pm/utils/dropPointInfo.d.ts +56 -0
- package/dist/runtime/pm/utils/dropPointInfo.js +28 -0
- package/dist/runtime/pm/utils/findUpwards.d.ts +20 -0
- package/dist/runtime/pm/utils/findUpwards.js +18 -0
- package/dist/runtime/pm/utils/getChildChunks.d.ts +3 -0
- package/dist/runtime/pm/utils/getChildChunks.js +15 -0
- package/dist/runtime/pm/utils/getDiffReplacementRange.d.ts +20 -0
- package/dist/runtime/pm/utils/getDiffReplacementRange.js +9 -0
- package/dist/runtime/pm/utils/getElMaxVisualSize.d.ts +9 -0
- package/dist/runtime/pm/utils/getElMaxVisualSize.js +7 -0
- package/dist/runtime/pm/utils/getElPropertyAsInt.d.ts +1 -0
- package/dist/runtime/pm/utils/getElPropertyAsInt.js +8 -0
- package/dist/runtime/pm/utils/getGroupNodeNames.d.ts +2 -0
- package/dist/runtime/pm/utils/getGroupNodeNames.js +7 -0
- package/dist/runtime/pm/utils/getMarkPosition.d.ts +11 -0
- package/dist/runtime/pm/utils/getMarkPosition.js +34 -0
- package/dist/runtime/pm/utils/getMarksInSelection.d.ts +3 -0
- package/dist/runtime/pm/utils/getMarksInSelection.js +16 -0
- package/dist/runtime/pm/utils/getTypeByName.d.ts +2 -0
- package/dist/runtime/pm/utils/getTypeByName.js +5 -0
- package/dist/runtime/pm/utils/index.d.ts +15 -0
- package/dist/runtime/pm/utils/index.js +15 -0
- package/dist/runtime/pm/utils/internal/createNodeTypesList.d.ts +2 -0
- package/dist/runtime/pm/utils/internal/createNodeTypesList.js +17 -0
- package/dist/runtime/pm/utils/internal/debugMap.d.ts +7 -0
- package/dist/runtime/pm/utils/internal/debugMap.js +24 -0
- package/dist/runtime/pm/utils/internal/debugNode.d.ts +2 -0
- package/dist/runtime/pm/utils/internal/debugNode.js +18 -0
- package/dist/runtime/pm/utils/internal/debugSel.d.ts +5 -0
- package/dist/runtime/pm/utils/internal/debugSel.js +8 -0
- package/dist/runtime/pm/utils/internal/recurse.d.ts +2 -0
- package/dist/runtime/pm/utils/internal/recurse.js +39 -0
- package/dist/runtime/pm/utils/internal/stripBlockId.d.ts +2 -0
- package/dist/runtime/pm/utils/internal/stripBlockId.js +9 -0
- package/dist/runtime/pm/utils/mapSelection.d.ts +8 -0
- package/dist/runtime/pm/utils/mapSelection.js +12 -0
- package/dist/runtime/pm/utils/nodesBetween.d.ts +21 -0
- package/dist/runtime/pm/utils/nodesBetween.js +21 -0
- package/dist/runtime/pm/utils/pointToPmPoint.d.ts +2 -0
- package/dist/runtime/pm/utils/pointToPmPoint.js +3 -0
- package/dist/runtime/pm/utils/splitIntoChunks.d.ts +32 -0
- package/dist/runtime/pm/utils/splitIntoChunks.js +31 -0
- package/dist/runtime/testDocuments.d.ts +53 -0
- package/dist/runtime/testDocuments.js +122 -0
- package/dist/runtime/types/index.d.ts +53 -0
- package/dist/runtime/types/index.js +9 -0
- package/dist/types.d.mts +3 -0
- package/package.json +238 -0
- package/src/module.ts +101 -0
- package/src/runtime/assets/base.css +83 -0
- package/src/runtime/assets/handle-arrow.svg +16 -0
- package/src/runtime/assets/handle-border-circles-single.svg +44 -0
- package/src/runtime/assets/handle-border-circles.svg +27 -0
- package/src/runtime/assets/handle-temp.svg +1 -0
- package/src/runtime/assets/utils.css +9 -0
- package/src/runtime/components/CodeBlockThemePicker.vue +125 -0
- package/src/runtime/components/Commands.vue +67 -0
- package/src/runtime/components/Editor.vue +330 -0
- package/src/runtime/components/EditorDemoApp.vue +118 -0
- package/src/runtime/components/EditorDemoControls.vue +38 -0
- package/src/runtime/components/TestWrapper.vue +74 -0
- package/src/runtime/composables/useEditor.ts +29 -0
- package/src/runtime/composables/useWindowDebugging.ts +20 -0
- package/src/runtime/demo/App.vue +114 -0
- package/src/runtime/demo/README.md +1 -0
- package/src/runtime/demo/main.ts +8 -0
- package/src/runtime/demo/tailwind.css +4 -0
- package/src/runtime/env.d.ts +2 -0
- package/src/runtime/injectionKeys.ts +10 -0
- package/src/runtime/main.lib.ts +2 -0
- package/src/runtime/pm/commands/backspace.ts +44 -0
- package/src/runtime/pm/commands/changeAttrs.ts +37 -0
- package/src/runtime/pm/commands/deleteSelection.ts +22 -0
- package/src/runtime/pm/commands/enter.ts +27 -0
- package/src/runtime/pm/commands/insertBreak.ts +40 -0
- package/src/runtime/pm/features/Base/Base.ts +39 -0
- package/src/runtime/pm/features/Base/commands/deleteNodes.ts +54 -0
- package/src/runtime/pm/features/Base/commands/setCursorVisible.ts +24 -0
- package/src/runtime/pm/features/Base/plugins/debugSelectionPlugin.ts +57 -0
- package/src/runtime/pm/features/Base/plugins/isCursorVisiblePlugin.ts +28 -0
- package/src/runtime/pm/features/Base/plugins/isUsingTouchPlugin.ts +40 -0
- package/src/runtime/pm/features/Base/plugins/selectingIndicator.ts +38 -0
- package/src/runtime/pm/features/Base/plugins/unfocusedSelectionIndicatorPlugin.ts +107 -0
- package/src/runtime/pm/features/Base/types.ts +3 -0
- package/src/runtime/pm/features/BaseShortcuts/BaseShortcuts.ts +39 -0
- package/src/runtime/pm/features/Blockquote/Blockquote.ts +75 -0
- package/src/runtime/pm/features/Blockquote/commands/blockquoteEnter.ts +51 -0
- package/src/runtime/pm/features/Blockquote/commands/blockquoteShiftEnter.ts +26 -0
- package/src/runtime/pm/features/Blocks/Blocks.ts +3 -0
- package/src/runtime/pm/features/Blocks/Item.ts +176 -0
- package/src/runtime/pm/features/Blocks/List.ts +67 -0
- package/src/runtime/pm/features/Blocks/commands/changeItemType.ts +64 -0
- package/src/runtime/pm/features/Blocks/commands/changeTypeAttr.ts +47 -0
- package/src/runtime/pm/features/Blocks/commands/copyOrMoveItem.ts +179 -0
- package/src/runtime/pm/features/Blocks/commands/deleteItem.ts +24 -0
- package/src/runtime/pm/features/Blocks/commands/indentItem.ts +105 -0
- package/src/runtime/pm/features/Blocks/commands/itemMenuCommands.ts +62 -0
- package/src/runtime/pm/features/Blocks/commands/moveItem.ts +128 -0
- package/src/runtime/pm/features/Blocks/commands/setNode.ts +186 -0
- package/src/runtime/pm/features/Blocks/commands/splitItem.ts +116 -0
- package/src/runtime/pm/features/Blocks/commands/unindentItem.ts +82 -0
- package/src/runtime/pm/features/Blocks/components/DragTreeHandle.vue +142 -0
- package/src/runtime/pm/features/Blocks/components/ItemMenu.vue +88 -0
- package/src/runtime/pm/features/Blocks/components/ItemNodeView.vue +394 -0
- package/src/runtime/pm/features/Blocks/components/defaultItemMenu.ts +45 -0
- package/src/runtime/pm/features/Blocks/composables/useDragWithThreshold.ts +0 -0
- package/src/runtime/pm/features/Blocks/composables/useHandleHeight.ts +28 -0
- package/src/runtime/pm/features/Blocks/composables/useHasChildren.ts +14 -0
- package/src/runtime/pm/features/Blocks/composables/useNodeStates.ts +29 -0
- package/src/runtime/pm/features/Blocks/itemMenuMenuItems.ts +143 -0
- package/src/runtime/pm/features/Blocks/plugins/ensureLastItemIsContentPlugin.ts +52 -0
- package/src/runtime/pm/features/Blocks/plugins/itemBlockIdPlugin.ts +40 -0
- package/src/runtime/pm/features/Blocks/plugins/itemHasSingularSelectionPlugin.ts +32 -0
- package/src/runtime/pm/features/Blocks/plugins/itemMenuPlugin.ts +21 -0
- package/src/runtime/pm/features/Blocks/states/stateful.ts +41 -0
- package/src/runtime/pm/features/Blocks/states/task/cancelled.svg +32 -0
- package/src/runtime/pm/features/Blocks/states/task/checked.svg +27 -0
- package/src/runtime/pm/features/Blocks/states/task/checked2.svg +24 -0
- package/src/runtime/pm/features/Blocks/states/task/partial.svg +24 -0
- package/src/runtime/pm/features/Blocks/states/task/partial2.svg +31 -0
- package/src/runtime/pm/features/Blocks/states/task/unchecked.svg +20 -0
- package/src/runtime/pm/features/Blocks/types.ts +51 -0
- package/src/runtime/pm/features/Blocks/utils/createItemMenuCommandExecuter.ts +47 -0
- package/src/runtime/pm/features/Blocks/utils/fixBlockIds.ts +28 -0
- package/src/runtime/pm/features/Blocks/utils/isValidId.ts +8 -0
- package/src/runtime/pm/features/CodeBlock/CodeBlock.ts +104 -0
- package/src/runtime/pm/features/CodeBlock/build/generateHighlightJsInfo.js +63 -0
- package/src/runtime/pm/features/CodeBlock/commands/codeBlockEnterOrSplit.ts +55 -0
- package/src/runtime/pm/features/CodeBlock/commands/codeBlockIndent.ts +67 -0
- package/src/runtime/pm/features/CodeBlock/commands/codeBlockUnindent.ts +74 -0
- package/src/runtime/pm/features/CodeBlock/commands/focusCodeBlockLanguage.ts +44 -0
- package/src/runtime/pm/features/CodeBlock/components/CodeBlockView.vue +126 -0
- package/src/runtime/pm/features/CodeBlock/composables/useAsyncCodeBlockHighlighting.ts +185 -0
- package/src/runtime/pm/features/CodeBlock/composables/useHighlightJsTheme.ts +150 -0
- package/src/runtime/pm/features/CodeBlock/highlightJsInfo.ts +733 -0
- package/src/runtime/pm/features/CodeBlock/types.ts +7 -0
- package/src/runtime/pm/features/Collaboration/Collaboration.ts +295 -0
- package/src/runtime/pm/features/CommandsMenus/CommandBar.ts +130 -0
- package/src/runtime/pm/features/CommandsMenus/commandBarMenuItems.ts +209 -0
- package/src/runtime/pm/features/CommandsMenus/components/CommandBar.vue +63 -0
- package/src/runtime/pm/features/CommandsMenus/components/CommandBarItem.vue +48 -0
- package/src/runtime/pm/features/CommandsMenus/components/CommandMenuGroup.vue +59 -0
- package/src/runtime/pm/features/CommandsMenus/components/CommandMenuItem.vue +67 -0
- package/src/runtime/pm/features/CommandsMenus/components/CommandMenuList.vue +60 -0
- package/src/runtime/pm/features/CommandsMenus/components/TextIcon.vue +14 -0
- package/src/runtime/pm/features/CommandsMenus/icons/HighlightIcon.vue +51 -0
- package/src/runtime/pm/features/CommandsMenus/icons/SubscriptIcon.vue +5 -0
- package/src/runtime/pm/features/CommandsMenus/icons/SuperscriptIcon.vue +5 -0
- package/src/runtime/pm/features/CommandsMenus/types.ts +73 -0
- package/src/runtime/pm/features/CommandsMenus/utils/defaultCommandExecutor.ts +22 -0
- package/src/runtime/pm/features/CommandsMenus/utils/findCommand.ts +37 -0
- package/src/runtime/pm/features/CommandsMenus/utils/popupPositionModifier.ts +14 -0
- package/src/runtime/pm/features/CommandsMenus/utils/popupVerticalPositioner.ts +16 -0
- package/src/runtime/pm/features/Document/Document.ts +9 -0
- package/src/runtime/pm/features/DocumentApi/DocumentApi.ts +272 -0
- package/src/runtime/pm/features/DocumentApi/composables/useEditorContent.ts +105 -0
- package/src/runtime/pm/features/DocumentApi/composables/useTestDocumentApi.ts +95 -0
- package/src/runtime/pm/features/DocumentApi/types.ts +143 -0
- package/src/runtime/pm/features/DocumentApi/utils/convertFullTransactionForPartialState.ts +54 -0
- package/src/runtime/pm/features/DocumentApi/utils/convertTrForInstance.ts +24 -0
- package/src/runtime/pm/features/DocumentApi/utils/convertTransactionForFullState.ts +39 -0
- package/src/runtime/pm/features/DocumentApi/utils/copyMeta.ts +8 -0
- package/src/runtime/pm/features/DocumentApi/utils/getEmbedJson.ts +16 -0
- package/src/runtime/pm/features/DocumentApi/utils/getEmbedNodeFromDoc.ts +15 -0
- package/src/runtime/pm/features/DocumentApi/utils/getStateEmbedRange.ts +26 -0
- package/src/runtime/pm/features/DocumentApi/utils/isEmbedId.ts +5 -0
- package/src/runtime/pm/features/EmbeddedDocument/Embedded.ts +110 -0
- package/src/runtime/pm/features/EmbeddedDocument/EmbeddedDocument.ts +102 -0
- package/src/runtime/pm/features/EmbeddedDocument/components/EmbeddedDocumentPicker.vue +188 -0
- package/src/runtime/pm/features/EmbeddedDocument/components/EmbeddedNodeView.vue +187 -0
- package/src/runtime/pm/features/EmbeddedDocument/composables/useEmbeddedEditor.ts +302 -0
- package/src/runtime/pm/features/EmbeddedDocument/types.ts +61 -0
- package/src/runtime/pm/features/EmbeddedDocument/utils/isEmbeddedBlock.ts +12 -0
- package/src/runtime/pm/features/EmbeddedDocument/utils/redirectFromEmbedded.ts +48 -0
- package/src/runtime/pm/features/FileLoader/FileLoader.ts +120 -0
- package/src/runtime/pm/features/FileLoader/FileLoaderHandler/FileLoaderHandler.ts +100 -0
- package/src/runtime/pm/features/FileLoader/FileLoaderHandler/TestFileLoaderHandler.ts +61 -0
- package/src/runtime/pm/features/FileLoader/commands/insertFile.ts +87 -0
- package/src/runtime/pm/features/FileLoader/components/FileLoaderNodeView.vue +38 -0
- package/src/runtime/pm/features/FileLoader/plugins/fileLoaderPlugin.ts +70 -0
- package/src/runtime/pm/features/FileLoader/types.ts +91 -0
- package/src/runtime/pm/features/FileLoader/utils/cleanupFileLoaderNode.ts +39 -0
- package/src/runtime/pm/features/FileLoader/utils/cleanupFileLoaderNodes.ts +42 -0
- package/src/runtime/pm/features/FileLoader/utils/findLoadingNodePos.ts +16 -0
- package/src/runtime/pm/features/FileLoader/utils/optionsCheck.ts +16 -0
- package/src/runtime/pm/features/FileLoader/utils/readAsDataUrl.ts +12 -0
- package/src/runtime/pm/features/HardBreak/HardBreak.ts +21 -0
- package/src/runtime/pm/features/Heading/Heading.ts +130 -0
- package/src/runtime/pm/features/Heading/commands/changeLevelAttr.ts +55 -0
- package/src/runtime/pm/features/Heading/types.ts +17 -0
- package/src/runtime/pm/features/Highlight/Highlight.ts +234 -0
- package/src/runtime/pm/features/Highlight/retyped/tiptapHighlight.d.ts +3 -0
- package/src/runtime/pm/features/Highlight/retyped/tiptapHighlight.js +5 -0
- package/src/runtime/pm/features/Highlight/types.ts +25 -0
- package/src/runtime/pm/features/History/History.ts +112 -0
- package/src/runtime/pm/features/Iframe/Iframe.ts +163 -0
- package/src/runtime/pm/features/Iframe/IframeParsers.ts +116 -0
- package/src/runtime/pm/features/Iframe/components/IframeNodeView.vue +83 -0
- package/src/runtime/pm/features/Iframe/types.ts +7 -0
- package/src/runtime/pm/features/Image/Image.ts +16 -0
- package/src/runtime/pm/features/Link/Link.ts +313 -0
- package/src/runtime/pm/features/Link/components/BubbleMenuExternalLink.vue +125 -0
- package/src/runtime/pm/features/Link/components/BubbleMenuInternalLink.vue +130 -0
- package/src/runtime/pm/features/Link/components/BubbleMenuLink.vue +149 -0
- package/src/runtime/pm/features/Link/components/BubbleMenuLinkActions.vue +65 -0
- package/src/runtime/pm/features/Link/types.ts +53 -0
- package/src/runtime/pm/features/Menus/Menus.ts +195 -0
- package/src/runtime/pm/features/Menus/components/MarkMenuManager.vue +203 -0
- package/src/runtime/pm/features/Menus/types.ts +64 -0
- package/src/runtime/pm/features/Menus/utils/isMarkMenu.ts +5 -0
- package/src/runtime/pm/features/Tables/commands/tableEnter.ts +40 -0
- package/src/runtime/pm/features/Tables/index.ts +60 -0
- package/src/runtime/pm/schema.ts +128 -0
- package/src/runtime/pm/testSchema.ts +34 -0
- package/src/runtime/pm/utils/createDropIndicator.ts +61 -0
- package/src/runtime/pm/utils/createStateOnlyPluginApply.ts +11 -0
- package/src/runtime/pm/utils/createStateOnlyPluginObjApply.ts +16 -0
- package/src/runtime/pm/utils/dropPointInfo.ts +85 -0
- package/src/runtime/pm/utils/findUpwards.ts +43 -0
- package/src/runtime/pm/utils/getChildChunks.ts +24 -0
- package/src/runtime/pm/utils/getDiffReplacementRange.ts +32 -0
- package/src/runtime/pm/utils/getElMaxVisualSize.ts +14 -0
- package/src/runtime/pm/utils/getElPropertyAsInt.ts +8 -0
- package/src/runtime/pm/utils/getGroupNodeNames.ts +9 -0
- package/src/runtime/pm/utils/getMarkPosition.ts +57 -0
- package/src/runtime/pm/utils/getMarksInSelection.ts +19 -0
- package/src/runtime/pm/utils/getTypeByName.ts +7 -0
- package/src/runtime/pm/utils/index.ts +17 -0
- package/src/runtime/pm/utils/internal/createNodeTypesList.ts +25 -0
- package/src/runtime/pm/utils/internal/debugMap.ts +36 -0
- package/src/runtime/pm/utils/internal/debugNode.ts +38 -0
- package/src/runtime/pm/utils/internal/debugSel.ts +10 -0
- package/src/runtime/pm/utils/internal/recurse.ts +44 -0
- package/src/runtime/pm/utils/internal/stripBlockId.ts +10 -0
- package/src/runtime/pm/utils/mapSelection.ts +21 -0
- package/src/runtime/pm/utils/nodesBetween.ts +47 -0
- package/src/runtime/pm/utils/pointToPmPoint.ts +5 -0
- package/src/runtime/pm/utils/splitIntoChunks.ts +68 -0
- package/src/runtime/testDocuments.ts +130 -0
- package/src/runtime/types/index.ts +56 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { unreachable } from "@alanscodelog/utils/unreachable"
|
|
2
|
+
import type { EditorState, Transaction } from "@tiptap/pm/state"
|
|
3
|
+
import { Step, StepMap } from "@tiptap/pm/transform"
|
|
4
|
+
|
|
5
|
+
import { copyMeta } from "./copyMeta.js"
|
|
6
|
+
import { getStateEmbedRange } from "./getStateEmbedRange.js"
|
|
7
|
+
|
|
8
|
+
export function convertTransactionForFullState(
|
|
9
|
+
state: EditorState,
|
|
10
|
+
tr: Transaction
|
|
11
|
+
): Transaction {
|
|
12
|
+
// this happens when we forward a transaction directly
|
|
13
|
+
// which uses the real full state as the base (as happens with undo)
|
|
14
|
+
|
|
15
|
+
const steps = tr.getMeta("no-schema-convert")
|
|
16
|
+
? tr.steps
|
|
17
|
+
: JSON.parse(
|
|
18
|
+
JSON.stringify(tr.steps)
|
|
19
|
+
).map((step: any) => Step.fromJSON(state.schema, step))
|
|
20
|
+
|
|
21
|
+
const extTr = state.tr as Transaction
|
|
22
|
+
copyMeta(tr, extTr)
|
|
23
|
+
const trSubId = tr.doc.nodeAt(1)?.attrs.blockId
|
|
24
|
+
if (!trSubId && !tr.getMeta("no-step-convert")) {
|
|
25
|
+
unreachable()
|
|
26
|
+
}
|
|
27
|
+
const embedRange = trSubId ? getStateEmbedRange(tr.doc, trSubId) : undefined
|
|
28
|
+
const offsetMap = embedRange && !tr.getMeta("no-step-convert")
|
|
29
|
+
? StepMap.offset(embedRange.start !== undefined ? embedRange.start - 1 : 0)
|
|
30
|
+
: undefined
|
|
31
|
+
// see https://github.com/ueberdosis/tiptap/issues/1883
|
|
32
|
+
// and https://github.com/ueberdosis/tiptap/issues/74#issuecomment-460206175
|
|
33
|
+
for (const step of steps) {
|
|
34
|
+
const mapped = offsetMap ? step.map(offsetMap)! : step
|
|
35
|
+
extTr.step(mapped)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return extTr
|
|
39
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { keys } from "@alanscodelog/utils/keys"
|
|
2
|
+
import type { Transaction } from "@tiptap/pm/state"
|
|
3
|
+
|
|
4
|
+
export function copyMeta(from: Transaction, to: Transaction): void {
|
|
5
|
+
for (const key of keys<string>((from as any).meta)) {
|
|
6
|
+
to.setMeta(key, from.getMeta(key))
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getEmbedJson(
|
|
2
|
+
nodeWanted: Record<string, any> | undefined
|
|
3
|
+
): Record<string, any> | undefined {
|
|
4
|
+
if (nodeWanted) {
|
|
5
|
+
return {
|
|
6
|
+
type: "doc",
|
|
7
|
+
content: [
|
|
8
|
+
{
|
|
9
|
+
type: "list",
|
|
10
|
+
content: [nodeWanted as any]
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return undefined
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { walk } from "@alanscodelog/utils/walk"
|
|
2
|
+
|
|
3
|
+
export function getEmbedNodeFromDoc(json: Record<string, any>, subId: string | undefined): Record<string, any> | undefined {
|
|
4
|
+
if (!subId) return
|
|
5
|
+
let nodeWanted: Record<string, any> | undefined
|
|
6
|
+
walk(json.content, el => {
|
|
7
|
+
if (!nodeWanted && el && el.type === "item") {
|
|
8
|
+
if (el.attrs.blockId === subId) {
|
|
9
|
+
nodeWanted = el
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return el
|
|
13
|
+
}, { before: true })
|
|
14
|
+
return nodeWanted
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Node } from "@tiptap/pm/model"
|
|
2
|
+
|
|
3
|
+
import type { BlockId } from "../types.js"
|
|
4
|
+
|
|
5
|
+
export function getStateEmbedRange(
|
|
6
|
+
doc: Node,
|
|
7
|
+
blockId: BlockId
|
|
8
|
+
): { start: number, end: number } | { start: undefined, end: undefined } {
|
|
9
|
+
const id = blockId.blockId
|
|
10
|
+
let start: number | undefined
|
|
11
|
+
let end: number | undefined
|
|
12
|
+
doc.nodesBetween(0, doc.content.size, (node, pos) => {
|
|
13
|
+
if (start === undefined && node.type.name === "item" && node.attrs.blockId === id) {
|
|
14
|
+
start = pos
|
|
15
|
+
end = pos + node.nodeSize
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
|
+
if (start !== undefined) return false
|
|
19
|
+
return true
|
|
20
|
+
})
|
|
21
|
+
if (start === undefined || end === undefined) {
|
|
22
|
+
return { start: undefined, end: undefined }
|
|
23
|
+
} else {
|
|
24
|
+
return { start, end }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type Command, Extension } from "@tiptap/core"
|
|
2
|
+
import { TextSelection } from "@tiptap/pm/state"
|
|
3
|
+
|
|
4
|
+
import type { EmbeddedDocumentNodeOptions } from "./types.js"
|
|
5
|
+
|
|
6
|
+
declare module "@tiptap/core" {
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
embeddedCommandRedirect: {
|
|
11
|
+
embeddedCommandRedirect: (
|
|
12
|
+
commandName: string,
|
|
13
|
+
args: any,
|
|
14
|
+
) => ReturnType
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This is for "internal" use by the embedded editor only.
|
|
21
|
+
*
|
|
22
|
+
* It should not be registered by the root editor or the documentApi.
|
|
23
|
+
*
|
|
24
|
+
* It provides some additional communication between the embedded editor and the root editor.
|
|
25
|
+
*
|
|
26
|
+
* See {@link EmbeddedDocumentNodeOptions.embeddedBlockCommandRedirect} for more info.
|
|
27
|
+
*
|
|
28
|
+
* See also {@link redirectFromEmbedded} for creating redirectable commands.
|
|
29
|
+
*
|
|
30
|
+
* This extension should always be configured with the root editor and the getPos function from the embedded node view.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
|
+
export const Embedded = Extension.create<EmbeddedDocumentNodeOptions>({
|
|
36
|
+
name: "embedded",
|
|
37
|
+
addOptions() {
|
|
38
|
+
return {
|
|
39
|
+
embeddedBlockCommandRedirect: undefined,
|
|
40
|
+
getPos: undefined as any,
|
|
41
|
+
rootEditor: undefined as any,
|
|
42
|
+
getEmbedId: undefined as any
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
addCommands() {
|
|
46
|
+
if (!this.options.rootEditor) {
|
|
47
|
+
throw new Error("Embedded: Extension must be configured with the root editor.")
|
|
48
|
+
}
|
|
49
|
+
if (!this.options.getPos) {
|
|
50
|
+
throw new Error("Embedded: Extension must be configured with the getPos function.")
|
|
51
|
+
}
|
|
52
|
+
if (!this.options.getEmbedId) {
|
|
53
|
+
throw new Error("Embedded: Extension must be configured with the getEmbedId function.")
|
|
54
|
+
}
|
|
55
|
+
const { rootEditor, getPos, getEmbedId } = this.options
|
|
56
|
+
return {
|
|
57
|
+
embeddedCommandRedirect: (
|
|
58
|
+
commandName: string,
|
|
59
|
+
args: any
|
|
60
|
+
): Command => ({ editor, dispatch }) => {
|
|
61
|
+
const embedId = getEmbedId()
|
|
62
|
+
const nodePos = getPos()
|
|
63
|
+
if (this.options.embeddedBlockCommandRedirect) {
|
|
64
|
+
const res = this.options.embeddedBlockCommandRedirect(commandName, args, { editor, rootEditor, nodePos, embedId, dispatch })
|
|
65
|
+
if (res !== undefined) return res
|
|
66
|
+
}
|
|
67
|
+
switch (commandName) {
|
|
68
|
+
case "insertFile":
|
|
69
|
+
return rootEditor.commands.insertFile(args[0], nodePos)
|
|
70
|
+
case "splitItem":
|
|
71
|
+
if (!nodePos) return false
|
|
72
|
+
return rootEditor.commands.command(({ tr, commands, state, dispatch }) => {
|
|
73
|
+
const from = nodePos
|
|
74
|
+
const schema = state.schema
|
|
75
|
+
if (schema.nodes.item) {
|
|
76
|
+
if (!dispatch) return true
|
|
77
|
+
const node = schema.nodes.item.createAndFill()
|
|
78
|
+
if (!node) return false
|
|
79
|
+
tr.insert(from + 1, node)
|
|
80
|
+
tr.setSelection(TextSelection.create(tr.doc, from + 3))
|
|
81
|
+
commands.focus()
|
|
82
|
+
return true
|
|
83
|
+
}
|
|
84
|
+
return false
|
|
85
|
+
})
|
|
86
|
+
case "indentItem":
|
|
87
|
+
if (!nodePos) return false
|
|
88
|
+
return rootEditor.commands.command(() => {
|
|
89
|
+
rootEditor.commands.indentItem(nodePos)
|
|
90
|
+
rootEditor.commands.setNodeSelection(nodePos + 2)
|
|
91
|
+
return true
|
|
92
|
+
})
|
|
93
|
+
case "unindentItem":
|
|
94
|
+
if (!nodePos) return false
|
|
95
|
+
return rootEditor.commands.command(() => {
|
|
96
|
+
rootEditor.commands.unindentItem(nodePos)
|
|
97
|
+
rootEditor.commands.setNodeSelection(nodePos - 2)
|
|
98
|
+
return true
|
|
99
|
+
})
|
|
100
|
+
default:
|
|
101
|
+
|
|
102
|
+
// eslint-disable-next-line no-console
|
|
103
|
+
console.warn(`No redirect handler found for command ${commandName}`)
|
|
104
|
+
break
|
|
105
|
+
}
|
|
106
|
+
return false
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
})
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { isBlank } from "@alanscodelog/utils/isBlank"
|
|
2
|
+
import { mergeAttributes, Node } from "@tiptap/core"
|
|
3
|
+
import { VueNodeViewRenderer } from "@tiptap/vue-3"
|
|
4
|
+
|
|
5
|
+
import EmbeddedNodeView from "./components/EmbeddedNodeView.vue"
|
|
6
|
+
|
|
7
|
+
import type { HTMLAttributesOptions } from "../../../types/index.js"
|
|
8
|
+
import { isValidId } from "../Blocks/utils/isValidId.js"
|
|
9
|
+
|
|
10
|
+
declare module "@tiptap/core" {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
14
|
+
embeddedDocument: {
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Extension that adds support for embedded documents.
|
|
21
|
+
*
|
|
22
|
+
* Must be used with the provided `History` extension instead of the normal one.
|
|
23
|
+
*
|
|
24
|
+
* The node view provides `isEmbedded` and `isDeepEmbedded` for any child component instances.
|
|
25
|
+
*
|
|
26
|
+
* If using a custom editor wrapper, you will need to:
|
|
27
|
+
*
|
|
28
|
+
* - Provide the custom editor wrapper component with the {@link embeddedEditorComponentInjectionKey} injection key. The component should expose the tiptap editor instance with `defineExpose` as the `editor` property.
|
|
29
|
+
* - Provide the document api by creating an instance of the {@link DocumentApi} class and providing it with the {@link documentApiInjectionKey}.
|
|
30
|
+
* - Provide a ref to it's document's id with the {@link parentEditorIdInjectionKey} if it's using ids to load documents so that the EmbeddedNodeview can detect circular embeds and avoid rendering them.
|
|
31
|
+
* - Add the class `editor-is-embedded-block` to the editor wrapper (it must be the immediate parent of view.dom) so commands such as enter can check if they should act differently. See {@link isEmbeddedBlock}.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
35
|
+
export const EmbeddedDocument = Node.create<HTMLAttributesOptions>({
|
|
36
|
+
name: "embeddedDoc" satisfies NodeEmbeddedDocumentName,
|
|
37
|
+
group: "block",
|
|
38
|
+
draggable: false,
|
|
39
|
+
atom: true,
|
|
40
|
+
// defining: true,
|
|
41
|
+
addNodeView() {
|
|
42
|
+
// am having lint only issues
|
|
43
|
+
return VueNodeViewRenderer(EmbeddedNodeView, {
|
|
44
|
+
stopEvent() {
|
|
45
|
+
return true
|
|
46
|
+
},
|
|
47
|
+
ignoreMutation() {
|
|
48
|
+
return true
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
addOptions() {
|
|
53
|
+
return {
|
|
54
|
+
HTMLAttributes: {
|
|
55
|
+
default: { }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
addAttributes() {
|
|
60
|
+
return {
|
|
61
|
+
embedId: {
|
|
62
|
+
default: { docId: undefined, blockId: undefined }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
parseHTML() {
|
|
67
|
+
return [{
|
|
68
|
+
tag: `div[type=${this.name}]`,
|
|
69
|
+
getAttrs: (element: HTMLElement) => {
|
|
70
|
+
const docId = element.getAttribute("embeddocid")
|
|
71
|
+
if (docId === undefined || docId === null) { return false }
|
|
72
|
+
if (isBlank(docId) || !isValidId(docId)) {
|
|
73
|
+
return { embedId: { docId: undefined, blockId: undefined } }
|
|
74
|
+
}
|
|
75
|
+
const blockId = element.getAttribute("embedblockid")
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
embedId: {
|
|
79
|
+
docId: isBlank(docId) || !isValidId(docId) ? undefined : docId,
|
|
80
|
+
blockId
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}]
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
88
|
+
renderHTML({ HTMLAttributes }) {
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
90
|
+
const mergedHTMLAttributes = mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
91
|
+
embeddocid: HTMLAttributes.embedId.docId ?? "",
|
|
92
|
+
embedblockid: HTMLAttributes.embedId.blockId,
|
|
93
|
+
type: this.name
|
|
94
|
+
})
|
|
95
|
+
delete mergedHTMLAttributes.embedId
|
|
96
|
+
return [
|
|
97
|
+
"div",
|
|
98
|
+
mergedHTMLAttributes
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
export type NodeEmbeddedDocumentName = "embeddedDoc"
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- v-if is to prevent styles from existing/getting applied to other documents when the popup is hidden, and also not having v-if on the editor causes problems with prosemirror -->
|
|
3
|
+
<div
|
|
4
|
+
v-if="isShown"
|
|
5
|
+
class="
|
|
6
|
+
embedded-document-picker
|
|
7
|
+
w-[calc(100dvw-var(--spacing-20))]
|
|
8
|
+
max-h-[calc(100dvh-var(--spacing-20))]
|
|
9
|
+
overflow-auto
|
|
10
|
+
bg-neutral-100
|
|
11
|
+
dark:bg-neutral-900
|
|
12
|
+
p-2
|
|
13
|
+
rounded-sm
|
|
14
|
+
flex-1
|
|
15
|
+
flex
|
|
16
|
+
flex-col
|
|
17
|
+
gap-2
|
|
18
|
+
"
|
|
19
|
+
>
|
|
20
|
+
<component
|
|
21
|
+
:is="'style'"
|
|
22
|
+
>
|
|
23
|
+
.embedded-document-picker li[blockid="{{ newEmbedId.blockId }}"]:not(:has(li:hover)):after {
|
|
24
|
+
border-color: rgb(var(--color-accent-500));
|
|
25
|
+
}
|
|
26
|
+
.embedded-document-picker li[blockid="{{ newEmbedId.blockId }}"]:has(li:hover):after {
|
|
27
|
+
border-color: rgb(var(--color-accent-500)/50%);
|
|
28
|
+
}
|
|
29
|
+
</component>
|
|
30
|
+
<!-- @vue-expect-error -->
|
|
31
|
+
<WSimpleInput
|
|
32
|
+
placeholder="Change document."
|
|
33
|
+
suggestions-class="max-h-[200px] overflow-y-auto"
|
|
34
|
+
:suggestions="searchSuggestions"
|
|
35
|
+
:suggestion-label="(suggestion:any) => suggestion.title"
|
|
36
|
+
:restrict-to-suggestions="false"
|
|
37
|
+
ref="inputComponent"
|
|
38
|
+
v-model="searchString"
|
|
39
|
+
@submit="pickDocId"
|
|
40
|
+
>
|
|
41
|
+
<!-- @vue-expect-error -->
|
|
42
|
+
<template
|
|
43
|
+
v-if="searchLoading"
|
|
44
|
+
#right
|
|
45
|
+
>
|
|
46
|
+
<WIcon><i-line-md-loading-loop/></WIcon>
|
|
47
|
+
</template>
|
|
48
|
+
<!-- @vue-expect-error -->
|
|
49
|
+
<template #suggestion-item="{ item }">
|
|
50
|
+
{{ item.title }}
|
|
51
|
+
</template>
|
|
52
|
+
</WSimpleInput>
|
|
53
|
+
<WCheckbox v-model="embedFullDocument">
|
|
54
|
+
Embed Full Document
|
|
55
|
+
</WCheckbox>
|
|
56
|
+
<div
|
|
57
|
+
v-if="!embedFullDocument && newEmbedId.docId"
|
|
58
|
+
class="border border-neutral-500 rounded-sm"
|
|
59
|
+
>
|
|
60
|
+
<div class="bg-neutral-200 dark:bg-neutral-800 rounded-t-sm p-1">
|
|
61
|
+
Pick a block to embed:
|
|
62
|
+
</div>
|
|
63
|
+
<div
|
|
64
|
+
class="
|
|
65
|
+
flex-1
|
|
66
|
+
[&_li]:after:rounded-sm
|
|
67
|
+
[&_li]:after:border-2
|
|
68
|
+
[&_li]:after:border-transparent
|
|
69
|
+
[&_li]:after:content-['']
|
|
70
|
+
[&_li]:after:absolute
|
|
71
|
+
[&_li]:after:inset-[-3px]
|
|
72
|
+
[&_li]:after:transition-all
|
|
73
|
+
[&_li]:cursor-pointer
|
|
74
|
+
[&_li]:after:pointer-events-none
|
|
75
|
+
[&_li:hover:not(:has(li:hover))]:after:content-['']
|
|
76
|
+
[&_li:hover:not(:has(li:hover))]:after:border-accent-500
|
|
77
|
+
[&_li:hover:not(:has(li:hover))]:after:bg-accent-500/30
|
|
78
|
+
[&_li:hover:not(:has(li:hover))]:after:pointer-events-none
|
|
79
|
+
[&_li:hover:not(:has(li:hover))]:pointer-events-all
|
|
80
|
+
[&_a]:pointer-events-none
|
|
81
|
+
overflow-y-auto
|
|
82
|
+
p-2
|
|
83
|
+
"
|
|
84
|
+
@pointerdown.prevent
|
|
85
|
+
@pointerup.prevent="pickBlockId"
|
|
86
|
+
>
|
|
87
|
+
<!-- @vue-expect-error -->
|
|
88
|
+
<Editor
|
|
89
|
+
:is-embedded="true"
|
|
90
|
+
:doc-id="newEmbedId.docId"
|
|
91
|
+
:editor-options="{ editable: false }"
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div class="flex flex-row no-wrap gap-2 justify-end">
|
|
96
|
+
<!-- @vue-expect-error -->
|
|
97
|
+
<WButton
|
|
98
|
+
color="danger"
|
|
99
|
+
@click="emit('cancel')"
|
|
100
|
+
>
|
|
101
|
+
Cancel
|
|
102
|
+
</WButton>
|
|
103
|
+
<!-- @vue-expect-error -->
|
|
104
|
+
<WButton
|
|
105
|
+
color="ok"
|
|
106
|
+
@click="submit"
|
|
107
|
+
>
|
|
108
|
+
Submit
|
|
109
|
+
</WButton>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script setup lang="ts">
|
|
115
|
+
import WIcon from "@witchcraft/ui/components/Icon"
|
|
116
|
+
import WButton from "@witchcraft/ui/components/LibButton"
|
|
117
|
+
import WCheckbox from "@witchcraft/ui/components/LibCheckbox"
|
|
118
|
+
import type WInputDeprecated from "@witchcraft/ui/components/LibInputDeprecated"
|
|
119
|
+
import WSimpleInput from "@witchcraft/ui/components/LibSimpleInput"
|
|
120
|
+
import { inject, nextTick, provide, ref, toRef, watch } from "vue"
|
|
121
|
+
|
|
122
|
+
import ILineMdLoadingLoop from "~icons/line-md/loading-loop"
|
|
123
|
+
|
|
124
|
+
import Editor from "../../../../components/Editor.vue"
|
|
125
|
+
import { documentApiInjectionKey, type MaybeEmbedId } from "../../DocumentApi/types.js"
|
|
126
|
+
import { isDeepEmbeddedInjectionKey } from "../types.js"
|
|
127
|
+
|
|
128
|
+
const props = defineProps<{
|
|
129
|
+
embedId: MaybeEmbedId
|
|
130
|
+
/** We need this, otherwise prosemirror? gets in an infinite loop because the component is not actually displayed? I think... Chrome debugger freezes completely. */
|
|
131
|
+
isShown: boolean
|
|
132
|
+
}>()
|
|
133
|
+
const emit = defineEmits<{
|
|
134
|
+
(e: "submit", embedId: MaybeEmbedId): void
|
|
135
|
+
(e: "cancel"): void
|
|
136
|
+
}>()
|
|
137
|
+
|
|
138
|
+
const embedId = toRef(props, "embedId")
|
|
139
|
+
const newEmbedId = ref<MaybeEmbedId>({ ...props.embedId })
|
|
140
|
+
// const editorComponent = inject(embeddedEditorComponentInjectionKey, Editor)
|
|
141
|
+
const documentApi = inject(documentApiInjectionKey)
|
|
142
|
+
|
|
143
|
+
// make this work like an un-embedded editor
|
|
144
|
+
provide(isDeepEmbeddedInjectionKey, true)
|
|
145
|
+
|
|
146
|
+
function pickBlockId(e: MouseEvent) {
|
|
147
|
+
const el = e.target as HTMLElement
|
|
148
|
+
const item = el.closest(".item-content")
|
|
149
|
+
const id = item?.getAttribute("blockid")
|
|
150
|
+
if (id) {
|
|
151
|
+
newEmbedId.value.blockId = id
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// bit of an ugly hack but it works
|
|
156
|
+
const justPicked = ref(false)
|
|
157
|
+
const inputComponent = ref<InstanceType<typeof WInputDeprecated> | null>(null)
|
|
158
|
+
const searchString = ref("")
|
|
159
|
+
const searchLoading = ref(false)
|
|
160
|
+
const searchSuggestions = ref<{ title: string, docId: string }[]>([])
|
|
161
|
+
watch(searchString, async newVal => {
|
|
162
|
+
if (justPicked.value) return
|
|
163
|
+
searchLoading.value = true
|
|
164
|
+
inputComponent.value?.suggestionsComponent?.suggestions.close()
|
|
165
|
+
searchSuggestions.value = await documentApi!.getSuggestions(newVal)
|
|
166
|
+
inputComponent.value?.suggestionsComponent?.suggestions.open()
|
|
167
|
+
searchLoading.value = false
|
|
168
|
+
}, { immediate: true })
|
|
169
|
+
|
|
170
|
+
function pickDocId(_val: string, suggestion?: { docId: string, title: string }) {
|
|
171
|
+
if (suggestion?.docId) {
|
|
172
|
+
newEmbedId.value.docId = suggestion.docId
|
|
173
|
+
justPicked.value = true
|
|
174
|
+
nextTick(() => {
|
|
175
|
+
justPicked.value = false
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const embedFullDocument = ref(embedId.value.blockId === undefined)
|
|
181
|
+
function submit() {
|
|
182
|
+
if (embedFullDocument.value) {
|
|
183
|
+
emit("submit", { ...newEmbedId.value, blockId: undefined })
|
|
184
|
+
} else {
|
|
185
|
+
emit("submit", newEmbedId.value)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</script>
|