@blade-hq/agent-react 2612.0.0-beta.1 → 2612.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/chat/ChatPanel.d.ts +1 -3
- package/dist/chat/LightComposer.d.ts +1 -1
- package/dist/chat/LiteMessageList.d.ts +1 -1
- package/dist/chat/MessageList.d.ts +1 -0
- package/dist/chat/WorkflowRunBlock.d.ts +19 -3
- package/dist/chat/ai-elements/reasoning.d.ts +4 -4
- package/dist/chat/customization.d.ts +1 -5
- package/dist/chat/index.d.ts +1 -4
- package/dist/chat/lib/citations.d.ts +5 -22
- package/dist/chat/markdown/MarkdownContent.d.ts +3 -0
- package/dist/chat/runtime/actions.d.ts +2 -1
- package/dist/chat/runtime/composer-channels.d.ts +4 -0
- package/dist/chat/runtime/input-cache-reset.d.ts +1 -1
- package/dist/chat/runtime/input-history-storage.d.ts +2 -0
- package/dist/chat/runtime/input-services.d.ts +0 -6
- package/dist/{chunk-FQQJP2GJ.js → chunk-7TQVTNPL.js} +780 -819
- package/dist/chunk-7TQVTNPL.js.map +1 -0
- package/dist/{chunk-WCMGQJLE.js → chunk-EYRP6PV3.js} +2 -2
- package/dist/{chunk-6ZDOQEWK.js → chunk-JVM2WTTS.js} +898 -638
- package/dist/chunk-JVM2WTTS.js.map +1 -0
- package/dist/components/ChatInput.d.ts +3 -1
- package/dist/components/TopicAssetSubmitDialog.d.ts +14 -0
- package/dist/components/plugin-connector.d.ts +1 -0
- package/dist/embed/entry.d.ts +2 -0
- package/dist/host.d.ts +0 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -4
- package/dist/internal.d.ts +3 -0
- package/dist/internal.js +9 -3
- package/dist/internal.js.map +1 -1
- package/dist/lib/agent-computer-command.d.ts +1 -3
- package/dist/rich-input/ChatInput.d.ts +1 -1
- package/dist/rich-input/FileCompletionMenu.d.ts +6 -9
- package/dist/rich-input/SkillStatusBar.d.ts +2 -4
- package/dist/rich-input/extensions/plugin-mention.d.ts +15 -0
- package/dist/rich-input/extensions/skill-mention.d.ts +3 -21
- package/dist/rich-input/extensions/topic-asset-mention.d.ts +13 -0
- package/dist/rich-input/index.d.ts +6 -3
- package/dist/rich-input/lib/composer-content.d.ts +11 -21
- package/dist/rich-input/lib/input-history-document.d.ts +3 -0
- package/dist/rich-input/lib/plugin-suggestions.d.ts +7 -0
- package/dist/rich-input/lib/reference-candidates.d.ts +27 -0
- package/dist/rich-input/lib/skill-suggestions.d.ts +1 -1
- package/dist/rich-input/lib/topic-asset-suggestions.d.ts +6 -0
- package/dist/rich-input/services.d.ts +2 -3
- package/dist/rich-input/use-input-history.d.ts +8 -8
- package/dist/rich-input/use-reference-candidates.d.ts +8 -0
- package/dist/rich-input.js +6409 -6351
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +1 -1
- package/node_modules/@floating-ui/core/LICENSE +20 -0
- package/node_modules/@floating-ui/core/README.md +4 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs +1 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs +1184 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +531 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +531 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.esm.js +1058 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +1058 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.js +1203 -0
- package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.min.js +1 -0
- package/node_modules/@floating-ui/core/package.json +63 -0
- package/node_modules/@floating-ui/dom/LICENSE +20 -0
- package/node_modules/@floating-ui/dom/README.md +4 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs +1 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs +956 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts +358 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.ts +358 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js +781 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +781 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.js +975 -0
- package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.min.js +1 -0
- package/node_modules/@floating-ui/dom/package.json +71 -0
- package/node_modules/@floating-ui/utils/LICENSE +20 -0
- package/node_modules/@floating-ui/utils/README.md +4 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +103 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +103 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.esm.js +165 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +165 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.js +192 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js +1 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.esm.js +136 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +136 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.js +167 -0
- package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.min.js +1 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.esm.js +165 -0
- package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.umd.js +192 -0
- package/node_modules/@floating-ui/utils/dom/package.json +6 -0
- package/node_modules/@floating-ui/utils/package.json +70 -0
- package/node_modules/@radix-ui/primitive/LICENSE +21 -0
- package/node_modules/@radix-ui/primitive/README.md +3 -0
- package/node_modules/@radix-ui/primitive/dist/index.d.mts +20 -0
- package/node_modules/@radix-ui/primitive/dist/index.d.ts +20 -0
- package/node_modules/@radix-ui/primitive/dist/index.js +76 -0
- package/node_modules/@radix-ui/primitive/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/primitive/dist/index.mjs +53 -0
- package/node_modules/@radix-ui/primitive/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/primitive/package.json +47 -0
- package/node_modules/@radix-ui/react-collapsible/LICENSE +21 -0
- package/node_modules/@radix-ui/react-collapsible/README.md +3 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.d.mts +33 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.d.ts +33 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.js +187 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.mjs +155 -0
- package/node_modules/@radix-ui/react-collapsible/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-collapsible/package.json +75 -0
- package/node_modules/@radix-ui/react-compose-refs/README.md +13 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.d.mts +15 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.d.ts +15 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.js +74 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +41 -0
- package/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-compose-refs/package.json +75 -0
- package/node_modules/@radix-ui/react-context/README.md +13 -0
- package/node_modules/@radix-ui/react-context/dist/index.d.mts +21 -0
- package/node_modules/@radix-ui/react-context/dist/index.d.ts +21 -0
- package/node_modules/@radix-ui/react-context/dist/index.js +114 -0
- package/node_modules/@radix-ui/react-context/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-context/dist/index.mjs +81 -0
- package/node_modules/@radix-ui/react-context/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-context/package.json +75 -0
- package/node_modules/@radix-ui/react-id/README.md +13 -0
- package/node_modules/@radix-ui/react-id/dist/index.d.mts +3 -0
- package/node_modules/@radix-ui/react-id/dist/index.d.ts +3 -0
- package/node_modules/@radix-ui/react-id/dist/index.js +49 -0
- package/node_modules/@radix-ui/react-id/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-id/dist/index.mjs +16 -0
- package/node_modules/@radix-ui/react-id/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-id/package.json +78 -0
- package/node_modules/@radix-ui/react-presence/LICENSE +21 -0
- package/node_modules/@radix-ui/react-presence/README.md +3 -0
- package/node_modules/@radix-ui/react-presence/dist/index.d.mts +12 -0
- package/node_modules/@radix-ui/react-presence/dist/index.d.ts +12 -0
- package/node_modules/@radix-ui/react-presence/dist/index.js +171 -0
- package/node_modules/@radix-ui/react-presence/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-presence/dist/index.mjs +139 -0
- package/node_modules/@radix-ui/react-presence/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-presence/package.json +69 -0
- package/node_modules/@radix-ui/react-primitive/LICENSE +21 -0
- package/node_modules/@radix-ui/react-primitive/README.md +3 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.d.mts +52 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.d.ts +52 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.js +80 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.mjs +47 -0
- package/node_modules/@radix-ui/react-primitive/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-primitive/package.json +68 -0
- package/node_modules/@radix-ui/react-slot/LICENSE +21 -0
- package/node_modules/@radix-ui/react-slot/README.md +3 -0
- package/node_modules/@radix-ui/react-slot/dist/index.d.mts +17 -0
- package/node_modules/@radix-ui/react-slot/dist/index.d.ts +17 -0
- package/node_modules/@radix-ui/react-slot/dist/index.js +138 -0
- package/node_modules/@radix-ui/react-slot/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-slot/dist/index.mjs +105 -0
- package/node_modules/@radix-ui/react-slot/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-slot/package.json +63 -0
- package/node_modules/@radix-ui/react-use-controllable-state/LICENSE +21 -0
- package/node_modules/@radix-ui/react-use-controllable-state/README.md +3 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.d.mts +40 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.d.ts +40 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +169 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +136 -0
- package/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-use-controllable-state/package.json +64 -0
- package/node_modules/@radix-ui/react-use-effect-event/LICENSE +21 -0
- package/node_modules/@radix-ui/react-use-effect-event/README.md +5 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.d.mts +8 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.d.ts +8 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.js +60 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs +27 -0
- package/node_modules/@radix-ui/react-use-effect-event/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-use-effect-event/package.json +65 -0
- package/node_modules/@radix-ui/react-use-effect-event/src/index.ts +1 -0
- package/node_modules/@radix-ui/react-use-effect-event/src/use-effect-event.tsx +36 -0
- package/node_modules/@radix-ui/react-use-layout-effect/README.md +13 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.d.mts +12 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.d.ts +12 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +41 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +7 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +8 -0
- package/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.map +7 -0
- package/node_modules/@radix-ui/react-use-layout-effect/package.json +75 -0
- package/node_modules/@remirror/core-constants/LICENSE +21 -0
- package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.cts +612 -0
- package/node_modules/@remirror/core-constants/dist/_tsup-dts-rollup.d.ts +612 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.cjs +314 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.cts +20 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.d.ts +20 -0
- package/node_modules/@remirror/core-constants/dist/remirror-core-constants.js +269 -0
- package/node_modules/@remirror/core-constants/dist-types/core-constants.d.ts +431 -0
- package/node_modules/@remirror/core-constants/dist-types/error-constants.d.ts +119 -0
- package/node_modules/@remirror/core-constants/dist-types/index.d.ts +2 -0
- package/node_modules/@remirror/core-constants/dist-types/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@remirror/core-constants/package.json +45 -0
- package/node_modules/@remirror/core-constants/readme.md +17 -0
- package/node_modules/@tiptap/core/LICENSE.md +21 -0
- package/node_modules/@tiptap/core/README.md +18 -0
- package/node_modules/@tiptap/core/dist/index.cjs +7126 -0
- package/node_modules/@tiptap/core/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/core/dist/index.d.cts +4954 -0
- package/node_modules/@tiptap/core/dist/index.d.ts +4954 -0
- package/node_modules/@tiptap/core/dist/index.js +6992 -0
- package/node_modules/@tiptap/core/dist/index.js.map +1 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs +56 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs.map +1 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts +23 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts +23 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +26 -0
- package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.cjs +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.cts +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.ts +1 -0
- package/node_modules/@tiptap/core/jsx-dev-runtime/index.js +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.cjs +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.d.cts +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.d.ts +1 -0
- package/node_modules/@tiptap/core/jsx-runtime/index.js +1 -0
- package/node_modules/@tiptap/core/package.json +70 -0
- package/node_modules/@tiptap/core/src/CommandManager.ts +138 -0
- package/node_modules/@tiptap/core/src/Editor.ts +806 -0
- package/node_modules/@tiptap/core/src/EventEmitter.ts +58 -0
- package/node_modules/@tiptap/core/src/Extendable.ts +602 -0
- package/node_modules/@tiptap/core/src/Extension.ts +55 -0
- package/node_modules/@tiptap/core/src/ExtensionManager.ts +440 -0
- package/node_modules/@tiptap/core/src/InputRule.ts +290 -0
- package/node_modules/@tiptap/core/src/Mark.ts +211 -0
- package/node_modules/@tiptap/core/src/MarkView.ts +122 -0
- package/node_modules/@tiptap/core/src/Node.ts +377 -0
- package/node_modules/@tiptap/core/src/NodePos.ts +257 -0
- package/node_modules/@tiptap/core/src/NodeView.ts +339 -0
- package/node_modules/@tiptap/core/src/PasteRule.ts +373 -0
- package/node_modules/@tiptap/core/src/Tracker.ts +36 -0
- package/node_modules/@tiptap/core/src/__tests__/transformPastedHTML.test.ts +575 -0
- package/node_modules/@tiptap/core/src/commands/blur.ts +29 -0
- package/node_modules/@tiptap/core/src/commands/clearContent.ts +25 -0
- package/node_modules/@tiptap/core/src/commands/clearNodes.ts +57 -0
- package/node_modules/@tiptap/core/src/commands/command.ts +22 -0
- package/node_modules/@tiptap/core/src/commands/createParagraphNear.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/cut.ts +36 -0
- package/node_modules/@tiptap/core/src/commands/deleteCurrentNode.ts +44 -0
- package/node_modules/@tiptap/core/src/commands/deleteNode.ts +41 -0
- package/node_modules/@tiptap/core/src/commands/deleteRange.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/deleteSelection.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/enter.ts +19 -0
- package/node_modules/@tiptap/core/src/commands/exitCode.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/extendMarkRange.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/first.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/focus.ts +108 -0
- package/node_modules/@tiptap/core/src/commands/forEach.ts +24 -0
- package/node_modules/@tiptap/core/src/commands/index.ts +57 -0
- package/node_modules/@tiptap/core/src/commands/insertContent.ts +46 -0
- package/node_modules/@tiptap/core/src/commands/insertContentAt.ts +212 -0
- package/node_modules/@tiptap/core/src/commands/join.ts +69 -0
- package/node_modules/@tiptap/core/src/commands/joinItemBackward.ts +37 -0
- package/node_modules/@tiptap/core/src/commands/joinItemForward.ts +37 -0
- package/node_modules/@tiptap/core/src/commands/joinTextblockBackward.ts +20 -0
- package/node_modules/@tiptap/core/src/commands/joinTextblockForward.ts +20 -0
- package/node_modules/@tiptap/core/src/commands/keyboardShortcut.ts +100 -0
- package/node_modules/@tiptap/core/src/commands/lift.ts +34 -0
- package/node_modules/@tiptap/core/src/commands/liftEmptyBlock.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/liftListItem.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/newlineInCode.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/resetAttributes.ts +73 -0
- package/node_modules/@tiptap/core/src/commands/scrollIntoView.ts +23 -0
- package/node_modules/@tiptap/core/src/commands/selectAll.ts +27 -0
- package/node_modules/@tiptap/core/src/commands/selectNodeBackward.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/selectNodeForward.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/selectParentNode.ts +21 -0
- package/node_modules/@tiptap/core/src/commands/selectTextblockEnd.ts +23 -0
- package/node_modules/@tiptap/core/src/commands/selectTextblockStart.ts +23 -0
- package/node_modules/@tiptap/core/src/commands/setContent.ts +76 -0
- package/node_modules/@tiptap/core/src/commands/setMark.ts +118 -0
- package/node_modules/@tiptap/core/src/commands/setMeta.ts +25 -0
- package/node_modules/@tiptap/core/src/commands/setNode.ts +57 -0
- package/node_modules/@tiptap/core/src/commands/setNodeSelection.ts +31 -0
- package/node_modules/@tiptap/core/src/commands/setTextDirection.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/setTextSelection.ts +35 -0
- package/node_modules/@tiptap/core/src/commands/sinkListItem.ts +26 -0
- package/node_modules/@tiptap/core/src/commands/splitBlock.ts +115 -0
- package/node_modules/@tiptap/core/src/commands/splitListItem.ts +149 -0
- package/node_modules/@tiptap/core/src/commands/toggleList.ts +159 -0
- package/node_modules/@tiptap/core/src/commands/toggleMark.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/toggleNode.ts +47 -0
- package/node_modules/@tiptap/core/src/commands/toggleWrap.ts +32 -0
- package/node_modules/@tiptap/core/src/commands/undoInputRule.ts +49 -0
- package/node_modules/@tiptap/core/src/commands/unsetAllMarks.ts +32 -0
- package/node_modules/@tiptap/core/src/commands/unsetMark.ts +65 -0
- package/node_modules/@tiptap/core/src/commands/unsetTextDirection.ts +51 -0
- package/node_modules/@tiptap/core/src/commands/updateAttributes.ts +150 -0
- package/node_modules/@tiptap/core/src/commands/wrapIn.ts +27 -0
- package/node_modules/@tiptap/core/src/commands/wrapInList.ts +27 -0
- package/node_modules/@tiptap/core/src/extensions/clipboardTextSerializer.ts +44 -0
- package/node_modules/@tiptap/core/src/extensions/commands.ts +14 -0
- package/node_modules/@tiptap/core/src/extensions/delete.ts +89 -0
- package/node_modules/@tiptap/core/src/extensions/drop.ts +26 -0
- package/node_modules/@tiptap/core/src/extensions/editable.ts +18 -0
- package/node_modules/@tiptap/core/src/extensions/focusEvents.ts +41 -0
- package/node_modules/@tiptap/core/src/extensions/index.ts +10 -0
- package/node_modules/@tiptap/core/src/extensions/keymap.ts +160 -0
- package/node_modules/@tiptap/core/src/extensions/paste.ts +25 -0
- package/node_modules/@tiptap/core/src/extensions/tabindex.ts +18 -0
- package/node_modules/@tiptap/core/src/extensions/textDirection.ts +86 -0
- package/node_modules/@tiptap/core/src/helpers/MappablePosition.ts +66 -0
- package/node_modules/@tiptap/core/src/helpers/combineTransactionSteps.ts +21 -0
- package/node_modules/@tiptap/core/src/helpers/createChainableState.ts +39 -0
- package/node_modules/@tiptap/core/src/helpers/createDocument.ts +24 -0
- package/node_modules/@tiptap/core/src/helpers/createNodeFromContent.ts +119 -0
- package/node_modules/@tiptap/core/src/helpers/defaultBlockAt.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/findChildren.ts +24 -0
- package/node_modules/@tiptap/core/src/helpers/findChildrenInRange.ts +36 -0
- package/node_modules/@tiptap/core/src/helpers/findParentNode.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/findParentNodeClosestToPos.ts +37 -0
- package/node_modules/@tiptap/core/src/helpers/flattenExtensions.ts +30 -0
- package/node_modules/@tiptap/core/src/helpers/generateHTML.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/generateJSON.ts +18 -0
- package/node_modules/@tiptap/core/src/helpers/generateText.ts +34 -0
- package/node_modules/@tiptap/core/src/helpers/getAttributes.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/getAttributesFromExtensions.ts +122 -0
- package/node_modules/@tiptap/core/src/helpers/getChangedRanges.ts +85 -0
- package/node_modules/@tiptap/core/src/helpers/getDebugJSON.ts +54 -0
- package/node_modules/@tiptap/core/src/helpers/getExtensionField.ts +32 -0
- package/node_modules/@tiptap/core/src/helpers/getHTMLFromFragment.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/getMarkAttributes.ts +30 -0
- package/node_modules/@tiptap/core/src/helpers/getMarkRange.ts +90 -0
- package/node_modules/@tiptap/core/src/helpers/getMarkType.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/getMarksBetween.ts +44 -0
- package/node_modules/@tiptap/core/src/helpers/getNodeAtPosition.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/getNodeAttributes.ts +22 -0
- package/node_modules/@tiptap/core/src/helpers/getNodeType.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/getRenderedAttributes.ts +23 -0
- package/node_modules/@tiptap/core/src/helpers/getSchema.ts +12 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaByResolvedExtensions.ts +183 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaTypeByName.ts +11 -0
- package/node_modules/@tiptap/core/src/helpers/getSchemaTypeNameByName.ts +19 -0
- package/node_modules/@tiptap/core/src/helpers/getSplittedAttributes.ts +28 -0
- package/node_modules/@tiptap/core/src/helpers/getText.ts +28 -0
- package/node_modules/@tiptap/core/src/helpers/getTextBetween.ts +52 -0
- package/node_modules/@tiptap/core/src/helpers/getTextContentFromNodes.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/getTextSerializersFromSchema.ts +16 -0
- package/node_modules/@tiptap/core/src/helpers/index.ts +55 -0
- package/node_modules/@tiptap/core/src/helpers/injectExtensionAttributesToParseRule.ts +47 -0
- package/node_modules/@tiptap/core/src/helpers/isActive.ts +23 -0
- package/node_modules/@tiptap/core/src/helpers/isAtEndOfNode.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/isAtStartOfNode.ts +11 -0
- package/node_modules/@tiptap/core/src/helpers/isExtensionRulesEnabled.ts +13 -0
- package/node_modules/@tiptap/core/src/helpers/isList.ts +27 -0
- package/node_modules/@tiptap/core/src/helpers/isMarkActive.ts +94 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeActive.ts +51 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeEmpty.ts +62 -0
- package/node_modules/@tiptap/core/src/helpers/isNodeSelection.ts +5 -0
- package/node_modules/@tiptap/core/src/helpers/isTextSelection.ts +5 -0
- package/node_modules/@tiptap/core/src/helpers/posToDOMRect.ts +35 -0
- package/node_modules/@tiptap/core/src/helpers/resolveExtensions.ts +25 -0
- package/node_modules/@tiptap/core/src/helpers/resolveFocusPosition.ts +31 -0
- package/node_modules/@tiptap/core/src/helpers/rewriteUnknownContent.ts +149 -0
- package/node_modules/@tiptap/core/src/helpers/selectionToInsertionEnd.ts +29 -0
- package/node_modules/@tiptap/core/src/helpers/sortExtensions.ts +26 -0
- package/node_modules/@tiptap/core/src/helpers/splitExtensions.ts +16 -0
- package/node_modules/@tiptap/core/src/index.ts +28 -0
- package/node_modules/@tiptap/core/src/inputRules/index.ts +5 -0
- package/node_modules/@tiptap/core/src/inputRules/markInputRule.ts +68 -0
- package/node_modules/@tiptap/core/src/inputRules/nodeInputRule.ts +73 -0
- package/node_modules/@tiptap/core/src/inputRules/textInputRule.ts +35 -0
- package/node_modules/@tiptap/core/src/inputRules/textblockTypeInputRule.ts +35 -0
- package/node_modules/@tiptap/core/src/inputRules/wrappingInputRule.ts +82 -0
- package/node_modules/@tiptap/core/src/jsx-runtime.ts +65 -0
- package/node_modules/@tiptap/core/src/lib/ResizableNodeView.ts +1060 -0
- package/node_modules/@tiptap/core/src/lib/index.ts +1 -0
- package/node_modules/@tiptap/core/src/pasteRules/index.ts +3 -0
- package/node_modules/@tiptap/core/src/pasteRules/markPasteRule.ts +71 -0
- package/node_modules/@tiptap/core/src/pasteRules/nodePasteRule.ts +44 -0
- package/node_modules/@tiptap/core/src/pasteRules/textPasteRule.ts +34 -0
- package/node_modules/@tiptap/core/src/style.ts +71 -0
- package/node_modules/@tiptap/core/src/types.ts +1058 -0
- package/node_modules/@tiptap/core/src/utilities/callOrReturn.ts +21 -0
- package/node_modules/@tiptap/core/src/utilities/canInsertNode.ts +30 -0
- package/node_modules/@tiptap/core/src/utilities/createStyleTag.ts +21 -0
- package/node_modules/@tiptap/core/src/utilities/deleteProps.ts +16 -0
- package/node_modules/@tiptap/core/src/utilities/elementFromString.ts +27 -0
- package/node_modules/@tiptap/core/src/utilities/escapeForRegEx.ts +4 -0
- package/node_modules/@tiptap/core/src/utilities/findDuplicates.ts +8 -0
- package/node_modules/@tiptap/core/src/utilities/fromString.ts +19 -0
- package/node_modules/@tiptap/core/src/utilities/index.ts +26 -0
- package/node_modules/@tiptap/core/src/utilities/isAndroid.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isEmptyObject.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isFirefox.ts +11 -0
- package/node_modules/@tiptap/core/src/utilities/isFunction.ts +4 -0
- package/node_modules/@tiptap/core/src/utilities/isMacOS.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isNumber.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isPlainObject.ts +13 -0
- package/node_modules/@tiptap/core/src/utilities/isRegExp.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isSafari.ts +11 -0
- package/node_modules/@tiptap/core/src/utilities/isString.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/isiOS.ts +7 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/attributeUtils.ts +130 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/createAtomBlockMarkdownSpec.ts +141 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/createBlockMarkdownSpec.ts +225 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/createInlineMarkdownSpec.ts +282 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/index.ts +13 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/parseIndentedBlocks.ts +194 -0
- package/node_modules/@tiptap/core/src/utilities/markdown/renderNestedMarkdownContent.ts +96 -0
- package/node_modules/@tiptap/core/src/utilities/mergeAttributes.ts +109 -0
- package/node_modules/@tiptap/core/src/utilities/mergeDeep.ts +17 -0
- package/node_modules/@tiptap/core/src/utilities/minMax.ts +3 -0
- package/node_modules/@tiptap/core/src/utilities/objectIncludes.ts +30 -0
- package/node_modules/@tiptap/core/src/utilities/removeDuplicates.ts +13 -0
- package/node_modules/@tiptap/extension-bubble-menu/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-bubble-menu/README.md +18 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs +462 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts +169 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts +169 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js +443 -0
- package/node_modules/@tiptap/extension-bubble-menu/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-bubble-menu/package.json +54 -0
- package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu-plugin.ts +650 -0
- package/node_modules/@tiptap/extension-bubble-menu/src/bubble-menu.ts +50 -0
- package/node_modules/@tiptap/extension-bubble-menu/src/index.ts +6 -0
- package/node_modules/@tiptap/extension-floating-menu/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-floating-menu/README.md +18 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs +380 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts +179 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts +179 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js +361 -0
- package/node_modules/@tiptap/extension-floating-menu/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-floating-menu/package.json +53 -0
- package/node_modules/@tiptap/extension-floating-menu/src/floating-menu-plugin.ts +525 -0
- package/node_modules/@tiptap/extension-floating-menu/src/floating-menu.ts +77 -0
- package/node_modules/@tiptap/extension-floating-menu/src/index.ts +6 -0
- package/node_modules/@tiptap/extension-mention/LICENSE.md +21 -0
- package/node_modules/@tiptap/extension-mention/README.md +18 -0
- package/node_modules/@tiptap/extension-mention/dist/index.cjs +277 -0
- package/node_modules/@tiptap/extension-mention/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/extension-mention/dist/index.d.cts +93 -0
- package/node_modules/@tiptap/extension-mention/dist/index.d.ts +93 -0
- package/node_modules/@tiptap/extension-mention/dist/index.js +250 -0
- package/node_modules/@tiptap/extension-mention/dist/index.js.map +1 -0
- package/node_modules/@tiptap/extension-mention/package.json +52 -0
- package/node_modules/@tiptap/extension-mention/src/index.ts +5 -0
- package/node_modules/@tiptap/extension-mention/src/mention.ts +357 -0
- package/node_modules/@tiptap/extension-mention/src/utils/get-default-suggestion-attributes.ts +89 -0
- package/node_modules/@tiptap/pm/LICENSE.md +21 -0
- package/node_modules/@tiptap/pm/README.md +22 -0
- package/node_modules/@tiptap/pm/changeset/index.ts +1 -0
- package/node_modules/@tiptap/pm/collab/index.ts +1 -0
- package/node_modules/@tiptap/pm/commands/index.ts +1 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.d.cts +18 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.d.ts +18 -0
- package/node_modules/@tiptap/pm/dist/changeset/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/collab/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/collab/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/collab/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/collab/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/commands/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/commands/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/commands/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/commands/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/dropcursor/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/gapcursor/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/history/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/history/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/history/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/history/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/inputrules/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/keymap/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/markdown/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/menu/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/menu/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/menu/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/menu/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/model/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/model/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/model/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/model/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-basic/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/schema-list/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/state/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/state/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/state/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/state/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/tables/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/tables/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/tables/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/tables/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/trailing-node/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/transform/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/transform/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/transform/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/transform/index.js +2 -0
- package/node_modules/@tiptap/pm/dist/view/index.cjs +2 -0
- package/node_modules/@tiptap/pm/dist/view/index.d.cts +1 -0
- package/node_modules/@tiptap/pm/dist/view/index.d.ts +1 -0
- package/node_modules/@tiptap/pm/dist/view/index.js +2 -0
- package/node_modules/@tiptap/pm/dropcursor/index.ts +1 -0
- package/node_modules/@tiptap/pm/gapcursor/index.ts +1 -0
- package/node_modules/@tiptap/pm/history/index.ts +1 -0
- package/node_modules/@tiptap/pm/inputrules/index.ts +1 -0
- package/node_modules/@tiptap/pm/keymap/index.ts +1 -0
- package/node_modules/@tiptap/pm/markdown/index.ts +1 -0
- package/node_modules/@tiptap/pm/menu/index.ts +1 -0
- package/node_modules/@tiptap/pm/model/index.ts +1 -0
- package/node_modules/@tiptap/pm/package.json +211 -0
- package/node_modules/@tiptap/pm/schema-basic/index.ts +1 -0
- package/node_modules/@tiptap/pm/schema-list/index.ts +1 -0
- package/node_modules/@tiptap/pm/state/index.ts +1 -0
- package/node_modules/@tiptap/pm/tables/index.ts +1 -0
- package/node_modules/@tiptap/pm/trailing-node/index.ts +1 -0
- package/node_modules/@tiptap/pm/transform/index.ts +1 -0
- package/node_modules/@tiptap/pm/view/index.ts +1 -0
- package/node_modules/@tiptap/react/LICENSE.md +21 -0
- package/node_modules/@tiptap/react/README.md +18 -0
- package/node_modules/@tiptap/react/dist/index.cjs +1195 -0
- package/node_modules/@tiptap/react/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/react/dist/index.d.cts +534 -0
- package/node_modules/@tiptap/react/dist/index.d.ts +534 -0
- package/node_modules/@tiptap/react/dist/index.js +1131 -0
- package/node_modules/@tiptap/react/dist/index.js.map +1 -0
- package/node_modules/@tiptap/react/dist/menus/index.cjs +499 -0
- package/node_modules/@tiptap/react/dist/menus/index.cjs.map +1 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.cts +19 -0
- package/node_modules/@tiptap/react/dist/menus/index.d.ts +19 -0
- package/node_modules/@tiptap/react/dist/menus/index.js +461 -0
- package/node_modules/@tiptap/react/dist/menus/index.js.map +1 -0
- package/node_modules/@tiptap/react/package.json +76 -0
- package/node_modules/@tiptap/react/src/Context.tsx +60 -0
- package/node_modules/@tiptap/react/src/Editor.ts +13 -0
- package/node_modules/@tiptap/react/src/EditorContent.tsx +229 -0
- package/node_modules/@tiptap/react/src/NodeViewContent.tsx +30 -0
- package/node_modules/@tiptap/react/src/NodeViewWrapper.tsx +27 -0
- package/node_modules/@tiptap/react/src/ReactMarkViewRenderer.tsx +106 -0
- package/node_modules/@tiptap/react/src/ReactNodeViewRenderer.tsx +387 -0
- package/node_modules/@tiptap/react/src/ReactRenderer.tsx +282 -0
- package/node_modules/@tiptap/react/src/Tiptap.tsx +224 -0
- package/node_modules/@tiptap/react/src/index.ts +13 -0
- package/node_modules/@tiptap/react/src/menus/BubbleMenu.spec.ts +174 -0
- package/node_modules/@tiptap/react/src/menus/BubbleMenu.tsx +153 -0
- package/node_modules/@tiptap/react/src/menus/FloatingMenu.spec.ts +164 -0
- package/node_modules/@tiptap/react/src/menus/FloatingMenu.tsx +137 -0
- package/node_modules/@tiptap/react/src/menus/getAutoPluginKey.ts +5 -0
- package/node_modules/@tiptap/react/src/menus/index.ts +2 -0
- package/node_modules/@tiptap/react/src/menus/useMenuElementProps.ts +354 -0
- package/node_modules/@tiptap/react/src/types.ts +6 -0
- package/node_modules/@tiptap/react/src/useEditor.ts +382 -0
- package/node_modules/@tiptap/react/src/useEditorState.ts +173 -0
- package/node_modules/@tiptap/react/src/useReactNodeView.ts +28 -0
- package/node_modules/@tiptap/suggestion/LICENSE.md +21 -0
- package/node_modules/@tiptap/suggestion/README.md +18 -0
- package/node_modules/@tiptap/suggestion/dist/index.cjs +369 -0
- package/node_modules/@tiptap/suggestion/dist/index.cjs.map +1 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.cts +213 -0
- package/node_modules/@tiptap/suggestion/dist/index.d.ts +213 -0
- package/node_modules/@tiptap/suggestion/dist/index.js +339 -0
- package/node_modules/@tiptap/suggestion/dist/index.js.map +1 -0
- package/node_modules/@tiptap/suggestion/package.json +50 -0
- package/node_modules/@tiptap/suggestion/src/__tests__/suggestion.test.ts +127 -0
- package/node_modules/@tiptap/suggestion/src/findSuggestionMatch.ts +79 -0
- package/node_modules/@tiptap/suggestion/src/index.ts +8 -0
- package/node_modules/@tiptap/suggestion/src/suggestion.ts +585 -0
- package/node_modules/@types/linkify-it/LICENSE +21 -0
- package/node_modules/@types/linkify-it/README.md +15 -0
- package/node_modules/@types/linkify-it/build/index.cjs.d.ts +178 -0
- package/node_modules/@types/linkify-it/index.d.mts +174 -0
- package/node_modules/@types/linkify-it/index.d.ts +3 -0
- package/node_modules/@types/linkify-it/package.json +50 -0
- package/node_modules/@types/markdown-it/LICENSE +21 -0
- package/node_modules/@types/markdown-it/README.md +15 -0
- package/node_modules/@types/markdown-it/dist/index.cjs.d.ts +1236 -0
- package/node_modules/@types/markdown-it/dist/markdown-it.d.ts +5 -0
- package/node_modules/@types/markdown-it/dist/markdown-it.min.d.ts +5 -0
- package/node_modules/@types/markdown-it/index.d.mts +1 -0
- package/node_modules/@types/markdown-it/index.d.ts +3 -0
- package/node_modules/@types/markdown-it/lib/common/html_blocks.d.mts +7 -0
- package/node_modules/@types/markdown-it/lib/common/html_re.d.mts +2 -0
- package/node_modules/@types/markdown-it/lib/common/utils.d.mts +62 -0
- package/node_modules/@types/markdown-it/lib/helpers/index.d.mts +5 -0
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_destination.d.mts +7 -0
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_label.d.mts +3 -0
- package/node_modules/@types/markdown-it/lib/helpers/parse_link_title.d.mts +29 -0
- package/node_modules/@types/markdown-it/lib/index.d.mts +404 -0
- package/node_modules/@types/markdown-it/lib/parser_block.d.mts +25 -0
- package/node_modules/@types/markdown-it/lib/parser_core.d.mts +18 -0
- package/node_modules/@types/markdown-it/lib/parser_inline.d.mts +38 -0
- package/node_modules/@types/markdown-it/lib/renderer.d.mts +96 -0
- package/node_modules/@types/markdown-it/lib/ruler.d.mts +158 -0
- package/node_modules/@types/markdown-it/lib/rules_block/state_block.d.mts +124 -0
- package/node_modules/@types/markdown-it/lib/rules_core/state_core.d.mts +18 -0
- package/node_modules/@types/markdown-it/lib/rules_inline/state_inline.d.mts +73 -0
- package/node_modules/@types/markdown-it/lib/token.d.mts +108 -0
- package/node_modules/@types/markdown-it/package.json +54 -0
- package/node_modules/@types/mdurl/LICENSE +21 -0
- package/node_modules/@types/mdurl/README.md +15 -0
- package/node_modules/@types/mdurl/build/index.cjs.d.ts +52 -0
- package/node_modules/@types/mdurl/index.d.mts +6 -0
- package/node_modules/@types/mdurl/index.d.ts +3 -0
- package/node_modules/@types/mdurl/lib/decode.d.mts +10 -0
- package/node_modules/@types/mdurl/lib/encode.d.mts +15 -0
- package/node_modules/@types/mdurl/lib/format.d.mts +3 -0
- package/node_modules/@types/mdurl/lib/parse.d.mts +18 -0
- package/node_modules/@types/mdurl/package.json +36 -0
- package/node_modules/@types/use-sync-external-store/LICENSE +21 -0
- package/node_modules/@types/use-sync-external-store/README.md +15 -0
- package/node_modules/@types/use-sync-external-store/index.d.ts +5 -0
- package/node_modules/@types/use-sync-external-store/package.json +30 -0
- package/node_modules/@types/use-sync-external-store/shim/index.d.ts +1 -0
- package/node_modules/@types/use-sync-external-store/shim/with-selector.d.ts +1 -0
- package/node_modules/@types/use-sync-external-store/with-selector.d.ts +7 -0
- package/node_modules/argparse/LICENSE +254 -0
- package/node_modules/argparse/README.md +84 -0
- package/node_modules/argparse/argparse.js +3707 -0
- package/node_modules/argparse/lib/sub.js +67 -0
- package/node_modules/argparse/lib/textwrap.js +440 -0
- package/node_modules/argparse/package.json +31 -0
- package/node_modules/crelt/LICENSE +19 -0
- package/node_modules/crelt/README.md +23 -0
- package/node_modules/crelt/dist/index.cjs +31 -0
- package/node_modules/crelt/dist/index.d.cts +4 -0
- package/node_modules/crelt/index.d.ts +4 -0
- package/node_modules/crelt/index.js +28 -0
- package/node_modules/crelt/package.json +35 -0
- package/node_modules/crelt/rollup.config.js +13 -0
- package/node_modules/entities/LICENSE +11 -0
- package/node_modules/entities/lib/decode.d.ts +211 -0
- package/node_modules/entities/lib/decode.d.ts.map +1 -0
- package/node_modules/entities/lib/decode.js +536 -0
- package/node_modules/entities/lib/decode.js.map +1 -0
- package/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
- package/node_modules/entities/lib/decode_codepoint.d.ts.map +1 -0
- package/node_modules/entities/lib/decode_codepoint.js +76 -0
- package/node_modules/entities/lib/decode_codepoint.js.map +1 -0
- package/node_modules/entities/lib/encode.d.ts +22 -0
- package/node_modules/entities/lib/encode.d.ts.map +1 -0
- package/node_modules/entities/lib/encode.js +77 -0
- package/node_modules/entities/lib/encode.js.map +1 -0
- package/node_modules/entities/lib/escape.d.ts +43 -0
- package/node_modules/entities/lib/escape.d.ts.map +1 -0
- package/node_modules/entities/lib/escape.js +122 -0
- package/node_modules/entities/lib/escape.js.map +1 -0
- package/node_modules/entities/lib/esm/decode.d.ts +211 -0
- package/node_modules/entities/lib/esm/decode.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/decode.js +496 -0
- package/node_modules/entities/lib/esm/decode.js.map +1 -0
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
- package/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/decode_codepoint.js +71 -0
- package/node_modules/entities/lib/esm/decode_codepoint.js.map +1 -0
- package/node_modules/entities/lib/esm/encode.d.ts +22 -0
- package/node_modules/entities/lib/esm/encode.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/encode.js +69 -0
- package/node_modules/entities/lib/esm/encode.js.map +1 -0
- package/node_modules/entities/lib/esm/escape.d.ts +43 -0
- package/node_modules/entities/lib/esm/escape.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/escape.js +116 -0
- package/node_modules/entities/lib/esm/escape.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.js +7 -0
- package/node_modules/entities/lib/esm/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js +7 -0
- package/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/generated/encode-html.js +10 -0
- package/node_modules/entities/lib/esm/generated/encode-html.js.map +1 -0
- package/node_modules/entities/lib/esm/index.d.ts +96 -0
- package/node_modules/entities/lib/esm/index.d.ts.map +1 -0
- package/node_modules/entities/lib/esm/index.js +99 -0
- package/node_modules/entities/lib/esm/index.js.map +1 -0
- package/node_modules/entities/lib/esm/package.json +1 -0
- package/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
- package/node_modules/entities/lib/generated/decode-data-html.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-html.js +9 -0
- package/node_modules/entities/lib/generated/decode-data-html.js.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
- package/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
- package/node_modules/entities/lib/generated/decode-data-xml.js.map +1 -0
- package/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
- package/node_modules/entities/lib/generated/encode-html.d.ts.map +1 -0
- package/node_modules/entities/lib/generated/encode-html.js +12 -0
- package/node_modules/entities/lib/generated/encode-html.js.map +1 -0
- package/node_modules/entities/lib/index.d.ts +96 -0
- package/node_modules/entities/lib/index.d.ts.map +1 -0
- package/node_modules/entities/lib/index.js +126 -0
- package/node_modules/entities/lib/index.js.map +1 -0
- package/node_modules/entities/package.json +90 -0
- package/node_modules/entities/readme.md +122 -0
- package/node_modules/escape-string-regexp/index.d.ts +18 -0
- package/node_modules/escape-string-regexp/index.js +13 -0
- package/node_modules/escape-string-regexp/license +9 -0
- package/node_modules/escape-string-regexp/package.json +38 -0
- package/node_modules/escape-string-regexp/readme.md +34 -0
- package/node_modules/fast-equals/LICENSE +21 -0
- package/node_modules/fast-equals/README.md +477 -0
- package/node_modules/fast-equals/dist/cjs/comparator.d.cts +60 -0
- package/node_modules/fast-equals/dist/cjs/equals.d.cts +62 -0
- package/node_modules/fast-equals/dist/cjs/index.cjs +653 -0
- package/node_modules/fast-equals/dist/cjs/index.cjs.map +1 -0
- package/node_modules/fast-equals/dist/cjs/index.d.cts +66 -0
- package/node_modules/fast-equals/dist/cjs/internalTypes.d.cts +178 -0
- package/node_modules/fast-equals/dist/cjs/utils.d.cts +33 -0
- package/node_modules/fast-equals/dist/es/comparator.d.mts +60 -0
- package/node_modules/fast-equals/dist/es/equals.d.mts +62 -0
- package/node_modules/fast-equals/dist/es/index.d.mts +66 -0
- package/node_modules/fast-equals/dist/es/index.mjs +642 -0
- package/node_modules/fast-equals/dist/es/index.mjs.map +1 -0
- package/node_modules/fast-equals/dist/es/internalTypes.d.mts +178 -0
- package/node_modules/fast-equals/dist/es/utils.d.mts +33 -0
- package/node_modules/fast-equals/dist/umd/comparator.d.ts +26 -0
- package/node_modules/fast-equals/dist/umd/equals.d.ts +62 -0
- package/node_modules/fast-equals/dist/umd/index.d.ts +47 -0
- package/node_modules/fast-equals/dist/umd/index.js +659 -0
- package/node_modules/fast-equals/dist/umd/index.js.map +1 -0
- package/node_modules/fast-equals/dist/umd/internalTypes.d.ts +159 -0
- package/node_modules/fast-equals/dist/umd/utils.d.ts +28 -0
- package/node_modules/fast-equals/index.d.ts +260 -0
- package/node_modules/fast-equals/package.json +113 -0
- package/node_modules/linkify-it/LICENSE +22 -0
- package/node_modules/linkify-it/README.md +196 -0
- package/node_modules/linkify-it/build/index.cjs.js +832 -0
- package/node_modules/linkify-it/index.mjs +642 -0
- package/node_modules/linkify-it/lib/re.mjs +189 -0
- package/node_modules/linkify-it/package.json +58 -0
- package/node_modules/markdown-it/LICENSE +22 -0
- package/node_modules/markdown-it/README.md +324 -0
- package/node_modules/markdown-it/bin/markdown-it.mjs +107 -0
- package/node_modules/markdown-it/dist/index.cjs.js +5547 -0
- package/node_modules/markdown-it/dist/markdown-it.js +6969 -0
- package/node_modules/markdown-it/dist/markdown-it.min.js +2 -0
- package/node_modules/markdown-it/index.mjs +1 -0
- package/node_modules/markdown-it/lib/common/html_blocks.mjs +67 -0
- package/node_modules/markdown-it/lib/common/html_re.mjs +25 -0
- package/node_modules/markdown-it/lib/common/utils.mjs +304 -0
- package/node_modules/markdown-it/lib/helpers/index.mjs +11 -0
- package/node_modules/markdown-it/lib/helpers/parse_link_destination.mjs +77 -0
- package/node_modules/markdown-it/lib/helpers/parse_link_label.mjs +49 -0
- package/node_modules/markdown-it/lib/helpers/parse_link_title.mjs +66 -0
- package/node_modules/markdown-it/lib/index.mjs +565 -0
- package/node_modules/markdown-it/lib/parser_block.mjs +134 -0
- package/node_modules/markdown-it/lib/parser_core.mjs +62 -0
- package/node_modules/markdown-it/lib/parser_inline.mjs +197 -0
- package/node_modules/markdown-it/lib/presets/commonmark.mjs +88 -0
- package/node_modules/markdown-it/lib/presets/default.mjs +47 -0
- package/node_modules/markdown-it/lib/presets/zero.mjs +70 -0
- package/node_modules/markdown-it/lib/renderer.mjs +322 -0
- package/node_modules/markdown-it/lib/ruler.mjs +340 -0
- package/node_modules/markdown-it/lib/rules_block/blockquote.mjs +209 -0
- package/node_modules/markdown-it/lib/rules_block/code.mjs +30 -0
- package/node_modules/markdown-it/lib/rules_block/fence.mjs +94 -0
- package/node_modules/markdown-it/lib/rules_block/heading.mjs +51 -0
- package/node_modules/markdown-it/lib/rules_block/hr.mjs +40 -0
- package/node_modules/markdown-it/lib/rules_block/html_block.mjs +69 -0
- package/node_modules/markdown-it/lib/rules_block/lheading.mjs +82 -0
- package/node_modules/markdown-it/lib/rules_block/list.mjs +331 -0
- package/node_modules/markdown-it/lib/rules_block/paragraph.mjs +46 -0
- package/node_modules/markdown-it/lib/rules_block/reference.mjs +212 -0
- package/node_modules/markdown-it/lib/rules_block/state_block.mjs +220 -0
- package/node_modules/markdown-it/lib/rules_block/table.mjs +228 -0
- package/node_modules/markdown-it/lib/rules_core/block.mjs +13 -0
- package/node_modules/markdown-it/lib/rules_core/inline.mjs +11 -0
- package/node_modules/markdown-it/lib/rules_core/linkify.mjs +134 -0
- package/node_modules/markdown-it/lib/rules_core/normalize.mjs +17 -0
- package/node_modules/markdown-it/lib/rules_core/replacements.mjs +101 -0
- package/node_modules/markdown-it/lib/rules_core/smartquotes.mjs +193 -0
- package/node_modules/markdown-it/lib/rules_core/state_core.mjs +17 -0
- package/node_modules/markdown-it/lib/rules_core/text_join.mjs +43 -0
- package/node_modules/markdown-it/lib/rules_inline/autolink.mjs +72 -0
- package/node_modules/markdown-it/lib/rules_inline/backticks.mjs +60 -0
- package/node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs +124 -0
- package/node_modules/markdown-it/lib/rules_inline/emphasis.mjs +123 -0
- package/node_modules/markdown-it/lib/rules_inline/entity.mjs +51 -0
- package/node_modules/markdown-it/lib/rules_inline/escape.mjs +69 -0
- package/node_modules/markdown-it/lib/rules_inline/fragments_join.mjs +38 -0
- package/node_modules/markdown-it/lib/rules_inline/html_inline.mjs +50 -0
- package/node_modules/markdown-it/lib/rules_inline/image.mjs +138 -0
- package/node_modules/markdown-it/lib/rules_inline/link.mjs +139 -0
- package/node_modules/markdown-it/lib/rules_inline/linkify.mjs +63 -0
- package/node_modules/markdown-it/lib/rules_inline/newline.mjs +42 -0
- package/node_modules/markdown-it/lib/rules_inline/state_inline.mjs +123 -0
- package/node_modules/markdown-it/lib/rules_inline/strikethrough.mjs +127 -0
- package/node_modules/markdown-it/lib/rules_inline/text.mjs +86 -0
- package/node_modules/markdown-it/lib/token.mjs +191 -0
- package/node_modules/markdown-it/package.json +92 -0
- package/node_modules/mdurl/LICENSE +45 -0
- package/node_modules/mdurl/README.md +102 -0
- package/node_modules/mdurl/build/index.cjs.js +534 -0
- package/node_modules/mdurl/index.mjs +11 -0
- package/node_modules/mdurl/lib/decode.mjs +112 -0
- package/node_modules/mdurl/lib/encode.mjs +89 -0
- package/node_modules/mdurl/lib/format.mjs +21 -0
- package/node_modules/mdurl/lib/parse.mjs +308 -0
- package/node_modules/mdurl/package.json +37 -0
- package/node_modules/orderedmap/LICENSE +19 -0
- package/node_modules/orderedmap/README.md +69 -0
- package/node_modules/orderedmap/dist/index.cjs +139 -0
- package/node_modules/orderedmap/dist/index.d.cts +33 -0
- package/node_modules/orderedmap/dist/index.d.ts +33 -0
- package/node_modules/orderedmap/dist/index.js +137 -0
- package/node_modules/orderedmap/package.json +39 -0
- package/node_modules/prosemirror-changeset/CHANGELOG.md +147 -0
- package/node_modules/prosemirror-changeset/LICENSE +19 -0
- package/node_modules/prosemirror-changeset/README.md +175 -0
- package/node_modules/prosemirror-changeset/dist/index.cjs +585 -0
- package/node_modules/prosemirror-changeset/dist/index.d.cts +186 -0
- package/node_modules/prosemirror-changeset/dist/index.d.ts +186 -0
- package/node_modules/prosemirror-changeset/dist/index.js +715 -0
- package/node_modules/prosemirror-changeset/package.json +40 -0
- package/node_modules/prosemirror-changeset/src/README.md +32 -0
- package/node_modules/prosemirror-changeset/src/change.ts +189 -0
- package/node_modules/prosemirror-changeset/src/changeset.ts +212 -0
- package/node_modules/prosemirror-changeset/src/diff.ts +151 -0
- package/node_modules/prosemirror-changeset/src/simplify.ts +132 -0
- package/node_modules/prosemirror-changeset/test/test-changed-range.ts +48 -0
- package/node_modules/prosemirror-changeset/test/test-changes.ts +211 -0
- package/node_modules/prosemirror-changeset/test/test-diff.ts +69 -0
- package/node_modules/prosemirror-changeset/test/test-merge.ts +56 -0
- package/node_modules/prosemirror-changeset/test/test-simplify.ts +71 -0
- package/node_modules/prosemirror-collab/.tern-project +8 -0
- package/node_modules/prosemirror-collab/CHANGELOG.md +77 -0
- package/node_modules/prosemirror-collab/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-collab/LICENSE +19 -0
- package/node_modules/prosemirror-collab/README.md +28 -0
- package/node_modules/prosemirror-collab/dist/index.cjs +155 -0
- package/node_modules/prosemirror-collab/dist/index.d.cts +60 -0
- package/node_modules/prosemirror-collab/dist/index.d.ts +60 -0
- package/node_modules/prosemirror-collab/dist/index.js +156 -0
- package/node_modules/prosemirror-collab/package.json +40 -0
- package/node_modules/prosemirror-collab/src/README.md +11 -0
- package/node_modules/prosemirror-collab/src/collab.ts +184 -0
- package/node_modules/prosemirror-commands/.tern-project +8 -0
- package/node_modules/prosemirror-commands/CHANGELOG.md +322 -0
- package/node_modules/prosemirror-commands/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-commands/LICENSE +19 -0
- package/node_modules/prosemirror-commands/README.md +28 -0
- package/node_modules/prosemirror-commands/dist/index.cjs +687 -0
- package/node_modules/prosemirror-commands/dist/index.d.cts +215 -0
- package/node_modules/prosemirror-commands/dist/index.d.ts +215 -0
- package/node_modules/prosemirror-commands/dist/index.js +850 -0
- package/node_modules/prosemirror-commands/package.json +39 -0
- package/node_modules/prosemirror-commands/src/README.md +40 -0
- package/node_modules/prosemirror-commands/src/commands.ts +783 -0
- package/node_modules/prosemirror-dropcursor/CHANGELOG.md +137 -0
- package/node_modules/prosemirror-dropcursor/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-dropcursor/LICENSE +19 -0
- package/node_modules/prosemirror-dropcursor/README.md +50 -0
- package/node_modules/prosemirror-dropcursor/dist/index.cjs +185 -0
- package/node_modules/prosemirror-dropcursor/dist/index.d.cts +38 -0
- package/node_modules/prosemirror-dropcursor/dist/index.d.ts +38 -0
- package/node_modules/prosemirror-dropcursor/dist/index.js +146 -0
- package/node_modules/prosemirror-dropcursor/package.json +38 -0
- package/node_modules/prosemirror-dropcursor/src/dropcursor.ts +170 -0
- package/node_modules/prosemirror-gapcursor/CHANGELOG.md +122 -0
- package/node_modules/prosemirror-gapcursor/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-gapcursor/LICENSE +19 -0
- package/node_modules/prosemirror-gapcursor/README.md +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.cjs +239 -0
- package/node_modules/prosemirror-gapcursor/dist/index.d.cts +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.d.ts +31 -0
- package/node_modules/prosemirror-gapcursor/dist/index.js +239 -0
- package/node_modules/prosemirror-gapcursor/package.json +43 -0
- package/node_modules/prosemirror-gapcursor/src/README.md +21 -0
- package/node_modules/prosemirror-gapcursor/src/gapcursor.ts +141 -0
- package/node_modules/prosemirror-gapcursor/src/index.ts +91 -0
- package/node_modules/prosemirror-gapcursor/style/gapcursor.css +25 -0
- package/node_modules/prosemirror-history/.tern-project +8 -0
- package/node_modules/prosemirror-history/CHANGELOG.md +170 -0
- package/node_modules/prosemirror-history/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-history/LICENSE +19 -0
- package/node_modules/prosemirror-history/README.md +27 -0
- package/node_modules/prosemirror-history/dist/index.cjs +382 -0
- package/node_modules/prosemirror-history/dist/index.d.cts +64 -0
- package/node_modules/prosemirror-history/dist/index.d.ts +64 -0
- package/node_modules/prosemirror-history/dist/index.js +453 -0
- package/node_modules/prosemirror-history/package.json +40 -0
- package/node_modules/prosemirror-history/src/README.md +23 -0
- package/node_modules/prosemirror-history/src/history.ts +465 -0
- package/node_modules/prosemirror-inputrules/.tern-project +8 -0
- package/node_modules/prosemirror-inputrules/CHANGELOG.md +127 -0
- package/node_modules/prosemirror-inputrules/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-inputrules/LICENSE +19 -0
- package/node_modules/prosemirror-inputrules/README.md +29 -0
- package/node_modules/prosemirror-inputrules/dist/index.cjs +194 -0
- package/node_modules/prosemirror-inputrules/dist/index.d.cts +131 -0
- package/node_modules/prosemirror-inputrules/dist/index.d.ts +131 -0
- package/node_modules/prosemirror-inputrules/dist/index.js +239 -0
- package/node_modules/prosemirror-inputrules/package.json +36 -0
- package/node_modules/prosemirror-inputrules/src/README.md +23 -0
- package/node_modules/prosemirror-inputrules/src/index.ts +4 -0
- package/node_modules/prosemirror-inputrules/src/inputrules.ts +167 -0
- package/node_modules/prosemirror-inputrules/src/rulebuilders.ts +59 -0
- package/node_modules/prosemirror-inputrules/src/rules.ts +17 -0
- package/node_modules/prosemirror-keymap/.tern-project +8 -0
- package/node_modules/prosemirror-keymap/CHANGELOG.md +104 -0
- package/node_modules/prosemirror-keymap/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-keymap/LICENSE +19 -0
- package/node_modules/prosemirror-keymap/README.md +27 -0
- package/node_modules/prosemirror-keymap/dist/index.cjs +65 -0
- package/node_modules/prosemirror-keymap/dist/index.d.cts +47 -0
- package/node_modules/prosemirror-keymap/dist/index.d.ts +47 -0
- package/node_modules/prosemirror-keymap/dist/index.js +128 -0
- package/node_modules/prosemirror-keymap/package.json +38 -0
- package/node_modules/prosemirror-keymap/src/README.md +5 -0
- package/node_modules/prosemirror-keymap/src/keymap.ts +105 -0
- package/node_modules/prosemirror-markdown/.tern-project +8 -0
- package/node_modules/prosemirror-markdown/CHANGELOG.md +311 -0
- package/node_modules/prosemirror-markdown/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-markdown/LICENSE +19 -0
- package/node_modules/prosemirror-markdown/README.md +276 -0
- package/node_modules/prosemirror-markdown/dist/index.cjs +966 -0
- package/node_modules/prosemirror-markdown/dist/index.d.cts +335 -0
- package/node_modules/prosemirror-markdown/dist/index.d.ts +335 -0
- package/node_modules/prosemirror-markdown/dist/index.js +878 -0
- package/node_modules/prosemirror-markdown/package.json +40 -0
- package/node_modules/prosemirror-markdown/src/README.md +42 -0
- package/node_modules/prosemirror-markdown/src/from_markdown.ts +272 -0
- package/node_modules/prosemirror-markdown/src/index.ts +5 -0
- package/node_modules/prosemirror-markdown/src/schema.ts +156 -0
- package/node_modules/prosemirror-markdown/src/to_markdown.ts +483 -0
- package/node_modules/prosemirror-menu/.tern-project +8 -0
- package/node_modules/prosemirror-menu/CHANGELOG.md +107 -0
- package/node_modules/prosemirror-menu/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-menu/LICENSE +19 -0
- package/node_modules/prosemirror-menu/README.md +235 -0
- package/node_modules/prosemirror-menu/dist/index.cjs +798 -0
- package/node_modules/prosemirror-menu/dist/index.d.cts +281 -0
- package/node_modules/prosemirror-menu/dist/index.d.ts +281 -0
- package/node_modules/prosemirror-menu/dist/index.js +795 -0
- package/node_modules/prosemirror-menu/package.json +42 -0
- package/node_modules/prosemirror-menu/src/README.md +60 -0
- package/node_modules/prosemirror-menu/src/icons.ts +53 -0
- package/node_modules/prosemirror-menu/src/index.ts +4 -0
- package/node_modules/prosemirror-menu/src/menu.ts +628 -0
- package/node_modules/prosemirror-menu/src/menubar.ts +210 -0
- package/node_modules/prosemirror-menu/style/menu.css +169 -0
- package/node_modules/prosemirror-model/.tern-project +8 -0
- package/node_modules/prosemirror-model/CHANGELOG.md +730 -0
- package/node_modules/prosemirror-model/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-model/LICENSE +19 -0
- package/node_modules/prosemirror-model/README.md +29 -0
- package/node_modules/prosemirror-model/dist/index.cjs +2898 -0
- package/node_modules/prosemirror-model/dist/index.d.cts +1679 -0
- package/node_modules/prosemirror-model/dist/index.d.ts +1679 -0
- package/node_modules/prosemirror-model/dist/index.js +3464 -0
- package/node_modules/prosemirror-model/package.json +38 -0
- package/node_modules/prosemirror-model/src/README.md +62 -0
- package/node_modules/prosemirror-model/src/comparedeep.ts +15 -0
- package/node_modules/prosemirror-model/src/content.ts +413 -0
- package/node_modules/prosemirror-model/src/diff.ts +52 -0
- package/node_modules/prosemirror-model/src/dom.ts +1 -0
- package/node_modules/prosemirror-model/src/fragment.ts +268 -0
- package/node_modules/prosemirror-model/src/from_dom.ts +848 -0
- package/node_modules/prosemirror-model/src/index.ts +11 -0
- package/node_modules/prosemirror-model/src/mark.ts +111 -0
- package/node_modules/prosemirror-model/src/node.ts +402 -0
- package/node_modules/prosemirror-model/src/replace.ts +225 -0
- package/node_modules/prosemirror-model/src/resolvedpos.ts +289 -0
- package/node_modules/prosemirror-model/src/schema.ts +705 -0
- package/node_modules/prosemirror-model/src/to_dom.ts +238 -0
- package/node_modules/prosemirror-schema-basic/.tern-project +8 -0
- package/node_modules/prosemirror-schema-basic/CHANGELOG.md +81 -0
- package/node_modules/prosemirror-schema-basic/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-schema-basic/LICENSE +19 -0
- package/node_modules/prosemirror-schema-basic/README.md +28 -0
- package/node_modules/prosemirror-schema-basic/dist/index.cjs +246 -0
- package/node_modules/prosemirror-schema-basic/dist/index.d.cts +87 -0
- package/node_modules/prosemirror-schema-basic/dist/index.d.ts +87 -0
- package/node_modules/prosemirror-schema-basic/dist/index.js +183 -0
- package/node_modules/prosemirror-schema-basic/package.json +37 -0
- package/node_modules/prosemirror-schema-basic/src/README.md +8 -0
- package/node_modules/prosemirror-schema-basic/src/schema-basic.ts +166 -0
- package/node_modules/prosemirror-schema-list/.tern-project +8 -0
- package/node_modules/prosemirror-schema-list/CHANGELOG.md +140 -0
- package/node_modules/prosemirror-schema-list/CONTRIBUTING.md +100 -0
- package/node_modules/prosemirror-schema-list/LICENSE +19 -0
- package/node_modules/prosemirror-schema-list/README.md +28 -0
- package/node_modules/prosemirror-schema-list/dist/index.cjs +253 -0
- package/node_modules/prosemirror-schema-list/dist/index.d.cts +71 -0
- package/node_modules/prosemirror-schema-list/dist/index.d.ts +71 -0
- package/node_modules/prosemirror-schema-list/dist/index.js +289 -0
- package/node_modules/prosemirror-schema-list/package.json +40 -0
- package/node_modules/prosemirror-schema-list/src/README.md +29 -0
- package/node_modules/prosemirror-schema-list/src/schema-list.ts +267 -0
- package/node_modules/prosemirror-state/.tern-project +8 -0
- package/node_modules/prosemirror-state/CHANGELOG.md +296 -0
- package/node_modules/prosemirror-state/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-state/LICENSE +19 -0
- package/node_modules/prosemirror-state/README.md +28 -0
- package/node_modules/prosemirror-state/dist/index.cjs +884 -0
- package/node_modules/prosemirror-state/dist/index.d.cts +709 -0
- package/node_modules/prosemirror-state/dist/index.d.ts +709 -0
- package/node_modules/prosemirror-state/dist/index.js +1002 -0
- package/node_modules/prosemirror-state/package.json +39 -0
- package/node_modules/prosemirror-state/src/README.md +42 -0
- package/node_modules/prosemirror-state/src/index.ts +7 -0
- package/node_modules/prosemirror-state/src/plugin.ts +142 -0
- package/node_modules/prosemirror-state/src/selection.ts +462 -0
- package/node_modules/prosemirror-state/src/state.ts +266 -0
- package/node_modules/prosemirror-state/src/transaction.ts +215 -0
- package/node_modules/prosemirror-tables/LICENSE +19 -0
- package/node_modules/prosemirror-tables/README.md +254 -0
- package/node_modules/prosemirror-tables/dist/index.cjs +2683 -0
- package/node_modules/prosemirror-tables/dist/index.d.cts +751 -0
- package/node_modules/prosemirror-tables/dist/index.d.cts.map +1 -0
- package/node_modules/prosemirror-tables/dist/index.d.ts +751 -0
- package/node_modules/prosemirror-tables/dist/index.d.ts.map +1 -0
- package/node_modules/prosemirror-tables/dist/index.js +2626 -0
- package/node_modules/prosemirror-tables/dist/index.js.map +1 -0
- package/node_modules/prosemirror-tables/package.json +80 -0
- package/node_modules/prosemirror-tables/style/tables.css +48 -0
- package/node_modules/prosemirror-trailing-node/LICENSE +21 -0
- package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.cts +41 -0
- package/node_modules/prosemirror-trailing-node/dist/_tsup-dts-rollup.d.ts +41 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.cjs +70 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.cts +2 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.d.ts +2 -0
- package/node_modules/prosemirror-trailing-node/dist/prosemirror-trailing-node.js +43 -0
- package/node_modules/prosemirror-trailing-node/dist-types/index.d.ts +2 -0
- package/node_modules/prosemirror-trailing-node/dist-types/trailing-node-plugin.d.ts +33 -0
- package/node_modules/prosemirror-trailing-node/dist-types/tsconfig.tsbuildinfo +1 -0
- package/node_modules/prosemirror-trailing-node/package.json +57 -0
- package/node_modules/prosemirror-trailing-node/readme.md +55 -0
- package/node_modules/prosemirror-transform/.tern-project +8 -0
- package/node_modules/prosemirror-transform/CHANGELOG.md +502 -0
- package/node_modules/prosemirror-transform/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-transform/LICENSE +19 -0
- package/node_modules/prosemirror-transform/README.md +29 -0
- package/node_modules/prosemirror-transform/dist/index.cjs +1888 -0
- package/node_modules/prosemirror-transform/dist/index.d.cts +847 -0
- package/node_modules/prosemirror-transform/dist/index.d.ts +847 -0
- package/node_modules/prosemirror-transform/dist/index.js +2181 -0
- package/node_modules/prosemirror-transform/package.json +37 -0
- package/node_modules/prosemirror-transform/src/README.md +59 -0
- package/node_modules/prosemirror-transform/src/attr_step.ts +98 -0
- package/node_modules/prosemirror-transform/src/index.ts +11 -0
- package/node_modules/prosemirror-transform/src/map.ts +284 -0
- package/node_modules/prosemirror-transform/src/mark.ts +106 -0
- package/node_modules/prosemirror-transform/src/mark_step.ts +224 -0
- package/node_modules/prosemirror-transform/src/replace.ts +460 -0
- package/node_modules/prosemirror-transform/src/replace_step.ts +178 -0
- package/node_modules/prosemirror-transform/src/step.ts +97 -0
- package/node_modules/prosemirror-transform/src/structure.ts +349 -0
- package/node_modules/prosemirror-transform/src/transform.ts +271 -0
- package/node_modules/prosemirror-view/.tern-project +8 -0
- package/node_modules/prosemirror-view/CHANGELOG.md +2447 -0
- package/node_modules/prosemirror-view/CONTRIBUTING.md +104 -0
- package/node_modules/prosemirror-view/LICENSE +19 -0
- package/node_modules/prosemirror-view/README.md +28 -0
- package/node_modules/prosemirror-view/dist/index.cjs +5381 -0
- package/node_modules/prosemirror-view/dist/index.d.cts +904 -0
- package/node_modules/prosemirror-view/dist/index.d.ts +904 -0
- package/node_modules/prosemirror-view/dist/index.js +5900 -0
- package/node_modules/prosemirror-view/package.json +43 -0
- package/node_modules/prosemirror-view/src/README.md +38 -0
- package/node_modules/prosemirror-view/src/browser.ts +24 -0
- package/node_modules/prosemirror-view/src/capturekeys.ts +345 -0
- package/node_modules/prosemirror-view/src/clipboard.ts +263 -0
- package/node_modules/prosemirror-view/src/decoration.ts +793 -0
- package/node_modules/prosemirror-view/src/dom.ts +159 -0
- package/node_modules/prosemirror-view/src/domchange.ts +383 -0
- package/node_modules/prosemirror-view/src/domcoords.ts +515 -0
- package/node_modules/prosemirror-view/src/domobserver.ts +392 -0
- package/node_modules/prosemirror-view/src/index.ts +825 -0
- package/node_modules/prosemirror-view/src/input.ts +830 -0
- package/node_modules/prosemirror-view/src/selection.ts +216 -0
- package/node_modules/prosemirror-view/src/viewdesc.ts +1590 -0
- package/node_modules/prosemirror-view/style/prosemirror.css +54 -0
- package/node_modules/punycode.js/LICENSE-MIT.txt +20 -0
- package/node_modules/punycode.js/README.md +148 -0
- package/node_modules/punycode.js/package.json +58 -0
- package/node_modules/punycode.js/punycode.es6.js +444 -0
- package/node_modules/punycode.js/punycode.js +443 -0
- package/node_modules/rope-sequence/LICENSE +19 -0
- package/node_modules/rope-sequence/README.md +63 -0
- package/node_modules/rope-sequence/dist/index.cjs +209 -0
- package/node_modules/rope-sequence/dist/index.d.cts +11 -0
- package/node_modules/rope-sequence/dist/index.d.ts +11 -0
- package/node_modules/rope-sequence/dist/index.js +207 -0
- package/node_modules/rope-sequence/index.js +190 -0
- package/node_modules/rope-sequence/package.json +34 -0
- package/node_modules/rope-sequence/test.js +78 -0
- package/node_modules/uc.micro/LICENSE.txt +20 -0
- package/node_modules/uc.micro/README.md +14 -0
- package/node_modules/uc.micro/build/index.cjs.js +20 -0
- package/node_modules/uc.micro/categories/Cc/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/Cf/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/P/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/S/regex.mjs +1 -0
- package/node_modules/uc.micro/categories/Z/regex.mjs +1 -0
- package/node_modules/uc.micro/index.mjs +8 -0
- package/node_modules/uc.micro/package.json +37 -0
- package/node_modules/uc.micro/properties/Any/regex.mjs +1 -0
- package/node_modules/use-sync-external-store/LICENSE +21 -0
- package/node_modules/use-sync-external-store/README.md +5 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +97 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +85 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +95 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +88 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.js +59 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +66 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +96 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +84 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js +27 -0
- package/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.js +13 -0
- package/node_modules/use-sync-external-store/index.js +7 -0
- package/node_modules/use-sync-external-store/package.json +43 -0
- package/node_modules/use-sync-external-store/shim/index.js +7 -0
- package/node_modules/use-sync-external-store/shim/index.native.js +7 -0
- package/node_modules/use-sync-external-store/shim/with-selector.js +7 -0
- package/node_modules/use-sync-external-store/with-selector.js +7 -0
- package/node_modules/w3c-keyname/.tern-port +1 -0
- package/node_modules/w3c-keyname/LICENSE +19 -0
- package/node_modules/w3c-keyname/README.md +18 -0
- package/node_modules/w3c-keyname/index.cjs +127 -0
- package/node_modules/w3c-keyname/index.d.cts +5 -0
- package/node_modules/w3c-keyname/index.d.ts +5 -0
- package/node_modules/w3c-keyname/index.js +119 -0
- package/node_modules/w3c-keyname/package.json +37 -0
- package/package.json +120 -3
- package/public-api.md +23 -2
- package/dist/chat/tool-renderers/KbSearchRenderer.d.ts +0 -2
- package/dist/chat/tool-renderers/kb-search-result.d.ts +0 -19
- package/dist/chunk-6ZDOQEWK.js.map +0 -1
- package/dist/chunk-FQQJP2GJ.js.map +0 -1
- package/dist/rich-input/extensions/kb-mention.d.ts +0 -18
- package/dist/rich-input/extensions/workflow-mention.d.ts +0 -10
- package/dist/rich-input/lib/kb-suggestions.d.ts +0 -37
- /package/dist/{chunk-WCMGQJLE.js.map → chunk-EYRP6PV3.js.map} +0 -0
|
@@ -0,0 +1,1888 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
4
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
5
|
+
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
6
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
10
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
var prosemirrorModel = require('prosemirror-model');
|
|
20
|
+
var lower16 = 0xffff;
|
|
21
|
+
var factor16 = Math.pow(2, 16);
|
|
22
|
+
function makeRecover(index, offset) {
|
|
23
|
+
return index + offset * factor16;
|
|
24
|
+
}
|
|
25
|
+
function recoverIndex(value) {
|
|
26
|
+
return value & lower16;
|
|
27
|
+
}
|
|
28
|
+
function recoverOffset(value) {
|
|
29
|
+
return (value - (value & lower16)) / factor16;
|
|
30
|
+
}
|
|
31
|
+
var DEL_BEFORE = 1,
|
|
32
|
+
DEL_AFTER = 2,
|
|
33
|
+
DEL_ACROSS = 4,
|
|
34
|
+
DEL_SIDE = 8;
|
|
35
|
+
var MapResult = function () {
|
|
36
|
+
function MapResult(pos, delInfo, recover) {
|
|
37
|
+
_classCallCheck(this, MapResult);
|
|
38
|
+
this.pos = pos;
|
|
39
|
+
this.delInfo = delInfo;
|
|
40
|
+
this.recover = recover;
|
|
41
|
+
}
|
|
42
|
+
_createClass(MapResult, [{
|
|
43
|
+
key: "deleted",
|
|
44
|
+
get: function get() {
|
|
45
|
+
return (this.delInfo & DEL_SIDE) > 0;
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
48
|
+
key: "deletedBefore",
|
|
49
|
+
get: function get() {
|
|
50
|
+
return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "deletedAfter",
|
|
54
|
+
get: function get() {
|
|
55
|
+
return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "deletedAcross",
|
|
59
|
+
get: function get() {
|
|
60
|
+
return (this.delInfo & DEL_ACROSS) > 0;
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
return MapResult;
|
|
64
|
+
}();
|
|
65
|
+
var StepMap = function () {
|
|
66
|
+
function StepMap(ranges) {
|
|
67
|
+
var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
68
|
+
_classCallCheck(this, StepMap);
|
|
69
|
+
this.ranges = ranges;
|
|
70
|
+
this.inverted = inverted;
|
|
71
|
+
if (!ranges.length && StepMap.empty) return StepMap.empty;
|
|
72
|
+
}
|
|
73
|
+
_createClass(StepMap, [{
|
|
74
|
+
key: "recover",
|
|
75
|
+
value: function recover(value) {
|
|
76
|
+
var diff = 0,
|
|
77
|
+
index = recoverIndex(value);
|
|
78
|
+
if (!this.inverted) for (var i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
|
|
79
|
+
return this.ranges[index * 3] + diff + recoverOffset(value);
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "mapResult",
|
|
83
|
+
value: function mapResult(pos) {
|
|
84
|
+
var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
85
|
+
return this._map(pos, assoc, false);
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "map",
|
|
89
|
+
value: function map(pos) {
|
|
90
|
+
var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
91
|
+
return this._map(pos, assoc, true);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "_map",
|
|
95
|
+
value: function _map(pos, assoc, simple) {
|
|
96
|
+
var diff = 0,
|
|
97
|
+
oldIndex = this.inverted ? 2 : 1,
|
|
98
|
+
newIndex = this.inverted ? 1 : 2;
|
|
99
|
+
for (var i = 0; i < this.ranges.length; i += 3) {
|
|
100
|
+
var start = this.ranges[i] - (this.inverted ? diff : 0);
|
|
101
|
+
if (start > pos) break;
|
|
102
|
+
var oldSize = this.ranges[i + oldIndex],
|
|
103
|
+
newSize = this.ranges[i + newIndex],
|
|
104
|
+
end = start + oldSize;
|
|
105
|
+
if (pos <= end) {
|
|
106
|
+
var side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
|
|
107
|
+
var result = start + diff + (side < 0 ? 0 : newSize);
|
|
108
|
+
if (simple) return result;
|
|
109
|
+
var recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
|
|
110
|
+
var del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
|
|
111
|
+
if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
|
|
112
|
+
return new MapResult(result, del, recover);
|
|
113
|
+
}
|
|
114
|
+
diff += newSize - oldSize;
|
|
115
|
+
}
|
|
116
|
+
return simple ? pos + diff : new MapResult(pos + diff, 0, null);
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: "touches",
|
|
120
|
+
value: function touches(pos, recover) {
|
|
121
|
+
var diff = 0,
|
|
122
|
+
index = recoverIndex(recover);
|
|
123
|
+
var oldIndex = this.inverted ? 2 : 1,
|
|
124
|
+
newIndex = this.inverted ? 1 : 2;
|
|
125
|
+
for (var i = 0; i < this.ranges.length; i += 3) {
|
|
126
|
+
var start = this.ranges[i] - (this.inverted ? diff : 0);
|
|
127
|
+
if (start > pos) break;
|
|
128
|
+
var oldSize = this.ranges[i + oldIndex],
|
|
129
|
+
end = start + oldSize;
|
|
130
|
+
if (pos <= end && i == index * 3) return true;
|
|
131
|
+
diff += this.ranges[i + newIndex] - oldSize;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
key: "forEach",
|
|
137
|
+
value: function forEach(f) {
|
|
138
|
+
var oldIndex = this.inverted ? 2 : 1,
|
|
139
|
+
newIndex = this.inverted ? 1 : 2;
|
|
140
|
+
for (var i = 0, diff = 0; i < this.ranges.length; i += 3) {
|
|
141
|
+
var start = this.ranges[i],
|
|
142
|
+
oldStart = start - (this.inverted ? diff : 0),
|
|
143
|
+
newStart = start + (this.inverted ? 0 : diff);
|
|
144
|
+
var oldSize = this.ranges[i + oldIndex],
|
|
145
|
+
newSize = this.ranges[i + newIndex];
|
|
146
|
+
f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
|
|
147
|
+
diff += newSize - oldSize;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
key: "invert",
|
|
152
|
+
value: function invert() {
|
|
153
|
+
return new StepMap(this.ranges, !this.inverted);
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "toString",
|
|
157
|
+
value: function toString() {
|
|
158
|
+
return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
|
|
159
|
+
}
|
|
160
|
+
}], [{
|
|
161
|
+
key: "offset",
|
|
162
|
+
value: function offset(n) {
|
|
163
|
+
return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);
|
|
164
|
+
}
|
|
165
|
+
}]);
|
|
166
|
+
return StepMap;
|
|
167
|
+
}();
|
|
168
|
+
StepMap.empty = new StepMap([]);
|
|
169
|
+
var Mapping = function () {
|
|
170
|
+
function Mapping(maps, mirror) {
|
|
171
|
+
var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
172
|
+
var to = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : maps ? maps.length : 0;
|
|
173
|
+
_classCallCheck(this, Mapping);
|
|
174
|
+
this.mirror = mirror;
|
|
175
|
+
this.from = from;
|
|
176
|
+
this.to = to;
|
|
177
|
+
this._maps = maps || [];
|
|
178
|
+
this.ownData = !(maps || mirror);
|
|
179
|
+
}
|
|
180
|
+
_createClass(Mapping, [{
|
|
181
|
+
key: "maps",
|
|
182
|
+
get: function get() {
|
|
183
|
+
return this._maps;
|
|
184
|
+
}
|
|
185
|
+
}, {
|
|
186
|
+
key: "slice",
|
|
187
|
+
value: function slice() {
|
|
188
|
+
var from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
189
|
+
var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.maps.length;
|
|
190
|
+
return new Mapping(this._maps, this.mirror, from, to);
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "appendMap",
|
|
194
|
+
value: function appendMap(map, mirrors) {
|
|
195
|
+
if (!this.ownData) {
|
|
196
|
+
this._maps = this._maps.slice();
|
|
197
|
+
this.mirror = this.mirror && this.mirror.slice();
|
|
198
|
+
this.ownData = true;
|
|
199
|
+
}
|
|
200
|
+
this.to = this._maps.push(map);
|
|
201
|
+
if (mirrors != null) this.setMirror(this._maps.length - 1, mirrors);
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "appendMapping",
|
|
205
|
+
value: function appendMapping(mapping) {
|
|
206
|
+
for (var i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
|
|
207
|
+
var mirr = mapping.getMirror(i);
|
|
208
|
+
this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, {
|
|
212
|
+
key: "getMirror",
|
|
213
|
+
value: function getMirror(n) {
|
|
214
|
+
if (this.mirror) for (var i = 0; i < this.mirror.length; i++) if (this.mirror[i] == n) return this.mirror[i + (i % 2 ? -1 : 1)];
|
|
215
|
+
}
|
|
216
|
+
}, {
|
|
217
|
+
key: "setMirror",
|
|
218
|
+
value: function setMirror(n, m) {
|
|
219
|
+
if (!this.mirror) this.mirror = [];
|
|
220
|
+
this.mirror.push(n, m);
|
|
221
|
+
}
|
|
222
|
+
}, {
|
|
223
|
+
key: "appendMappingInverted",
|
|
224
|
+
value: function appendMappingInverted(mapping) {
|
|
225
|
+
for (var i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
|
|
226
|
+
var mirr = mapping.getMirror(i);
|
|
227
|
+
this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
231
|
+
key: "invert",
|
|
232
|
+
value: function invert() {
|
|
233
|
+
var inverse = new Mapping();
|
|
234
|
+
inverse.appendMappingInverted(this);
|
|
235
|
+
return inverse;
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
key: "map",
|
|
239
|
+
value: function map(pos) {
|
|
240
|
+
var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
241
|
+
if (this.mirror) return this._map(pos, assoc, true);
|
|
242
|
+
for (var i = this.from; i < this.to; i++) pos = this._maps[i].map(pos, assoc);
|
|
243
|
+
return pos;
|
|
244
|
+
}
|
|
245
|
+
}, {
|
|
246
|
+
key: "mapResult",
|
|
247
|
+
value: function mapResult(pos) {
|
|
248
|
+
var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
249
|
+
return this._map(pos, assoc, false);
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
key: "_map",
|
|
253
|
+
value: function _map(pos, assoc, simple) {
|
|
254
|
+
var delInfo = 0;
|
|
255
|
+
for (var i = this.from; i < this.to; i++) {
|
|
256
|
+
var map = this._maps[i],
|
|
257
|
+
result = map.mapResult(pos, assoc);
|
|
258
|
+
if (result.recover != null) {
|
|
259
|
+
var corr = this.getMirror(i);
|
|
260
|
+
if (corr != null && corr > i && corr < this.to) {
|
|
261
|
+
i = corr;
|
|
262
|
+
pos = this._maps[corr].recover(result.recover);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
delInfo |= result.delInfo;
|
|
267
|
+
pos = result.pos;
|
|
268
|
+
}
|
|
269
|
+
return simple ? pos : new MapResult(pos, delInfo, null);
|
|
270
|
+
}
|
|
271
|
+
}]);
|
|
272
|
+
return Mapping;
|
|
273
|
+
}();
|
|
274
|
+
var stepsByID = Object.create(null);
|
|
275
|
+
var Step = function () {
|
|
276
|
+
function Step() {
|
|
277
|
+
_classCallCheck(this, Step);
|
|
278
|
+
}
|
|
279
|
+
_createClass(Step, [{
|
|
280
|
+
key: "getMap",
|
|
281
|
+
value: function getMap() {
|
|
282
|
+
return StepMap.empty;
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
key: "merge",
|
|
286
|
+
value: function merge(other) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
}], [{
|
|
290
|
+
key: "fromJSON",
|
|
291
|
+
value: function fromJSON(schema, json) {
|
|
292
|
+
if (!json || !json.stepType) throw new RangeError("Invalid input for Step.fromJSON");
|
|
293
|
+
var type = stepsByID[json.stepType];
|
|
294
|
+
if (!type) throw new RangeError("No step type ".concat(json.stepType, " defined"));
|
|
295
|
+
return type.fromJSON(schema, json);
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "jsonID",
|
|
299
|
+
value: function jsonID(id, stepClass) {
|
|
300
|
+
if (id in stepsByID) throw new RangeError("Duplicate use of step JSON ID " + id);
|
|
301
|
+
stepsByID[id] = stepClass;
|
|
302
|
+
stepClass.prototype.jsonID = id;
|
|
303
|
+
return stepClass;
|
|
304
|
+
}
|
|
305
|
+
}]);
|
|
306
|
+
return Step;
|
|
307
|
+
}();
|
|
308
|
+
var StepResult = function () {
|
|
309
|
+
function StepResult(doc, failed) {
|
|
310
|
+
_classCallCheck(this, StepResult);
|
|
311
|
+
this.doc = doc;
|
|
312
|
+
this.failed = failed;
|
|
313
|
+
}
|
|
314
|
+
_createClass(StepResult, null, [{
|
|
315
|
+
key: "ok",
|
|
316
|
+
value: function ok(doc) {
|
|
317
|
+
return new StepResult(doc, null);
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
key: "fail",
|
|
321
|
+
value: function fail(message) {
|
|
322
|
+
return new StepResult(null, message);
|
|
323
|
+
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "fromReplace",
|
|
326
|
+
value: function fromReplace(doc, from, to, slice) {
|
|
327
|
+
try {
|
|
328
|
+
return StepResult.ok(doc.replace(from, to, slice));
|
|
329
|
+
} catch (e) {
|
|
330
|
+
if (e instanceof prosemirrorModel.ReplaceError) return StepResult.fail(e.message);
|
|
331
|
+
throw e;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}]);
|
|
335
|
+
return StepResult;
|
|
336
|
+
}();
|
|
337
|
+
function mapFragment(fragment, f, parent) {
|
|
338
|
+
var mapped = [];
|
|
339
|
+
for (var i = 0; i < fragment.childCount; i++) {
|
|
340
|
+
var child = fragment.child(i);
|
|
341
|
+
if (child.content.size) child = child.copy(mapFragment(child.content, f, child));
|
|
342
|
+
if (child.isInline) child = f(child, parent, i);
|
|
343
|
+
mapped.push(child);
|
|
344
|
+
}
|
|
345
|
+
return prosemirrorModel.Fragment.fromArray(mapped);
|
|
346
|
+
}
|
|
347
|
+
var AddMarkStep = function (_Step) {
|
|
348
|
+
_inherits(AddMarkStep, _Step);
|
|
349
|
+
var _super = _createSuper(AddMarkStep);
|
|
350
|
+
function AddMarkStep(from, to, mark) {
|
|
351
|
+
var _this;
|
|
352
|
+
_classCallCheck(this, AddMarkStep);
|
|
353
|
+
_this = _super.call(this);
|
|
354
|
+
_this.from = from;
|
|
355
|
+
_this.to = to;
|
|
356
|
+
_this.mark = mark;
|
|
357
|
+
return _this;
|
|
358
|
+
}
|
|
359
|
+
_createClass(AddMarkStep, [{
|
|
360
|
+
key: "apply",
|
|
361
|
+
value: function apply(doc) {
|
|
362
|
+
var _this2 = this;
|
|
363
|
+
var oldSlice = doc.slice(this.from, this.to),
|
|
364
|
+
$from = doc.resolve(this.from);
|
|
365
|
+
var parent = $from.node($from.sharedDepth(this.to));
|
|
366
|
+
var slice = new prosemirrorModel.Slice(mapFragment(oldSlice.content, function (node, parent) {
|
|
367
|
+
if (!node.isAtom || !parent.type.allowsMarkType(_this2.mark.type)) return node;
|
|
368
|
+
return node.mark(_this2.mark.addToSet(node.marks));
|
|
369
|
+
}, parent), oldSlice.openStart, oldSlice.openEnd);
|
|
370
|
+
return StepResult.fromReplace(doc, this.from, this.to, slice);
|
|
371
|
+
}
|
|
372
|
+
}, {
|
|
373
|
+
key: "invert",
|
|
374
|
+
value: function invert() {
|
|
375
|
+
return new RemoveMarkStep(this.from, this.to, this.mark);
|
|
376
|
+
}
|
|
377
|
+
}, {
|
|
378
|
+
key: "map",
|
|
379
|
+
value: function map(mapping) {
|
|
380
|
+
var from = mapping.mapResult(this.from, 1),
|
|
381
|
+
to = mapping.mapResult(this.to, -1);
|
|
382
|
+
if (from.deleted && to.deleted || from.pos >= to.pos) return null;
|
|
383
|
+
return new AddMarkStep(from.pos, to.pos, this.mark);
|
|
384
|
+
}
|
|
385
|
+
}, {
|
|
386
|
+
key: "merge",
|
|
387
|
+
value: function merge(other) {
|
|
388
|
+
if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
}, {
|
|
392
|
+
key: "toJSON",
|
|
393
|
+
value: function toJSON() {
|
|
394
|
+
return {
|
|
395
|
+
stepType: "addMark",
|
|
396
|
+
mark: this.mark.toJSON(),
|
|
397
|
+
from: this.from,
|
|
398
|
+
to: this.to
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
}], [{
|
|
402
|
+
key: "fromJSON",
|
|
403
|
+
value: function fromJSON(schema, json) {
|
|
404
|
+
if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
405
|
+
return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
|
|
406
|
+
}
|
|
407
|
+
}]);
|
|
408
|
+
return AddMarkStep;
|
|
409
|
+
}(Step);
|
|
410
|
+
Step.jsonID("addMark", AddMarkStep);
|
|
411
|
+
var RemoveMarkStep = function (_Step2) {
|
|
412
|
+
_inherits(RemoveMarkStep, _Step2);
|
|
413
|
+
var _super2 = _createSuper(RemoveMarkStep);
|
|
414
|
+
function RemoveMarkStep(from, to, mark) {
|
|
415
|
+
var _this3;
|
|
416
|
+
_classCallCheck(this, RemoveMarkStep);
|
|
417
|
+
_this3 = _super2.call(this);
|
|
418
|
+
_this3.from = from;
|
|
419
|
+
_this3.to = to;
|
|
420
|
+
_this3.mark = mark;
|
|
421
|
+
return _this3;
|
|
422
|
+
}
|
|
423
|
+
_createClass(RemoveMarkStep, [{
|
|
424
|
+
key: "apply",
|
|
425
|
+
value: function apply(doc) {
|
|
426
|
+
var _this4 = this;
|
|
427
|
+
var oldSlice = doc.slice(this.from, this.to);
|
|
428
|
+
var slice = new prosemirrorModel.Slice(mapFragment(oldSlice.content, function (node) {
|
|
429
|
+
return node.mark(_this4.mark.removeFromSet(node.marks));
|
|
430
|
+
}, doc), oldSlice.openStart, oldSlice.openEnd);
|
|
431
|
+
return StepResult.fromReplace(doc, this.from, this.to, slice);
|
|
432
|
+
}
|
|
433
|
+
}, {
|
|
434
|
+
key: "invert",
|
|
435
|
+
value: function invert() {
|
|
436
|
+
return new AddMarkStep(this.from, this.to, this.mark);
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
key: "map",
|
|
440
|
+
value: function map(mapping) {
|
|
441
|
+
var from = mapping.mapResult(this.from, 1),
|
|
442
|
+
to = mapping.mapResult(this.to, -1);
|
|
443
|
+
if (from.deleted && to.deleted || from.pos >= to.pos) return null;
|
|
444
|
+
return new RemoveMarkStep(from.pos, to.pos, this.mark);
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
key: "merge",
|
|
448
|
+
value: function merge(other) {
|
|
449
|
+
if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
key: "toJSON",
|
|
454
|
+
value: function toJSON() {
|
|
455
|
+
return {
|
|
456
|
+
stepType: "removeMark",
|
|
457
|
+
mark: this.mark.toJSON(),
|
|
458
|
+
from: this.from,
|
|
459
|
+
to: this.to
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
}], [{
|
|
463
|
+
key: "fromJSON",
|
|
464
|
+
value: function fromJSON(schema, json) {
|
|
465
|
+
if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
|
|
466
|
+
return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
|
|
467
|
+
}
|
|
468
|
+
}]);
|
|
469
|
+
return RemoveMarkStep;
|
|
470
|
+
}(Step);
|
|
471
|
+
Step.jsonID("removeMark", RemoveMarkStep);
|
|
472
|
+
var AddNodeMarkStep = function (_Step3) {
|
|
473
|
+
_inherits(AddNodeMarkStep, _Step3);
|
|
474
|
+
var _super3 = _createSuper(AddNodeMarkStep);
|
|
475
|
+
function AddNodeMarkStep(pos, mark) {
|
|
476
|
+
var _this5;
|
|
477
|
+
_classCallCheck(this, AddNodeMarkStep);
|
|
478
|
+
_this5 = _super3.call(this);
|
|
479
|
+
_this5.pos = pos;
|
|
480
|
+
_this5.mark = mark;
|
|
481
|
+
return _this5;
|
|
482
|
+
}
|
|
483
|
+
_createClass(AddNodeMarkStep, [{
|
|
484
|
+
key: "apply",
|
|
485
|
+
value: function apply(doc) {
|
|
486
|
+
var node = doc.nodeAt(this.pos);
|
|
487
|
+
if (!node) return StepResult.fail("No node at mark step's position");
|
|
488
|
+
var updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
489
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
490
|
+
}
|
|
491
|
+
}, {
|
|
492
|
+
key: "invert",
|
|
493
|
+
value: function invert(doc) {
|
|
494
|
+
var node = doc.nodeAt(this.pos);
|
|
495
|
+
if (node) {
|
|
496
|
+
var newSet = this.mark.addToSet(node.marks);
|
|
497
|
+
if (newSet.length == node.marks.length) {
|
|
498
|
+
for (var i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new AddNodeMarkStep(this.pos, node.marks[i]);
|
|
499
|
+
return new AddNodeMarkStep(this.pos, this.mark);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return new RemoveNodeMarkStep(this.pos, this.mark);
|
|
503
|
+
}
|
|
504
|
+
}, {
|
|
505
|
+
key: "map",
|
|
506
|
+
value: function map(mapping) {
|
|
507
|
+
var pos = mapping.mapResult(this.pos, 1);
|
|
508
|
+
return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
|
|
509
|
+
}
|
|
510
|
+
}, {
|
|
511
|
+
key: "toJSON",
|
|
512
|
+
value: function toJSON() {
|
|
513
|
+
return {
|
|
514
|
+
stepType: "addNodeMark",
|
|
515
|
+
pos: this.pos,
|
|
516
|
+
mark: this.mark.toJSON()
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
}], [{
|
|
520
|
+
key: "fromJSON",
|
|
521
|
+
value: function fromJSON(schema, json) {
|
|
522
|
+
if (typeof json.pos != "number") throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
523
|
+
return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
|
|
524
|
+
}
|
|
525
|
+
}]);
|
|
526
|
+
return AddNodeMarkStep;
|
|
527
|
+
}(Step);
|
|
528
|
+
Step.jsonID("addNodeMark", AddNodeMarkStep);
|
|
529
|
+
var RemoveNodeMarkStep = function (_Step4) {
|
|
530
|
+
_inherits(RemoveNodeMarkStep, _Step4);
|
|
531
|
+
var _super4 = _createSuper(RemoveNodeMarkStep);
|
|
532
|
+
function RemoveNodeMarkStep(pos, mark) {
|
|
533
|
+
var _this6;
|
|
534
|
+
_classCallCheck(this, RemoveNodeMarkStep);
|
|
535
|
+
_this6 = _super4.call(this);
|
|
536
|
+
_this6.pos = pos;
|
|
537
|
+
_this6.mark = mark;
|
|
538
|
+
return _this6;
|
|
539
|
+
}
|
|
540
|
+
_createClass(RemoveNodeMarkStep, [{
|
|
541
|
+
key: "apply",
|
|
542
|
+
value: function apply(doc) {
|
|
543
|
+
var node = doc.nodeAt(this.pos);
|
|
544
|
+
if (!node) return StepResult.fail("No node at mark step's position");
|
|
545
|
+
var updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
546
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
547
|
+
}
|
|
548
|
+
}, {
|
|
549
|
+
key: "invert",
|
|
550
|
+
value: function invert(doc) {
|
|
551
|
+
var node = doc.nodeAt(this.pos);
|
|
552
|
+
if (!node || !this.mark.isInSet(node.marks)) return this;
|
|
553
|
+
return new AddNodeMarkStep(this.pos, this.mark);
|
|
554
|
+
}
|
|
555
|
+
}, {
|
|
556
|
+
key: "map",
|
|
557
|
+
value: function map(mapping) {
|
|
558
|
+
var pos = mapping.mapResult(this.pos, 1);
|
|
559
|
+
return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
|
|
560
|
+
}
|
|
561
|
+
}, {
|
|
562
|
+
key: "toJSON",
|
|
563
|
+
value: function toJSON() {
|
|
564
|
+
return {
|
|
565
|
+
stepType: "removeNodeMark",
|
|
566
|
+
pos: this.pos,
|
|
567
|
+
mark: this.mark.toJSON()
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
}], [{
|
|
571
|
+
key: "fromJSON",
|
|
572
|
+
value: function fromJSON(schema, json) {
|
|
573
|
+
if (typeof json.pos != "number") throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
|
|
574
|
+
return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
|
|
575
|
+
}
|
|
576
|
+
}]);
|
|
577
|
+
return RemoveNodeMarkStep;
|
|
578
|
+
}(Step);
|
|
579
|
+
Step.jsonID("removeNodeMark", RemoveNodeMarkStep);
|
|
580
|
+
var ReplaceStep = function (_Step5) {
|
|
581
|
+
_inherits(ReplaceStep, _Step5);
|
|
582
|
+
var _super5 = _createSuper(ReplaceStep);
|
|
583
|
+
function ReplaceStep(from, to, slice) {
|
|
584
|
+
var _this7;
|
|
585
|
+
var structure = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
586
|
+
_classCallCheck(this, ReplaceStep);
|
|
587
|
+
_this7 = _super5.call(this);
|
|
588
|
+
_this7.from = from;
|
|
589
|
+
_this7.to = to;
|
|
590
|
+
_this7.slice = slice;
|
|
591
|
+
_this7.structure = structure;
|
|
592
|
+
return _this7;
|
|
593
|
+
}
|
|
594
|
+
_createClass(ReplaceStep, [{
|
|
595
|
+
key: "apply",
|
|
596
|
+
value: function apply(doc) {
|
|
597
|
+
if (this.structure && contentBetween(doc, this.from, this.to)) return StepResult.fail("Structure replace would overwrite content");
|
|
598
|
+
return StepResult.fromReplace(doc, this.from, this.to, this.slice);
|
|
599
|
+
}
|
|
600
|
+
}, {
|
|
601
|
+
key: "getMap",
|
|
602
|
+
value: function getMap() {
|
|
603
|
+
return new StepMap([this.from, this.to - this.from, this.slice.size]);
|
|
604
|
+
}
|
|
605
|
+
}, {
|
|
606
|
+
key: "invert",
|
|
607
|
+
value: function invert(doc) {
|
|
608
|
+
return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
|
|
609
|
+
}
|
|
610
|
+
}, {
|
|
611
|
+
key: "map",
|
|
612
|
+
value: function map(mapping) {
|
|
613
|
+
var from = mapping.mapResult(this.from, 1),
|
|
614
|
+
to = mapping.mapResult(this.to, -1);
|
|
615
|
+
if (from.deletedAcross && to.deletedAcross) return null;
|
|
616
|
+
return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
|
|
617
|
+
}
|
|
618
|
+
}, {
|
|
619
|
+
key: "merge",
|
|
620
|
+
value: function merge(other) {
|
|
621
|
+
if (!(other instanceof ReplaceStep) || other.structure || this.structure) return null;
|
|
622
|
+
if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
|
|
623
|
+
var slice = this.slice.size + other.slice.size == 0 ? prosemirrorModel.Slice.empty : new prosemirrorModel.Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
|
|
624
|
+
return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
|
|
625
|
+
} else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
|
|
626
|
+
var _slice = this.slice.size + other.slice.size == 0 ? prosemirrorModel.Slice.empty : new prosemirrorModel.Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
|
|
627
|
+
return new ReplaceStep(other.from, this.to, _slice, this.structure);
|
|
628
|
+
} else {
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}, {
|
|
633
|
+
key: "toJSON",
|
|
634
|
+
value: function toJSON() {
|
|
635
|
+
var json = {
|
|
636
|
+
stepType: "replace",
|
|
637
|
+
from: this.from,
|
|
638
|
+
to: this.to
|
|
639
|
+
};
|
|
640
|
+
if (this.slice.size) json.slice = this.slice.toJSON();
|
|
641
|
+
if (this.structure) json.structure = true;
|
|
642
|
+
return json;
|
|
643
|
+
}
|
|
644
|
+
}], [{
|
|
645
|
+
key: "fromJSON",
|
|
646
|
+
value: function fromJSON(schema, json) {
|
|
647
|
+
if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
648
|
+
return new ReplaceStep(json.from, json.to, prosemirrorModel.Slice.fromJSON(schema, json.slice), !!json.structure);
|
|
649
|
+
}
|
|
650
|
+
}]);
|
|
651
|
+
return ReplaceStep;
|
|
652
|
+
}(Step);
|
|
653
|
+
Step.jsonID("replace", ReplaceStep);
|
|
654
|
+
var ReplaceAroundStep = function (_Step6) {
|
|
655
|
+
_inherits(ReplaceAroundStep, _Step6);
|
|
656
|
+
var _super6 = _createSuper(ReplaceAroundStep);
|
|
657
|
+
function ReplaceAroundStep(from, to, gapFrom, gapTo, slice, insert) {
|
|
658
|
+
var _this8;
|
|
659
|
+
var structure = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
660
|
+
_classCallCheck(this, ReplaceAroundStep);
|
|
661
|
+
_this8 = _super6.call(this);
|
|
662
|
+
_this8.from = from;
|
|
663
|
+
_this8.to = to;
|
|
664
|
+
_this8.gapFrom = gapFrom;
|
|
665
|
+
_this8.gapTo = gapTo;
|
|
666
|
+
_this8.slice = slice;
|
|
667
|
+
_this8.insert = insert;
|
|
668
|
+
_this8.structure = structure;
|
|
669
|
+
return _this8;
|
|
670
|
+
}
|
|
671
|
+
_createClass(ReplaceAroundStep, [{
|
|
672
|
+
key: "apply",
|
|
673
|
+
value: function apply(doc) {
|
|
674
|
+
if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to))) return StepResult.fail("Structure gap-replace would overwrite content");
|
|
675
|
+
var gap = doc.slice(this.gapFrom, this.gapTo);
|
|
676
|
+
if (gap.openStart || gap.openEnd) return StepResult.fail("Gap is not a flat range");
|
|
677
|
+
var inserted = this.slice.insertAt(this.insert, gap.content);
|
|
678
|
+
if (!inserted) return StepResult.fail("Content does not fit in gap");
|
|
679
|
+
return StepResult.fromReplace(doc, this.from, this.to, inserted);
|
|
680
|
+
}
|
|
681
|
+
}, {
|
|
682
|
+
key: "getMap",
|
|
683
|
+
value: function getMap() {
|
|
684
|
+
return new StepMap([this.from, this.gapFrom - this.from, this.insert, this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);
|
|
685
|
+
}
|
|
686
|
+
}, {
|
|
687
|
+
key: "invert",
|
|
688
|
+
value: function invert(doc) {
|
|
689
|
+
var gap = this.gapTo - this.gapFrom;
|
|
690
|
+
return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
691
|
+
}
|
|
692
|
+
}, {
|
|
693
|
+
key: "map",
|
|
694
|
+
value: function map(mapping) {
|
|
695
|
+
var from = mapping.mapResult(this.from, 1),
|
|
696
|
+
to = mapping.mapResult(this.to, -1);
|
|
697
|
+
var gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
|
|
698
|
+
var gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
|
|
699
|
+
if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;
|
|
700
|
+
return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
701
|
+
}
|
|
702
|
+
}, {
|
|
703
|
+
key: "toJSON",
|
|
704
|
+
value: function toJSON() {
|
|
705
|
+
var json = {
|
|
706
|
+
stepType: "replaceAround",
|
|
707
|
+
from: this.from,
|
|
708
|
+
to: this.to,
|
|
709
|
+
gapFrom: this.gapFrom,
|
|
710
|
+
gapTo: this.gapTo,
|
|
711
|
+
insert: this.insert
|
|
712
|
+
};
|
|
713
|
+
if (this.slice.size) json.slice = this.slice.toJSON();
|
|
714
|
+
if (this.structure) json.structure = true;
|
|
715
|
+
return json;
|
|
716
|
+
}
|
|
717
|
+
}], [{
|
|
718
|
+
key: "fromJSON",
|
|
719
|
+
value: function fromJSON(schema, json) {
|
|
720
|
+
if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number") throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
721
|
+
return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, prosemirrorModel.Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
|
|
722
|
+
}
|
|
723
|
+
}]);
|
|
724
|
+
return ReplaceAroundStep;
|
|
725
|
+
}(Step);
|
|
726
|
+
Step.jsonID("replaceAround", ReplaceAroundStep);
|
|
727
|
+
function contentBetween(doc, from, to) {
|
|
728
|
+
var $from = doc.resolve(from),
|
|
729
|
+
dist = to - from,
|
|
730
|
+
depth = $from.depth;
|
|
731
|
+
while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
|
|
732
|
+
depth--;
|
|
733
|
+
dist--;
|
|
734
|
+
}
|
|
735
|
+
if (dist > 0) {
|
|
736
|
+
var next = $from.node(depth).maybeChild($from.indexAfter(depth));
|
|
737
|
+
while (dist > 0) {
|
|
738
|
+
if (!next || next.isLeaf) return true;
|
|
739
|
+
next = next.firstChild;
|
|
740
|
+
dist--;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
function _addMark(tr, from, to, mark) {
|
|
746
|
+
var removed = [],
|
|
747
|
+
added = [];
|
|
748
|
+
var removing, adding;
|
|
749
|
+
tr.doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
750
|
+
if (!node.isInline) return;
|
|
751
|
+
var marks = node.marks;
|
|
752
|
+
if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
|
|
753
|
+
var start = Math.max(pos, from),
|
|
754
|
+
end = Math.min(pos + node.nodeSize, to);
|
|
755
|
+
var newSet = mark.addToSet(marks);
|
|
756
|
+
for (var i = 0; i < marks.length; i++) {
|
|
757
|
+
if (!marks[i].isInSet(newSet)) {
|
|
758
|
+
if (removing && removing.to == start && removing.mark.eq(marks[i])) removing.to = end;else removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (adding && adding.to == start) adding.to = end;else added.push(adding = new AddMarkStep(start, end, mark));
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
removed.forEach(function (s) {
|
|
765
|
+
return tr.step(s);
|
|
766
|
+
});
|
|
767
|
+
added.forEach(function (s) {
|
|
768
|
+
return tr.step(s);
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
function _removeMark(tr, from, to, mark) {
|
|
772
|
+
var matched = [],
|
|
773
|
+
step = 0;
|
|
774
|
+
tr.doc.nodesBetween(from, to, function (node, pos) {
|
|
775
|
+
if (!node.isInline) return;
|
|
776
|
+
step++;
|
|
777
|
+
var toRemove = null;
|
|
778
|
+
if (mark instanceof prosemirrorModel.MarkType) {
|
|
779
|
+
var set = node.marks,
|
|
780
|
+
found;
|
|
781
|
+
while (found = mark.isInSet(set)) {
|
|
782
|
+
(toRemove || (toRemove = [])).push(found);
|
|
783
|
+
set = found.removeFromSet(set);
|
|
784
|
+
}
|
|
785
|
+
} else if (mark) {
|
|
786
|
+
if (mark.isInSet(node.marks)) toRemove = [mark];
|
|
787
|
+
} else {
|
|
788
|
+
toRemove = node.marks;
|
|
789
|
+
}
|
|
790
|
+
if (toRemove && toRemove.length) {
|
|
791
|
+
var end = Math.min(pos + node.nodeSize, to);
|
|
792
|
+
for (var i = 0; i < toRemove.length; i++) {
|
|
793
|
+
var style = toRemove[i],
|
|
794
|
+
_found = void 0;
|
|
795
|
+
for (var j = 0; j < matched.length; j++) {
|
|
796
|
+
var m = matched[j];
|
|
797
|
+
if (m.step == step - 1 && style.eq(matched[j].style)) _found = m;
|
|
798
|
+
}
|
|
799
|
+
if (_found) {
|
|
800
|
+
_found.to = end;
|
|
801
|
+
_found.step = step;
|
|
802
|
+
} else {
|
|
803
|
+
matched.push({
|
|
804
|
+
style: style,
|
|
805
|
+
from: Math.max(pos, from),
|
|
806
|
+
to: end,
|
|
807
|
+
step: step
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
matched.forEach(function (m) {
|
|
814
|
+
return tr.step(new RemoveMarkStep(m.from, m.to, m.style));
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
function _clearIncompatible(tr, pos, parentType) {
|
|
818
|
+
var match = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : parentType.contentMatch;
|
|
819
|
+
var clearNewlines = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
820
|
+
var node = tr.doc.nodeAt(pos);
|
|
821
|
+
var replSteps = [],
|
|
822
|
+
cur = pos + 1;
|
|
823
|
+
for (var i = 0; i < node.childCount; i++) {
|
|
824
|
+
var child = node.child(i),
|
|
825
|
+
end = cur + child.nodeSize;
|
|
826
|
+
var allowed = match.matchType(child.type);
|
|
827
|
+
if (!allowed) {
|
|
828
|
+
replSteps.push(new ReplaceStep(cur, end, prosemirrorModel.Slice.empty));
|
|
829
|
+
} else {
|
|
830
|
+
match = allowed;
|
|
831
|
+
for (var j = 0; j < child.marks.length; j++) if (!parentType.allowsMarkType(child.marks[j].type)) tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
|
|
832
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
833
|
+
var m = void 0,
|
|
834
|
+
newline = /\r?\n|\r/g,
|
|
835
|
+
slice = void 0;
|
|
836
|
+
while (m = newline.exec(child.text)) {
|
|
837
|
+
if (!slice) slice = new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
|
|
838
|
+
replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
cur = end;
|
|
843
|
+
}
|
|
844
|
+
if (!match.validEnd) {
|
|
845
|
+
var fill = match.fillBefore(prosemirrorModel.Fragment.empty, true);
|
|
846
|
+
tr.replace(cur, cur, new prosemirrorModel.Slice(fill, 0, 0));
|
|
847
|
+
}
|
|
848
|
+
for (var _i = replSteps.length - 1; _i >= 0; _i--) tr.step(replSteps[_i]);
|
|
849
|
+
}
|
|
850
|
+
function canCut(node, start, end) {
|
|
851
|
+
return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
|
|
852
|
+
}
|
|
853
|
+
function liftTarget(range) {
|
|
854
|
+
var parent = range.parent;
|
|
855
|
+
var content = parent.content.cutByIndex(range.startIndex, range.endIndex);
|
|
856
|
+
for (var depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {
|
|
857
|
+
var node = range.$from.node(depth);
|
|
858
|
+
var index = range.$from.index(depth) + contentBefore,
|
|
859
|
+
endIndex = range.$to.indexAfter(depth) - contentAfter;
|
|
860
|
+
if (depth < range.depth && node.canReplace(index, endIndex, content)) return depth;
|
|
861
|
+
if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) break;
|
|
862
|
+
if (index) contentBefore = 1;
|
|
863
|
+
if (endIndex < node.childCount) contentAfter = 1;
|
|
864
|
+
}
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
function _lift(tr, range, target) {
|
|
868
|
+
var $from = range.$from,
|
|
869
|
+
$to = range.$to,
|
|
870
|
+
depth = range.depth;
|
|
871
|
+
var gapStart = $from.before(depth + 1),
|
|
872
|
+
gapEnd = $to.after(depth + 1);
|
|
873
|
+
var start = gapStart,
|
|
874
|
+
end = gapEnd;
|
|
875
|
+
var before = prosemirrorModel.Fragment.empty,
|
|
876
|
+
openStart = 0;
|
|
877
|
+
for (var d = depth, splitting = false; d > target; d--) if (splitting || $from.index(d) > 0) {
|
|
878
|
+
splitting = true;
|
|
879
|
+
before = prosemirrorModel.Fragment.from($from.node(d).copy(before));
|
|
880
|
+
openStart++;
|
|
881
|
+
} else {
|
|
882
|
+
start--;
|
|
883
|
+
}
|
|
884
|
+
var after = prosemirrorModel.Fragment.empty,
|
|
885
|
+
openEnd = 0;
|
|
886
|
+
for (var _d = depth, _splitting = false; _d > target; _d--) if (_splitting || $to.after(_d + 1) < $to.end(_d)) {
|
|
887
|
+
_splitting = true;
|
|
888
|
+
after = prosemirrorModel.Fragment.from($to.node(_d).copy(after));
|
|
889
|
+
openEnd++;
|
|
890
|
+
} else {
|
|
891
|
+
end++;
|
|
892
|
+
}
|
|
893
|
+
tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new prosemirrorModel.Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
|
|
894
|
+
}
|
|
895
|
+
function findWrapping(range, nodeType) {
|
|
896
|
+
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
897
|
+
var innerRange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : range;
|
|
898
|
+
var around = findWrappingOutside(range, nodeType);
|
|
899
|
+
var inner = around && findWrappingInside(innerRange, nodeType);
|
|
900
|
+
if (!inner) return null;
|
|
901
|
+
return around.map(withAttrs).concat({
|
|
902
|
+
type: nodeType,
|
|
903
|
+
attrs: attrs
|
|
904
|
+
}).concat(inner.map(withAttrs));
|
|
905
|
+
}
|
|
906
|
+
function withAttrs(type) {
|
|
907
|
+
return {
|
|
908
|
+
type: type,
|
|
909
|
+
attrs: null
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
function findWrappingOutside(range, type) {
|
|
913
|
+
var parent = range.parent,
|
|
914
|
+
startIndex = range.startIndex,
|
|
915
|
+
endIndex = range.endIndex;
|
|
916
|
+
var around = parent.contentMatchAt(startIndex).findWrapping(type);
|
|
917
|
+
if (!around) return null;
|
|
918
|
+
var outer = around.length ? around[0] : type;
|
|
919
|
+
return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
|
|
920
|
+
}
|
|
921
|
+
function findWrappingInside(range, type) {
|
|
922
|
+
var parent = range.parent,
|
|
923
|
+
startIndex = range.startIndex,
|
|
924
|
+
endIndex = range.endIndex;
|
|
925
|
+
var inner = parent.child(startIndex);
|
|
926
|
+
var inside = type.contentMatch.findWrapping(inner.type);
|
|
927
|
+
if (!inside) return null;
|
|
928
|
+
var lastType = inside.length ? inside[inside.length - 1] : type;
|
|
929
|
+
var innerMatch = lastType.contentMatch;
|
|
930
|
+
for (var i = startIndex; innerMatch && i < endIndex; i++) innerMatch = innerMatch.matchType(parent.child(i).type);
|
|
931
|
+
if (!innerMatch || !innerMatch.validEnd) return null;
|
|
932
|
+
return inside;
|
|
933
|
+
}
|
|
934
|
+
function _wrap2(tr, range, wrappers) {
|
|
935
|
+
var content = prosemirrorModel.Fragment.empty;
|
|
936
|
+
for (var i = wrappers.length - 1; i >= 0; i--) {
|
|
937
|
+
if (content.size) {
|
|
938
|
+
var match = wrappers[i].type.contentMatch.matchFragment(content);
|
|
939
|
+
if (!match || !match.validEnd) throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
|
|
940
|
+
}
|
|
941
|
+
content = prosemirrorModel.Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
942
|
+
}
|
|
943
|
+
var start = range.start,
|
|
944
|
+
end = range.end;
|
|
945
|
+
tr.step(new ReplaceAroundStep(start, end, start, end, new prosemirrorModel.Slice(content, 0, 0), wrappers.length, true));
|
|
946
|
+
}
|
|
947
|
+
function _setBlockType(tr, from, to, type, attrs) {
|
|
948
|
+
if (!type.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock");
|
|
949
|
+
var mapFrom = tr.steps.length;
|
|
950
|
+
tr.doc.nodesBetween(from, to, function (node, pos) {
|
|
951
|
+
var attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
|
|
952
|
+
if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
|
|
953
|
+
var convertNewlines = null;
|
|
954
|
+
if (type.schema.linebreakReplacement) {
|
|
955
|
+
var pre = type.whitespace == "pre",
|
|
956
|
+
supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
|
|
957
|
+
if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;
|
|
958
|
+
}
|
|
959
|
+
if (convertNewlines === false) replaceLinebreaks(tr, node, pos, mapFrom);
|
|
960
|
+
_clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);
|
|
961
|
+
var mapping = tr.mapping.slice(mapFrom);
|
|
962
|
+
var startM = mapping.map(pos, 1),
|
|
963
|
+
endM = mapping.map(pos + node.nodeSize, 1);
|
|
964
|
+
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
|
|
965
|
+
if (convertNewlines === true) replaceNewlines(tr, node, pos, mapFrom);
|
|
966
|
+
return false;
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
function replaceNewlines(tr, node, pos, mapFrom) {
|
|
971
|
+
node.forEach(function (child, offset) {
|
|
972
|
+
if (child.isText) {
|
|
973
|
+
var m,
|
|
974
|
+
newline = /\r?\n|\r/g;
|
|
975
|
+
while (m = newline.exec(child.text)) {
|
|
976
|
+
var start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
|
|
977
|
+
tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
function replaceLinebreaks(tr, node, pos, mapFrom) {
|
|
983
|
+
node.forEach(function (child, offset) {
|
|
984
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
985
|
+
var start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
|
|
986
|
+
tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
function canChangeType(doc, pos, type) {
|
|
991
|
+
var $pos = doc.resolve(pos),
|
|
992
|
+
index = $pos.index();
|
|
993
|
+
return $pos.parent.canReplaceWith(index, index + 1, type);
|
|
994
|
+
}
|
|
995
|
+
function _setNodeMarkup(tr, pos, type, attrs, marks) {
|
|
996
|
+
var node = tr.doc.nodeAt(pos);
|
|
997
|
+
if (!node) throw new RangeError("No node at given position");
|
|
998
|
+
if (!type) type = node.type;
|
|
999
|
+
var newNode = type.create(attrs, null, marks || node.marks);
|
|
1000
|
+
if (node.isLeaf) return tr.replaceWith(pos, pos + node.nodeSize, newNode);
|
|
1001
|
+
if (!type.validContent(node.content)) throw new RangeError("Invalid content for node type " + type.name);
|
|
1002
|
+
tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(newNode), 0, 0), 1, true));
|
|
1003
|
+
}
|
|
1004
|
+
function canSplit(doc, pos) {
|
|
1005
|
+
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1006
|
+
var typesAfter = arguments.length > 3 ? arguments[3] : undefined;
|
|
1007
|
+
var $pos = doc.resolve(pos),
|
|
1008
|
+
base = $pos.depth - depth;
|
|
1009
|
+
var innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
|
|
1010
|
+
if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;
|
|
1011
|
+
for (var d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
|
|
1012
|
+
var node = $pos.node(d),
|
|
1013
|
+
_index = $pos.index(d);
|
|
1014
|
+
if (node.type.spec.isolating) return false;
|
|
1015
|
+
var rest = node.content.cutByIndex(_index, node.childCount);
|
|
1016
|
+
var overrideChild = typesAfter && typesAfter[i + 1];
|
|
1017
|
+
if (overrideChild) rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
|
|
1018
|
+
var after = typesAfter && typesAfter[i] || node;
|
|
1019
|
+
if (!node.canReplace(_index + 1, node.childCount) || !after.type.validContent(rest)) return false;
|
|
1020
|
+
}
|
|
1021
|
+
var index = $pos.indexAfter(base);
|
|
1022
|
+
var baseType = typesAfter && typesAfter[0];
|
|
1023
|
+
return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
|
|
1024
|
+
}
|
|
1025
|
+
function _split(tr, pos) {
|
|
1026
|
+
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
1027
|
+
var typesAfter = arguments.length > 3 ? arguments[3] : undefined;
|
|
1028
|
+
var $pos = tr.doc.resolve(pos),
|
|
1029
|
+
before = prosemirrorModel.Fragment.empty,
|
|
1030
|
+
after = prosemirrorModel.Fragment.empty;
|
|
1031
|
+
for (var d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
|
|
1032
|
+
before = prosemirrorModel.Fragment.from($pos.node(d).copy(before));
|
|
1033
|
+
var typeAfter = typesAfter && typesAfter[i];
|
|
1034
|
+
after = prosemirrorModel.Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
|
|
1035
|
+
}
|
|
1036
|
+
tr.step(new ReplaceStep(pos, pos, new prosemirrorModel.Slice(before.append(after), depth, depth), true));
|
|
1037
|
+
}
|
|
1038
|
+
function canJoin(doc, pos) {
|
|
1039
|
+
var $pos = doc.resolve(pos),
|
|
1040
|
+
index = $pos.index();
|
|
1041
|
+
return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
|
|
1042
|
+
}
|
|
1043
|
+
function canAppendWithSubstitutedLinebreaks(a, b) {
|
|
1044
|
+
if (!b.content.size) a.type.compatibleContent(b.type);
|
|
1045
|
+
var match = a.contentMatchAt(a.childCount);
|
|
1046
|
+
var linebreakReplacement = a.type.schema.linebreakReplacement;
|
|
1047
|
+
for (var i = 0; i < b.childCount; i++) {
|
|
1048
|
+
var child = b.child(i);
|
|
1049
|
+
var type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
|
|
1050
|
+
match = match.matchType(type);
|
|
1051
|
+
if (!match) return false;
|
|
1052
|
+
if (!a.type.allowsMarks(child.marks)) return false;
|
|
1053
|
+
}
|
|
1054
|
+
return match.validEnd;
|
|
1055
|
+
}
|
|
1056
|
+
function joinable(a, b) {
|
|
1057
|
+
return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
|
|
1058
|
+
}
|
|
1059
|
+
function joinPoint(doc, pos) {
|
|
1060
|
+
var dir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
|
|
1061
|
+
var $pos = doc.resolve(pos);
|
|
1062
|
+
for (var d = $pos.depth;; d--) {
|
|
1063
|
+
var before = void 0,
|
|
1064
|
+
after = void 0,
|
|
1065
|
+
index = $pos.index(d);
|
|
1066
|
+
if (d == $pos.depth) {
|
|
1067
|
+
before = $pos.nodeBefore;
|
|
1068
|
+
after = $pos.nodeAfter;
|
|
1069
|
+
} else if (dir > 0) {
|
|
1070
|
+
before = $pos.node(d + 1);
|
|
1071
|
+
index++;
|
|
1072
|
+
after = $pos.node(d).maybeChild(index);
|
|
1073
|
+
} else {
|
|
1074
|
+
before = $pos.node(d).maybeChild(index - 1);
|
|
1075
|
+
after = $pos.node(d + 1);
|
|
1076
|
+
}
|
|
1077
|
+
if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1)) return pos;
|
|
1078
|
+
if (d == 0) break;
|
|
1079
|
+
pos = dir < 0 ? $pos.before(d) : $pos.after(d);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
function _join(tr, pos, depth) {
|
|
1083
|
+
var convertNewlines = null;
|
|
1084
|
+
var linebreakReplacement = tr.doc.type.schema.linebreakReplacement;
|
|
1085
|
+
var $before = tr.doc.resolve(pos - depth),
|
|
1086
|
+
beforeType = $before.node().type;
|
|
1087
|
+
if (linebreakReplacement && beforeType.inlineContent) {
|
|
1088
|
+
var pre = beforeType.whitespace == "pre";
|
|
1089
|
+
var supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
|
|
1090
|
+
if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;
|
|
1091
|
+
}
|
|
1092
|
+
var mapFrom = tr.steps.length;
|
|
1093
|
+
if (convertNewlines === false) {
|
|
1094
|
+
var $after = tr.doc.resolve(pos + depth);
|
|
1095
|
+
replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
|
|
1096
|
+
}
|
|
1097
|
+
if (beforeType.inlineContent) _clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
|
|
1098
|
+
var mapping = tr.mapping.slice(mapFrom),
|
|
1099
|
+
start = mapping.map(pos - depth);
|
|
1100
|
+
tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), prosemirrorModel.Slice.empty, true));
|
|
1101
|
+
if (convertNewlines === true) {
|
|
1102
|
+
var $full = tr.doc.resolve(start);
|
|
1103
|
+
replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
|
|
1104
|
+
}
|
|
1105
|
+
return tr;
|
|
1106
|
+
}
|
|
1107
|
+
function insertPoint(doc, pos, nodeType) {
|
|
1108
|
+
var $pos = doc.resolve(pos);
|
|
1109
|
+
if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos;
|
|
1110
|
+
if ($pos.parentOffset == 0) for (var d = $pos.depth - 1; d >= 0; d--) {
|
|
1111
|
+
var index = $pos.index(d);
|
|
1112
|
+
if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.before(d + 1);
|
|
1113
|
+
if (index > 0) return null;
|
|
1114
|
+
}
|
|
1115
|
+
if ($pos.parentOffset == $pos.parent.content.size) for (var _d2 = $pos.depth - 1; _d2 >= 0; _d2--) {
|
|
1116
|
+
var _index2 = $pos.indexAfter(_d2);
|
|
1117
|
+
if ($pos.node(_d2).canReplaceWith(_index2, _index2, nodeType)) return $pos.after(_d2 + 1);
|
|
1118
|
+
if (_index2 < $pos.node(_d2).childCount) return null;
|
|
1119
|
+
}
|
|
1120
|
+
return null;
|
|
1121
|
+
}
|
|
1122
|
+
function dropPoint(doc, pos, slice) {
|
|
1123
|
+
var $pos = doc.resolve(pos);
|
|
1124
|
+
if (!slice.content.size) return pos;
|
|
1125
|
+
var content = slice.content;
|
|
1126
|
+
for (var i = 0; i < slice.openStart; i++) content = content.firstChild.content;
|
|
1127
|
+
for (var pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
|
|
1128
|
+
for (var d = $pos.depth; d >= 0; d--) {
|
|
1129
|
+
var bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
|
|
1130
|
+
var insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
|
|
1131
|
+
var parent = $pos.node(d),
|
|
1132
|
+
fits = false;
|
|
1133
|
+
if (pass == 1) {
|
|
1134
|
+
fits = parent.canReplace(insertPos, insertPos, content);
|
|
1135
|
+
} else {
|
|
1136
|
+
var wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
|
|
1137
|
+
fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
|
|
1138
|
+
}
|
|
1139
|
+
if (fits) return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
function replaceStep(doc, from) {
|
|
1145
|
+
var to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : from;
|
|
1146
|
+
var slice = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : prosemirrorModel.Slice.empty;
|
|
1147
|
+
if (from == to && !slice.size) return null;
|
|
1148
|
+
var $from = doc.resolve(from),
|
|
1149
|
+
$to = doc.resolve(to);
|
|
1150
|
+
if (fitsTrivially($from, $to, slice)) return new ReplaceStep(from, to, slice);
|
|
1151
|
+
return new Fitter($from, $to, slice).fit();
|
|
1152
|
+
}
|
|
1153
|
+
function fitsTrivially($from, $to, slice) {
|
|
1154
|
+
return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
|
|
1155
|
+
}
|
|
1156
|
+
var Fitter = function () {
|
|
1157
|
+
function Fitter($from, $to, unplaced) {
|
|
1158
|
+
_classCallCheck(this, Fitter);
|
|
1159
|
+
this.$from = $from;
|
|
1160
|
+
this.$to = $to;
|
|
1161
|
+
this.unplaced = unplaced;
|
|
1162
|
+
this.frontier = [];
|
|
1163
|
+
this.placed = prosemirrorModel.Fragment.empty;
|
|
1164
|
+
for (var i = 0; i <= $from.depth; i++) {
|
|
1165
|
+
var node = $from.node(i);
|
|
1166
|
+
this.frontier.push({
|
|
1167
|
+
type: node.type,
|
|
1168
|
+
match: node.contentMatchAt($from.indexAfter(i))
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
for (var _i2 = $from.depth; _i2 > 0; _i2--) this.placed = prosemirrorModel.Fragment.from($from.node(_i2).copy(this.placed));
|
|
1172
|
+
}
|
|
1173
|
+
_createClass(Fitter, [{
|
|
1174
|
+
key: "depth",
|
|
1175
|
+
get: function get() {
|
|
1176
|
+
return this.frontier.length - 1;
|
|
1177
|
+
}
|
|
1178
|
+
}, {
|
|
1179
|
+
key: "fit",
|
|
1180
|
+
value: function fit() {
|
|
1181
|
+
while (this.unplaced.size) {
|
|
1182
|
+
var fit = this.findFittable();
|
|
1183
|
+
if (fit) this.placeNodes(fit);else this.openMore() || this.dropNode();
|
|
1184
|
+
}
|
|
1185
|
+
var moveInline = this.mustMoveInline(),
|
|
1186
|
+
placedSize = this.placed.size - this.depth - this.$from.depth;
|
|
1187
|
+
var $from = this.$from,
|
|
1188
|
+
$to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
|
|
1189
|
+
if (!$to) return null;
|
|
1190
|
+
var content = this.placed,
|
|
1191
|
+
openStart = $from.depth,
|
|
1192
|
+
openEnd = $to.depth;
|
|
1193
|
+
while (openStart && openEnd && content.childCount == 1) {
|
|
1194
|
+
content = content.firstChild.content;
|
|
1195
|
+
openStart--;
|
|
1196
|
+
openEnd--;
|
|
1197
|
+
}
|
|
1198
|
+
var slice = new prosemirrorModel.Slice(content, openStart, openEnd);
|
|
1199
|
+
if (moveInline > -1) return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
|
|
1200
|
+
if (slice.size || $from.pos != this.$to.pos) return new ReplaceStep($from.pos, $to.pos, slice);
|
|
1201
|
+
return null;
|
|
1202
|
+
}
|
|
1203
|
+
}, {
|
|
1204
|
+
key: "findFittable",
|
|
1205
|
+
value: function findFittable() {
|
|
1206
|
+
var startDepth = this.unplaced.openStart;
|
|
1207
|
+
for (var cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
|
|
1208
|
+
var node = cur.firstChild;
|
|
1209
|
+
if (cur.childCount > 1) openEnd = 0;
|
|
1210
|
+
if (node.type.spec.isolating && openEnd <= d) {
|
|
1211
|
+
startDepth = d;
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
cur = node.content;
|
|
1215
|
+
}
|
|
1216
|
+
for (var pass = 1; pass <= 2; pass++) {
|
|
1217
|
+
for (var sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
|
|
1218
|
+
var fragment = void 0,
|
|
1219
|
+
parent = null;
|
|
1220
|
+
if (sliceDepth) {
|
|
1221
|
+
parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
|
|
1222
|
+
fragment = parent.content;
|
|
1223
|
+
} else {
|
|
1224
|
+
fragment = this.unplaced.content;
|
|
1225
|
+
}
|
|
1226
|
+
var first = fragment.firstChild;
|
|
1227
|
+
for (var frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
|
|
1228
|
+
var _this$frontier$fronti = this.frontier[frontierDepth],
|
|
1229
|
+
type = _this$frontier$fronti.type,
|
|
1230
|
+
match = _this$frontier$fronti.match,
|
|
1231
|
+
_wrap = void 0,
|
|
1232
|
+
inject = null;
|
|
1233
|
+
if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(prosemirrorModel.Fragment.from(first), false)) : parent && type.compatibleContent(parent.type))) return {
|
|
1234
|
+
sliceDepth: sliceDepth,
|
|
1235
|
+
frontierDepth: frontierDepth,
|
|
1236
|
+
parent: parent,
|
|
1237
|
+
inject: inject
|
|
1238
|
+
};else if (pass == 2 && first && (_wrap = match.findWrapping(first.type))) return {
|
|
1239
|
+
sliceDepth: sliceDepth,
|
|
1240
|
+
frontierDepth: frontierDepth,
|
|
1241
|
+
parent: parent,
|
|
1242
|
+
wrap: _wrap
|
|
1243
|
+
};
|
|
1244
|
+
if (parent && match.matchType(parent.type)) break;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}, {
|
|
1250
|
+
key: "openMore",
|
|
1251
|
+
value: function openMore() {
|
|
1252
|
+
var _this$unplaced = this.unplaced,
|
|
1253
|
+
content = _this$unplaced.content,
|
|
1254
|
+
openStart = _this$unplaced.openStart,
|
|
1255
|
+
openEnd = _this$unplaced.openEnd;
|
|
1256
|
+
var inner = contentAt(content, openStart);
|
|
1257
|
+
if (!inner.childCount || inner.firstChild.isLeaf) return false;
|
|
1258
|
+
this.unplaced = new prosemirrorModel.Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
}, {
|
|
1262
|
+
key: "dropNode",
|
|
1263
|
+
value: function dropNode() {
|
|
1264
|
+
var _this$unplaced2 = this.unplaced,
|
|
1265
|
+
content = _this$unplaced2.content,
|
|
1266
|
+
openStart = _this$unplaced2.openStart,
|
|
1267
|
+
openEnd = _this$unplaced2.openEnd;
|
|
1268
|
+
var inner = contentAt(content, openStart);
|
|
1269
|
+
if (inner.childCount <= 1 && openStart > 0) {
|
|
1270
|
+
var openAtEnd = content.size - openStart <= openStart + inner.size;
|
|
1271
|
+
this.unplaced = new prosemirrorModel.Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
|
|
1272
|
+
} else {
|
|
1273
|
+
this.unplaced = new prosemirrorModel.Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}, {
|
|
1277
|
+
key: "placeNodes",
|
|
1278
|
+
value: function placeNodes(_ref) {
|
|
1279
|
+
var sliceDepth = _ref.sliceDepth,
|
|
1280
|
+
frontierDepth = _ref.frontierDepth,
|
|
1281
|
+
parent = _ref.parent,
|
|
1282
|
+
inject = _ref.inject,
|
|
1283
|
+
wrap = _ref.wrap;
|
|
1284
|
+
while (this.depth > frontierDepth) this.closeFrontierNode();
|
|
1285
|
+
if (wrap) for (var i = 0; i < wrap.length; i++) this.openFrontierNode(wrap[i]);
|
|
1286
|
+
var slice = this.unplaced,
|
|
1287
|
+
fragment = parent ? parent.content : slice.content;
|
|
1288
|
+
var openStart = slice.openStart - sliceDepth;
|
|
1289
|
+
var taken = 0,
|
|
1290
|
+
add = [];
|
|
1291
|
+
var _this$frontier$fronti2 = this.frontier[frontierDepth],
|
|
1292
|
+
match = _this$frontier$fronti2.match,
|
|
1293
|
+
type = _this$frontier$fronti2.type;
|
|
1294
|
+
if (inject) {
|
|
1295
|
+
for (var _i3 = 0; _i3 < inject.childCount; _i3++) add.push(inject.child(_i3));
|
|
1296
|
+
match = match.matchFragment(inject);
|
|
1297
|
+
}
|
|
1298
|
+
var openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
|
|
1299
|
+
while (taken < fragment.childCount) {
|
|
1300
|
+
var next = fragment.child(taken),
|
|
1301
|
+
matches = match.matchType(next.type);
|
|
1302
|
+
if (!matches) break;
|
|
1303
|
+
taken++;
|
|
1304
|
+
if (taken > 1 || openStart == 0 || next.content.size) {
|
|
1305
|
+
match = matches;
|
|
1306
|
+
add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
var toEnd = taken == fragment.childCount;
|
|
1310
|
+
if (!toEnd) openEndCount = -1;
|
|
1311
|
+
this.placed = addToFragment(this.placed, frontierDepth, prosemirrorModel.Fragment.from(add));
|
|
1312
|
+
this.frontier[frontierDepth].match = match;
|
|
1313
|
+
if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();
|
|
1314
|
+
for (var _i4 = 0, cur = fragment; _i4 < openEndCount; _i4++) {
|
|
1315
|
+
var node = cur.lastChild;
|
|
1316
|
+
this.frontier.push({
|
|
1317
|
+
type: node.type,
|
|
1318
|
+
match: node.contentMatchAt(node.childCount)
|
|
1319
|
+
});
|
|
1320
|
+
cur = node.content;
|
|
1321
|
+
}
|
|
1322
|
+
this.unplaced = !toEnd ? new prosemirrorModel.Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? prosemirrorModel.Slice.empty : new prosemirrorModel.Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
|
|
1323
|
+
}
|
|
1324
|
+
}, {
|
|
1325
|
+
key: "mustMoveInline",
|
|
1326
|
+
value: function mustMoveInline() {
|
|
1327
|
+
if (!this.$to.parent.isTextblock) return -1;
|
|
1328
|
+
var top = this.frontier[this.depth],
|
|
1329
|
+
level;
|
|
1330
|
+
if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) return -1;
|
|
1331
|
+
var depth = this.$to.depth,
|
|
1332
|
+
after = this.$to.after(depth);
|
|
1333
|
+
while (depth > 1 && after == this.$to.end(--depth)) ++after;
|
|
1334
|
+
return after;
|
|
1335
|
+
}
|
|
1336
|
+
}, {
|
|
1337
|
+
key: "findCloseLevel",
|
|
1338
|
+
value: function findCloseLevel($to) {
|
|
1339
|
+
scan: for (var i = Math.min(this.depth, $to.depth); i >= 0; i--) {
|
|
1340
|
+
var _this$frontier$i = this.frontier[i],
|
|
1341
|
+
match = _this$frontier$i.match,
|
|
1342
|
+
type = _this$frontier$i.type;
|
|
1343
|
+
var dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
|
|
1344
|
+
var fit = contentAfterFits($to, i, type, match, dropInner);
|
|
1345
|
+
if (!fit) continue;
|
|
1346
|
+
for (var d = i - 1; d >= 0; d--) {
|
|
1347
|
+
var _this$frontier$d = this.frontier[d],
|
|
1348
|
+
_match = _this$frontier$d.match,
|
|
1349
|
+
_type = _this$frontier$d.type;
|
|
1350
|
+
var matches = contentAfterFits($to, d, _type, _match, true);
|
|
1351
|
+
if (!matches || matches.childCount) continue scan;
|
|
1352
|
+
}
|
|
1353
|
+
return {
|
|
1354
|
+
depth: i,
|
|
1355
|
+
fit: fit,
|
|
1356
|
+
move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}, {
|
|
1361
|
+
key: "close",
|
|
1362
|
+
value: function close($to) {
|
|
1363
|
+
var close = this.findCloseLevel($to);
|
|
1364
|
+
if (!close) return null;
|
|
1365
|
+
while (this.depth > close.depth) this.closeFrontierNode();
|
|
1366
|
+
if (close.fit.childCount) this.placed = addToFragment(this.placed, close.depth, close.fit);
|
|
1367
|
+
$to = close.move;
|
|
1368
|
+
for (var d = close.depth + 1; d <= $to.depth; d++) {
|
|
1369
|
+
var node = $to.node(d),
|
|
1370
|
+
add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
|
|
1371
|
+
this.openFrontierNode(node.type, node.attrs, add);
|
|
1372
|
+
}
|
|
1373
|
+
return $to;
|
|
1374
|
+
}
|
|
1375
|
+
}, {
|
|
1376
|
+
key: "openFrontierNode",
|
|
1377
|
+
value: function openFrontierNode(type) {
|
|
1378
|
+
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1379
|
+
var content = arguments.length > 2 ? arguments[2] : undefined;
|
|
1380
|
+
var top = this.frontier[this.depth];
|
|
1381
|
+
top.match = top.match.matchType(type);
|
|
1382
|
+
this.placed = addToFragment(this.placed, this.depth, prosemirrorModel.Fragment.from(type.create(attrs, content)));
|
|
1383
|
+
this.frontier.push({
|
|
1384
|
+
type: type,
|
|
1385
|
+
match: type.contentMatch
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
}, {
|
|
1389
|
+
key: "closeFrontierNode",
|
|
1390
|
+
value: function closeFrontierNode() {
|
|
1391
|
+
var open = this.frontier.pop();
|
|
1392
|
+
var add = open.match.fillBefore(prosemirrorModel.Fragment.empty, true);
|
|
1393
|
+
if (add.childCount) this.placed = addToFragment(this.placed, this.frontier.length, add);
|
|
1394
|
+
}
|
|
1395
|
+
}]);
|
|
1396
|
+
return Fitter;
|
|
1397
|
+
}();
|
|
1398
|
+
function dropFromFragment(fragment, depth, count) {
|
|
1399
|
+
if (depth == 0) return fragment.cutByIndex(count, fragment.childCount);
|
|
1400
|
+
return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
|
|
1401
|
+
}
|
|
1402
|
+
function addToFragment(fragment, depth, content) {
|
|
1403
|
+
if (depth == 0) return fragment.append(content);
|
|
1404
|
+
return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
|
|
1405
|
+
}
|
|
1406
|
+
function contentAt(fragment, depth) {
|
|
1407
|
+
for (var i = 0; i < depth; i++) fragment = fragment.firstChild.content;
|
|
1408
|
+
return fragment;
|
|
1409
|
+
}
|
|
1410
|
+
function closeNodeStart(node, openStart, openEnd) {
|
|
1411
|
+
if (openStart <= 0) return node;
|
|
1412
|
+
var frag = node.content;
|
|
1413
|
+
if (openStart > 1) frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
|
|
1414
|
+
if (openStart > 0) {
|
|
1415
|
+
frag = node.type.contentMatch.fillBefore(frag).append(frag);
|
|
1416
|
+
if (openEnd <= 0) frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(prosemirrorModel.Fragment.empty, true));
|
|
1417
|
+
}
|
|
1418
|
+
return node.copy(frag);
|
|
1419
|
+
}
|
|
1420
|
+
function contentAfterFits($to, depth, type, match, open) {
|
|
1421
|
+
var node = $to.node(depth),
|
|
1422
|
+
index = open ? $to.indexAfter(depth) : $to.index(depth);
|
|
1423
|
+
if (index == node.childCount && !type.compatibleContent(node.type)) return null;
|
|
1424
|
+
var fit = match.fillBefore(node.content, true, index);
|
|
1425
|
+
return fit && !invalidMarks(type, node.content, index) ? fit : null;
|
|
1426
|
+
}
|
|
1427
|
+
function invalidMarks(type, fragment, start) {
|
|
1428
|
+
for (var i = start; i < fragment.childCount; i++) if (!type.allowsMarks(fragment.child(i).marks)) return true;
|
|
1429
|
+
return false;
|
|
1430
|
+
}
|
|
1431
|
+
function definesContent(type) {
|
|
1432
|
+
return type.spec.defining || type.spec.definingForContent;
|
|
1433
|
+
}
|
|
1434
|
+
function _replaceRange(tr, from, to, slice) {
|
|
1435
|
+
if (!slice.size) return tr.deleteRange(from, to);
|
|
1436
|
+
var $from = tr.doc.resolve(from),
|
|
1437
|
+
$to = tr.doc.resolve(to);
|
|
1438
|
+
if (fitsTrivially($from, $to, slice)) return tr.step(new ReplaceStep(from, to, slice));
|
|
1439
|
+
var targetDepths = coveredDepths($from, $to);
|
|
1440
|
+
if (targetDepths[targetDepths.length - 1] == 0) targetDepths.pop();
|
|
1441
|
+
var preferredTarget = -($from.depth + 1);
|
|
1442
|
+
targetDepths.unshift(preferredTarget);
|
|
1443
|
+
for (var d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
|
|
1444
|
+
var spec = $from.node(d).type.spec;
|
|
1445
|
+
if (spec.defining || spec.definingAsContext || spec.isolating) break;
|
|
1446
|
+
if (targetDepths.indexOf(d) > -1) preferredTarget = d;else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d);
|
|
1447
|
+
}
|
|
1448
|
+
var preferredTargetIndex = targetDepths.indexOf(preferredTarget);
|
|
1449
|
+
var leftNodes = [],
|
|
1450
|
+
preferredDepth = slice.openStart;
|
|
1451
|
+
for (var content = slice.content, i = 0;; i++) {
|
|
1452
|
+
var node = content.firstChild;
|
|
1453
|
+
leftNodes.push(node);
|
|
1454
|
+
if (i == slice.openStart) break;
|
|
1455
|
+
content = node.content;
|
|
1456
|
+
}
|
|
1457
|
+
for (var _d3 = preferredDepth - 1; _d3 >= 0; _d3--) {
|
|
1458
|
+
var leftNode = leftNodes[_d3],
|
|
1459
|
+
def = definesContent(leftNode.type);
|
|
1460
|
+
if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) preferredDepth = _d3;else if (def || !leftNode.type.isTextblock) break;
|
|
1461
|
+
}
|
|
1462
|
+
for (var j = slice.openStart; j >= 0; j--) {
|
|
1463
|
+
var openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
|
|
1464
|
+
var insert = leftNodes[openDepth];
|
|
1465
|
+
if (!insert) continue;
|
|
1466
|
+
for (var _i5 = 0; _i5 < targetDepths.length; _i5++) {
|
|
1467
|
+
var targetDepth = targetDepths[(_i5 + preferredTargetIndex) % targetDepths.length],
|
|
1468
|
+
expand = true;
|
|
1469
|
+
if (targetDepth < 0) {
|
|
1470
|
+
expand = false;
|
|
1471
|
+
targetDepth = -targetDepth;
|
|
1472
|
+
}
|
|
1473
|
+
var parent = $from.node(targetDepth - 1),
|
|
1474
|
+
index = $from.index(targetDepth - 1);
|
|
1475
|
+
if (parent.canReplaceWith(index, index, insert.type, insert.marks)) return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new prosemirrorModel.Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
var startSteps = tr.steps.length;
|
|
1479
|
+
for (var _i6 = targetDepths.length - 1; _i6 >= 0; _i6--) {
|
|
1480
|
+
tr.replace(from, to, slice);
|
|
1481
|
+
if (tr.steps.length > startSteps) break;
|
|
1482
|
+
var depth = targetDepths[_i6];
|
|
1483
|
+
if (depth < 0) continue;
|
|
1484
|
+
from = $from.before(depth);
|
|
1485
|
+
to = $to.after(depth);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
|
|
1489
|
+
if (depth < oldOpen) {
|
|
1490
|
+
var first = fragment.firstChild;
|
|
1491
|
+
fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
|
|
1492
|
+
}
|
|
1493
|
+
if (depth > newOpen) {
|
|
1494
|
+
var match = parent.contentMatchAt(0);
|
|
1495
|
+
var start = match.fillBefore(fragment).append(fragment);
|
|
1496
|
+
fragment = start.append(match.matchFragment(start).fillBefore(prosemirrorModel.Fragment.empty, true));
|
|
1497
|
+
}
|
|
1498
|
+
return fragment;
|
|
1499
|
+
}
|
|
1500
|
+
function _replaceRangeWith(tr, from, to, node) {
|
|
1501
|
+
if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
|
|
1502
|
+
var point = insertPoint(tr.doc, from, node.type);
|
|
1503
|
+
if (point != null) from = to = point;
|
|
1504
|
+
}
|
|
1505
|
+
tr.replaceRange(from, to, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(node), 0, 0));
|
|
1506
|
+
}
|
|
1507
|
+
function _deleteRange(tr, from, to) {
|
|
1508
|
+
var $from = tr.doc.resolve(from),
|
|
1509
|
+
$to = tr.doc.resolve(to);
|
|
1510
|
+
var covered = coveredDepths($from, $to);
|
|
1511
|
+
for (var i = 0; i < covered.length; i++) {
|
|
1512
|
+
var depth = covered[i],
|
|
1513
|
+
last = i == covered.length - 1;
|
|
1514
|
+
if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) return tr["delete"]($from.start(depth), $to.end(depth));
|
|
1515
|
+
if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr["delete"]($from.before(depth), $to.after(depth));
|
|
1516
|
+
}
|
|
1517
|
+
for (var d = 1; d <= $from.depth && d <= $to.depth; d++) {
|
|
1518
|
+
if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) return tr["delete"]($from.before(d), to);
|
|
1519
|
+
}
|
|
1520
|
+
tr["delete"](from, to);
|
|
1521
|
+
}
|
|
1522
|
+
function coveredDepths($from, $to) {
|
|
1523
|
+
var result = [],
|
|
1524
|
+
minDepth = Math.min($from.depth, $to.depth);
|
|
1525
|
+
for (var d = minDepth; d >= 0; d--) {
|
|
1526
|
+
var start = $from.start(d);
|
|
1527
|
+
if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) break;
|
|
1528
|
+
if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1) result.push(d);
|
|
1529
|
+
}
|
|
1530
|
+
return result;
|
|
1531
|
+
}
|
|
1532
|
+
var AttrStep = function (_Step7) {
|
|
1533
|
+
_inherits(AttrStep, _Step7);
|
|
1534
|
+
var _super7 = _createSuper(AttrStep);
|
|
1535
|
+
function AttrStep(pos, attr, value) {
|
|
1536
|
+
var _this9;
|
|
1537
|
+
_classCallCheck(this, AttrStep);
|
|
1538
|
+
_this9 = _super7.call(this);
|
|
1539
|
+
_this9.pos = pos;
|
|
1540
|
+
_this9.attr = attr;
|
|
1541
|
+
_this9.value = value;
|
|
1542
|
+
return _this9;
|
|
1543
|
+
}
|
|
1544
|
+
_createClass(AttrStep, [{
|
|
1545
|
+
key: "apply",
|
|
1546
|
+
value: function apply(doc) {
|
|
1547
|
+
var node = doc.nodeAt(this.pos);
|
|
1548
|
+
if (!node) return StepResult.fail("No node at attribute step's position");
|
|
1549
|
+
var attrs = Object.create(null);
|
|
1550
|
+
for (var name in node.attrs) attrs[name] = node.attrs[name];
|
|
1551
|
+
attrs[this.attr] = this.value;
|
|
1552
|
+
var updated = node.type.create(attrs, null, node.marks);
|
|
1553
|
+
return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
|
|
1554
|
+
}
|
|
1555
|
+
}, {
|
|
1556
|
+
key: "getMap",
|
|
1557
|
+
value: function getMap() {
|
|
1558
|
+
return StepMap.empty;
|
|
1559
|
+
}
|
|
1560
|
+
}, {
|
|
1561
|
+
key: "invert",
|
|
1562
|
+
value: function invert(doc) {
|
|
1563
|
+
return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
|
|
1564
|
+
}
|
|
1565
|
+
}, {
|
|
1566
|
+
key: "map",
|
|
1567
|
+
value: function map(mapping) {
|
|
1568
|
+
var pos = mapping.mapResult(this.pos, 1);
|
|
1569
|
+
return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
|
|
1570
|
+
}
|
|
1571
|
+
}, {
|
|
1572
|
+
key: "toJSON",
|
|
1573
|
+
value: function toJSON() {
|
|
1574
|
+
return {
|
|
1575
|
+
stepType: "attr",
|
|
1576
|
+
pos: this.pos,
|
|
1577
|
+
attr: this.attr,
|
|
1578
|
+
value: this.value
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
}], [{
|
|
1582
|
+
key: "fromJSON",
|
|
1583
|
+
value: function fromJSON(schema, json) {
|
|
1584
|
+
if (typeof json.pos != "number" || typeof json.attr != "string") throw new RangeError("Invalid input for AttrStep.fromJSON");
|
|
1585
|
+
return new AttrStep(json.pos, json.attr, json.value);
|
|
1586
|
+
}
|
|
1587
|
+
}]);
|
|
1588
|
+
return AttrStep;
|
|
1589
|
+
}(Step);
|
|
1590
|
+
Step.jsonID("attr", AttrStep);
|
|
1591
|
+
var DocAttrStep = function (_Step8) {
|
|
1592
|
+
_inherits(DocAttrStep, _Step8);
|
|
1593
|
+
var _super8 = _createSuper(DocAttrStep);
|
|
1594
|
+
function DocAttrStep(attr, value) {
|
|
1595
|
+
var _this10;
|
|
1596
|
+
_classCallCheck(this, DocAttrStep);
|
|
1597
|
+
_this10 = _super8.call(this);
|
|
1598
|
+
_this10.attr = attr;
|
|
1599
|
+
_this10.value = value;
|
|
1600
|
+
return _this10;
|
|
1601
|
+
}
|
|
1602
|
+
_createClass(DocAttrStep, [{
|
|
1603
|
+
key: "apply",
|
|
1604
|
+
value: function apply(doc) {
|
|
1605
|
+
var attrs = Object.create(null);
|
|
1606
|
+
for (var name in doc.attrs) attrs[name] = doc.attrs[name];
|
|
1607
|
+
attrs[this.attr] = this.value;
|
|
1608
|
+
var updated = doc.type.create(attrs, doc.content, doc.marks);
|
|
1609
|
+
return StepResult.ok(updated);
|
|
1610
|
+
}
|
|
1611
|
+
}, {
|
|
1612
|
+
key: "getMap",
|
|
1613
|
+
value: function getMap() {
|
|
1614
|
+
return StepMap.empty;
|
|
1615
|
+
}
|
|
1616
|
+
}, {
|
|
1617
|
+
key: "invert",
|
|
1618
|
+
value: function invert(doc) {
|
|
1619
|
+
return new DocAttrStep(this.attr, doc.attrs[this.attr]);
|
|
1620
|
+
}
|
|
1621
|
+
}, {
|
|
1622
|
+
key: "map",
|
|
1623
|
+
value: function map(mapping) {
|
|
1624
|
+
return this;
|
|
1625
|
+
}
|
|
1626
|
+
}, {
|
|
1627
|
+
key: "toJSON",
|
|
1628
|
+
value: function toJSON() {
|
|
1629
|
+
return {
|
|
1630
|
+
stepType: "docAttr",
|
|
1631
|
+
attr: this.attr,
|
|
1632
|
+
value: this.value
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
}], [{
|
|
1636
|
+
key: "fromJSON",
|
|
1637
|
+
value: function fromJSON(schema, json) {
|
|
1638
|
+
if (typeof json.attr != "string") throw new RangeError("Invalid input for DocAttrStep.fromJSON");
|
|
1639
|
+
return new DocAttrStep(json.attr, json.value);
|
|
1640
|
+
}
|
|
1641
|
+
}]);
|
|
1642
|
+
return DocAttrStep;
|
|
1643
|
+
}(Step);
|
|
1644
|
+
Step.jsonID("docAttr", DocAttrStep);
|
|
1645
|
+
exports.TransformError = function (_Error) {
|
|
1646
|
+
_inherits(TransformError, _Error);
|
|
1647
|
+
var _super9 = _createSuper(TransformError);
|
|
1648
|
+
function TransformError() {
|
|
1649
|
+
_classCallCheck(this, TransformError);
|
|
1650
|
+
return _super9.apply(this, arguments);
|
|
1651
|
+
}
|
|
1652
|
+
return _createClass(TransformError);
|
|
1653
|
+
}(_wrapNativeSuper(Error));
|
|
1654
|
+
exports.TransformError = function TransformError(message) {
|
|
1655
|
+
var err = Error.call(this, message);
|
|
1656
|
+
err.__proto__ = TransformError.prototype;
|
|
1657
|
+
return err;
|
|
1658
|
+
};
|
|
1659
|
+
exports.TransformError.prototype = Object.create(Error.prototype);
|
|
1660
|
+
exports.TransformError.prototype.constructor = exports.TransformError;
|
|
1661
|
+
exports.TransformError.prototype.name = "TransformError";
|
|
1662
|
+
var Transform = function () {
|
|
1663
|
+
function Transform(doc) {
|
|
1664
|
+
_classCallCheck(this, Transform);
|
|
1665
|
+
this.doc = doc;
|
|
1666
|
+
this.steps = [];
|
|
1667
|
+
this.docs = [];
|
|
1668
|
+
this.mapping = new Mapping();
|
|
1669
|
+
}
|
|
1670
|
+
_createClass(Transform, [{
|
|
1671
|
+
key: "before",
|
|
1672
|
+
get: function get() {
|
|
1673
|
+
return this.docs.length ? this.docs[0] : this.doc;
|
|
1674
|
+
}
|
|
1675
|
+
}, {
|
|
1676
|
+
key: "step",
|
|
1677
|
+
value: function step(_step) {
|
|
1678
|
+
var result = this.maybeStep(_step);
|
|
1679
|
+
if (result.failed) throw new exports.TransformError(result.failed);
|
|
1680
|
+
return this;
|
|
1681
|
+
}
|
|
1682
|
+
}, {
|
|
1683
|
+
key: "maybeStep",
|
|
1684
|
+
value: function maybeStep(step) {
|
|
1685
|
+
var result = step.apply(this.doc);
|
|
1686
|
+
if (!result.failed) this.addStep(step, result.doc);
|
|
1687
|
+
return result;
|
|
1688
|
+
}
|
|
1689
|
+
}, {
|
|
1690
|
+
key: "docChanged",
|
|
1691
|
+
get: function get() {
|
|
1692
|
+
return this.steps.length > 0;
|
|
1693
|
+
}
|
|
1694
|
+
}, {
|
|
1695
|
+
key: "changedRange",
|
|
1696
|
+
value: function changedRange() {
|
|
1697
|
+
var from = 1e9,
|
|
1698
|
+
to = -1e9;
|
|
1699
|
+
for (var i = 0; i < this.mapping.maps.length; i++) {
|
|
1700
|
+
var map = this.mapping.maps[i];
|
|
1701
|
+
if (i) {
|
|
1702
|
+
from = map.map(from, 1);
|
|
1703
|
+
to = map.map(to, -1);
|
|
1704
|
+
}
|
|
1705
|
+
map.forEach(function (_f, _t, fromB, toB) {
|
|
1706
|
+
from = Math.min(from, fromB);
|
|
1707
|
+
to = Math.max(to, toB);
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
return from == 1e9 ? null : {
|
|
1711
|
+
from: from,
|
|
1712
|
+
to: to
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
}, {
|
|
1716
|
+
key: "addStep",
|
|
1717
|
+
value: function addStep(step, doc) {
|
|
1718
|
+
this.docs.push(this.doc);
|
|
1719
|
+
this.steps.push(step);
|
|
1720
|
+
this.mapping.appendMap(step.getMap());
|
|
1721
|
+
this.doc = doc;
|
|
1722
|
+
}
|
|
1723
|
+
}, {
|
|
1724
|
+
key: "replace",
|
|
1725
|
+
value: function replace(from) {
|
|
1726
|
+
var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
1727
|
+
var slice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : prosemirrorModel.Slice.empty;
|
|
1728
|
+
var step = replaceStep(this.doc, from, to, slice);
|
|
1729
|
+
if (step) this.step(step);
|
|
1730
|
+
return this;
|
|
1731
|
+
}
|
|
1732
|
+
}, {
|
|
1733
|
+
key: "replaceWith",
|
|
1734
|
+
value: function replaceWith(from, to, content) {
|
|
1735
|
+
return this.replace(from, to, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(content), 0, 0));
|
|
1736
|
+
}
|
|
1737
|
+
}, {
|
|
1738
|
+
key: "delete",
|
|
1739
|
+
value: function _delete(from, to) {
|
|
1740
|
+
return this.replace(from, to, prosemirrorModel.Slice.empty);
|
|
1741
|
+
}
|
|
1742
|
+
}, {
|
|
1743
|
+
key: "insert",
|
|
1744
|
+
value: function insert(pos, content) {
|
|
1745
|
+
return this.replaceWith(pos, pos, content);
|
|
1746
|
+
}
|
|
1747
|
+
}, {
|
|
1748
|
+
key: "replaceRange",
|
|
1749
|
+
value: function replaceRange(from, to, slice) {
|
|
1750
|
+
_replaceRange(this, from, to, slice);
|
|
1751
|
+
return this;
|
|
1752
|
+
}
|
|
1753
|
+
}, {
|
|
1754
|
+
key: "replaceRangeWith",
|
|
1755
|
+
value: function replaceRangeWith(from, to, node) {
|
|
1756
|
+
_replaceRangeWith(this, from, to, node);
|
|
1757
|
+
return this;
|
|
1758
|
+
}
|
|
1759
|
+
}, {
|
|
1760
|
+
key: "deleteRange",
|
|
1761
|
+
value: function deleteRange(from, to) {
|
|
1762
|
+
_deleteRange(this, from, to);
|
|
1763
|
+
return this;
|
|
1764
|
+
}
|
|
1765
|
+
}, {
|
|
1766
|
+
key: "lift",
|
|
1767
|
+
value: function lift(range, target) {
|
|
1768
|
+
_lift(this, range, target);
|
|
1769
|
+
return this;
|
|
1770
|
+
}
|
|
1771
|
+
}, {
|
|
1772
|
+
key: "join",
|
|
1773
|
+
value: function join(pos) {
|
|
1774
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1775
|
+
_join(this, pos, depth);
|
|
1776
|
+
return this;
|
|
1777
|
+
}
|
|
1778
|
+
}, {
|
|
1779
|
+
key: "wrap",
|
|
1780
|
+
value: function wrap(range, wrappers) {
|
|
1781
|
+
_wrap2(this, range, wrappers);
|
|
1782
|
+
return this;
|
|
1783
|
+
}
|
|
1784
|
+
}, {
|
|
1785
|
+
key: "setBlockType",
|
|
1786
|
+
value: function setBlockType(from) {
|
|
1787
|
+
var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
|
|
1788
|
+
var type = arguments.length > 2 ? arguments[2] : undefined;
|
|
1789
|
+
var attrs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
1790
|
+
_setBlockType(this, from, to, type, attrs);
|
|
1791
|
+
return this;
|
|
1792
|
+
}
|
|
1793
|
+
}, {
|
|
1794
|
+
key: "setNodeMarkup",
|
|
1795
|
+
value: function setNodeMarkup(pos, type) {
|
|
1796
|
+
var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
1797
|
+
var marks = arguments.length > 3 ? arguments[3] : undefined;
|
|
1798
|
+
_setNodeMarkup(this, pos, type, attrs, marks);
|
|
1799
|
+
return this;
|
|
1800
|
+
}
|
|
1801
|
+
}, {
|
|
1802
|
+
key: "setNodeAttribute",
|
|
1803
|
+
value: function setNodeAttribute(pos, attr, value) {
|
|
1804
|
+
this.step(new AttrStep(pos, attr, value));
|
|
1805
|
+
return this;
|
|
1806
|
+
}
|
|
1807
|
+
}, {
|
|
1808
|
+
key: "setDocAttribute",
|
|
1809
|
+
value: function setDocAttribute(attr, value) {
|
|
1810
|
+
this.step(new DocAttrStep(attr, value));
|
|
1811
|
+
return this;
|
|
1812
|
+
}
|
|
1813
|
+
}, {
|
|
1814
|
+
key: "addNodeMark",
|
|
1815
|
+
value: function addNodeMark(pos, mark) {
|
|
1816
|
+
this.step(new AddNodeMarkStep(pos, mark));
|
|
1817
|
+
return this;
|
|
1818
|
+
}
|
|
1819
|
+
}, {
|
|
1820
|
+
key: "removeNodeMark",
|
|
1821
|
+
value: function removeNodeMark(pos, mark) {
|
|
1822
|
+
var node = this.doc.nodeAt(pos);
|
|
1823
|
+
if (!node) throw new RangeError("No node at position " + pos);
|
|
1824
|
+
if (mark instanceof prosemirrorModel.Mark) {
|
|
1825
|
+
if (mark.isInSet(node.marks)) this.step(new RemoveNodeMarkStep(pos, mark));
|
|
1826
|
+
} else {
|
|
1827
|
+
var set = node.marks,
|
|
1828
|
+
found,
|
|
1829
|
+
steps = [];
|
|
1830
|
+
while (found = mark.isInSet(set)) {
|
|
1831
|
+
steps.push(new RemoveNodeMarkStep(pos, found));
|
|
1832
|
+
set = found.removeFromSet(set);
|
|
1833
|
+
}
|
|
1834
|
+
for (var i = steps.length - 1; i >= 0; i--) this.step(steps[i]);
|
|
1835
|
+
}
|
|
1836
|
+
return this;
|
|
1837
|
+
}
|
|
1838
|
+
}, {
|
|
1839
|
+
key: "split",
|
|
1840
|
+
value: function split(pos) {
|
|
1841
|
+
var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
1842
|
+
var typesAfter = arguments.length > 2 ? arguments[2] : undefined;
|
|
1843
|
+
_split(this, pos, depth, typesAfter);
|
|
1844
|
+
return this;
|
|
1845
|
+
}
|
|
1846
|
+
}, {
|
|
1847
|
+
key: "addMark",
|
|
1848
|
+
value: function addMark(from, to, mark) {
|
|
1849
|
+
_addMark(this, from, to, mark);
|
|
1850
|
+
return this;
|
|
1851
|
+
}
|
|
1852
|
+
}, {
|
|
1853
|
+
key: "removeMark",
|
|
1854
|
+
value: function removeMark(from, to, mark) {
|
|
1855
|
+
_removeMark(this, from, to, mark);
|
|
1856
|
+
return this;
|
|
1857
|
+
}
|
|
1858
|
+
}, {
|
|
1859
|
+
key: "clearIncompatible",
|
|
1860
|
+
value: function clearIncompatible(pos, parentType, match) {
|
|
1861
|
+
_clearIncompatible(this, pos, parentType, match);
|
|
1862
|
+
return this;
|
|
1863
|
+
}
|
|
1864
|
+
}]);
|
|
1865
|
+
return Transform;
|
|
1866
|
+
}();
|
|
1867
|
+
exports.AddMarkStep = AddMarkStep;
|
|
1868
|
+
exports.AddNodeMarkStep = AddNodeMarkStep;
|
|
1869
|
+
exports.AttrStep = AttrStep;
|
|
1870
|
+
exports.DocAttrStep = DocAttrStep;
|
|
1871
|
+
exports.MapResult = MapResult;
|
|
1872
|
+
exports.Mapping = Mapping;
|
|
1873
|
+
exports.RemoveMarkStep = RemoveMarkStep;
|
|
1874
|
+
exports.RemoveNodeMarkStep = RemoveNodeMarkStep;
|
|
1875
|
+
exports.ReplaceAroundStep = ReplaceAroundStep;
|
|
1876
|
+
exports.ReplaceStep = ReplaceStep;
|
|
1877
|
+
exports.Step = Step;
|
|
1878
|
+
exports.StepMap = StepMap;
|
|
1879
|
+
exports.StepResult = StepResult;
|
|
1880
|
+
exports.Transform = Transform;
|
|
1881
|
+
exports.canJoin = canJoin;
|
|
1882
|
+
exports.canSplit = canSplit;
|
|
1883
|
+
exports.dropPoint = dropPoint;
|
|
1884
|
+
exports.findWrapping = findWrapping;
|
|
1885
|
+
exports.insertPoint = insertPoint;
|
|
1886
|
+
exports.joinPoint = joinPoint;
|
|
1887
|
+
exports.liftTarget = liftTarget;
|
|
1888
|
+
exports.replaceStep = replaceStep;
|