@blade-hq/agent-react 2612.0.0-beta.0 → 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 +98 -250
- package/dist/chat/AgentLoopBlock.d.ts +14 -0
- package/dist/{components → chat}/AskUserQuestionBlock.d.ts +3 -7
- package/dist/chat/AssistantTurnBlock.d.ts +50 -0
- package/dist/chat/AttachmentPreviewDialog.d.ts +26 -0
- package/dist/chat/ChatPanel.d.ts +62 -0
- package/dist/chat/CompactionCard.d.ts +6 -0
- package/dist/chat/ConnectionBanner.d.ts +10 -0
- package/dist/chat/CurrentPlanPanel.d.ts +20 -0
- package/dist/chat/FileDeliveryCards.d.ts +26 -0
- package/dist/chat/FinalArtifactCards.d.ts +8 -0
- package/dist/chat/ImageLightbox.d.ts +11 -0
- package/dist/chat/LightComposer.d.ts +7 -0
- package/dist/chat/LiteMessageList.d.ts +82 -0
- package/dist/chat/MessageActions.d.ts +6 -0
- package/dist/chat/MessageContextPills.d.ts +6 -0
- package/dist/chat/MessageFileAttachmentList.d.ts +13 -0
- package/dist/chat/MessageList.d.ts +55 -0
- package/dist/chat/PostChatFollowupBlock.d.ts +11 -0
- package/dist/{components → chat}/RenderErrorBoundary.d.ts +0 -1
- package/dist/chat/ResultFeedback.d.ts +11 -0
- package/dist/chat/SessionReplayBar.d.ts +12 -0
- package/dist/chat/TextAttachmentPills.d.ts +10 -0
- package/dist/chat/ToolCallBlock.d.ts +48 -0
- package/dist/chat/ToolUiCard.d.ts +6 -0
- package/dist/chat/TurnNavRail.d.ts +17 -0
- package/dist/chat/UserMessageBubble.d.ts +20 -0
- package/dist/chat/WorkflowRunBlock.d.ts +29 -0
- package/dist/chat/ai-elements/reasoning.d.ts +32 -0
- package/dist/chat/ai-elements/shimmer.d.ts +15 -0
- package/dist/chat/assistant-turn-questions.d.ts +14 -0
- package/dist/chat/card/CardContext.d.ts +7 -0
- package/dist/chat/chat-theme.d.ts +19 -0
- package/dist/chat/customization.d.ts +210 -0
- package/dist/chat/display-utils.d.ts +48 -0
- package/dist/{components/PostChatFollowupBlock.d.ts → chat/followup-interaction.d.ts} +5 -17
- package/dist/chat/index.d.ts +97 -0
- package/dist/chat/lib/citations.d.ts +13 -0
- package/dist/chat/lib/code-language.d.ts +5 -0
- package/dist/chat/lib/loopback.d.ts +8 -0
- package/dist/chat/lib/markdown-asset-url.d.ts +5 -0
- package/dist/chat/lib/preview-dispatch.d.ts +24 -0
- package/dist/chat/lib/skill-name.d.ts +9 -0
- package/dist/chat/lib/skill-visibility.d.ts +8 -0
- package/dist/chat/lib/ui-meta.d.ts +5 -0
- package/dist/chat/lib/use-async-value.d.ts +8 -0
- package/dist/chat/markdown/ExternalAnchor.d.ts +9 -0
- package/dist/chat/markdown/MarkdownContent.d.ts +43 -0
- package/dist/chat/markdown/text.d.ts +11 -0
- package/dist/chat/message-list-blocks.d.ts +92 -0
- package/dist/chat/plan/PlanSummaryCard.d.ts +10 -0
- package/dist/chat/plan/extract-plan-messages.d.ts +4 -0
- package/dist/chat/plan/parse-plan-messages.d.ts +10 -0
- package/dist/chat/plan/parse-plan-tree.d.ts +16 -0
- package/dist/chat/plan/types.d.ts +56 -0
- package/dist/chat/reasoning-visibility.d.ts +2 -0
- package/dist/chat/runtime/actions.d.ts +23 -0
- package/dist/chat/runtime/background-task-dismissals.d.ts +10 -0
- package/dist/chat/runtime/composer-channels.d.ts +50 -0
- package/dist/chat/runtime/environment.d.ts +152 -0
- package/dist/chat/runtime/input-cache-reset.d.ts +8 -0
- package/dist/chat/runtime/input-history-storage.d.ts +2 -0
- package/dist/chat/runtime/input-services.d.ts +105 -0
- package/dist/chat/runtime/session-source.d.ts +49 -0
- package/dist/chat/runtime/use-chat-actions.d.ts +19 -0
- package/dist/chat/runtime/use-session-replay.d.ts +16 -0
- package/dist/chat/scroll-anchor.d.ts +46 -0
- package/dist/chat/tool-renderers/BashRenderer.d.ts +2 -0
- package/dist/chat/tool-renderers/FileEditRenderer.d.ts +2 -0
- package/dist/chat/tool-renderers/FileReadRenderer.d.ts +2 -0
- package/dist/chat/tool-renderers/SearchRenderer.d.ts +2 -0
- package/dist/chat/tool-renderers/SubmitResultRenderer.d.ts +2 -0
- package/dist/chat/tool-renderers/registry.d.ts +5 -0
- package/dist/chat/tool-renderers/shared.d.ts +30 -0
- package/dist/chat/tool-renderers/write-preview-scroll.d.ts +5 -0
- package/dist/chat-OCLOVB3H.css +175 -0
- package/dist/chat.css +175 -0
- package/dist/chunk-7TQVTNPL.js +26947 -0
- package/dist/chunk-7TQVTNPL.js.map +1 -0
- package/dist/chunk-EYRP6PV3.js +258 -0
- package/dist/chunk-EYRP6PV3.js.map +1 -0
- package/dist/chunk-JVM2WTTS.js +49625 -0
- package/dist/chunk-JVM2WTTS.js.map +1 -0
- package/dist/{chunk-G3PMV62Z.js → chunk-PR4QN5HX.js} +9 -2
- package/dist/components/AgentChat.d.ts +3 -3
- package/dist/components/ChatInput.d.ts +3 -1
- package/dist/components/ChatView.d.ts +2 -2
- package/dist/components/ConnectorPanel.d.ts +1 -1
- package/dist/components/ContextCard.d.ts +1 -1
- package/dist/components/LlmChat.d.ts +1 -1
- package/dist/components/McpAppCard.d.ts +1 -1
- package/dist/components/PlanUpdateBlock.d.ts +0 -8
- package/dist/components/PluginConnectorList.d.ts +1 -1
- package/dist/components/ReplayBar.d.ts +1 -1
- package/dist/components/SessionPluginConfigDialog.d.ts +1 -1
- package/dist/components/SessionPluginConfigForm.d.ts +1 -1
- package/dist/components/SessionPluginIcon.d.ts +1 -1
- package/dist/components/SessionPluginSelector.d.ts +1 -1
- package/dist/components/SessionQueuePanel.d.ts +1 -1
- package/dist/components/ToolUiCardView.d.ts +1 -1
- package/dist/components/TopicAssetSubmitDialog.d.ts +14 -0
- package/dist/components/plugin-config-draft.d.ts +1 -1
- package/dist/components/plugin-config-schema.d.ts +1 -1
- package/dist/components/plugin-connector.d.ts +2 -1
- package/dist/components/use-session-plugin-activation.d.ts +1 -1
- package/dist/context.d.ts +11 -2
- package/dist/embed/blade-chat-element.d.ts +14 -1
- package/dist/embed/entry.d.ts +10 -78
- package/dist/hooks/use-replay.d.ts +1 -1
- package/dist/hooks/use-turn-navigation.d.ts +1 -1
- package/dist/host.d.ts +50 -0
- package/dist/index.d.ts +13 -69
- package/dist/index.js +15 -63524
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +63 -0
- package/dist/internal.js +662 -0
- package/dist/internal.js.map +1 -0
- package/dist/lib/agent-computer-command.d.ts +1 -3
- package/dist/lib/mount-renderers.d.ts +25 -0
- package/dist/lib/use-effect-event.d.ts +3 -0
- package/dist/rich-input/BackgroundTasksPill.d.ts +3 -0
- package/dist/rich-input/ChatInput.d.ts +59 -0
- package/dist/rich-input/ComposerAttachmentViewport.d.ts +3 -0
- package/dist/rich-input/ConnectButton.d.ts +24 -0
- package/dist/rich-input/FileCompletionMenu.d.ts +41 -0
- package/dist/rich-input/FileSizeLimitDialog.d.ts +9 -0
- package/dist/rich-input/ModelSelector.d.ts +10 -0
- package/dist/rich-input/PlanningToggle.d.ts +7 -0
- package/dist/rich-input/ProgressCircle.d.ts +12 -0
- package/dist/rich-input/ReasoningModeSelect.d.ts +9 -0
- package/dist/rich-input/SkillCompletionMenu.d.ts +9 -0
- package/dist/rich-input/SkillStatusBar.d.ts +13 -0
- package/dist/rich-input/extensions/file-mention.d.ts +12 -0
- package/dist/rich-input/extensions/plugin-mention.d.ts +15 -0
- package/dist/rich-input/extensions/skill-mention.d.ts +30 -0
- package/dist/rich-input/extensions/topic-asset-mention.d.ts +13 -0
- package/dist/rich-input/index.d.ts +51 -0
- package/dist/rich-input/input-keyboard.d.ts +13 -0
- package/dist/rich-input/lib/attachment-upload.d.ts +10 -0
- package/dist/rich-input/lib/background-tasks-view.d.ts +31 -0
- package/dist/rich-input/lib/client-query.d.ts +32 -0
- package/dist/rich-input/lib/composer-content.d.ts +32 -0
- package/dist/rich-input/lib/image-input-availability.d.ts +3 -0
- 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/reasoning-levels.d.ts +1 -0
- package/dist/rich-input/lib/reference-candidates.d.ts +27 -0
- package/dist/rich-input/lib/session-data.d.ts +20 -0
- package/dist/rich-input/lib/skill-suggestions.d.ts +19 -0
- package/dist/rich-input/lib/token-estimate.d.ts +2 -0
- package/dist/rich-input/lib/token-pressure.d.ts +8 -0
- package/dist/rich-input/lib/topic-asset-suggestions.d.ts +6 -0
- package/dist/rich-input/lib/upload-results.d.ts +8 -0
- package/dist/rich-input/lib/user-home.d.ts +33 -0
- package/dist/rich-input/model/model-data.d.ts +6 -0
- package/dist/rich-input/model/resolve-model.d.ts +59 -0
- package/dist/rich-input/model/use-composer-model.d.ts +24 -0
- package/dist/rich-input/services.d.ts +21 -0
- package/dist/rich-input/use-dismiss-skill-suggestions-on-mode-change.d.ts +3 -0
- package/dist/rich-input/use-input-history.d.ts +14 -0
- package/dist/rich-input/use-reference-candidates.d.ts +8 -0
- package/dist/rich-input/voice/VoiceWaveform.d.ts +10 -0
- package/dist/rich-input/voice/use-tiptap-voice-input.d.ts +47 -0
- package/dist/rich-input/voice/use-voice-input.d.ts +2 -0
- package/dist/rich-input/voice/voice-input-support.d.ts +5 -0
- package/dist/rich-input.js +29911 -0
- package/dist/rich-input.js.map +1 -0
- package/dist/style.css +30 -64
- package/dist/style.full.css +210 -65
- package/dist/{webapi-W3IB5DO4.js → webapi-E7K2CNM7.js} +2 -2
- 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 +130 -4
- package/public-api.md +215 -3591
- package/dist/components/AgentLoopBlock.d.ts +0 -8
- package/dist/components/AgentTaskCard.d.ts +0 -12
- package/dist/components/AssistantTurnBlock.d.ts +0 -36
- package/dist/components/ChatSurface.d.ts +0 -199
- package/dist/components/ConnectionBanner.d.ts +0 -8
- package/dist/components/MarkdownContent.d.ts +0 -30
- package/dist/components/MessageList.d.ts +0 -62
- package/dist/components/Shimmer.d.ts +0 -7
- package/dist/components/ToolCallBlock.d.ts +0 -41
- package/dist/components/TurnNavRail.d.ts +0 -23
- package/dist/components/UserMessageBubble.d.ts +0 -25
- package/dist/components/display-utils.d.ts +0 -4
- /package/dist/{chunk-G3PMV62Z.js.map → chunk-PR4QN5HX.js.map} +0 -0
- /package/dist/{webapi-W3IB5DO4.js.map → webapi-E7K2CNM7.js.map} +0 -0
|
@@ -0,0 +1,1590 @@
|
|
|
1
|
+
import {DOMSerializer, Fragment, Mark, Node, TagParseRule} from "prosemirror-model"
|
|
2
|
+
import {TextSelection} from "prosemirror-state"
|
|
3
|
+
|
|
4
|
+
import {domIndex, isEquivalentPosition, DOMNode} from "./dom"
|
|
5
|
+
import * as browser from "./browser"
|
|
6
|
+
import {Decoration, DecorationSource, WidgetConstructor, WidgetType, NodeType} from "./decoration"
|
|
7
|
+
import {EditorView} from "./index"
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
interface Node {
|
|
11
|
+
/// @internal
|
|
12
|
+
pmViewDesc?: ViewDesc
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/// A ViewMutationRecord represents a DOM
|
|
17
|
+
/// [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)
|
|
18
|
+
/// or a selection change happens within the view. When the change is
|
|
19
|
+
/// a selection change, the record will have a `type` property of
|
|
20
|
+
/// `"selection"` (which doesn't occur for native mutation records).
|
|
21
|
+
export type ViewMutationRecord = MutationRecord | { type: "selection", target: DOMNode }
|
|
22
|
+
|
|
23
|
+
/// By default, document nodes are rendered using the result of the
|
|
24
|
+
/// [`toDOM`](#model.NodeSpec.toDOM) method of their spec, and managed
|
|
25
|
+
/// entirely by the editor. For some use cases, such as embedded
|
|
26
|
+
/// node-specific editing interfaces, you want more control over
|
|
27
|
+
/// the behavior of a node's in-editor representation, and need to
|
|
28
|
+
/// [define](#view.EditorProps.nodeViews) a custom node view.
|
|
29
|
+
///
|
|
30
|
+
/// Objects returned as node views must conform to this interface.
|
|
31
|
+
export interface NodeView {
|
|
32
|
+
/// The outer DOM node that represents the document node.
|
|
33
|
+
dom: DOMNode
|
|
34
|
+
|
|
35
|
+
/// The DOM node that should hold the node's content. Only meaningful
|
|
36
|
+
/// if the node view also defines a `dom` property and if its node
|
|
37
|
+
/// type is not a leaf node type. When this is present, ProseMirror
|
|
38
|
+
/// will take care of rendering the node's children into it. When it
|
|
39
|
+
/// is not present, the node view itself is responsible for rendering
|
|
40
|
+
/// (or deciding not to render) its child nodes.
|
|
41
|
+
contentDOM?: HTMLElement | null
|
|
42
|
+
|
|
43
|
+
/// When given, this will be called when the view is updating
|
|
44
|
+
/// itself. It will be given a node, an array of active decorations
|
|
45
|
+
/// around the node (which are automatically drawn, and the node
|
|
46
|
+
/// view may ignore if it isn't interested in them), and a
|
|
47
|
+
/// [decoration source](#view.DecorationSource) that represents any
|
|
48
|
+
/// decorations that apply to the content of the node (which again
|
|
49
|
+
/// may be ignored). It should return true if it was able to update
|
|
50
|
+
/// to that node, and false otherwise. If the node view has a
|
|
51
|
+
/// `contentDOM` property (or no `dom` property), updating its child
|
|
52
|
+
/// nodes will be handled by ProseMirror.
|
|
53
|
+
update?: (node: Node, decorations: readonly Decoration[], innerDecorations: DecorationSource) => boolean
|
|
54
|
+
|
|
55
|
+
/// By default, `update` will only be called when a node of the same
|
|
56
|
+
/// node type appears in this view's position. When you set this to
|
|
57
|
+
/// true, it will be called for any node, making it possible to have
|
|
58
|
+
/// a node view that representsmultiple types of nodes. You will
|
|
59
|
+
/// need to check the type of the nodes you get in `update` and
|
|
60
|
+
/// return `false` for types you cannot handle.
|
|
61
|
+
multiType?: boolean
|
|
62
|
+
|
|
63
|
+
/// Can be used to override the way the node's selected status (as a
|
|
64
|
+
/// node selection) is displayed.
|
|
65
|
+
selectNode?: () => void
|
|
66
|
+
|
|
67
|
+
/// When defining a `selectNode` method, you should also provide a
|
|
68
|
+
/// `deselectNode` method to remove the effect again.
|
|
69
|
+
deselectNode?: () => void
|
|
70
|
+
|
|
71
|
+
/// This will be called to handle setting the selection inside the
|
|
72
|
+
/// node. The `anchor` and `head` positions are relative to the start
|
|
73
|
+
/// of the node. By default, a DOM selection will be created between
|
|
74
|
+
/// the DOM positions corresponding to those positions, but if you
|
|
75
|
+
/// override it you can do something else.
|
|
76
|
+
setSelection?: (anchor: number, head: number, root: Document | ShadowRoot) => void
|
|
77
|
+
|
|
78
|
+
/// Can be used to prevent the editor view from trying to handle some
|
|
79
|
+
/// or all DOM events that bubble up from the node view. Events for
|
|
80
|
+
/// which this returns true are not handled by the editor.
|
|
81
|
+
stopEvent?: (event: Event) => boolean
|
|
82
|
+
|
|
83
|
+
/// Called when a [mutation](#view.ViewMutationRecord) happens within the
|
|
84
|
+
/// view. Return false if the editor should re-read the selection or re-parse
|
|
85
|
+
/// the range around the mutation, true if it can safely be ignored.
|
|
86
|
+
ignoreMutation?: (mutation: ViewMutationRecord) => boolean
|
|
87
|
+
|
|
88
|
+
/// Called when the node view is removed from the editor or the whole
|
|
89
|
+
/// editor is destroyed.
|
|
90
|
+
destroy?: () => void
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/// By default, document marks are rendered using the result of the
|
|
94
|
+
/// [`toDOM`](#model.MarkSpec.toDOM) method of their spec, and managed entirely
|
|
95
|
+
/// by the editor. For some use cases, you want more control over the behavior
|
|
96
|
+
/// of a mark's in-editor representation, and need to
|
|
97
|
+
/// [define](#view.EditorProps.markViews) a custom mark view.
|
|
98
|
+
///
|
|
99
|
+
/// Objects returned as mark views must conform to this interface.
|
|
100
|
+
export interface MarkView {
|
|
101
|
+
/// The outer DOM node that represents the document node.
|
|
102
|
+
dom: DOMNode
|
|
103
|
+
|
|
104
|
+
/// The DOM node that should hold the mark's content. When this is not
|
|
105
|
+
/// present, the `dom` property is used as the content DOM.
|
|
106
|
+
contentDOM?: HTMLElement | null
|
|
107
|
+
|
|
108
|
+
/// Called when a [mutation](#view.ViewMutationRecord) happens within the
|
|
109
|
+
/// view. Return false if the editor should re-read the selection or re-parse
|
|
110
|
+
/// the range around the mutation, true if it can safely be ignored.
|
|
111
|
+
ignoreMutation?: (mutation: ViewMutationRecord) => boolean
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/// Called when the mark view is removed from the editor or the whole
|
|
115
|
+
/// editor is destroyed.
|
|
116
|
+
destroy?: () => void
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// View descriptions are data structures that describe the DOM that is
|
|
120
|
+
// used to represent the editor's content. They are used for:
|
|
121
|
+
//
|
|
122
|
+
// - Incremental redrawing when the document changes
|
|
123
|
+
//
|
|
124
|
+
// - Figuring out what part of the document a given DOM position
|
|
125
|
+
// corresponds to
|
|
126
|
+
//
|
|
127
|
+
// - Wiring in custom implementations of the editing interface for a
|
|
128
|
+
// given node
|
|
129
|
+
//
|
|
130
|
+
// They form a doubly-linked mutable tree, starting at `view.docView`.
|
|
131
|
+
|
|
132
|
+
const NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3
|
|
133
|
+
|
|
134
|
+
// Superclass for the various kinds of descriptions. Defines their
|
|
135
|
+
// basic structure and shared methods.
|
|
136
|
+
export class ViewDesc {
|
|
137
|
+
dirty = NOT_DIRTY
|
|
138
|
+
declare node: Node | null
|
|
139
|
+
|
|
140
|
+
constructor(
|
|
141
|
+
public parent: ViewDesc | undefined,
|
|
142
|
+
public children: ViewDesc[],
|
|
143
|
+
public dom: DOMNode,
|
|
144
|
+
// This is the node that holds the child views. It may be null for
|
|
145
|
+
// descs that don't have children.
|
|
146
|
+
public contentDOM: HTMLElement | null
|
|
147
|
+
) {
|
|
148
|
+
// An expando property on the DOM node provides a link back to its
|
|
149
|
+
// description.
|
|
150
|
+
dom.pmViewDesc = this
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Used to check whether a given description corresponds to a
|
|
154
|
+
// widget/mark/node.
|
|
155
|
+
matchesWidget(widget: Decoration) { return false }
|
|
156
|
+
matchesMark(mark: Mark) { return false }
|
|
157
|
+
matchesNode(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource) { return false }
|
|
158
|
+
matchesHack(nodeName: string) { return false }
|
|
159
|
+
|
|
160
|
+
// When parsing in-editor content (in domchange.js), we allow
|
|
161
|
+
// descriptions to determine the parse rules that should be used to
|
|
162
|
+
// parse them.
|
|
163
|
+
parseRule(): Omit<TagParseRule, "tag"> | null { return null }
|
|
164
|
+
|
|
165
|
+
// Used by the editor's event handler to ignore events that come
|
|
166
|
+
// from certain descs.
|
|
167
|
+
stopEvent(event: Event) { return false }
|
|
168
|
+
|
|
169
|
+
// The size of the content represented by this desc.
|
|
170
|
+
get size() {
|
|
171
|
+
let size = 0
|
|
172
|
+
for (let i = 0; i < this.children.length; i++) size += this.children[i].size
|
|
173
|
+
return size
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// For block nodes, this represents the space taken up by their
|
|
177
|
+
// start/end tokens.
|
|
178
|
+
get border() { return 0 }
|
|
179
|
+
|
|
180
|
+
destroy() {
|
|
181
|
+
this.parent = undefined
|
|
182
|
+
if (this.dom.pmViewDesc == this) this.dom.pmViewDesc = undefined
|
|
183
|
+
for (let i = 0; i < this.children.length; i++)
|
|
184
|
+
this.children[i].destroy()
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
posBeforeChild(child: ViewDesc): number {
|
|
188
|
+
for (let i = 0, pos = this.posAtStart;; i++) {
|
|
189
|
+
let cur = this.children[i]
|
|
190
|
+
if (cur == child) return pos
|
|
191
|
+
pos += cur.size
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
get posBefore() {
|
|
196
|
+
return this.parent!.posBeforeChild(this)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
get posAtStart() {
|
|
200
|
+
return this.parent ? this.parent.posBeforeChild(this) + this.border : 0
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
get posAfter() {
|
|
204
|
+
return this.posBefore + this.size
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
get posAtEnd() {
|
|
208
|
+
return this.posAtStart + this.size - 2 * this.border
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
localPosFromDOM(dom: DOMNode, offset: number, bias: number): number {
|
|
212
|
+
// If the DOM position is in the content, use the child desc after
|
|
213
|
+
// it to figure out a position.
|
|
214
|
+
if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {
|
|
215
|
+
if (bias < 0) {
|
|
216
|
+
let domBefore, desc: ViewDesc | undefined
|
|
217
|
+
if (dom == this.contentDOM) {
|
|
218
|
+
domBefore = dom.childNodes[offset - 1]
|
|
219
|
+
} else {
|
|
220
|
+
while (dom.parentNode != this.contentDOM) dom = dom.parentNode!
|
|
221
|
+
domBefore = dom.previousSibling
|
|
222
|
+
}
|
|
223
|
+
while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) domBefore = domBefore.previousSibling
|
|
224
|
+
return domBefore ? this.posBeforeChild(desc!) + desc!.size : this.posAtStart
|
|
225
|
+
} else {
|
|
226
|
+
let domAfter, desc: ViewDesc | undefined
|
|
227
|
+
if (dom == this.contentDOM) {
|
|
228
|
+
domAfter = dom.childNodes[offset]
|
|
229
|
+
} else {
|
|
230
|
+
while (dom.parentNode != this.contentDOM) dom = dom.parentNode!
|
|
231
|
+
domAfter = dom.nextSibling
|
|
232
|
+
}
|
|
233
|
+
while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this)) domAfter = domAfter.nextSibling
|
|
234
|
+
return domAfter ? this.posBeforeChild(desc!) : this.posAtEnd
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Otherwise, use various heuristics, falling back on the bias
|
|
238
|
+
// parameter, to determine whether to return the position at the
|
|
239
|
+
// start or at the end of this view desc.
|
|
240
|
+
let atEnd
|
|
241
|
+
if (dom == this.dom && this.contentDOM) {
|
|
242
|
+
atEnd = offset > domIndex(this.contentDOM)
|
|
243
|
+
} else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {
|
|
244
|
+
atEnd = dom.compareDocumentPosition(this.contentDOM) & 2
|
|
245
|
+
} else if (this.dom.firstChild) {
|
|
246
|
+
if (offset == 0) for (let search = dom;; search = search.parentNode!) {
|
|
247
|
+
if (search == this.dom) { atEnd = false; break }
|
|
248
|
+
if (search.previousSibling) break
|
|
249
|
+
}
|
|
250
|
+
if (atEnd == null && offset == dom.childNodes.length) for (let search = dom;; search = search.parentNode!) {
|
|
251
|
+
if (search == this.dom) { atEnd = true; break }
|
|
252
|
+
if (search.nextSibling) break
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Scan up the dom finding the first desc that is a descendant of
|
|
259
|
+
// this one.
|
|
260
|
+
nearestDesc(dom: DOMNode): ViewDesc | undefined
|
|
261
|
+
nearestDesc(dom: DOMNode, onlyNodes: true): NodeViewDesc | undefined
|
|
262
|
+
nearestDesc(dom: DOMNode, onlyNodes: boolean = false) {
|
|
263
|
+
for (let first = true, cur: DOMNode | null = dom; cur; cur = cur.parentNode) {
|
|
264
|
+
let desc = this.getDesc(cur), nodeDOM
|
|
265
|
+
if (desc && (!onlyNodes || desc.node)) {
|
|
266
|
+
// If dom is outside of this desc's nodeDOM, don't count it.
|
|
267
|
+
if (first && (nodeDOM = (desc as NodeViewDesc).nodeDOM) &&
|
|
268
|
+
!(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom))
|
|
269
|
+
first = false
|
|
270
|
+
else
|
|
271
|
+
return desc
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
getDesc(dom: DOMNode) {
|
|
277
|
+
let desc = dom.pmViewDesc
|
|
278
|
+
for (let cur: ViewDesc | undefined = desc; cur; cur = cur.parent) if (cur == this) return desc
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
posFromDOM(dom: DOMNode, offset: number, bias: number) {
|
|
282
|
+
for (let scan: DOMNode | null = dom; scan; scan = scan.parentNode) {
|
|
283
|
+
let desc = this.getDesc(scan)
|
|
284
|
+
if (desc) return desc.localPosFromDOM(dom, offset, bias)
|
|
285
|
+
}
|
|
286
|
+
return -1
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Find the desc for the node after the given pos, if any. (When a
|
|
290
|
+
// parent node overrode rendering, there might not be one.)
|
|
291
|
+
descAt(pos: number): ViewDesc | undefined {
|
|
292
|
+
for (let i = 0, offset = 0; i < this.children.length; i++) {
|
|
293
|
+
let child = this.children[i], end = offset + child.size
|
|
294
|
+
if (offset == pos && end != offset) {
|
|
295
|
+
while (!child.border && child.children.length) {
|
|
296
|
+
for (let i = 0; i < child.children.length; i++) {
|
|
297
|
+
let inner = child.children[i]
|
|
298
|
+
if (inner.size) { child = inner; break }
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return child
|
|
302
|
+
}
|
|
303
|
+
if (pos < end) return child.descAt(pos - offset - child.border)
|
|
304
|
+
offset = end
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
domFromPos(pos: number, side: number): {node: DOMNode, offset: number, atom?: number} {
|
|
309
|
+
if (!this.contentDOM) return {node: this.dom, offset: 0, atom: pos + 1}
|
|
310
|
+
// First find the position in the child array
|
|
311
|
+
let i = 0, offset = 0
|
|
312
|
+
for (let curPos = 0; i < this.children.length; i++) {
|
|
313
|
+
let child = this.children[i], end = curPos + child.size
|
|
314
|
+
if (end > pos || child instanceof TrailingHackViewDesc) { offset = pos - curPos; break }
|
|
315
|
+
curPos = end
|
|
316
|
+
}
|
|
317
|
+
// If this points into the middle of a child, call through
|
|
318
|
+
if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side)
|
|
319
|
+
// Go back if there were any zero-length widgets with side >= 0 before this point
|
|
320
|
+
for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--) {}
|
|
321
|
+
// Scan towards the first useable node
|
|
322
|
+
if (side <= 0) {
|
|
323
|
+
let prev, enter = true
|
|
324
|
+
for (;; i--, enter = false) {
|
|
325
|
+
prev = i ? this.children[i - 1] : null
|
|
326
|
+
if (!prev || prev.dom.parentNode == this.contentDOM) break
|
|
327
|
+
}
|
|
328
|
+
if (prev && side && enter && !prev.border && !prev.domAtom) return prev.domFromPos(prev.size, side)
|
|
329
|
+
return {node: this.contentDOM, offset: prev ? domIndex(prev.dom) + 1 : 0}
|
|
330
|
+
} else {
|
|
331
|
+
let next, enter = true
|
|
332
|
+
for (;; i++, enter = false) {
|
|
333
|
+
next = i < this.children.length ? this.children[i] : null
|
|
334
|
+
if (!next || next.dom.parentNode == this.contentDOM) break
|
|
335
|
+
}
|
|
336
|
+
if (next && enter && !next.border && !next.domAtom) return next.domFromPos(0, side)
|
|
337
|
+
return {node: this.contentDOM, offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Used to find a DOM range in a single parent for a given changed
|
|
342
|
+
// range.
|
|
343
|
+
parseRange(
|
|
344
|
+
from: number, to: number, base = 0
|
|
345
|
+
): {node: DOMNode, from: number, to: number, fromOffset: number, toOffset: number} {
|
|
346
|
+
if (this.children.length == 0)
|
|
347
|
+
return {node: this.contentDOM!, from, to, fromOffset: 0, toOffset: this.contentDOM!.childNodes.length}
|
|
348
|
+
|
|
349
|
+
let fromOffset = -1, toOffset = -1
|
|
350
|
+
for (let offset = base, i = 0;; i++) {
|
|
351
|
+
let child = this.children[i], end = offset + child.size
|
|
352
|
+
if (fromOffset == -1 && from <= end) {
|
|
353
|
+
let childBase = offset + child.border
|
|
354
|
+
// FIXME maybe descend mark views to parse a narrower range?
|
|
355
|
+
if (from >= childBase && to <= end - child.border && child.node &&
|
|
356
|
+
child.contentDOM && this.contentDOM!.contains(child.contentDOM))
|
|
357
|
+
return child.parseRange(from, to, childBase)
|
|
358
|
+
|
|
359
|
+
from = offset
|
|
360
|
+
for (let j = i; j > 0; j--) {
|
|
361
|
+
let prev = this.children[j - 1]
|
|
362
|
+
if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {
|
|
363
|
+
fromOffset = domIndex(prev.dom) + 1
|
|
364
|
+
break
|
|
365
|
+
}
|
|
366
|
+
from -= prev.size
|
|
367
|
+
}
|
|
368
|
+
if (fromOffset == -1) fromOffset = 0
|
|
369
|
+
}
|
|
370
|
+
if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {
|
|
371
|
+
to = end
|
|
372
|
+
for (let j = i + 1; j < this.children.length; j++) {
|
|
373
|
+
let next = this.children[j]
|
|
374
|
+
if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {
|
|
375
|
+
toOffset = domIndex(next.dom)
|
|
376
|
+
break
|
|
377
|
+
}
|
|
378
|
+
to += next.size
|
|
379
|
+
}
|
|
380
|
+
if (toOffset == -1) toOffset = this.contentDOM!.childNodes.length
|
|
381
|
+
break
|
|
382
|
+
}
|
|
383
|
+
offset = end
|
|
384
|
+
}
|
|
385
|
+
return {node: this.contentDOM!, from, to, fromOffset, toOffset}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
emptyChildAt(side: number): boolean {
|
|
389
|
+
if (this.border || !this.contentDOM || !this.children.length) return false
|
|
390
|
+
let child = this.children[side < 0 ? 0 : this.children.length - 1]
|
|
391
|
+
return child.size == 0 || child.emptyChildAt(side)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
domAfterPos(pos: number): DOMNode {
|
|
395
|
+
let {node, offset} = this.domFromPos(pos, 0)
|
|
396
|
+
if (node.nodeType != 1 || offset == node.childNodes.length)
|
|
397
|
+
throw new RangeError("No node after pos " + pos)
|
|
398
|
+
return node.childNodes[offset]
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// View descs are responsible for setting any selection that falls
|
|
402
|
+
// entirely inside of them, so that custom implementations can do
|
|
403
|
+
// custom things with the selection. Note that this falls apart when
|
|
404
|
+
// a selection starts in such a node and ends in another, in which
|
|
405
|
+
// case we just use whatever domFromPos produces as a best effort.
|
|
406
|
+
setSelection(anchor: number, head: number, view: EditorView, force = false): void {
|
|
407
|
+
// If the selection falls entirely in a child, give it to that child
|
|
408
|
+
let from = Math.min(anchor, head), to = Math.max(anchor, head)
|
|
409
|
+
for (let i = 0, offset = 0; i < this.children.length; i++) {
|
|
410
|
+
let child = this.children[i], end = offset + child.size
|
|
411
|
+
if (from > offset && to < end)
|
|
412
|
+
return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force)
|
|
413
|
+
offset = end
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1)
|
|
417
|
+
let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1)
|
|
418
|
+
let domSel = (view.root as Document).getSelection()!
|
|
419
|
+
let selRange = view.domSelectionRange()
|
|
420
|
+
|
|
421
|
+
let brKludge = false
|
|
422
|
+
// On Firefox, using Selection.collapse to put the cursor after a
|
|
423
|
+
// BR node for some reason doesn't always work (#1073). On Safari,
|
|
424
|
+
// the cursor sometimes inexplicable visually lags behind its
|
|
425
|
+
// reported position in such situations (#1092).
|
|
426
|
+
if ((browser.gecko || browser.safari) && anchor == head) {
|
|
427
|
+
let {node, offset} = anchorDOM
|
|
428
|
+
if (node.nodeType == 3) {
|
|
429
|
+
brKludge = !!(offset && node.nodeValue![offset - 1] == "\n")
|
|
430
|
+
// Issue #1128
|
|
431
|
+
if (brKludge && offset == node.nodeValue!.length) {
|
|
432
|
+
for (let scan: DOMNode | null = node, after; scan; scan = scan.parentNode) {
|
|
433
|
+
if (after = scan.nextSibling) {
|
|
434
|
+
if (after.nodeName == "BR")
|
|
435
|
+
anchorDOM = headDOM = {node: after.parentNode!, offset: domIndex(after) + 1}
|
|
436
|
+
break
|
|
437
|
+
}
|
|
438
|
+
let desc = scan.pmViewDesc
|
|
439
|
+
if (desc && desc.node && desc.node.isBlock) break
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
} else {
|
|
443
|
+
let prev = node.childNodes[offset - 1]
|
|
444
|
+
brKludge = prev && (prev.nodeName == "BR" || (prev as HTMLElement).contentEditable == "false")
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
// Firefox can act strangely when the selection is in front of an
|
|
448
|
+
// uneditable node. See #1163 and https://bugzilla.mozilla.org/show_bug.cgi?id=1709536
|
|
449
|
+
if (browser.gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
|
|
450
|
+
let after = selRange.focusNode.childNodes[selRange.focusOffset]
|
|
451
|
+
if (after && (after as HTMLElement).contentEditable == "false") force = true
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (!(force || brKludge && browser.safari) &&
|
|
455
|
+
isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode!, selRange.anchorOffset) &&
|
|
456
|
+
isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode!, selRange.focusOffset))
|
|
457
|
+
return
|
|
458
|
+
|
|
459
|
+
// Selection.extend can be used to create an 'inverted' selection
|
|
460
|
+
// (one where the focus is before the anchor), but not all
|
|
461
|
+
// browsers support it yet.
|
|
462
|
+
let domSelExtended = false
|
|
463
|
+
if ((domSel.extend || anchor == head) && !(brKludge && browser.gecko)) {
|
|
464
|
+
domSel.collapse(anchorDOM.node, anchorDOM.offset)
|
|
465
|
+
try {
|
|
466
|
+
if (anchor != head)
|
|
467
|
+
domSel.extend(headDOM.node, headDOM.offset)
|
|
468
|
+
domSelExtended = true
|
|
469
|
+
} catch (_) {
|
|
470
|
+
// In some cases with Chrome the selection is empty after calling
|
|
471
|
+
// collapse, even when it should be valid. This appears to be a bug, but
|
|
472
|
+
// it is difficult to isolate. If this happens fallback to the old path
|
|
473
|
+
// without using extend.
|
|
474
|
+
// Similarly, this could crash on Safari if the editor is hidden, and
|
|
475
|
+
// there was no selection.
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (!domSelExtended) {
|
|
479
|
+
if (anchor > head) { let tmp = anchorDOM; anchorDOM = headDOM; headDOM = tmp }
|
|
480
|
+
let range = document.createRange()
|
|
481
|
+
range.setEnd(headDOM.node, headDOM.offset)
|
|
482
|
+
range.setStart(anchorDOM.node, anchorDOM.offset)
|
|
483
|
+
domSel.removeAllRanges()
|
|
484
|
+
domSel.addRange(range)
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
ignoreMutation(mutation: ViewMutationRecord): boolean {
|
|
489
|
+
return !this.contentDOM && mutation.type != "selection"
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
get contentLost() {
|
|
493
|
+
return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// Remove a subtree of the element tree that has been touched
|
|
497
|
+
// by a DOM change, so that the next update will redraw it.
|
|
498
|
+
markDirty(from: number, to: number) {
|
|
499
|
+
for (let offset = 0, i = 0; i < this.children.length; i++) {
|
|
500
|
+
let child = this.children[i], end = offset + child.size
|
|
501
|
+
if (offset == end ? from <= end && to >= offset : from < end && to > offset) {
|
|
502
|
+
let startInside = offset + child.border, endInside = end - child.border
|
|
503
|
+
if (from >= startInside && to <= endInside) {
|
|
504
|
+
this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY
|
|
505
|
+
if (from == startInside && to == endInside &&
|
|
506
|
+
(child.contentLost || child.dom.parentNode != this.contentDOM)) child.dirty = NODE_DIRTY
|
|
507
|
+
else child.markDirty(from - startInside, to - startInside)
|
|
508
|
+
return
|
|
509
|
+
} else {
|
|
510
|
+
child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length
|
|
511
|
+
? CONTENT_DIRTY : NODE_DIRTY
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
offset = end
|
|
515
|
+
}
|
|
516
|
+
this.dirty = CONTENT_DIRTY
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
markParentsDirty() {
|
|
520
|
+
let level = 1
|
|
521
|
+
for (let node = this.parent; node; node = node.parent, level++) {
|
|
522
|
+
let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY
|
|
523
|
+
if (node.dirty < dirty) node.dirty = dirty
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
get domAtom() { return false }
|
|
528
|
+
|
|
529
|
+
get ignoreForCoords() { return false }
|
|
530
|
+
|
|
531
|
+
get ignoreForSelection() { return false }
|
|
532
|
+
|
|
533
|
+
isText(text: string) { return false }
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// A widget desc represents a widget decoration, which is a DOM node
|
|
537
|
+
// drawn between the document nodes.
|
|
538
|
+
class WidgetViewDesc extends ViewDesc {
|
|
539
|
+
constructor(parent: ViewDesc, readonly widget: Decoration, view: EditorView, pos: number) {
|
|
540
|
+
let self: WidgetViewDesc, dom = (widget.type as any).toDOM as WidgetConstructor
|
|
541
|
+
if (typeof dom == "function") dom = dom(view, () => {
|
|
542
|
+
if (!self) return pos
|
|
543
|
+
if (self.parent) return self.parent.posBeforeChild(self)
|
|
544
|
+
})
|
|
545
|
+
if (!widget.type.spec.raw) {
|
|
546
|
+
if (dom.nodeType != 1) {
|
|
547
|
+
let wrap = document.createElement("span")
|
|
548
|
+
wrap.appendChild(dom)
|
|
549
|
+
dom = wrap
|
|
550
|
+
}
|
|
551
|
+
;(dom as HTMLElement).contentEditable = "false"
|
|
552
|
+
;(dom as HTMLElement).classList.add("ProseMirror-widget")
|
|
553
|
+
}
|
|
554
|
+
super(parent, [], dom, null)
|
|
555
|
+
this.widget = widget
|
|
556
|
+
self = this
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
matchesWidget(widget: Decoration) {
|
|
560
|
+
return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type)
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
parseRule() { return {ignore: true} }
|
|
564
|
+
|
|
565
|
+
stopEvent(event: Event) {
|
|
566
|
+
let stop = this.widget.spec.stopEvent
|
|
567
|
+
return stop ? stop(event) : false
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
ignoreMutation(mutation: ViewMutationRecord) {
|
|
571
|
+
return mutation.type != "selection" || this.widget.spec.ignoreSelection
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
destroy() {
|
|
575
|
+
this.widget.type.destroy(this.dom)
|
|
576
|
+
super.destroy()
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
get domAtom() { return true }
|
|
580
|
+
|
|
581
|
+
get ignoreForSelection() { return !!this.widget.type.spec.relaxedSide }
|
|
582
|
+
|
|
583
|
+
get side() { return (this.widget.type as any).side as number }
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
class CompositionViewDesc extends ViewDesc {
|
|
587
|
+
constructor(parent: ViewDesc, dom: DOMNode, readonly textDOM: Text, readonly text: string) {
|
|
588
|
+
super(parent, [], dom, null)
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
get size() { return this.text.length }
|
|
592
|
+
|
|
593
|
+
localPosFromDOM(dom: DOMNode, offset: number) {
|
|
594
|
+
if (dom != this.textDOM) return this.posAtStart + (offset ? this.size : 0)
|
|
595
|
+
return this.posAtStart + offset
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
domFromPos(pos: number) {
|
|
599
|
+
return {node: this.textDOM, offset: pos}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
ignoreMutation(mut: ViewMutationRecord) {
|
|
603
|
+
return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// A mark desc represents a mark. May have multiple children,
|
|
608
|
+
// depending on how the mark is split. Note that marks are drawn using
|
|
609
|
+
// a fixed nesting order, for simplicity and predictability, so in
|
|
610
|
+
// some cases they will be split more often than would appear
|
|
611
|
+
// necessary.
|
|
612
|
+
class MarkViewDesc extends ViewDesc {
|
|
613
|
+
constructor(parent: ViewDesc, readonly mark: Mark, dom: DOMNode, contentDOM: HTMLElement, readonly spec: MarkView) {
|
|
614
|
+
super(parent, [], dom, contentDOM)
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
static create(parent: ViewDesc, mark: Mark, inline: boolean, view: EditorView) {
|
|
618
|
+
let custom = view.nodeViews[mark.type.name]
|
|
619
|
+
let spec: {dom: HTMLElement, contentDOM?: HTMLElement} = custom && (custom as any)(mark, view, inline)
|
|
620
|
+
if (!spec || !spec.dom)
|
|
621
|
+
spec = (DOMSerializer.renderSpec as any)(document, mark.type.spec.toDOM!(mark, inline), null, mark.attrs) as any
|
|
622
|
+
return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom as HTMLElement, spec)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
parseRule() {
|
|
626
|
+
if ((this.dirty & NODE_DIRTY) || this.mark.type.spec.reparseInView) return null
|
|
627
|
+
return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM!}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
matchesMark(mark: Mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark) }
|
|
631
|
+
|
|
632
|
+
markDirty(from: number, to: number) {
|
|
633
|
+
super.markDirty(from, to)
|
|
634
|
+
// Move dirty info to nearest node view
|
|
635
|
+
if (this.dirty != NOT_DIRTY) {
|
|
636
|
+
let parent = this.parent!
|
|
637
|
+
while (!parent.node) parent = parent.parent!
|
|
638
|
+
if (parent.dirty < this.dirty) parent.dirty = this.dirty
|
|
639
|
+
this.dirty = NOT_DIRTY
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
slice(from: number, to: number, view: EditorView) {
|
|
644
|
+
let copy = MarkViewDesc.create(this.parent!, this.mark, true, view)
|
|
645
|
+
let nodes = this.children, size = this.size
|
|
646
|
+
if (to < size) nodes = replaceNodes(nodes, to, size, view)
|
|
647
|
+
if (from > 0) nodes = replaceNodes(nodes, 0, from, view)
|
|
648
|
+
for (let i = 0; i < nodes.length; i++) nodes[i].parent = copy
|
|
649
|
+
copy.children = nodes
|
|
650
|
+
return copy
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
ignoreMutation(mutation: ViewMutationRecord) {
|
|
654
|
+
return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation)
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
destroy() {
|
|
658
|
+
if (this.spec.destroy) this.spec.destroy()
|
|
659
|
+
super.destroy()
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// Node view descs are the main, most common type of view desc, and
|
|
664
|
+
// correspond to an actual node in the document. Unlike mark descs,
|
|
665
|
+
// they populate their child array themselves.
|
|
666
|
+
export class NodeViewDesc extends ViewDesc {
|
|
667
|
+
constructor(
|
|
668
|
+
parent: ViewDesc | undefined,
|
|
669
|
+
public node: Node,
|
|
670
|
+
public outerDeco: readonly Decoration[],
|
|
671
|
+
public innerDeco: DecorationSource,
|
|
672
|
+
dom: DOMNode,
|
|
673
|
+
contentDOM: HTMLElement | null,
|
|
674
|
+
readonly nodeDOM: DOMNode,
|
|
675
|
+
view: EditorView,
|
|
676
|
+
pos: number
|
|
677
|
+
) {
|
|
678
|
+
super(parent, [], dom, contentDOM)
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// By default, a node is rendered using the `toDOM` method from the
|
|
682
|
+
// node type spec. But client code can use the `nodeViews` spec to
|
|
683
|
+
// supply a custom node view, which can influence various aspects of
|
|
684
|
+
// the way the node works.
|
|
685
|
+
//
|
|
686
|
+
// (Using subclassing for this was intentionally decided against,
|
|
687
|
+
// since it'd require exposing a whole slew of finicky
|
|
688
|
+
// implementation details to the user code that they probably will
|
|
689
|
+
// never need.)
|
|
690
|
+
static create(parent: ViewDesc | undefined, node: Node, outerDeco: readonly Decoration[],
|
|
691
|
+
innerDeco: DecorationSource, view: EditorView, pos: number) {
|
|
692
|
+
let custom = view.nodeViews[node.type.name], descObj: ViewDesc
|
|
693
|
+
let spec: NodeView | undefined = custom && (custom as any)(node, view, () => {
|
|
694
|
+
// (This is a function that allows the custom view to find its
|
|
695
|
+
// own position)
|
|
696
|
+
if (!descObj) return pos
|
|
697
|
+
if (descObj.parent) return descObj.parent.posBeforeChild(descObj)
|
|
698
|
+
}, outerDeco, innerDeco)
|
|
699
|
+
|
|
700
|
+
let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM
|
|
701
|
+
if (node.isText) {
|
|
702
|
+
if (!dom) dom = document.createTextNode(node.text!)
|
|
703
|
+
else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node")
|
|
704
|
+
} else if (!dom) {
|
|
705
|
+
let spec = (DOMSerializer.renderSpec as any)(document, node.type.spec.toDOM!(node), null, node.attrs)
|
|
706
|
+
;({dom, contentDOM} = spec as {dom: DOMNode, contentDOM?: HTMLElement})
|
|
707
|
+
}
|
|
708
|
+
if (!contentDOM && !node.isText && dom.nodeName != "BR") { // Chrome gets confused by <br contenteditable=false>
|
|
709
|
+
if (!(dom as HTMLElement).hasAttribute("contenteditable")) (dom as HTMLElement).contentEditable = "false"
|
|
710
|
+
if (node.type.spec.draggable) (dom as HTMLElement).draggable = true
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
let nodeDOM = dom
|
|
714
|
+
dom = applyOuterDeco(dom, outerDeco, node)
|
|
715
|
+
|
|
716
|
+
if (spec)
|
|
717
|
+
return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM,
|
|
718
|
+
spec, view, pos + 1)
|
|
719
|
+
else if (node.isText)
|
|
720
|
+
return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view)
|
|
721
|
+
else
|
|
722
|
+
return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1)
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
parseRule() {
|
|
726
|
+
// Experimental kludge to allow opt-in re-parsing of nodes
|
|
727
|
+
if (this.node.type.spec.reparseInView) return null
|
|
728
|
+
// FIXME the assumption that this can always return the current
|
|
729
|
+
// attrs means that if the user somehow manages to change the
|
|
730
|
+
// attrs in the dom, that won't be picked up. Not entirely sure
|
|
731
|
+
// whether this is a problem
|
|
732
|
+
let rule: Omit<TagParseRule, "tag"> = {node: this.node.type.name, attrs: this.node.attrs}
|
|
733
|
+
if (this.node.type.whitespace == "pre") rule.preserveWhitespace = "full"
|
|
734
|
+
if (!this.contentDOM) {
|
|
735
|
+
rule.getContent = () => this.node.content
|
|
736
|
+
} else if (!this.contentLost) {
|
|
737
|
+
rule.contentElement = this.contentDOM
|
|
738
|
+
} else {
|
|
739
|
+
// Chrome likes to randomly recreate parent nodes when
|
|
740
|
+
// backspacing things. When that happens, this tries to find the
|
|
741
|
+
// new parent.
|
|
742
|
+
for (let i = this.children.length - 1; i >= 0; i--) {
|
|
743
|
+
let child = this.children[i]
|
|
744
|
+
if (this.dom.contains(child.dom.parentNode)) {
|
|
745
|
+
rule.contentElement = child.dom.parentNode as HTMLElement
|
|
746
|
+
break
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
if (!rule.contentElement) rule.getContent = () => Fragment.empty
|
|
750
|
+
}
|
|
751
|
+
return rule
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
matchesNode(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource) {
|
|
755
|
+
return this.dirty == NOT_DIRTY && node.eq(this.node) &&
|
|
756
|
+
sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco)
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
get size() { return this.node.nodeSize }
|
|
760
|
+
|
|
761
|
+
get border() { return this.node.isLeaf ? 0 : 1 }
|
|
762
|
+
|
|
763
|
+
// Syncs `this.children` to match `this.node.content` and the local
|
|
764
|
+
// decorations, possibly introducing nesting for marks. Then, in a
|
|
765
|
+
// separate step, syncs the DOM inside `this.contentDOM` to
|
|
766
|
+
// `this.children`.
|
|
767
|
+
updateChildren(view: EditorView, pos: number) {
|
|
768
|
+
let inline = this.node.inlineContent, off = pos
|
|
769
|
+
let composition = view.composing ? this.localCompositionInfo(view, pos) : null
|
|
770
|
+
let localComposition = composition && composition.pos > -1 ? composition : null
|
|
771
|
+
let compositionInChild = composition && composition.pos < 0
|
|
772
|
+
let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view)
|
|
773
|
+
iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
|
|
774
|
+
if (widget.spec.marks)
|
|
775
|
+
updater.syncToMarks(widget.spec.marks, inline, view, i)
|
|
776
|
+
else if ((widget.type as WidgetType).side >= 0 && !insideNode)
|
|
777
|
+
updater.syncToMarks(i == this.node.childCount ? Mark.none : this.node.child(i).marks, inline, view, i)
|
|
778
|
+
// If the next node is a desc matching this widget, reuse it,
|
|
779
|
+
// otherwise insert the widget as a new view desc.
|
|
780
|
+
updater.placeWidget(widget, view, off)
|
|
781
|
+
}, (child, outerDeco, innerDeco, i) => {
|
|
782
|
+
// Make sure the wrapping mark descs match the node's marks.
|
|
783
|
+
updater.syncToMarks(child.marks, inline, view, i)
|
|
784
|
+
// Try several strategies for drawing this node
|
|
785
|
+
let compIndex
|
|
786
|
+
if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) {
|
|
787
|
+
// Found precise match with existing node view
|
|
788
|
+
} else if (compositionInChild && view.state.selection.from > off &&
|
|
789
|
+
view.state.selection.to < off + child.nodeSize &&
|
|
790
|
+
(compIndex = updater.findIndexWithChild(composition!.node)) > -1 &&
|
|
791
|
+
updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) {
|
|
792
|
+
// Updated the specific node that holds the composition
|
|
793
|
+
} else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off)) {
|
|
794
|
+
// Could update an existing node to reflect this node
|
|
795
|
+
} else {
|
|
796
|
+
// Add it as a new view
|
|
797
|
+
updater.addNode(child, outerDeco, innerDeco, view, off)
|
|
798
|
+
}
|
|
799
|
+
off += child.nodeSize
|
|
800
|
+
})
|
|
801
|
+
// Drop all remaining descs after the current position.
|
|
802
|
+
updater.syncToMarks([], inline, view, 0)
|
|
803
|
+
if (this.node.isTextblock) updater.addTextblockHacks()
|
|
804
|
+
updater.destroyRest()
|
|
805
|
+
|
|
806
|
+
// Sync the DOM if anything changed
|
|
807
|
+
if (updater.changed || this.dirty == CONTENT_DIRTY) {
|
|
808
|
+
// May have to protect focused DOM from being changed if a composition is active
|
|
809
|
+
if (localComposition) this.protectLocalComposition(view, localComposition)
|
|
810
|
+
renderDescs(this.contentDOM!, this.children, view)
|
|
811
|
+
if (browser.ios) iosHacks(this.dom as HTMLElement)
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
localCompositionInfo(view: EditorView, pos: number): {node: Text, pos: number, text: string} | null {
|
|
816
|
+
// Only do something if both the selection and a focused text node
|
|
817
|
+
// are inside of this node
|
|
818
|
+
let {from, to} = view.state.selection
|
|
819
|
+
if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) return null
|
|
820
|
+
let textNode = view.input.compositionNode
|
|
821
|
+
if (!textNode || !this.dom.contains(textNode.parentNode)) return null
|
|
822
|
+
|
|
823
|
+
if (this.node.inlineContent) {
|
|
824
|
+
// Find the text in the focused node in the node, stop if it's not
|
|
825
|
+
// there (may have been modified through other means, in which
|
|
826
|
+
// case it should overwritten)
|
|
827
|
+
let text = textNode.nodeValue!
|
|
828
|
+
let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos)
|
|
829
|
+
return textPos < 0 ? null : {node: textNode, pos: textPos, text}
|
|
830
|
+
} else {
|
|
831
|
+
return {node: textNode, pos: -1, text: ""}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
protectLocalComposition(view: EditorView, {node, pos, text}: {node: Text, pos: number, text: string}) {
|
|
836
|
+
// The node is already part of a local view desc, leave it there
|
|
837
|
+
if (this.getDesc(node)) return
|
|
838
|
+
|
|
839
|
+
// Create a composition view for the orphaned nodes
|
|
840
|
+
let topNode: DOMNode = node
|
|
841
|
+
for (;; topNode = topNode.parentNode!) {
|
|
842
|
+
if (topNode.parentNode == this.contentDOM) break
|
|
843
|
+
while (topNode.previousSibling) topNode.parentNode!.removeChild(topNode.previousSibling)
|
|
844
|
+
while (topNode.nextSibling) topNode.parentNode!.removeChild(topNode.nextSibling)
|
|
845
|
+
if (topNode.pmViewDesc) topNode.pmViewDesc = undefined
|
|
846
|
+
}
|
|
847
|
+
let desc = new CompositionViewDesc(this, topNode, node, text)
|
|
848
|
+
view.input.compositionNodes.push(desc)
|
|
849
|
+
|
|
850
|
+
// Patch up this.children to contain the composition view
|
|
851
|
+
this.children = replaceNodes(this.children, pos, pos + text.length, view, desc)
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// If this desc must be updated to match the given node decoration,
|
|
855
|
+
// do so and return true.
|
|
856
|
+
update(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, view: EditorView) {
|
|
857
|
+
if (this.dirty == NODE_DIRTY ||
|
|
858
|
+
!node.sameMarkup(this.node)) return false
|
|
859
|
+
this.updateInner(node, outerDeco, innerDeco, view)
|
|
860
|
+
return true
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
updateInner(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, view: EditorView) {
|
|
864
|
+
this.updateOuterDeco(outerDeco)
|
|
865
|
+
this.node = node
|
|
866
|
+
this.innerDeco = innerDeco
|
|
867
|
+
if (this.contentDOM) this.updateChildren(view, this.posAtStart)
|
|
868
|
+
this.dirty = NOT_DIRTY
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
updateOuterDeco(outerDeco: readonly Decoration[]) {
|
|
872
|
+
if (sameOuterDeco(outerDeco, this.outerDeco)) return
|
|
873
|
+
let needsWrap = this.nodeDOM.nodeType != 1
|
|
874
|
+
let oldDOM = this.dom
|
|
875
|
+
this.dom = patchOuterDeco(this.dom, this.nodeDOM,
|
|
876
|
+
computeOuterDeco(this.outerDeco, this.node, needsWrap),
|
|
877
|
+
computeOuterDeco(outerDeco, this.node, needsWrap))
|
|
878
|
+
if (this.dom != oldDOM) {
|
|
879
|
+
oldDOM.pmViewDesc = undefined
|
|
880
|
+
this.dom.pmViewDesc = this
|
|
881
|
+
}
|
|
882
|
+
this.outerDeco = outerDeco
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// Mark this node as being the selected node.
|
|
886
|
+
selectNode() {
|
|
887
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
888
|
+
;(this.nodeDOM as HTMLElement).classList.add("ProseMirror-selectednode")
|
|
889
|
+
if (this.contentDOM || !this.node.type.spec.draggable) (this.nodeDOM as HTMLElement).draggable = true
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
// Remove selected node marking from this node.
|
|
894
|
+
deselectNode() {
|
|
895
|
+
if (this.nodeDOM.nodeType == 1) {
|
|
896
|
+
;(this.nodeDOM as HTMLElement).classList.remove("ProseMirror-selectednode")
|
|
897
|
+
if (this.contentDOM || !this.node.type.spec.draggable) (this.nodeDOM as HTMLElement).removeAttribute("draggable")
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
get domAtom() { return this.node.isAtom }
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// Create a view desc for the top-level document node, to be exported
|
|
905
|
+
// and used by the view class.
|
|
906
|
+
export function docViewDesc(doc: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource,
|
|
907
|
+
dom: HTMLElement, view: EditorView): NodeViewDesc {
|
|
908
|
+
applyOuterDeco(dom, outerDeco, doc)
|
|
909
|
+
let docView = new NodeViewDesc(undefined, doc, outerDeco, innerDeco, dom, dom, dom, view, 0)
|
|
910
|
+
if (docView.contentDOM) docView.updateChildren(view, 0)
|
|
911
|
+
return docView
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
class TextViewDesc extends NodeViewDesc {
|
|
915
|
+
constructor(parent: ViewDesc | undefined, node: Node, outerDeco: readonly Decoration[],
|
|
916
|
+
innerDeco: DecorationSource, dom: DOMNode, nodeDOM: DOMNode, view: EditorView) {
|
|
917
|
+
super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0)
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
parseRule() {
|
|
921
|
+
let skip = this.nodeDOM.parentNode
|
|
922
|
+
while (skip && skip != this.dom && !(skip as any).pmIsDeco) skip = skip.parentNode
|
|
923
|
+
return {skip: (skip || true) as any}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
update(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, view: EditorView) {
|
|
927
|
+
if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||
|
|
928
|
+
!node.sameMarkup(this.node)) return false
|
|
929
|
+
this.updateOuterDeco(outerDeco)
|
|
930
|
+
if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {
|
|
931
|
+
this.nodeDOM.nodeValue = node.text!
|
|
932
|
+
if (view.trackWrites == this.nodeDOM) view.trackWrites = null
|
|
933
|
+
}
|
|
934
|
+
this.node = node
|
|
935
|
+
this.dirty = NOT_DIRTY
|
|
936
|
+
return true
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
inParent() {
|
|
940
|
+
let parentDOM = this.parent!.contentDOM
|
|
941
|
+
for (let n: DOMNode | null = this.nodeDOM; n; n = n.parentNode) if (n == parentDOM) return true
|
|
942
|
+
return false
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
domFromPos(pos: number) {
|
|
946
|
+
return {node: this.nodeDOM, offset: pos}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
localPosFromDOM(dom: DOMNode, offset: number, bias: number) {
|
|
950
|
+
if (dom == this.nodeDOM) return this.posAtStart + Math.min(offset, this.node.text!.length)
|
|
951
|
+
return super.localPosFromDOM(dom, offset, bias)
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
ignoreMutation(mutation: ViewMutationRecord) {
|
|
955
|
+
return mutation.type != "characterData" && mutation.type != "selection"
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
slice(from: number, to: number, view: EditorView) {
|
|
959
|
+
let node = this.node.cut(from, to), dom = document.createTextNode(node.text!)
|
|
960
|
+
return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view)
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
markDirty(from: number, to: number) {
|
|
964
|
+
super.markDirty(from, to)
|
|
965
|
+
if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue!.length))
|
|
966
|
+
this.dirty = NODE_DIRTY
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
get domAtom() { return false }
|
|
970
|
+
|
|
971
|
+
isText(text: string) { return this.node.text == text }
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// A dummy desc used to tag trailing BR or IMG nodes created to work
|
|
975
|
+
// around contentEditable terribleness.
|
|
976
|
+
class TrailingHackViewDesc extends ViewDesc {
|
|
977
|
+
parseRule() { return {ignore: true} }
|
|
978
|
+
matchesHack(nodeName: string) { return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName }
|
|
979
|
+
get domAtom() { return true }
|
|
980
|
+
get ignoreForCoords() { return this.dom.nodeName == "IMG" }
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// A separate subclass is used for customized node views, so that the
|
|
984
|
+
// extra checks only have to be made for nodes that are actually
|
|
985
|
+
// customized.
|
|
986
|
+
class CustomNodeViewDesc extends NodeViewDesc {
|
|
987
|
+
constructor(parent: ViewDesc | undefined, node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource,
|
|
988
|
+
dom: DOMNode, contentDOM: HTMLElement | null, nodeDOM: DOMNode, readonly spec: NodeView,
|
|
989
|
+
view: EditorView, pos: number) {
|
|
990
|
+
super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos)
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// A custom `update` method gets to decide whether the update goes
|
|
994
|
+
// through. If it does, and there's a `contentDOM` node, our logic
|
|
995
|
+
// updates the children.
|
|
996
|
+
update(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, view: EditorView) {
|
|
997
|
+
if (this.dirty == NODE_DIRTY) return false
|
|
998
|
+
if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {
|
|
999
|
+
let result = this.spec.update(node, outerDeco, innerDeco)
|
|
1000
|
+
if (result) this.updateInner(node, outerDeco, innerDeco, view)
|
|
1001
|
+
return result
|
|
1002
|
+
} else if (!this.contentDOM && !node.isLeaf) {
|
|
1003
|
+
return false
|
|
1004
|
+
} else {
|
|
1005
|
+
return super.update(node, outerDeco, innerDeco, view)
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
selectNode() {
|
|
1010
|
+
this.spec.selectNode ? this.spec.selectNode() : super.selectNode()
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
deselectNode() {
|
|
1014
|
+
this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode()
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
setSelection(anchor: number, head: number, view: EditorView, force: boolean) {
|
|
1018
|
+
this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root)
|
|
1019
|
+
: super.setSelection(anchor, head, view, force)
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
destroy() {
|
|
1023
|
+
if (this.spec.destroy) this.spec.destroy()
|
|
1024
|
+
super.destroy()
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
stopEvent(event: Event) {
|
|
1028
|
+
return this.spec.stopEvent ? this.spec.stopEvent(event) : false
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
ignoreMutation(mutation: ViewMutationRecord) {
|
|
1032
|
+
return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation)
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
// Sync the content of the given DOM node with the nodes associated
|
|
1037
|
+
// with the given array of view descs, recursing into mark descs
|
|
1038
|
+
// because this should sync the subtree for a whole node at a time.
|
|
1039
|
+
function renderDescs(parentDOM: HTMLElement, descs: readonly ViewDesc[], view: EditorView) {
|
|
1040
|
+
let dom = parentDOM.firstChild, written = false
|
|
1041
|
+
for (let i = 0; i < descs.length; i++) {
|
|
1042
|
+
let desc = descs[i], childDOM = desc.dom
|
|
1043
|
+
if (childDOM.parentNode == parentDOM) {
|
|
1044
|
+
while (childDOM != dom) { dom = rm(dom!); written = true }
|
|
1045
|
+
dom = dom.nextSibling
|
|
1046
|
+
} else {
|
|
1047
|
+
written = true
|
|
1048
|
+
parentDOM.insertBefore(childDOM, dom)
|
|
1049
|
+
}
|
|
1050
|
+
if (desc instanceof MarkViewDesc) {
|
|
1051
|
+
let pos = dom ? dom.previousSibling : parentDOM.lastChild
|
|
1052
|
+
renderDescs(desc.contentDOM!, desc.children, view)
|
|
1053
|
+
dom = pos ? pos.nextSibling : parentDOM.firstChild
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
while (dom) { dom = rm(dom); written = true }
|
|
1057
|
+
if (written && view.trackWrites == parentDOM) view.trackWrites = null
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
type OuterDecoLevel = {[attr: string]: string}
|
|
1061
|
+
|
|
1062
|
+
const OuterDecoLevel: {new (nodeName?: string): OuterDecoLevel} = function(this: any, nodeName?: string) {
|
|
1063
|
+
if (nodeName) this.nodeName = nodeName
|
|
1064
|
+
} as any
|
|
1065
|
+
OuterDecoLevel.prototype = Object.create(null)
|
|
1066
|
+
|
|
1067
|
+
const noDeco = [new OuterDecoLevel]
|
|
1068
|
+
|
|
1069
|
+
function computeOuterDeco(outerDeco: readonly Decoration[], node: Node, needsWrap: boolean) {
|
|
1070
|
+
if (outerDeco.length == 0) return noDeco
|
|
1071
|
+
|
|
1072
|
+
let top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top]
|
|
1073
|
+
|
|
1074
|
+
for (let i = 0; i < outerDeco.length; i++) {
|
|
1075
|
+
let attrs = (outerDeco[i].type as NodeType).attrs
|
|
1076
|
+
if (!attrs) continue
|
|
1077
|
+
if (attrs.nodeName)
|
|
1078
|
+
result.push(top = new OuterDecoLevel(attrs.nodeName))
|
|
1079
|
+
|
|
1080
|
+
for (let name in attrs) {
|
|
1081
|
+
let val = attrs[name]
|
|
1082
|
+
if (val == null) continue
|
|
1083
|
+
if (needsWrap && result.length == 1)
|
|
1084
|
+
result.push(top = new OuterDecoLevel(node.isInline ? "span" : "div"))
|
|
1085
|
+
if (name == "class") top.class = (top.class ? top.class + " " : "") + val
|
|
1086
|
+
else if (name == "style") top.style = (top.style ? top.style + ";" : "") + val
|
|
1087
|
+
else if (name != "nodeName") top[name] = val
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return result
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
function patchOuterDeco(outerDOM: DOMNode, nodeDOM: DOMNode,
|
|
1095
|
+
prevComputed: readonly OuterDecoLevel[], curComputed: readonly OuterDecoLevel[]) {
|
|
1096
|
+
// Shortcut for trivial case
|
|
1097
|
+
if (prevComputed == noDeco && curComputed == noDeco) return nodeDOM
|
|
1098
|
+
|
|
1099
|
+
let curDOM = nodeDOM
|
|
1100
|
+
for (let i = 0; i < curComputed.length; i++) {
|
|
1101
|
+
let deco = curComputed[i], prev = prevComputed[i]
|
|
1102
|
+
if (i) {
|
|
1103
|
+
let parent: DOMNode | null
|
|
1104
|
+
if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&
|
|
1105
|
+
(parent = curDOM.parentNode) && parent.nodeName!.toLowerCase() == deco.nodeName) {
|
|
1106
|
+
curDOM = parent
|
|
1107
|
+
} else {
|
|
1108
|
+
parent = document.createElement(deco.nodeName)
|
|
1109
|
+
;(parent as any).pmIsDeco = true
|
|
1110
|
+
parent.appendChild(curDOM)
|
|
1111
|
+
prev = noDeco[0]
|
|
1112
|
+
curDOM = parent
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
patchAttributes(curDOM as HTMLElement, prev || noDeco[0], deco)
|
|
1116
|
+
}
|
|
1117
|
+
return curDOM
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
function patchAttributes(dom: HTMLElement, prev: {[name: string]: string}, cur: {[name: string]: string}) {
|
|
1121
|
+
for (let name in prev)
|
|
1122
|
+
if (name != "class" && name != "style" && name != "nodeName" && !(name in cur))
|
|
1123
|
+
dom.removeAttribute(name)
|
|
1124
|
+
for (let name in cur)
|
|
1125
|
+
if (name != "class" && name != "style" && name != "nodeName" && cur[name] != prev[name])
|
|
1126
|
+
dom.setAttribute(name, cur[name])
|
|
1127
|
+
if (prev.class != cur.class) {
|
|
1128
|
+
let prevList = prev.class ? prev.class.split(" ").filter(Boolean) : []
|
|
1129
|
+
let curList = cur.class ? cur.class.split(" ").filter(Boolean) : []
|
|
1130
|
+
for (let i = 0; i < prevList.length; i++) if (curList.indexOf(prevList[i]) == -1)
|
|
1131
|
+
dom.classList.remove(prevList[i])
|
|
1132
|
+
for (let i = 0; i < curList.length; i++) if (prevList.indexOf(curList[i]) == -1)
|
|
1133
|
+
dom.classList.add(curList[i])
|
|
1134
|
+
if (dom.classList.length == 0)
|
|
1135
|
+
dom.removeAttribute("class")
|
|
1136
|
+
}
|
|
1137
|
+
if (prev.style != cur.style) {
|
|
1138
|
+
if (prev.style) {
|
|
1139
|
+
let prop = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g, m
|
|
1140
|
+
while (m = prop.exec(prev.style))
|
|
1141
|
+
dom.style.removeProperty(m[1])
|
|
1142
|
+
}
|
|
1143
|
+
if (cur.style)
|
|
1144
|
+
dom.style.cssText += cur.style
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
function applyOuterDeco(dom: DOMNode, deco: readonly Decoration[], node: Node) {
|
|
1149
|
+
return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1))
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
function sameOuterDeco(a: readonly Decoration[], b: readonly Decoration[]) {
|
|
1153
|
+
if (a.length != b.length) return false
|
|
1154
|
+
for (let i = 0; i < a.length; i++) if (!a[i].type.eq(b[i].type)) return false
|
|
1155
|
+
return true
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
// Remove a DOM node and return its next sibling.
|
|
1159
|
+
function rm(dom: DOMNode) {
|
|
1160
|
+
let next = dom.nextSibling
|
|
1161
|
+
dom.parentNode!.removeChild(dom)
|
|
1162
|
+
return next
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
// Helper class for incrementally updating a tree of mark descs and
|
|
1166
|
+
// the widget and node descs inside of them.
|
|
1167
|
+
class ViewTreeUpdater {
|
|
1168
|
+
// Index into `this.top`'s child array, represents the current
|
|
1169
|
+
// update position.
|
|
1170
|
+
index = 0
|
|
1171
|
+
// When entering a mark, the current top and index are pushed
|
|
1172
|
+
// onto this.
|
|
1173
|
+
stack: (ViewDesc | number)[] = []
|
|
1174
|
+
// Tracks whether anything was changed
|
|
1175
|
+
changed = false
|
|
1176
|
+
preMatch: {index: number, matched: Map<ViewDesc, number>, matches: readonly ViewDesc[]}
|
|
1177
|
+
top: ViewDesc
|
|
1178
|
+
|
|
1179
|
+
constructor(top: NodeViewDesc, readonly lock: DOMNode | null, private readonly view: EditorView) {
|
|
1180
|
+
this.top = top
|
|
1181
|
+
this.preMatch = preMatch(top.node.content, top)
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// Destroy and remove the children between the given indices in
|
|
1185
|
+
// `this.top`.
|
|
1186
|
+
destroyBetween(start: number, end: number) {
|
|
1187
|
+
if (start == end) return
|
|
1188
|
+
for (let i = start; i < end; i++) this.top.children[i].destroy()
|
|
1189
|
+
this.top.children.splice(start, end - start)
|
|
1190
|
+
this.changed = true
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// Destroy all remaining children in `this.top`.
|
|
1194
|
+
destroyRest() {
|
|
1195
|
+
this.destroyBetween(this.index, this.top.children.length)
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// Sync the current stack of mark descs with the given array of
|
|
1199
|
+
// marks, reusing existing mark descs when possible.
|
|
1200
|
+
syncToMarks(marks: readonly Mark[], inline: boolean, view: EditorView, parentIndex: number) {
|
|
1201
|
+
let keep = 0, depth = this.stack.length >> 1
|
|
1202
|
+
let maxKeep = Math.min(depth, marks.length)
|
|
1203
|
+
while (keep < maxKeep &&
|
|
1204
|
+
(keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1] as ViewDesc)
|
|
1205
|
+
.matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)
|
|
1206
|
+
keep++
|
|
1207
|
+
|
|
1208
|
+
while (keep < depth) {
|
|
1209
|
+
this.destroyRest()
|
|
1210
|
+
this.top.dirty = NOT_DIRTY
|
|
1211
|
+
this.index = this.stack.pop() as number
|
|
1212
|
+
this.top = this.stack.pop() as ViewDesc
|
|
1213
|
+
depth--
|
|
1214
|
+
}
|
|
1215
|
+
while (depth < marks.length) {
|
|
1216
|
+
this.stack.push(this.top, this.index + 1)
|
|
1217
|
+
let found = -1, scanTo = this.top.children.length
|
|
1218
|
+
if (parentIndex < this.preMatch.index) scanTo = Math.min(this.index + 3, scanTo)
|
|
1219
|
+
for (let i = this.index; i < scanTo; i++) {
|
|
1220
|
+
let next = this.top.children[i]
|
|
1221
|
+
if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) { found = i; break }
|
|
1222
|
+
}
|
|
1223
|
+
if (found > -1) {
|
|
1224
|
+
if (found > this.index) {
|
|
1225
|
+
this.changed = true
|
|
1226
|
+
this.destroyBetween(this.index, found)
|
|
1227
|
+
}
|
|
1228
|
+
this.top = this.top.children[this.index]
|
|
1229
|
+
} else {
|
|
1230
|
+
let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view)
|
|
1231
|
+
this.top.children.splice(this.index, 0, markDesc)
|
|
1232
|
+
this.top = markDesc
|
|
1233
|
+
this.changed = true
|
|
1234
|
+
}
|
|
1235
|
+
this.index = 0
|
|
1236
|
+
depth++
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
// Try to find a node desc matching the given data. Skip over it and
|
|
1241
|
+
// return true when successful.
|
|
1242
|
+
findNodeMatch(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, index: number): boolean {
|
|
1243
|
+
let found = -1, targetDesc
|
|
1244
|
+
if (index >= this.preMatch.index &&
|
|
1245
|
+
(targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top &&
|
|
1246
|
+
targetDesc.matchesNode(node, outerDeco, innerDeco)) {
|
|
1247
|
+
found = this.top.children.indexOf(targetDesc, this.index)
|
|
1248
|
+
} else {
|
|
1249
|
+
for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {
|
|
1250
|
+
let child = this.top.children[i]
|
|
1251
|
+
if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {
|
|
1252
|
+
found = i
|
|
1253
|
+
break
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
if (found < 0) return false
|
|
1258
|
+
this.destroyBetween(this.index, found)
|
|
1259
|
+
this.index++
|
|
1260
|
+
return true
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
updateNodeAt(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, index: number, view: EditorView) {
|
|
1264
|
+
let child = this.top.children[index] as NodeViewDesc
|
|
1265
|
+
if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM) child.dirty = CONTENT_DIRTY
|
|
1266
|
+
if (!child.update(node, outerDeco, innerDeco, view)) return false
|
|
1267
|
+
this.destroyBetween(this.index, index)
|
|
1268
|
+
this.index++
|
|
1269
|
+
return true
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
findIndexWithChild(domNode: DOMNode) {
|
|
1273
|
+
for (;;) {
|
|
1274
|
+
let parent = domNode.parentNode
|
|
1275
|
+
if (!parent) return -1
|
|
1276
|
+
if (parent == this.top.contentDOM) {
|
|
1277
|
+
let desc = domNode.pmViewDesc
|
|
1278
|
+
if (desc) for (let i = this.index; i < this.top.children.length; i++) {
|
|
1279
|
+
if (this.top.children[i] == desc) return i
|
|
1280
|
+
}
|
|
1281
|
+
return -1
|
|
1282
|
+
}
|
|
1283
|
+
domNode = parent
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
// Try to update the next node, if any, to the given data. Checks
|
|
1288
|
+
// pre-matches to avoid overwriting nodes that could still be used.
|
|
1289
|
+
updateNextNode(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource,
|
|
1290
|
+
view: EditorView, index: number, pos: number): boolean {
|
|
1291
|
+
for (let i = this.index; i < this.top.children.length; i++) {
|
|
1292
|
+
let next = this.top.children[i]
|
|
1293
|
+
if (next instanceof NodeViewDesc) {
|
|
1294
|
+
let preMatch = this.preMatch.matched.get(next)
|
|
1295
|
+
if (preMatch != null && preMatch != index) return false
|
|
1296
|
+
let nextDOM = next.dom, updated
|
|
1297
|
+
|
|
1298
|
+
// Can't update if nextDOM is or contains this.lock, except if
|
|
1299
|
+
// it's a text node whose content already matches the new text
|
|
1300
|
+
// and whose decorations match the new ones.
|
|
1301
|
+
let locked = this.isLocked(nextDOM) &&
|
|
1302
|
+
!(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text &&
|
|
1303
|
+
next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco))
|
|
1304
|
+
if (!locked && next.update(node, outerDeco, innerDeco, view)) {
|
|
1305
|
+
this.destroyBetween(this.index, i)
|
|
1306
|
+
if (next.dom != nextDOM) this.changed = true
|
|
1307
|
+
this.index++
|
|
1308
|
+
return true
|
|
1309
|
+
} else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {
|
|
1310
|
+
this.destroyBetween(this.index, i)
|
|
1311
|
+
this.top.children[this.index] = updated
|
|
1312
|
+
if (updated.contentDOM) {
|
|
1313
|
+
updated.dirty = CONTENT_DIRTY
|
|
1314
|
+
updated.updateChildren(view, pos + 1)
|
|
1315
|
+
updated.dirty = NOT_DIRTY
|
|
1316
|
+
}
|
|
1317
|
+
this.changed = true
|
|
1318
|
+
this.index++
|
|
1319
|
+
return true
|
|
1320
|
+
}
|
|
1321
|
+
break
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return false
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// When a node with content is replaced by a different node with
|
|
1328
|
+
// identical content, move over its children.
|
|
1329
|
+
recreateWrapper(next: NodeViewDesc, node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource,
|
|
1330
|
+
view: EditorView, pos: number) {
|
|
1331
|
+
if (next.dirty || node.isAtom || !next.children.length ||
|
|
1332
|
+
!next.node.content.eq(node.content) ||
|
|
1333
|
+
!sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco)) return null
|
|
1334
|
+
let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos)
|
|
1335
|
+
if (wrapper.contentDOM) {
|
|
1336
|
+
wrapper.children = next.children
|
|
1337
|
+
next.children = []
|
|
1338
|
+
for (let ch of wrapper.children) ch.parent = wrapper
|
|
1339
|
+
}
|
|
1340
|
+
next.destroy()
|
|
1341
|
+
return wrapper
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
// Insert the node as a newly created node desc.
|
|
1345
|
+
addNode(node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, view: EditorView, pos: number) {
|
|
1346
|
+
let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos)
|
|
1347
|
+
if (desc.contentDOM) desc.updateChildren(view, pos + 1)
|
|
1348
|
+
this.top.children.splice(this.index++, 0, desc)
|
|
1349
|
+
this.changed = true
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
placeWidget(widget: Decoration, view: EditorView, pos: number) {
|
|
1353
|
+
let next = this.index < this.top.children.length ? this.top.children[this.index] : null
|
|
1354
|
+
if (next && next.matchesWidget(widget) &&
|
|
1355
|
+
(widget == (next as WidgetViewDesc).widget || !(next as any).widget.type.toDOM.parentNode)) {
|
|
1356
|
+
this.index++
|
|
1357
|
+
} else {
|
|
1358
|
+
let desc = new WidgetViewDesc(this.top, widget, view, pos)
|
|
1359
|
+
this.top.children.splice(this.index++, 0, desc)
|
|
1360
|
+
this.changed = true
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
// Make sure a textblock looks and behaves correctly in
|
|
1365
|
+
// contentEditable.
|
|
1366
|
+
addTextblockHacks() {
|
|
1367
|
+
let lastChild = this.top.children[this.index - 1], parent = this.top
|
|
1368
|
+
while (lastChild instanceof MarkViewDesc) {
|
|
1369
|
+
parent = lastChild
|
|
1370
|
+
lastChild = parent.children[parent.children.length - 1]
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if (!lastChild || // Empty textblock
|
|
1374
|
+
!(lastChild instanceof TextViewDesc) ||
|
|
1375
|
+
/\n$/.test(lastChild.node.text!) ||
|
|
1376
|
+
(this.view.requiresGeckoHackNode && /\s$/.test(lastChild.node.text!))) {
|
|
1377
|
+
// Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)
|
|
1378
|
+
if ((browser.safari || browser.chrome) && lastChild && (lastChild.dom as HTMLElement).contentEditable == "false")
|
|
1379
|
+
this.addHackNode("IMG", parent)
|
|
1380
|
+
this.addHackNode("BR", this.top)
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
addHackNode(nodeName: string, parent: ViewDesc) {
|
|
1385
|
+
if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {
|
|
1386
|
+
this.index++
|
|
1387
|
+
} else {
|
|
1388
|
+
let dom = document.createElement(nodeName)
|
|
1389
|
+
if (nodeName == "IMG") {
|
|
1390
|
+
dom.className = "ProseMirror-separator"
|
|
1391
|
+
;(dom as HTMLImageElement).alt = ""
|
|
1392
|
+
}
|
|
1393
|
+
if (nodeName == "BR") dom.className = "ProseMirror-trailingBreak"
|
|
1394
|
+
let hack = new TrailingHackViewDesc(this.top, [], dom, null)
|
|
1395
|
+
if (parent != this.top) parent.children.push(hack)
|
|
1396
|
+
else parent.children.splice(this.index++, 0, hack)
|
|
1397
|
+
this.changed = true
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
isLocked(node: DOMNode) {
|
|
1402
|
+
return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode))
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
// Iterate from the end of the fragment and array of descs to find
|
|
1407
|
+
// directly matching ones, in order to avoid overeagerly reusing those
|
|
1408
|
+
// for other nodes.
|
|
1409
|
+
function preMatch(frag: Fragment, parentDesc: ViewDesc): {
|
|
1410
|
+
// The fragment index of the first node that is part of the sequence
|
|
1411
|
+
// of matched nodes at the end of the fragment.
|
|
1412
|
+
index: number,
|
|
1413
|
+
// A map from matched descs to fragment indices.
|
|
1414
|
+
matched: Map<ViewDesc, number>,
|
|
1415
|
+
// The matched descs.
|
|
1416
|
+
matches: readonly ViewDesc[]
|
|
1417
|
+
} {
|
|
1418
|
+
let curDesc = parentDesc, descI = curDesc.children.length
|
|
1419
|
+
let fI = frag.childCount, matched = new Map, matches = []
|
|
1420
|
+
outer: while (fI > 0) {
|
|
1421
|
+
let desc
|
|
1422
|
+
for (;;) {
|
|
1423
|
+
if (descI) {
|
|
1424
|
+
let next = curDesc.children[descI - 1]
|
|
1425
|
+
if (next instanceof MarkViewDesc) {
|
|
1426
|
+
curDesc = next
|
|
1427
|
+
descI = next.children.length
|
|
1428
|
+
} else {
|
|
1429
|
+
desc = next
|
|
1430
|
+
descI--
|
|
1431
|
+
break
|
|
1432
|
+
}
|
|
1433
|
+
} else if (curDesc == parentDesc) {
|
|
1434
|
+
break outer
|
|
1435
|
+
} else {
|
|
1436
|
+
descI = curDesc.parent!.children.indexOf(curDesc)
|
|
1437
|
+
curDesc = curDesc.parent!
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
let node = desc.node
|
|
1441
|
+
if (!node) continue
|
|
1442
|
+
if (node != frag.child(fI - 1)) break
|
|
1443
|
+
--fI
|
|
1444
|
+
matched.set(desc, fI)
|
|
1445
|
+
matches.push(desc)
|
|
1446
|
+
}
|
|
1447
|
+
return {index: fI, matched, matches: matches.reverse()}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
function compareSide(a: Decoration, b: Decoration) {
|
|
1451
|
+
return (a.type as WidgetType).side - (b.type as WidgetType).side
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
// This function abstracts iterating over the nodes and decorations in
|
|
1455
|
+
// a fragment. Calls `onNode` for each node, with its local and child
|
|
1456
|
+
// decorations. Splits text nodes when there is a decoration starting
|
|
1457
|
+
// or ending inside of them. Calls `onWidget` for each widget.
|
|
1458
|
+
function iterDeco(
|
|
1459
|
+
parent: Node,
|
|
1460
|
+
deco: DecorationSource,
|
|
1461
|
+
onWidget: (widget: Decoration, index: number, insideNode: boolean) => void,
|
|
1462
|
+
onNode: (node: Node, outerDeco: readonly Decoration[], innerDeco: DecorationSource, index: number) => void
|
|
1463
|
+
) {
|
|
1464
|
+
let locals = deco.locals(parent), offset = 0
|
|
1465
|
+
// Simple, cheap variant for when there are no local decorations
|
|
1466
|
+
if (locals.length == 0) {
|
|
1467
|
+
for (let i = 0; i < parent.childCount; i++) {
|
|
1468
|
+
let child = parent.child(i)
|
|
1469
|
+
onNode(child, locals, deco.forChild(offset, child), i)
|
|
1470
|
+
offset += child.nodeSize
|
|
1471
|
+
}
|
|
1472
|
+
return
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
let decoIndex = 0, active = [], restNode = null
|
|
1476
|
+
for (let parentIndex = 0;;) {
|
|
1477
|
+
let widget, widgets
|
|
1478
|
+
while (decoIndex < locals.length && locals[decoIndex].to == offset) {
|
|
1479
|
+
let next = locals[decoIndex++]
|
|
1480
|
+
if (next.widget) {
|
|
1481
|
+
if (!widget) widget = next
|
|
1482
|
+
else (widgets || (widgets = [widget])).push(next)
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
if (widget) {
|
|
1486
|
+
if (widgets) {
|
|
1487
|
+
widgets.sort(compareSide)
|
|
1488
|
+
for (let i = 0; i < widgets.length; i++) onWidget(widgets[i], parentIndex, !!restNode)
|
|
1489
|
+
} else {
|
|
1490
|
+
onWidget(widget, parentIndex, !!restNode)
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
let child, index
|
|
1495
|
+
if (restNode) {
|
|
1496
|
+
index = -1
|
|
1497
|
+
child = restNode
|
|
1498
|
+
restNode = null
|
|
1499
|
+
} else if (parentIndex < parent.childCount) {
|
|
1500
|
+
index = parentIndex
|
|
1501
|
+
child = parent.child(parentIndex++)
|
|
1502
|
+
} else {
|
|
1503
|
+
break
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
for (let i = 0; i < active.length; i++) if (active[i].to <= offset) active.splice(i--, 1)
|
|
1507
|
+
while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset)
|
|
1508
|
+
active.push(locals[decoIndex++])
|
|
1509
|
+
|
|
1510
|
+
let end = offset + child.nodeSize
|
|
1511
|
+
if (child.isText) {
|
|
1512
|
+
let cutAt = end
|
|
1513
|
+
if (decoIndex < locals.length && locals[decoIndex].from < cutAt) cutAt = locals[decoIndex].from
|
|
1514
|
+
for (let i = 0; i < active.length; i++) if (active[i].to < cutAt) cutAt = active[i].to
|
|
1515
|
+
if (cutAt < end) {
|
|
1516
|
+
restNode = child.cut(cutAt - offset)
|
|
1517
|
+
child = child.cut(0, cutAt - offset)
|
|
1518
|
+
end = cutAt
|
|
1519
|
+
index = -1
|
|
1520
|
+
}
|
|
1521
|
+
} else {
|
|
1522
|
+
while (decoIndex < locals.length && locals[decoIndex].to < end) decoIndex++
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice()
|
|
1526
|
+
onNode(child, outerDeco, deco.forChild(offset, child), index)
|
|
1527
|
+
offset = end
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// List markers in Mobile Safari will mysteriously disappear
|
|
1532
|
+
// sometimes. This works around that.
|
|
1533
|
+
function iosHacks(dom: HTMLElement) {
|
|
1534
|
+
if (dom.nodeName == "UL" || dom.nodeName == "OL") {
|
|
1535
|
+
let oldCSS = dom.style.cssText
|
|
1536
|
+
dom.style.cssText = oldCSS + "; list-style: square !important"
|
|
1537
|
+
window.getComputedStyle(dom).listStyle
|
|
1538
|
+
dom.style.cssText = oldCSS
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// Find a piece of text in an inline fragment, overlapping from-to
|
|
1543
|
+
function findTextInFragment(frag: Fragment, text: string, from: number, to: number) {
|
|
1544
|
+
for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {
|
|
1545
|
+
let child = frag.child(i++), childStart = pos
|
|
1546
|
+
pos += child.nodeSize
|
|
1547
|
+
if (!child.isText) continue
|
|
1548
|
+
let str = child.text!
|
|
1549
|
+
while (i < frag.childCount) {
|
|
1550
|
+
let next = frag.child(i++)
|
|
1551
|
+
pos += next.nodeSize
|
|
1552
|
+
if (!next.isText) break
|
|
1553
|
+
str += next.text
|
|
1554
|
+
}
|
|
1555
|
+
if (pos >= from) {
|
|
1556
|
+
if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text)
|
|
1557
|
+
return to - text.length
|
|
1558
|
+
let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1
|
|
1559
|
+
if (found >= 0 && found + text.length + childStart >= from)
|
|
1560
|
+
return childStart + found
|
|
1561
|
+
if (from == to && str.length >= (to + text.length) - childStart &&
|
|
1562
|
+
str.slice(to - childStart, to - childStart + text.length) == text)
|
|
1563
|
+
return to
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
return -1
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// Replace range from-to in an array of view descs with replacement
|
|
1570
|
+
// (may be null to just delete). This goes very much against the grain
|
|
1571
|
+
// of the rest of this code, which tends to create nodes with the
|
|
1572
|
+
// right shape in one go, rather than messing with them after
|
|
1573
|
+
// creation, but is necessary in the composition hack.
|
|
1574
|
+
function replaceNodes(nodes: readonly ViewDesc[], from: number, to: number, view: EditorView, replacement?: ViewDesc) {
|
|
1575
|
+
let result = []
|
|
1576
|
+
for (let i = 0, off = 0; i < nodes.length; i++) {
|
|
1577
|
+
let child = nodes[i], start = off, end = off += child.size
|
|
1578
|
+
if (start >= to || end <= from) {
|
|
1579
|
+
result.push(child)
|
|
1580
|
+
} else {
|
|
1581
|
+
if (start < from) result.push((child as MarkViewDesc | TextViewDesc).slice(0, from - start, view))
|
|
1582
|
+
if (replacement) {
|
|
1583
|
+
result.push(replacement)
|
|
1584
|
+
replacement = undefined
|
|
1585
|
+
}
|
|
1586
|
+
if (end > to) result.push((child as MarkViewDesc | TextViewDesc).slice(to - start, child.size, view))
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
return result
|
|
1590
|
+
}
|