@tiptap/vue-3 2.0.0-beta.85 → 2.0.0-beta.89
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/dist/packages/vue-3/src/useEditor.d.ts +1 -2
- package/dist/tiptap-vue-3.cjs.js +0 -1
- package/dist/tiptap-vue-3.cjs.js.map +1 -1
- package/dist/tiptap-vue-3.esm.js +0 -1
- package/dist/tiptap-vue-3.esm.js.map +1 -1
- package/dist/tiptap-vue-3.umd.js +0 -1
- package/dist/tiptap-vue-3.umd.js.map +1 -1
- package/package.json +6 -5
- package/src/useEditor.ts +3 -9
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -147
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -227
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -18
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -319
- package/dist/packages/core/src/Node.d.ts +0 -388
- package/dist/packages/core/src/NodeView.d.ts +0 -27
- package/dist/packages/core/src/PasteRule.d.ts +0 -42
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -12
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -12
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -12
- package/dist/packages/core/src/commands/command.d.ts +0 -12
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -12
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -12
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -12
- package/dist/packages/core/src/commands/enter.d.ts +0 -12
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -12
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -13
- package/dist/packages/core/src/commands/first.d.ts +0 -12
- package/dist/packages/core/src/commands/focus.d.ts +0 -14
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -16
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -16
- package/dist/packages/core/src/commands/joinBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -12
- package/dist/packages/core/src/commands/lift.d.ts +0 -13
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -12
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -13
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -12
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -13
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -12
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -12
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -12
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -12
- package/dist/packages/core/src/commands/setContent.d.ts +0 -13
- package/dist/packages/core/src/commands/setMark.d.ts +0 -13
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -12
- package/dist/packages/core/src/commands/setNode.d.ts +0 -13
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -12
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -12
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -13
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -14
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -13
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -13
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -13
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -13
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -12
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -12
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -18
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -13
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -13
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -13
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -2
- package/dist/packages/core/src/extensions/commands.d.ts +0 -98
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -7
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -5
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -3
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -7
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -2
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -3
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -6
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -9
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -2
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -2
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -5
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -2
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -2
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -2
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -2
- package/dist/packages/core/src/helpers/getText.d.ts +0 -6
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -6
- package/dist/packages/core/src/helpers/getTextSeralizersFromSchema.d.ts +0 -3
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -60
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -12
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -12
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -9
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -14
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -23
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -12
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -9
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -210
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isClass.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-blockquote/src/blockquote.d.ts +0 -24
- package/dist/packages/extension-blockquote/src/index.d.ts +0 -3
- package/dist/packages/extension-bold/src/bold.d.ts +0 -27
- package/dist/packages/extension-bold/src/index.d.ts +0 -3
- package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +0 -43
- package/dist/packages/extension-bubble-menu/src/bubble-menu.d.ts +0 -6
- package/dist/packages/extension-bubble-menu/src/index.d.ts +0 -4
- package/dist/packages/extension-bullet-list/src/bullet-list.d.ts +0 -17
- package/dist/packages/extension-bullet-list/src/index.d.ts +0 -3
- package/dist/packages/extension-character-count/src/character-count.d.ts +0 -28
- package/dist/packages/extension-character-count/src/index.d.ts +0 -3
- package/dist/packages/extension-code/src/code.d.ts +0 -25
- package/dist/packages/extension-code/src/index.d.ts +0 -3
- package/dist/packages/extension-code-block/src/code-block.d.ts +0 -26
- package/dist/packages/extension-code-block/src/index.d.ts +0 -3
- package/dist/packages/extension-code-block-lowlight/src/code-block-lowlight.d.ts +0 -6
- package/dist/packages/extension-code-block-lowlight/src/index.d.ts +0 -3
- package/dist/packages/extension-code-block-lowlight/src/lowlight-plugin.d.ts +0 -6
- package/dist/packages/extension-collaboration/src/collaboration.d.ts +0 -30
- package/dist/packages/extension-collaboration/src/helpers/isChangeOrigin.d.ts +0 -2
- package/dist/packages/extension-collaboration/src/index.d.ts +0 -4
- package/dist/packages/extension-collaboration-cursor/src/collaboration-cursor.d.ts +0 -37
- package/dist/packages/extension-collaboration-cursor/src/index.d.ts +0 -3
- package/dist/packages/extension-color/src/color.d.ts +0 -20
- package/dist/packages/extension-color/src/index.d.ts +0 -3
- package/dist/packages/extension-document/src/document.d.ts +0 -2
- package/dist/packages/extension-document/src/index.d.ts +0 -3
- package/dist/packages/extension-dropcursor/src/dropcursor.d.ts +0 -7
- package/dist/packages/extension-dropcursor/src/index.d.ts +0 -3
- package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +0 -40
- package/dist/packages/extension-floating-menu/src/floating-menu.d.ts +0 -6
- package/dist/packages/extension-floating-menu/src/index.d.ts +0 -4
- package/dist/packages/extension-focus/src/focus.d.ts +0 -6
- package/dist/packages/extension-focus/src/index.d.ts +0 -3
- package/dist/packages/extension-font-family/src/font-family.d.ts +0 -21
- package/dist/packages/extension-font-family/src/index.d.ts +0 -3
- package/dist/packages/extension-gapcursor/src/gapcursor.d.ts +0 -15
- package/dist/packages/extension-gapcursor/src/index.d.ts +0 -3
- package/dist/packages/extension-hard-break/src/hard-break.d.ts +0 -16
- package/dist/packages/extension-hard-break/src/index.d.ts +0 -3
- package/dist/packages/extension-heading/src/heading.d.ts +0 -26
- package/dist/packages/extension-heading/src/index.d.ts +0 -3
- package/dist/packages/extension-highlight/src/highlight.d.ts +0 -30
- package/dist/packages/extension-highlight/src/index.d.ts +0 -3
- package/dist/packages/extension-history/src/history.d.ts +0 -20
- package/dist/packages/extension-history/src/index.d.ts +0 -3
- package/dist/packages/extension-horizontal-rule/src/horizontal-rule.d.ts +0 -15
- package/dist/packages/extension-horizontal-rule/src/index.d.ts +0 -3
- package/dist/packages/extension-image/src/image.d.ts +0 -21
- package/dist/packages/extension-image/src/index.d.ts +0 -3
- package/dist/packages/extension-italic/src/index.d.ts +0 -3
- package/dist/packages/extension-italic/src/italic.d.ts +0 -27
- package/dist/packages/extension-link/src/helpers/autolink.d.ts +0 -7
- package/dist/packages/extension-link/src/helpers/clickHandler.d.ts +0 -7
- package/dist/packages/extension-link/src/helpers/pasteHandler.d.ts +0 -9
- package/dist/packages/extension-link/src/index.d.ts +0 -3
- package/dist/packages/extension-link/src/link.d.ts +0 -44
- package/dist/packages/extension-list-item/src/index.d.ts +0 -3
- package/dist/packages/extension-list-item/src/list-item.d.ts +0 -5
- package/dist/packages/extension-mention/src/index.d.ts +0 -3
- package/dist/packages/extension-mention/src/mention.d.ts +0 -14
- package/dist/packages/extension-ordered-list/src/index.d.ts +0 -3
- package/dist/packages/extension-ordered-list/src/ordered-list.d.ts +0 -17
- package/dist/packages/extension-paragraph/src/index.d.ts +0 -3
- package/dist/packages/extension-paragraph/src/paragraph.d.ts +0 -15
- package/dist/packages/extension-placeholder/src/index.d.ts +0 -3
- package/dist/packages/extension-placeholder/src/placeholder.d.ts +0 -15
- package/dist/packages/extension-strike/src/index.d.ts +0 -3
- package/dist/packages/extension-strike/src/strike.d.ts +0 -25
- package/dist/packages/extension-subscript/src/index.d.ts +0 -3
- package/dist/packages/extension-subscript/src/subscript.d.ts +0 -23
- package/dist/packages/extension-superscript/src/index.d.ts +0 -3
- package/dist/packages/extension-superscript/src/superscript.d.ts +0 -23
- package/dist/packages/extension-table/src/TableView.d.ts +0 -17
- package/dist/packages/extension-table/src/index.d.ts +0 -4
- package/dist/packages/extension-table/src/table.d.ts +0 -55
- package/dist/packages/extension-table/src/utilities/createCell.d.ts +0 -2
- package/dist/packages/extension-table/src/utilities/createTable.d.ts +0 -2
- package/dist/packages/extension-table/src/utilities/deleteTableWhenAllCellsSelected.d.ts +0 -2
- package/dist/packages/extension-table/src/utilities/getTableNodeTypes.d.ts +0 -4
- package/dist/packages/extension-table/src/utilities/isCellSelection.d.ts +0 -2
- package/dist/packages/extension-table-cell/src/index.d.ts +0 -3
- package/dist/packages/extension-table-cell/src/table-cell.d.ts +0 -5
- package/dist/packages/extension-table-header/src/index.d.ts +0 -3
- package/dist/packages/extension-table-header/src/table-header.d.ts +0 -5
- package/dist/packages/extension-table-row/src/index.d.ts +0 -3
- package/dist/packages/extension-table-row/src/table-row.d.ts +0 -5
- package/dist/packages/extension-task-item/src/index.d.ts +0 -3
- package/dist/packages/extension-task-item/src/task-item.d.ts +0 -7
- package/dist/packages/extension-task-list/src/index.d.ts +0 -3
- package/dist/packages/extension-task-list/src/task-list.d.ts +0 -16
- package/dist/packages/extension-text/src/index.d.ts +0 -3
- package/dist/packages/extension-text/src/text.d.ts +0 -2
- package/dist/packages/extension-text-align/src/index.d.ts +0 -3
- package/dist/packages/extension-text-align/src/text-align.d.ts +0 -21
- package/dist/packages/extension-text-style/src/index.d.ts +0 -3
- package/dist/packages/extension-text-style/src/text-style.d.ts +0 -15
- package/dist/packages/extension-typography/src/index.d.ts +0 -3
- package/dist/packages/extension-typography/src/typography.d.ts +0 -23
- package/dist/packages/extension-underline/src/index.d.ts +0 -3
- package/dist/packages/extension-underline/src/underline.d.ts +0 -23
- package/dist/packages/html/src/generateHTML.d.ts +0 -2
- package/dist/packages/html/src/generateJSON.d.ts +0 -2
- package/dist/packages/html/src/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/html/src/index.d.ts +0 -2
- package/dist/packages/react/src/BubbleMenu.d.ts +0 -8
- package/dist/packages/react/src/Editor.d.ts +0 -6
- package/dist/packages/react/src/EditorContent.d.ts +0 -19
- package/dist/packages/react/src/FloatingMenu.d.ts +0 -8
- package/dist/packages/react/src/NodeViewContent.d.ts +0 -6
- package/dist/packages/react/src/NodeViewWrapper.d.ts +0 -6
- package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +0 -14
- package/dist/packages/react/src/ReactRenderer.d.ts +0 -27
- package/dist/packages/react/src/index.d.ts +0 -10
- package/dist/packages/react/src/useEditor.d.ts +0 -4
- package/dist/packages/react/src/useReactNodeView.d.ts +0 -7
- package/dist/packages/starter-kit/src/index.d.ts +0 -3
- package/dist/packages/starter-kit/src/starter-kit.d.ts +0 -37
- package/dist/packages/suggestion/src/findSuggestionMatch.d.ts +0 -15
- package/dist/packages/suggestion/src/index.d.ts +0 -4
- package/dist/packages/suggestion/src/suggestion.d.ts +0 -49
- package/dist/tests/cypress/integration/core/can.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/editorProps.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/extendExtensions.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/extendMarkRange.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/extensionOptions.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/fromString.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/generateHTML.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/generateJSON.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/isActive.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/isClass.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/mergeAttributes.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/mergeDeep.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/core/pluginOrder.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/extensions/bold.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/extensions/codeBlockLowlight.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/html/generateHTML.spec.d.ts +0 -1
- package/dist/tests/cypress/integration/html/generateJSON.spec.d.ts +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
1
|
import { EditorOptions } from '@tiptap/core';
|
|
3
2
|
import { Editor } from './Editor';
|
|
4
|
-
export declare const useEditor: (options?: Partial<EditorOptions>) =>
|
|
3
|
+
export declare const useEditor: (options?: Partial<EditorOptions>) => import("vue").ShallowRef<Editor | undefined>;
|
package/dist/tiptap-vue-3.cjs.js
CHANGED
|
@@ -222,7 +222,6 @@ const FloatingMenu = vue.defineComponent({
|
|
|
222
222
|
},
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
// We set a custom return type. Otherwise TypeScript will throw TS4023. Not sure why.
|
|
226
225
|
const useEditor = (options = {}) => {
|
|
227
226
|
const editor = vue.shallowRef();
|
|
228
227
|
vue.onMounted(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-vue-3.cjs.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import {\n onMounted,\n onBeforeUnmount,\n shallowRef,\n Ref,\n} from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\n// We set a custom return type. Otherwise TypeScript will throw TS4023. Not sure why.\nexport const useEditor = (options: Partial<EditorOptions> = {}): Ref<Editor> => {\n const editor = shallowRef<Editor>() as Ref<Editor>\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;;;;MAUa,UAAU,GAAGA,mBAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAAI;SACd;KACF;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;QAE1CC,aAAS,CAAC;YACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;YAET,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;gBACrC,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;gBAClC,YAAY;gBACZ,UAAU;aACX,CAAC,CAAC,CAAA;SACJ,CAAC,CA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,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM,EAAE,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAE5C,MAAM;;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;;YAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;YACnC,KAAK,EAAE;gBACL,UAAU,EAAE,QAAQ;aACrB;YACD,wBAAwB,EAAE,EAAE;;YAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAGL,mBAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-vue-3.cjs.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;;;;MAUa,UAAU,GAAGA,mBAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAAI;SACd;KACF;IAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;QAE1CC,aAAS,CAAC;YACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;YAET,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;gBACrC,SAAS;gBACT,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;gBAClC,YAAY;gBACZ,UAAU;aACX,CAAC,CAAC,CAAA;SACJ,CAAC,CAAA;QAEFC,mBAAe,CAAC;YACd,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;YAEnC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA;SACnC,CAAC,CAAA;QAEF,OAAO,gBAAM,OAAAC,KAAC,CAAC,KAAK,EAAE,EAAE,GA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,KAAK,EAAE;gBACL,UAAU,EAAE,QAAQ;aACrB;YACD,wBAAwB,EAAE,EAAE;;YAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAGL,mBAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;;;;;;;;;;;;;;;;"}
|
package/dist/tiptap-vue-3.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-vue-3.esm.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import {\n onMounted,\n onBeforeUnmount,\n shallowRef,\n Ref,\n} from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\n// We set a custom return type. Otherwise TypeScript will throw TS4023. Not sure why.\nexport const useEditor = (options: Partial<EditorOptions> = {}): Ref<Editor> => {\n const editor = shallowRef<Editor>() as Ref<Editor>\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-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IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAO,CAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-vue-3.esm.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["CoreEditor"],"mappings":";;;;;;MAUa,UAAU,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,YAAY;IAElB,KAAK,EAAE;QACL,SAAS,EAAE;;;YAGT,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,YAAY;SACtB;QAED,MAAM,EAAE;YACN,IAAI,EAAE,MAAmD;YACzD,QAAQ,EAAE,IAAI;SACf;QAED,YAAY,EAAE;YACZ,IAAI,EAAE,MAAyD;YAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;SACpB;QAED,UAAU,EAAE;YACV,IAAI,EAAE,QAAkF;YACxF,OAAO,EAAE,IAA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F;SAEe,mBAAmB,CAAC,SAAoB,EAAE,OAA6C;IACrG,OAAO,CAAC,KAA4B;;;;QAIlC,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;YAC9C,OAAO,EAAE,CAAA;SACV;QAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAwB,CAAA;KACzE,CAAA;AACH;;MC1Ma,eAAe,GAAG,eAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM,EAAE,CAAC,aAAa,EAAE,mBAAmB,CAAC;IAE5C,MAAM;;QACJ,OAAO,CAAC,CACN,IAAI,CAAC,EAAE,EAAE;;YAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;YACnC,KAAK,EAAE;gBACL,UAAU,EAAE,QAAQ;aACrB;YACD,wBAAwB,EAAE,EAAE;;YAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;KACF;CACF;;MCzBY,eAAe,GAAG,eAAe,CAAC;IAC7C,KAAK,EAAE;QACL,EAAE,EAAE;YACF,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,KAAK;SACf;KACF;IAED,MAAM;QACJ,OAAO,CAAC,CACN,IAAI,CAAC,EAAE,EAAE;YACP,KAAK,EAAE;gBACL,UAAU,EAAE,UAAU;aACvB;YACD,wBAAwB,EAAE,EAAE;SAC7B,CACF,CAAA;KACF;CACF;;;;"}
|
package/dist/tiptap-vue-3.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-vue-3.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import {\n onMounted,\n onBeforeUnmount,\n shallowRef,\n Ref,\n} from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\n// We set a custom return type. Otherwise TypeScript will throw TS4023. Not sure why.\nexport const useEditor = (options: Partial<EditorOptions> = {}): Ref<Editor> => {\n const editor = shallowRef<Editor>() as Ref<Editor>\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;QAUa,UAAU,GAAGA,mBAAe,CAAC;MACxC,IAAI,EAAE,YAAY;MAElB,KAAK,EAAE;UACL,SAAS,EAAE;;;cAGT,IAAI,EAAE,IAAI;cACV,OAAO,EAAE,YAAY;WACtB;UAED,MAAM,EAAE;cACN,IAAI,EAAE,MAAmD;cACzD,QAAQ,EAAE,IAAI;WACf;UAED,YAAY,EAAE;cACZ,IAAI,EAAE,MAAyD;cAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;WACpB;UAED,UAAU,EAAE;cACV,IAAI,EAAE,QAAkF;cACxF,OAAO,EAAE,IAAI;WACd;OACF;MAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;UACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;UAE1CC,aAAS,CAAC;cACR,MAAM,EACJ,SAAS,EAC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AAiB,CAAC,gBAAgB,EAAE;cAC9C,OAAO,EAAE,CAAA;WACV;UAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAwB,CAAA;OACzE,CAAA;EACH;;QC1Ma,eAAe,GAAGlB,mBAAe,CAAC;MAC7C,KAAK,EAAE;UACL,EAAE,EAAE;cACF,IAAI,EAAE,MAAM;cACZ,OAAO,EAAE,KAAK;WACf;OACF;MAED,MAAM,EAAE,CAAC,aAAa,EAAE,mBAAmB,CAAC;MAE5C,MAAM;;UACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;;cAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;cACnC,KAAK,EAAE;kBACL,UAAU,EAAE,QAAQ;eACrB;cACD,wBAAwB,EAAE,EAAE;;cAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;WAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;OACF;GACF;;QCzBY,eAAe,GAAGL,mBAAe,CAAC;MAC7C,KAAK,EAAE;UACL,EAAE,EAAE;cACF,IAAI,EAAE,MAAM;cACZ,OAAO,EAAE,KAAK;WACf;OACF;MAED,MAAM;UACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;cACP,KAAK,EAAE;kBACL,UAAU,EAAE,UAAU;eACvB;cACD,wBAAwB,EAAE,EAAE;WAC7B,CACF,CAAA;OACF;GACF;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-vue-3.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts","../src/NodeViewWrapper.ts","../src/NodeViewContent.ts"],"sourcesContent":["import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state'\nimport { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport {\n markRaw,\n Ref,\n customRef,\n ComponentInternalInstance,\n ComponentPublicInstance,\n reactive,\n} from 'vue'\nimport { VueRenderer } from './VueRenderer'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance,\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public vueRenderers = reactive<Map<string, VueRenderer>>(new Map())\n\n public contentComponent: ContentComponent | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('transaction', () => {\n this.reactiveState.value = this.view.state\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this)\n }\n\n get state() {\n return this.reactiveState\n ? this.reactiveState.value\n : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage\n ? this.reactiveExtensionStorage.value\n : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n h,\n ref,\n Ref,\n unref,\n Teleport,\n PropType,\n defineComponent,\n DefineComponent,\n watchEffect,\n nextTick,\n onBeforeUnmount,\n getCurrentInstance,\n} from 'vue'\nimport { Editor } from './Editor'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n const vueRenderers: any[] = []\n\n if (this.editor) {\n this.editor.vueRenderers.forEach(vueRenderer => {\n const node = h(\n Teleport,\n {\n to: vueRenderer.teleportElement,\n key: vueRenderer.id,\n },\n h(\n vueRenderer.component as DefineComponent,\n {\n ref: vueRenderer.id,\n ...vueRenderer.props,\n },\n ),\n )\n\n vueRenderers.push(node)\n })\n }\n\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n ...vueRenderers,\n )\n },\n})\n","import {\n h,\n ref,\n PropType,\n onMounted,\n onBeforeUnmount,\n defineComponent,\n} from 'vue'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { onMounted, onBeforeUnmount, shallowRef } from 'vue'\nimport { EditorOptions } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { reactive, markRaw, Component } from 'vue'\nimport { Editor } from '@tiptap/core'\nimport { Editor as ExtendedEditor } from './Editor'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\nexport class VueRenderer {\n id: string\n\n editor: ExtendedEditor\n\n component: Component\n\n teleportElement: Element\n\n element: Element\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.teleportElement = document.createElement('div')\n this.element = this.teleportElement\n this.props = reactive(props)\n this.editor.vueRenderers.set(this.id, this)\n\n if (this.editor.contentComponent) {\n this.editor.contentComponent.update()\n\n if (this.teleportElement.children.length !== 1) {\n throw Error('VueRenderer doesn’t support multiple child elements.')\n }\n\n this.element = this.teleportElement.firstElementChild as Element\n }\n }\n\n get ref(): any {\n return this.editor.contentComponent?.refs[this.id]\n }\n\n updateProps(props: Record<string, any> = {}): void {\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n }\n\n destroy(): void {\n this.editor.vueRenderers.delete(this.id)\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport {\n ref,\n Ref,\n provide,\n PropType,\n Component,\n defineComponent,\n} from 'vue'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { VueRenderer } from './VueRenderer'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n getDecorationClasses() {\n return this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n }\n\n destroy() {\n this.renderer.destroy()\n }\n\n}\n\nexport function VueNodeViewRenderer(component: Component, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as ProseMirrorNodeView\n }\n}\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as, {\n // @ts-ignore\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { h, defineComponent } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(\n this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n },\n )\n },\n})\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","reactive","markRaw","getCurrentInstance","watchEffect","nextTick","unref","Teleport","FloatingMenuPlugin","shallowRef","NodeView","provide"],"mappings":";;;;;;QAUa,UAAU,GAAGA,mBAAe,CAAC;MACxC,IAAI,EAAE,YAAY;MAElB,KAAK,EAAE;UACL,SAAS,EAAE;;;cAGT,IAAI,EAAE,IAAI;cACV,OAAO,EAAE,YAAY;WACtB;UAED,MAAM,EAAE;cACN,IAAI,EAAE,MAAmD;cACzD,QAAQ,EAAE,IAAI;WACf;UAED,YAAY,EAAE;cACZ,IAAI,EAAE,MAAyD;cAC/D,OAAO,EAAE,OAAO,EAAE,CAAC;WACpB;UAED,UAAU,EAAE;cACV,IAAI,EAAE,QAAkF;cACxF,OAAO,EAAE,IAAI;WACd;OACF;MAED,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;UACpB,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;UAE1CC,aAAS,CAAC;cACR,MAAM,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,GACX,GAAG,KAAK,CAAA;cAET,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;kBACrC,SAAS;kBACT,MAAM;kBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;kBAClC,YAAY;kBACZ,UAAU;eACX,CAAC,CAAC,C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AAE,EAAE;cACF,IAAI,EAAE,MAAM;cACZ,OAAO,EAAE,KAAK;WACf;OACF;MAED,MAAM,EAAE,CAAC,aAAa,EAAE,mBAAmB,CAAC;MAE5C,MAAM;;UACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;;cAEP,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK;cACnC,KAAK,EAAE;kBACL,UAAU,EAAE,QAAQ;eACrB;cACD,wBAAwB,EAAE,EAAE;;cAE5B,WAAW,EAAE,IAAI,CAAC,WAAW;WAC9B,EACD,MAAA,MAAA,IAAI,CAAC,MAAM,EAAC,OAAO,kDAAI,CACxB,CAAA;OACF;GACF;;QCzBY,eAAe,GAAGL,mBAAe,CAAC;MAC7C,KAAK,EAAE;UACL,EAAE,EAAE;cACF,IAAI,EAAE,MAAM;cACZ,OAAO,EAAE,KAAK;WACf;OACF;MAED,MAAM;UACJ,OAAOK,KAAC,CACN,IAAI,CAAC,EAAE,EAAE;cACP,KAAK,EAAE;kBACL,UAAU,EAAE,UAAU;eACvB;cACD,wBAAwB,EAAE,EAAE;WAC7B,CACF,CAAA;OACF;GACF;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/vue-3",
|
|
3
3
|
"description": "Vue components for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.89",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -28,15 +28,16 @@
|
|
|
28
28
|
"vue": "^3.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tiptap/extension-bubble-menu": "^2.0.0-beta.
|
|
32
|
-
"@tiptap/extension-floating-menu": "^2.0.0-beta.
|
|
31
|
+
"@tiptap/extension-bubble-menu": "^2.0.0-beta.54",
|
|
32
|
+
"@tiptap/extension-floating-menu": "^2.0.0-beta.49",
|
|
33
33
|
"prosemirror-state": "^1.3.4",
|
|
34
|
-
"prosemirror-view": "^1.23.
|
|
34
|
+
"prosemirror-view": "^1.23.5"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
38
|
"url": "https://github.com/ueberdosis/tiptap",
|
|
39
39
|
"directory": "packages/vue-3"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"gitHead": "9e48f8c23960198b166b23804c094f2ddccc3927"
|
|
42
43
|
}
|
package/src/useEditor.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
onMounted,
|
|
3
|
-
onBeforeUnmount,
|
|
4
|
-
shallowRef,
|
|
5
|
-
Ref,
|
|
6
|
-
} from 'vue'
|
|
1
|
+
import { onMounted, onBeforeUnmount, shallowRef } from 'vue'
|
|
7
2
|
import { EditorOptions } from '@tiptap/core'
|
|
8
3
|
import { Editor } from './Editor'
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const editor = shallowRef<Editor>() as Ref<Editor>
|
|
5
|
+
export const useEditor = (options: Partial<EditorOptions> = {}) => {
|
|
6
|
+
const editor = shallowRef<Editor>()
|
|
13
7
|
|
|
14
8
|
onMounted(() => {
|
|
15
9
|
editor.value = new Editor(options)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
-
import { Editor } from './Editor';
|
|
3
|
-
import { SingleCommands, ChainedCommands, CanCommands, AnyCommands, CommandProps } from './types';
|
|
4
|
-
export declare class CommandManager {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
rawCommands: AnyCommands;
|
|
7
|
-
customState?: EditorState;
|
|
8
|
-
constructor(props: {
|
|
9
|
-
editor: Editor;
|
|
10
|
-
state?: EditorState;
|
|
11
|
-
});
|
|
12
|
-
get hasCustomState(): boolean;
|
|
13
|
-
get state(): EditorState;
|
|
14
|
-
get commands(): SingleCommands;
|
|
15
|
-
get chain(): () => ChainedCommands;
|
|
16
|
-
get can(): () => CanCommands;
|
|
17
|
-
createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
|
|
18
|
-
createCan(startTr?: Transaction): CanCommands;
|
|
19
|
-
buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
|
|
20
|
-
}
|