@ecsplico/editor 2.1.1 → 3.0.0
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/CHANGELOG.md +74 -1
- package/README.md +39 -156
- package/dist/adapters/comments/drizzle.d.ts +1 -1
- package/dist/adapters/comments/{client.js → rest-model.js} +3 -3
- package/dist/adapters/comments/rest-model.js.map +1 -0
- package/dist/adapters/comments/types.d.ts +2 -2
- package/dist/adapters/document-state.d.ts +23 -0
- package/dist/adapters/document-state.js +66 -0
- package/dist/adapters/document-state.js.map +1 -0
- package/dist/adapters/documents.js +14 -11
- package/dist/adapters/documents.js.map +1 -1
- package/dist/adapters/drizzle.d.ts +2 -2
- package/dist/adapters/drizzle.js +97 -88
- package/dist/adapters/drizzle.js.map +1 -1
- package/dist/adapters/forge.d.ts +12 -7
- package/dist/adapters/forge.js +38 -45
- package/dist/adapters/forge.js.map +1 -1
- package/dist/adapters/http.d.ts +20 -0
- package/dist/adapters/http.js +68 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -5
- package/dist/adapters/json.d.ts +3 -3
- package/dist/adapters/json.js +58 -49
- package/dist/adapters/json.js.map +1 -1
- package/dist/adapters/memory.d.ts +21 -0
- package/dist/adapters/memory.js +53 -0
- package/dist/adapters/memory.js.map +1 -0
- package/dist/adapters/nitro.d.ts +23 -20
- package/dist/adapters/nitro.js +58 -163
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/react.d.ts +55 -0
- package/dist/adapters/react.js +209 -0
- package/dist/adapters/react.js.map +1 -0
- package/dist/adapters/shared.d.ts +15 -21
- package/dist/adapters/shared.js +10 -8
- package/dist/adapters/shared.js.map +1 -1
- package/dist/adapters/vue.d.ts +15 -30
- package/dist/adapters/vue.js +36 -87
- package/dist/adapters/vue.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +3 -3
- package/dist/config/index.d.ts +105 -0
- package/dist/config/index.js +95 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/abilities.js +1 -0
- package/dist/core/abilities.js.map +1 -1
- package/dist/{adapters/routes.js → core/api-routes.js} +5 -3
- package/dist/core/api-routes.js.map +1 -0
- package/dist/core/backend-capability.d.ts +7 -0
- package/dist/core/backend-capability.js +17 -0
- package/dist/core/backend-capability.js.map +1 -0
- package/dist/core/backend-types.d.ts +245 -0
- package/dist/core/backend-types.js +17 -0
- package/dist/core/backend-types.js.map +1 -0
- package/dist/core/backend.d.ts +108 -0
- package/dist/core/backend.js +14 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/block-convert.d.ts +7 -5
- package/dist/core/block-convert.js +28 -5
- package/dist/core/block-convert.js.map +1 -1
- package/dist/core/command-types.d.ts +89 -0
- package/dist/core/commands.d.ts +40 -0
- package/dist/core/commands.js +151 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/context.d.ts +17 -20
- package/dist/core/context.js +24 -21
- package/dist/core/context.js.map +1 -1
- package/dist/core/core-feature.d.ts +22 -7
- package/dist/core/core-feature.js +51 -18
- package/dist/core/core-feature.js.map +1 -1
- package/dist/core/define-editor.d.ts +4 -3
- package/dist/core/define-editor.js +14 -7
- package/dist/core/define-editor.js.map +1 -1
- package/dist/core/document-markdown.js +12 -3
- package/dist/core/document-markdown.js.map +1 -1
- package/dist/core/editor-ui.d.ts +8 -1
- package/dist/core/editor-ui.js +9 -8
- package/dist/core/editor-ui.js.map +1 -1
- package/dist/core/extension-points.d.ts +3 -15
- package/dist/core/feature-context.d.ts +8 -7
- package/dist/core/feature-context.js +12 -11
- package/dist/core/feature-context.js.map +1 -1
- package/dist/core/feature.d.ts +35 -19
- package/dist/core/feature.js.map +1 -1
- package/dist/core/fences.d.ts +2 -1
- package/dist/core/fences.js +3 -2
- package/dist/core/fences.js.map +1 -1
- package/dist/core/fetch-error.d.ts +1 -1
- package/dist/core/fetch-error.js +3 -1
- package/dist/core/fetch-error.js.map +1 -1
- package/dist/core/hash.d.ts +5 -0
- package/dist/core/hash.js +11 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/http-backend.d.ts +11 -0
- package/dist/core/http-backend.js +195 -0
- package/dist/core/http-backend.js.map +1 -0
- package/dist/core/index.d.ts +14 -9
- package/dist/core/index.js +12 -9
- package/dist/core/palette.d.ts +48 -0
- package/dist/core/palette.js +95 -0
- package/dist/core/palette.js.map +1 -0
- package/dist/core/schema/abilities.d.ts +2 -1
- package/dist/core/schema/abilities.js +5 -1
- package/dist/core/schema/abilities.js.map +1 -1
- package/dist/core/schema/index.d.ts +11 -5
- package/dist/core/schema/index.js +13 -8
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/schema/mark-flags.d.ts +8 -1
- package/dist/core/schema/of-features.d.ts +13 -0
- package/dist/core/schema/of-features.js +14 -0
- package/dist/core/schema/of-features.js.map +1 -0
- package/dist/core/slash.d.ts +8 -6
- package/dist/core/slash.js +24 -16
- package/dist/core/slash.js.map +1 -1
- package/dist/core/surface-session.js +13 -5
- package/dist/core/surface-session.js.map +1 -1
- package/dist/core/toolbar-items.d.ts +10 -4
- package/dist/core/toolbar-items.js +269 -195
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/core/util.js +11 -0
- package/dist/core/util.js.map +1 -0
- package/dist/document/DocumentSurface.d.ts +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +3 -3
- package/dist/features/ai/agent-op-review.d.ts +1 -1
- package/dist/features/ai/agent-op-review.js +1 -1
- package/dist/features/ai/agent-ops.js +1 -1
- package/dist/features/ai/ai-apply.d.ts +2 -2
- package/dist/features/ai/ai-apply.js +1 -1
- package/dist/features/ai/ai-review.js +1 -1
- package/dist/features/ai/ai-sse.d.ts +6 -6
- package/dist/features/ai/ai-sse.js +20 -63
- package/dist/features/ai/ai-sse.js.map +1 -1
- package/dist/features/ai/assistant.d.ts +8 -7
- package/dist/features/ai/assistant.js +3 -3
- package/dist/features/ai/assistant.js.map +1 -1
- package/dist/features/ai/block-actions.d.ts +3 -2
- package/dist/features/ai/block-actions.js +3 -2
- package/dist/features/ai/block-actions.js.map +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +1 -1
- package/dist/features/ai/components/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/components/DocumentChatOps.vue.d.ts +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +8 -8
- package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/document-chat-model.d.ts +8 -7
- package/dist/features/ai/document-chat-model.js +5 -5
- package/dist/features/ai/document-chat-model.js.map +1 -1
- package/dist/features/ai/document-chat.js +1 -1
- package/dist/features/ai/feature.js +27 -14
- package/dist/features/ai/feature.js.map +1 -1
- package/dist/features/ai/ghost-autocomplete.d.ts +7 -6
- package/dist/features/ai/ghost-autocomplete.js +6 -9
- package/dist/features/ai/ghost-autocomplete.js.map +1 -1
- package/dist/features/ai/index.d.ts +4 -3
- package/dist/features/ai/index.js +10 -10
- package/dist/features/ai/model-profiles.d.ts +5 -4
- package/dist/features/ai/model-profiles.js +2 -2
- package/dist/features/ai/model-profiles.js.map +1 -1
- package/dist/features/ai/protocol/block-lines.js +1 -1
- package/dist/features/ai/protocol/block-lines.js.map +1 -1
- package/dist/features/ai/protocol/chat.js +4 -1
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +3 -2
- package/dist/features/ai/protocol/models.d.ts +2 -16
- package/dist/features/ai/protocol/models.js.map +1 -1
- package/dist/features/ai/rate-limit.d.ts +1 -1
- package/dist/features/ai/rate-limit.js +3 -1
- package/dist/features/ai/rate-limit.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js +2 -2
- package/dist/features/ai/react/AiSidebar.js +4 -4
- package/dist/features/ai/react/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/react/DocumentChatOps.d.ts +1 -1
- package/dist/features/ai/react/DocumentChatOps.js +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +8 -10
- package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/react/use-ai-assistant.js +3 -3
- package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/react/use-document-chat.js +2 -2
- package/dist/features/ai/react/use-document-chat.js.map +1 -1
- package/dist/features/ai/react/use-model-profiles.d.ts +2 -1
- package/dist/features/ai/selection-flow.d.ts +1 -1
- package/dist/features/ai/selection-flow.js +1 -1
- package/dist/features/ai/sidebar-flow.d.ts +1 -1
- package/dist/features/ai/sidebar-flow.js +1 -1
- package/dist/features/ai/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/use-ai-assistant.js +3 -3
- package/dist/features/ai/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/use-document-chat.js +2 -2
- package/dist/features/ai/use-document-chat.js.map +1 -1
- package/dist/features/ai/use-model-profiles.d.ts +2 -1
- package/dist/features/authors/attribution.d.ts +1 -1
- package/dist/features/authors/feature.js +12 -11
- package/dist/features/authors/feature.js.map +1 -1
- package/dist/features/block-ui/block-actions.d.ts +22 -1
- package/dist/features/block-ui/block-actions.js +26 -2
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.js +33 -4
- package/dist/features/block-ui/components/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.vue.d.ts +4 -0
- package/dist/features/block-ui/components/BlockUi.js +1 -1
- package/dist/features/block-ui/feature.js +1 -0
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/index.d.ts +2 -2
- package/dist/features/block-ui/index.js +2 -2
- package/dist/features/block-ui/react/BlockActionsOverlay.d.ts +4 -0
- package/dist/features/block-ui/react/BlockActionsOverlay.js +38 -12
- package/dist/features/block-ui/react/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +1 -1
- package/dist/features/collab/anchor-resolver.js +1 -1
- package/dist/features/collab/feature.js +2 -0
- package/dist/features/collab/feature.js.map +1 -1
- package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
- package/dist/features/comments/feature.js +12 -11
- package/dist/features/comments/feature.js.map +1 -1
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/comments/index.js +1 -1
- package/dist/features/comments/margin-layout.d.ts +3 -2
- package/dist/features/comments/model.d.ts +3 -67
- package/dist/features/comments/model.js +2 -2
- package/dist/features/comments/model.js.map +1 -1
- package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
- package/dist/features/comments/react/use-comments.d.ts +2 -1
- package/dist/features/comments/react.d.ts +1 -1
- package/dist/features/comments/schema.d.ts +2 -52
- package/dist/features/comments/schema.js.map +1 -1
- package/dist/features/comments/snapshot-equality.js.map +1 -1
- package/dist/features/comments/use-comments.d.ts +3 -2
- package/dist/features/comments/vue.d.ts +1 -1
- package/dist/features/composites/accepted-children.d.ts +1 -0
- package/dist/features/composites/accepted-children.js +16 -1
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.js +31 -0
- package/dist/features/composites/ai-brief.js.map +1 -1
- package/dist/features/composites/bibliography-command.d.ts +11 -0
- package/dist/features/composites/bibliography-form.js +90 -0
- package/dist/features/composites/bibliography-form.js.map +1 -0
- package/dist/features/composites/bibliography.d.ts +33 -0
- package/dist/features/composites/bibliography.js +120 -0
- package/dist/features/composites/bibliography.js.map +1 -0
- package/dist/features/composites/components/BibliographyEditor.js +261 -0
- package/dist/features/composites/components/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/components/CompositeChrome.js +75 -26
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.js +46 -11
- package/dist/features/composites/components/CompositeDetails.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.vue.d.ts +2 -1
- package/dist/features/composites/components/CompositeFieldEditor.js +37 -4
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.js +17 -5
- package/dist/features/composites/components/CompositeInspector.js.map +1 -1
- package/dist/features/composites/components/CompositeTable.js +13 -4
- package/dist/features/composites/components/CompositeTable.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/components/CompositeView.js +11 -1
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +103 -0
- package/dist/features/composites/components/DerivationBadge.js.map +1 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js +60 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.js +122 -0
- package/dist/features/composites/components/ReferenceView.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.vue.d.ts +96 -0
- package/dist/features/composites/components/SettingsEditingTab.js +1 -1
- package/dist/features/composites/convert.js +2 -2
- package/dist/features/composites/convert.js.map +1 -1
- package/dist/features/composites/derivation.d.ts +61 -0
- package/dist/features/composites/derivation.js +98 -0
- package/dist/features/composites/derivation.js.map +1 -0
- package/dist/features/composites/derived-chrome.js +69 -0
- package/dist/features/composites/derived-chrome.js.map +1 -0
- package/dist/features/composites/feature.js +159 -109
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/fences.d.ts +4 -3
- package/dist/features/composites/fences.js +51 -7
- package/dist/features/composites/fences.js.map +1 -1
- package/dist/features/composites/index.d.ts +12 -3
- package/dist/features/composites/index.js +15 -6
- package/dist/features/composites/inspector-model.d.ts +4 -1
- package/dist/features/composites/inspector-model.js +8 -4
- package/dist/features/composites/inspector-model.js.map +1 -1
- package/dist/features/composites/kinds.d.ts +8 -1
- package/dist/features/composites/kinds.js +145 -6
- package/dist/features/composites/kinds.js.map +1 -1
- package/dist/features/composites/legacy.d.ts +4 -1
- package/dist/features/composites/legacy.js +56 -1
- package/dist/features/composites/legacy.js.map +1 -1
- package/dist/features/composites/meta-display.js +40 -1
- package/dist/features/composites/meta-display.js.map +1 -1
- package/dist/features/composites/meta-keys.d.ts +7 -0
- package/dist/features/composites/meta-keys.js +21 -0
- package/dist/features/composites/meta-keys.js.map +1 -0
- package/dist/features/composites/node-views.d.ts +6 -3
- package/dist/features/composites/node-views.js +7 -3
- package/dist/features/composites/node-views.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +6 -1
- package/dist/features/composites/nodes.js +33 -7
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/react/BibliographyEditor.js +229 -0
- package/dist/features/composites/react/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/react/CompositeChrome.js +65 -17
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeDetails.d.ts +2 -1
- package/dist/features/composites/react/CompositeDetails.js +45 -6
- package/dist/features/composites/react/CompositeDetails.js.map +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.js +24 -1
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.js +11 -5
- package/dist/features/composites/react/CompositeInspector.js.map +1 -1
- package/dist/features/composites/react/CompositeStatusMenu.js +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/react/CompositeTable.js +16 -2
- package/dist/features/composites/react/CompositeTable.js.map +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js +2 -2
- package/dist/features/composites/react/CompositeView.js +6 -1
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +116 -0
- package/dist/features/composites/react/DerivationBadge.js.map +1 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js +52 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/react/ReferenceView.d.ts +11 -0
- package/dist/features/composites/react/ReferenceView.js +115 -0
- package/dist/features/composites/react/ReferenceView.js.map +1 -0
- package/dist/features/composites/react/SettingsEditingTab.js +2 -2
- package/dist/features/composites/react.d.ts +2 -1
- package/dist/features/composites/react.js +7 -3
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/reference-ai.js +16 -0
- package/dist/features/composites/reference-ai.js.map +1 -0
- package/dist/features/composites/reference-label.d.ts +19 -0
- package/dist/features/composites/reference-label.js +58 -0
- package/dist/features/composites/reference-label.js.map +1 -0
- package/dist/features/composites/reference-suggestion.d.ts +10 -0
- package/dist/features/composites/reference-suggestion.js +41 -0
- package/dist/features/composites/reference-suggestion.js.map +1 -0
- package/dist/features/composites/reference-text.d.ts +18 -0
- package/dist/features/composites/reference-text.js +89 -0
- package/dist/features/composites/reference-text.js.map +1 -0
- package/dist/features/composites/reference.d.ts +44 -0
- package/dist/features/composites/reference.js +148 -0
- package/dist/features/composites/reference.js.map +1 -0
- package/dist/features/composites/reveal-source.d.ts +32 -0
- package/dist/features/composites/reveal-source.js +89 -0
- package/dist/features/composites/reveal-source.js.map +1 -0
- package/dist/features/composites/rows.d.ts +21 -2
- package/dist/features/composites/rows.js +63 -9
- package/dist/features/composites/rows.js.map +1 -1
- package/dist/features/composites/schema.d.ts +9 -3
- package/dist/features/composites/schema.js +11 -4
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/table-model.js +12 -21
- package/dist/features/composites/table-model.js.map +1 -1
- package/dist/features/composites/vue.d.ts +3 -2
- package/dist/features/composites/vue.js +8 -4
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/media/assets.d.ts +2 -0
- package/dist/features/media/assets.js +3 -2
- package/dist/features/media/assets.js.map +1 -1
- package/dist/features/media/components/FileView.js +13 -4
- package/dist/features/media/components/FileView.js.map +1 -1
- package/dist/features/media/feature.d.ts +3 -3
- package/dist/features/media/feature.js +21 -28
- package/dist/features/media/feature.js.map +1 -1
- package/dist/features/media/file-import.js +2 -2
- package/dist/features/media/file-import.js.map +1 -1
- package/dist/features/media/index.d.ts +2 -2
- package/dist/features/media/index.js +2 -2
- package/dist/features/media/react/FileView.js +19 -2
- package/dist/features/media/react/FileView.js.map +1 -1
- package/dist/features/media/schema.d.ts +8 -0
- package/dist/features/media/schema.js +126 -11
- package/dist/features/media/schema.js.map +1 -1
- package/dist/features/media/upload.d.ts +16 -14
- package/dist/features/media/upload.js +13 -19
- package/dist/features/media/upload.js.map +1 -1
- package/dist/features/mentions/index.d.ts +4 -3
- package/dist/features/mentions/index.js +4 -1
- package/dist/features/mentions/index.js.map +1 -1
- package/dist/features/mentions/mention-text.d.ts +1 -1
- package/dist/features/mentions/mention-text.js.map +1 -1
- package/dist/features/mentions/mention.d.ts +0 -6
- package/dist/features/mentions/mention.js.map +1 -1
- package/dist/features/mentions/metadata-defaults.d.ts +2 -2
- package/dist/features/mentions/metadata-defaults.js +3 -9
- package/dist/features/mentions/metadata-defaults.js.map +1 -1
- package/dist/features/mentions/schema.d.ts +2 -1
- package/dist/features/mentions/schema.js.map +1 -1
- package/dist/features/tables/feature.d.ts +2 -1
- package/dist/features/tables/feature.js +90 -70
- package/dist/features/tables/feature.js.map +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js +6 -9
- package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/feature.js +2 -0
- package/dist/features/themes/feature.js.map +1 -1
- package/dist/features/themes/index.d.ts +2 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js +7 -10
- package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/schema.d.ts +2 -6
- package/dist/features/themes/schema.js.map +1 -1
- package/dist/features/themes/theme-runtime.d.ts +1 -1
- package/dist/features/themes/theme-runtime.js +4 -2
- package/dist/features/themes/theme-runtime.js.map +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js +48 -28
- package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/feature.js +21 -19
- package/dist/features/transcript/feature.js.map +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js +55 -36
- package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/segment-node.d.ts +2 -0
- package/dist/features/transcript/segment-node.js +35 -7
- package/dist/features/transcript/segment-node.js.map +1 -1
- package/dist/i18n/de/composites.js +91 -1
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/integrations.js +49 -8
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/media.js +0 -1
- package/dist/i18n/de/media.js.map +1 -1
- package/dist/i18n/de/palette.js +22 -0
- package/dist/i18n/de/palette.js.map +1 -0
- package/dist/i18n/de/tables.js +0 -1
- package/dist/i18n/de/tables.js.map +1 -1
- package/dist/i18n/de/transcript.js +2 -1
- package/dist/i18n/de/transcript.js.map +1 -1
- package/dist/i18n/de/tree.js +3 -0
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +157 -11
- package/dist/i18n/de.js +3 -1
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en/composites.js +89 -1
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/integrations.js +49 -8
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/media.js +0 -1
- package/dist/i18n/en/media.js.map +1 -1
- package/dist/i18n/en/palette.js +22 -0
- package/dist/i18n/en/palette.js.map +1 -0
- package/dist/i18n/en/tables.js +0 -1
- package/dist/i18n/en/tables.js.map +1 -1
- package/dist/i18n/en/transcript.js +2 -1
- package/dist/i18n/en/transcript.js.map +1 -1
- package/dist/i18n/en/tree.js +3 -0
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/i18n/en.js +3 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/integrations/composite-ai/bibliography-fetch.d.ts +31 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js +159 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -0
- package/dist/integrations/composite-ai/composite-fill.d.ts +30 -8
- package/dist/integrations/composite-ai/composite-fill.js +97 -56
- package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
- package/dist/integrations/composite-ai/composite-summary.d.ts +4 -12
- package/dist/integrations/composite-ai/composite-summary.js +7 -26
- package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +29 -0
- package/dist/integrations/composite-ai/derive.js +173 -0
- package/dist/integrations/composite-ai/derive.js.map +1 -0
- package/dist/integrations/composite-ai/index.d.ts +11 -7
- package/dist/integrations/composite-ai/index.js +72 -14
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/rendition.d.ts +45 -0
- package/dist/integrations/composite-ai/rendition.js +314 -0
- package/dist/integrations/composite-ai/rendition.js.map +1 -0
- package/dist/integrations/composite-media/index.d.ts +7 -5
- package/dist/integrations/composite-media/index.js +86 -13
- package/dist/integrations/composite-media/index.js.map +1 -1
- package/dist/integrations/transcript-ai/index.d.ts +1 -1
- package/dist/integrations/transcript-ai/index.js +5 -2
- package/dist/integrations/transcript-ai/index.js.map +1 -1
- package/dist/integrations/transcript-ai/protocol.d.ts +2 -12
- package/dist/integrations/transcript-ai/protocol.js +0 -2
- package/dist/integrations/transcript-ai/protocol.js.map +1 -1
- package/dist/integrations/transcript-ai/transcript-cleanup.d.ts +5 -5
- package/dist/integrations/transcript-ai/transcript-cleanup.js +7 -10
- package/dist/integrations/transcript-ai/transcript-cleanup.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +10 -9
- package/dist/markdown/MarkdownSurface2.js +3 -6
- package/dist/markdown/MarkdownSurface2.js.map +1 -1
- package/dist/markdown/document.js +1 -1
- package/dist/markdown/source-mode.d.ts +1 -1
- package/dist/nuxt/module.d.ts +1402 -54
- package/dist/nuxt/module.js +6 -49
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/runtime/install-context.d.ts +7 -3
- package/dist/nuxt/runtime/install-context.js +14 -8
- package/dist/nuxt/runtime/install-context.js.map +1 -1
- package/dist/nuxt/runtime/plugins/editor-context-nuxt-ui.client.ts +2 -2
- package/dist/nuxt/runtime/server/plugins/editor-server.js +20 -12
- package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
- package/dist/presets/compose.d.ts +94 -0
- package/dist/presets/compose.js +164 -0
- package/dist/presets/compose.js.map +1 -0
- package/dist/react/AdvancedEditor.d.ts +15 -15
- package/dist/react/AdvancedEditor.js +15 -13
- package/dist/react/AdvancedEditor.js.map +1 -1
- package/dist/react/EditorCommandPalette.d.ts +13 -0
- package/dist/react/EditorCommandPalette.js +118 -0
- package/dist/react/EditorCommandPalette.js.map +1 -0
- package/dist/react/EditorSettingsModal.d.ts +5 -5
- package/dist/react/EditorSettingsModal.js +7 -4
- package/dist/react/EditorSettingsModal.js.map +1 -1
- package/dist/react/EditorSettingsPanel.d.ts +7 -7
- package/dist/react/EditorSettingsPanel.js +8 -5
- package/dist/react/EditorSettingsPanel.js.map +1 -1
- package/dist/react/EditorSurface.d.ts +7 -7
- package/dist/react/EditorSurface.js +10 -6
- package/dist/react/EditorSurface.js.map +1 -1
- package/dist/react/EditorToolbar.d.ts +4 -6
- package/dist/react/EditorToolbar.js +29 -37
- package/dist/react/EditorToolbar.js.map +1 -1
- package/dist/react/SimpleEditor.d.ts +22 -23
- package/dist/react/SimpleEditor.js +21 -7
- package/dist/react/SimpleEditor.js.map +1 -1
- package/dist/react/advanced.d.ts +4 -3
- package/dist/react/advanced.js +2 -2
- package/dist/react/compose.d.ts +20 -0
- package/dist/react/compose.js +49 -0
- package/dist/react/compose.js.map +1 -0
- package/dist/react/composed-surface.d.ts +39 -0
- package/dist/react/composed-surface.js +71 -0
- package/dist/react/composed-surface.js.map +1 -0
- package/dist/react/context.js +6 -2
- package/dist/react/context.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/key-labels.js +15 -0
- package/dist/react/key-labels.js.map +1 -0
- package/dist/react/settings.d.ts +1 -1
- package/dist/react/simple.d.ts +2 -2
- package/dist/react/ui/command.js +36 -1
- package/dist/react/ui/command.js.map +1 -1
- package/dist/schema/advanced.d.ts +6 -6
- package/dist/schema/advanced.js +26 -29
- package/dist/schema/advanced.js.map +1 -1
- package/dist/server/ai.d.ts +5 -16
- package/dist/server/ai.js.map +1 -1
- package/dist/server/auth.d.ts +9 -0
- package/dist/server/collab-state.d.ts +1 -1
- package/dist/server/collab-state.js.map +1 -1
- package/dist/server/collab.d.ts +13 -13
- package/dist/server/collab.js +34 -18
- package/dist/server/collab.js.map +1 -1
- package/dist/server/crossref.js +78 -0
- package/dist/server/crossref.js.map +1 -0
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/errors.js +1 -1
- package/dist/server/errors.js.map +1 -1
- package/dist/server/extract.js +308 -0
- package/dist/server/extract.js.map +1 -0
- package/dist/{nuxt/runtime/server/utils/editor-route.js → server/h3.js} +8 -16
- package/dist/server/h3.js.map +1 -0
- package/dist/server/handlers/ai.d.ts +30 -9
- package/dist/server/handlers/ai.js +170 -36
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +12 -5
- package/dist/server/handlers/context.js +10 -4
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +19 -13
- package/dist/server/handlers/editor.js +49 -38
- package/dist/server/handlers/editor.js.map +1 -1
- package/dist/server/handlers/index.d.ts +4 -4
- package/dist/server/handlers/index.js +4 -4
- package/dist/server/host.d.ts +16 -25
- package/dist/server/host.js +58 -41
- package/dist/server/host.js.map +1 -1
- package/dist/server/index.d.ts +6 -4
- package/dist/server/index.js +3 -2
- package/dist/server/pdf.js +97 -0
- package/dist/server/pdf.js.map +1 -0
- package/dist/server/{adapter.d.ts → ports.d.ts} +81 -30
- package/dist/server/ports.js +29 -0
- package/dist/server/ports.js.map +1 -0
- package/dist/server/routes.js +144 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/styles/composites.css +25 -0
- package/dist/tree/DocumentTree.js +56 -29
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +23 -0
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +1 -1
- package/dist/vue/AdvancedEditor.js +30 -9
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +32 -12
- package/dist/vue/SimpleEditor.js +62 -16
- package/dist/vue/SimpleEditor.js.map +1 -1
- package/dist/vue/SimpleEditor.vue.d.ts +37 -7
- package/dist/vue/advanced.d.ts +3 -2
- package/dist/vue/advanced.js +2 -2
- package/dist/vue/components/EditorCommandPalette.js +91 -0
- package/dist/vue/components/EditorCommandPalette.js.map +1 -0
- package/dist/vue/components/EditorCommandPalette.vue.d.ts +15 -0
- package/dist/vue/components/EditorSettingsModal.js +10 -6
- package/dist/vue/components/EditorSettingsModal.js.map +1 -1
- package/dist/vue/components/EditorSettingsModal.vue.d.ts +4 -4
- package/dist/vue/components/EditorSettingsPanel.js +10 -6
- package/dist/vue/components/EditorSettingsPanel.js.map +1 -1
- package/dist/vue/components/EditorSettingsPanel.vue.d.ts +6 -6
- package/dist/vue/components/EditorSurface.js +11 -6
- package/dist/vue/components/EditorSurface.js.map +1 -1
- package/dist/vue/components/EditorSurface.vue.d.ts +11 -11
- package/dist/vue/components/EditorToolbar.js +41 -49
- package/dist/vue/components/EditorToolbar.js.map +1 -1
- package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
- package/dist/vue/compose.d.ts +17 -0
- package/dist/vue/compose.js +51 -0
- package/dist/vue/compose.js.map +1 -0
- package/dist/vue/context-key.d.ts +6 -0
- package/dist/vue/context-key.js +6 -0
- package/dist/vue/context-key.js.map +1 -0
- package/dist/vue/context.d.ts +8 -6
- package/dist/vue/context.js +6 -5
- package/dist/vue/context.js.map +1 -1
- package/dist/vue/index.d.ts +10 -8
- package/dist/vue/index.js +10 -8
- package/dist/vue/kit/index.d.ts +2 -2
- package/dist/vue/kit/nuxt-ui.js +23 -0
- package/dist/vue/kit/nuxt-ui.js.map +1 -1
- package/dist/vue/kit/types.d.ts +40 -1
- package/package.json +30 -16
- package/dist/adapters/comments/client.d.ts +0 -64
- package/dist/adapters/comments/client.js.map +0 -1
- package/dist/adapters/routes.js.map +0 -1
- package/dist/core/toolbar.d.ts +0 -74
- package/dist/core/toolbar.js +0 -45
- package/dist/core/toolbar.js.map +0 -1
- package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
- package/dist/integrations/composite-ai/document-transcribe.js +0 -89
- package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
- package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
- package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
- package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
- package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
- package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
- package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
- package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
- package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
- package/dist/presets/advanced.d.ts +0 -33
- package/dist/presets/advanced.js +0 -50
- package/dist/presets/advanced.js.map +0 -1
- package/dist/presets/simple.d.ts +0 -9
- package/dist/presets/simple.js +0 -12
- package/dist/presets/simple.js.map +0 -1
- package/dist/react/advanced-preset.d.ts +0 -11
- package/dist/react/advanced-preset.js +0 -31
- package/dist/react/advanced-preset.js.map +0 -1
- package/dist/vue/advanced-preset.d.ts +0 -13
- package/dist/vue/advanced-preset.js +0 -33
- package/dist/vue/advanced-preset.js.map +0 -1
- package/docs/extending.md +0 -538
- package/docs/integration.md +0 -630
- package/docs/llms.md +0 -383
- package/docs/usage.md +0 -1076
package/dist/core/context.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { BackendError } from "./backend.js";
|
|
1
2
|
import { createTranslator } from "../i18n/index.js";
|
|
2
3
|
import { parseEditorSettings } from "../settings/index.js";
|
|
4
|
+
import { createFetchBackend } from "./http-backend.js";
|
|
3
5
|
import { silentNotifier } from "./notify.js";
|
|
4
6
|
import { createStore } from "./store.js";
|
|
5
|
-
import { ofetch } from "ofetch";
|
|
6
7
|
//#region src/core/context.ts
|
|
7
8
|
const STORAGE_KEY = "tiptap-editor:settings";
|
|
8
9
|
/** Pause after the last change before the settings are sent to the server (ms). */
|
|
@@ -20,19 +21,20 @@ function writeLocal(settings) {
|
|
|
20
21
|
} catch {}
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* The editor context of an app: the settings shared by all editors of the app, and the
|
|
24
|
+
* The editor context of an app: the settings shared by all editors of the app, and the backend. Framework-free;
|
|
24
25
|
* the Vue layer installs it with `app.use(createEditor())`, the React layer provides it through
|
|
25
26
|
* `EditorContextProvider`. The settings are read from localStorage right away (client only) and every change is
|
|
26
|
-
* written back. With `settings
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* Subscription and timer stop with `dispose()`.
|
|
27
|
+
* written back. With a backend that offers `settings`, `backend.settings.load()` (on `load()`, which
|
|
28
|
+
* the settings hooks call) answers: the user's account settings replace them (`synced`), `null` (the account has none
|
|
29
|
+
* yet) makes the account take this browser's, a refusal (`401`, `501`) or a network error keeps the local ones; once
|
|
30
|
+
* synced every change is also sent to the backend (`save`, debounced). Subscription and timer stop with `dispose()`.
|
|
30
31
|
*/
|
|
31
32
|
function createEditorContext(options = {}) {
|
|
32
|
-
const
|
|
33
|
-
|
|
33
|
+
const backend = options.backend ?? createFetchBackend();
|
|
34
|
+
let remoteStore = backend.settings;
|
|
35
|
+
const remoteMode = remoteStore !== void 0;
|
|
34
36
|
const settings = createStore(parseEditorSettings(null));
|
|
35
|
-
const ready = createStore(!remoteMode);
|
|
37
|
+
const ready = createStore(!remoteMode && backend.ready === void 0);
|
|
36
38
|
const synced = createStore(false);
|
|
37
39
|
let loading = false;
|
|
38
40
|
let loadRemote = () => {};
|
|
@@ -49,13 +51,14 @@ function createEditorContext(options = {}) {
|
|
|
49
51
|
ready,
|
|
50
52
|
synced,
|
|
51
53
|
load,
|
|
52
|
-
|
|
54
|
+
backend,
|
|
53
55
|
ai: options.ai,
|
|
54
56
|
notify: options.notify ?? silentNotifier,
|
|
55
57
|
locale,
|
|
56
58
|
t,
|
|
57
59
|
dispose: () => dispose()
|
|
58
60
|
};
|
|
61
|
+
if (!remoteMode) backend.ready?.then(() => ready.set(true));
|
|
59
62
|
if (!("window" in globalThis)) return context;
|
|
60
63
|
settings.set(readLocal());
|
|
61
64
|
writeLocal(settings.get());
|
|
@@ -68,13 +71,10 @@ function createEditorContext(options = {}) {
|
|
|
68
71
|
timer = setTimeout(() => {
|
|
69
72
|
const json = JSON.stringify(value);
|
|
70
73
|
if (json === remote) return;
|
|
71
|
-
|
|
72
|
-
method: "PUT",
|
|
73
|
-
body: value
|
|
74
|
-
}).then(() => {
|
|
74
|
+
remoteStore?.save(value).then(() => {
|
|
75
75
|
remote = json;
|
|
76
76
|
}).catch((error) => {
|
|
77
|
-
if (error
|
|
77
|
+
if (!(error instanceof BackendError && (error.status === 501 || error.status === 404))) console.warn(`tiptap-editor: ${t("settings.saveFailed")}`, error);
|
|
78
78
|
});
|
|
79
79
|
}, PUT_DEBOUNCE);
|
|
80
80
|
}
|
|
@@ -87,16 +87,19 @@ function createEditorContext(options = {}) {
|
|
|
87
87
|
clearTimeout(timer);
|
|
88
88
|
unsubscribe();
|
|
89
89
|
};
|
|
90
|
-
if (!
|
|
91
|
-
loadRemote = () =>
|
|
92
|
-
|
|
90
|
+
if (!remoteStore) return context;
|
|
91
|
+
loadRemote = () => Promise.resolve(backend.ready).then(() => {
|
|
92
|
+
remoteStore = backend.settings;
|
|
93
|
+
return remoteStore?.load();
|
|
94
|
+
}).then((stored) => {
|
|
95
|
+
if (!active || !remoteStore) return;
|
|
93
96
|
synced.set(true);
|
|
94
|
-
if (
|
|
95
|
-
settings.set(parseEditorSettings(
|
|
97
|
+
if (stored) {
|
|
98
|
+
settings.set(parseEditorSettings(stored));
|
|
96
99
|
remote = JSON.stringify(settings.get());
|
|
97
100
|
} else push(settings.get());
|
|
98
101
|
}).catch((error) => {
|
|
99
|
-
console.warn(`tiptap-editor: ${t("settings.loadFailed")}`, error);
|
|
102
|
+
if (!(error instanceof BackendError && (error.status === 501 || error.status === 404))) console.warn(`tiptap-editor: ${t("settings.loadFailed")}`, error);
|
|
100
103
|
}).finally(() => {
|
|
101
104
|
ready.set(true);
|
|
102
105
|
});
|
package/dist/core/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../src/core/context.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../src/core/context.ts"],"sourcesContent":["import type { EditorPublicConfig } from '../config'\nimport { createTranslator, DEFAULT_LOCALE, type Locale, type Messages, type Translate } from '../i18n'\nimport { type EditorSettings, parseEditorSettings } from '../settings'\nimport { BackendError, type EditorBackend } from './backend'\nimport { createFetchBackend } from './http-backend'\nimport { type Notifier, silentNotifier } from './notify'\nimport { createStore, type ReadonlyStore, type Store } from './store'\n\nconst STORAGE_KEY = 'tiptap-editor:settings'\n/** Pause after the last change before the settings are sent to the server (ms). */\nconst PUT_DEBOUNCE = 500\n\n/** Inert public AI configuration (set by the Nuxt client plugin); only the AI feature reads it. Defined with the public config view. */\nexport type EditorAiConfig = EditorPublicConfig['ai']\n\nexport interface EditorContextOptions {\n /**\n * Where documents, uploads, mention lookups, settings, themes and AI come from (default: the HTTP routes of the Nuxt\n * module over the platform `fetch`, `createFetchBackend`). A backend that offers `settings` keeps the settings per\n * account (`backend.settings`); without it they stay in this browser.\n */\n backend?: EditorBackend\n ai?: EditorAiConfig\n /** Shows app-level notices (e.g. model profiles); default: dropped (`silentNotifier`). */\n notify?: Notifier\n /** Language of every string the editor renders (toolbar, slash menu, settings, AI, notices); default `'de'`. Fixed for the life of the context. */\n locale?: Locale\n /** Overrides of single messages by key (`{ 'toolbar.bold': 'Strong' }`); the rest comes from the catalog of `locale`. */\n messages?: Partial<Messages>\n}\n\n/** What `createEditorContext` returns: shared by all editors of an app. One per app: there is no process-global state. */\nexport interface EditorContext {\n settings: Store<EditorSettings>\n /** True once the stored settings are usable: immediately in local mode, after the server answered in remote mode. */\n ready: ReadonlyStore<boolean>\n /** True once the account's settings from the server are in effect (always false in local mode). */\n synced: ReadonlyStore<boolean>\n /**\n * Starts the account-settings load of remote mode (idempotent, no-op in local mode). The framework layers'\n * settings hooks call it, so the server is asked only once an editor-side component needs the settings (not on a\n * login page).\n */\n load: () => void\n backend: EditorBackend\n ai: EditorAiConfig | undefined\n /** Notices of app-level models; surfaces hand features their own `FeatureContext.notify`. */\n notify: Notifier\n /** The language of the editor's strings (`options.locale`, default `'de'`). */\n locale: Locale\n /** Renders a message of the catalog (with the host's `messages` applied): `t('toolbar.bold')`, `t('ai.run', { task })`. */\n t: Translate\n /** Stops the persistence (store subscription and pending server write); call when the app goes away. */\n dispose: () => void\n}\n\nfunction readLocal(): EditorSettings {\n try {\n // Also migrates the flat `{ headingConversionScope }` of the per-browser settings before version 1.\n return parseEditorSettings(JSON.parse(localStorage.getItem(STORAGE_KEY) ?? 'null'))\n }\n catch {\n // Unreadable or corrupt (or no) storage: the defaults.\n return parseEditorSettings(null)\n }\n}\n\nfunction writeLocal(settings: EditorSettings) {\n try {\n localStorage.setItem(STORAGE_KEY, JSON.stringify(settings))\n }\n catch {\n // Storage unavailable (e.g. privacy mode): the settings last for this session only.\n }\n}\n\n/**\n * The editor context of an app: the settings shared by all editors of the app, and the backend. Framework-free;\n * the Vue layer installs it with `app.use(createEditor())`, the React layer provides it through\n * `EditorContextProvider`. The settings are read from localStorage right away (client only) and every change is\n * written back. With a backend that offers `settings`, `backend.settings.load()` (on `load()`, which\n * the settings hooks call) answers: the user's account settings replace them (`synced`), `null` (the account has none\n * yet) makes the account take this browser's, a refusal (`401`, `501`) or a network error keeps the local ones; once\n * synced every change is also sent to the backend (`save`, debounced). Subscription and timer stop with `dispose()`.\n */\nexport function createEditorContext(options: EditorContextOptions = {}): EditorContext {\n const backend = options.backend ?? createFetchBackend()\n // `let`: a probing backend (`backend.ready`) may drop `settings` before the first load.\n let remoteStore = backend.settings\n const remoteMode = remoteStore !== undefined\n const settings = createStore<EditorSettings>(parseEditorSettings(null))\n const ready = createStore(!remoteMode && backend.ready === undefined)\n const synced = createStore(false)\n let loading = false\n let loadRemote = () => {}\n const load = () => {\n if (loading) return\n loading = true\n loadRemote()\n }\n let dispose = () => {}\n const locale = options.locale ?? DEFAULT_LOCALE\n const t = createTranslator(locale, options.messages)\n const context: EditorContext = { settings, ready, synced, load, backend, ai: options.ai, notify: options.notify ?? silentNotifier, locale, t, dispose: () => dispose() }\n // Local mode: ready once the backend knows its capabilities (remote mode: after the settings load, which waits for it).\n if (!remoteMode) void backend.ready?.then(() => ready.set(true))\n // No browser storage (server render): defaults, nothing to persist.\n if (!('window' in globalThis)) return context\n\n settings.set(readLocal())\n writeLocal(settings.get())\n\n /** JSON of the settings the server holds, so values that came from it are not sent back. */\n let remote = ''\n let timer: ReturnType<typeof setTimeout> | undefined\n let active = true\n function push(value: EditorSettings) {\n clearTimeout(timer)\n timer = setTimeout(() => {\n const json = JSON.stringify(value)\n if (json === remote) return\n remoteStore?.save(value)\n .then(() => { remote = json })\n .catch((error: unknown) => {\n // 501/404: the host serves no settings (no `settings` port, so no route); nothing to report.\n if (!(error instanceof BackendError && (error.status === 501 || error.status === 404))) {\n console.warn(`tiptap-editor: ${t('settings.saveFailed')}`, error)\n }\n })\n }, PUT_DEBOUNCE)\n }\n\n const unsubscribe = settings.subscribe((value) => {\n writeLocal(value)\n if (synced.get()) push(value)\n })\n dispose = () => {\n active = false\n clearTimeout(timer)\n unsubscribe()\n }\n\n if (!remoteStore) return context\n loadRemote = () => Promise.resolve(backend.ready)\n .then(() => {\n remoteStore = backend.settings\n return remoteStore?.load()\n })\n .then((stored) => {\n // The probe dropped `settings` (the server keeps none): the account has no settings, the local ones stay.\n if (!active || !remoteStore) return\n synced.set(true)\n if (stored) {\n settings.set(parseEditorSettings(stored))\n remote = JSON.stringify(settings.get())\n }\n // The account has no settings yet: it takes this browser's.\n else push(settings.get())\n })\n .catch((error: unknown) => {\n // 501/404: the host serves no settings; the local ones stay and there is nothing to report.\n if (!(error instanceof BackendError && (error.status === 501 || error.status === 404))) {\n console.warn(`tiptap-editor: ${t('settings.loadFailed')}`, error)\n }\n })\n .finally(() => { ready.set(true) })\n return context\n}\n"],"mappings":";;;;;;;AAQA,MAAM,cAAc;;AAEpB,MAAM,eAAe;AA8CrB,SAAS,YAA4B;CACnC,IAAI;EAEF,OAAO,oBAAoB,KAAK,MAAM,aAAa,QAAQ,WAAW,KAAK,MAAM,CAAC;CACpF,QACM;EAEJ,OAAO,oBAAoB,IAAI;CACjC;AACF;AAEA,SAAS,WAAW,UAA0B;CAC5C,IAAI;EACF,aAAa,QAAQ,aAAa,KAAK,UAAU,QAAQ,CAAC;CAC5D,QACM,CAEN;AACF;;;;;;;;;;AAWA,SAAgB,oBAAoB,UAAgC,CAAC,GAAkB;CACrF,MAAM,UAAU,QAAQ,WAAW,mBAAmB;CAEtD,IAAI,cAAc,QAAQ;CAC1B,MAAM,aAAa,gBAAgB,KAAA;CACnC,MAAM,WAAW,YAA4B,oBAAoB,IAAI,CAAC;CACtE,MAAM,QAAQ,YAAY,CAAC,cAAc,QAAQ,UAAU,KAAA,CAAS;CACpE,MAAM,SAAS,YAAY,KAAK;CAChC,IAAI,UAAU;CACd,IAAI,mBAAmB,CAAC;CACxB,MAAM,aAAa;EACjB,IAAI,SAAS;EACb,UAAU;EACV,WAAW;CACb;CACA,IAAI,gBAAgB,CAAC;CACrB,MAAM,SAAS,QAAQ,UAAA;CACvB,MAAM,IAAI,iBAAiB,QAAQ,QAAQ,QAAQ;CACnD,MAAM,UAAyB;EAAE;EAAU;EAAO;EAAQ;EAAM;EAAS,IAAI,QAAQ;EAAI,QAAQ,QAAQ,UAAU;EAAgB;EAAQ;EAAG,eAAe,QAAQ;CAAE;CAEvK,IAAI,CAAC,YAAY,QAAa,OAAO,WAAW,MAAM,IAAI,IAAI,CAAC;CAE/D,IAAI,EAAE,YAAY,aAAa,OAAO;CAEtC,SAAS,IAAI,UAAU,CAAC;CACxB,WAAW,SAAS,IAAI,CAAC;;CAGzB,IAAI,SAAS;CACb,IAAI;CACJ,IAAI,SAAS;CACb,SAAS,KAAK,OAAuB;EACnC,aAAa,KAAK;EAClB,QAAQ,iBAAiB;GACvB,MAAM,OAAO,KAAK,UAAU,KAAK;GACjC,IAAI,SAAS,QAAQ;GACrB,aAAa,KAAK,KAAK,CAAC,CACrB,WAAW;IAAE,SAAS;GAAK,CAAC,CAAC,CAC7B,OAAO,UAAmB;IAEzB,IAAI,EAAE,iBAAiB,iBAAiB,MAAM,WAAW,OAAO,MAAM,WAAW,OAC/E,QAAQ,KAAK,kBAAkB,EAAE,qBAAqB,KAAK,KAAK;GAEpE,CAAC;EACL,GAAG,YAAY;CACjB;CAEA,MAAM,cAAc,SAAS,WAAW,UAAU;EAChD,WAAW,KAAK;EAChB,IAAI,OAAO,IAAI,GAAG,KAAK,KAAK;CAC9B,CAAC;CACD,gBAAgB;EACd,SAAS;EACT,aAAa,KAAK;EAClB,YAAY;CACd;CAEA,IAAI,CAAC,aAAa,OAAO;CACzB,mBAAmB,QAAQ,QAAQ,QAAQ,KAAK,CAAC,CAC9C,WAAW;EACV,cAAc,QAAQ;EACtB,OAAO,aAAa,KAAK;CAC3B,CAAC,CAAC,CACD,MAAM,WAAW;EAEhB,IAAI,CAAC,UAAU,CAAC,aAAa;EAC7B,OAAO,IAAI,IAAI;EACf,IAAI,QAAQ;GACV,SAAS,IAAI,oBAAoB,MAAM,CAAC;GACxC,SAAS,KAAK,UAAU,SAAS,IAAI,CAAC;EACxC,OAEK,KAAK,SAAS,IAAI,CAAC;CAC1B,CAAC,CAAC,CACD,OAAO,UAAmB;EAEzB,IAAI,EAAE,iBAAiB,iBAAiB,MAAM,WAAW,OAAO,MAAM,WAAW,OAC/E,QAAQ,KAAK,kBAAkB,EAAE,qBAAqB,KAAK,KAAK;CAEpE,CAAC,CAAC,CACD,cAAc;EAAE,MAAM,IAAI,IAAI;CAAE,CAAC;CACpC,OAAO;AACT"}
|
|
@@ -4,14 +4,29 @@ import { EditorFeature, FeatureContext } from "./feature.js";
|
|
|
4
4
|
/** Hover actions every editor with block UI has: „Umwandeln in …“, duplicate, delete (in this order, after features' own). */
|
|
5
5
|
export declare const coreBlockActions: (ctx: FeatureContext) => readonly BlockAction[];
|
|
6
6
|
/**
|
|
7
|
-
* The base of every editor
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* StarterKit's undo history is off when a collaboration session brings its own.
|
|
7
|
+
* The content base of every editor: StarterKit with StrikeX, block IDs and node flags, the verbatim `OpaqueFence` for
|
|
8
|
+
* Markdown fences of unknown kinds, Markdown, abilities and metadata infrastructure and the standard conversions.
|
|
9
|
+
* StarterKit's undo history is off when a collaboration session brings its own. Its `schemaExtensions` are the base
|
|
10
|
+
* of the server schema (`schemaExtensionsOf` appends `BlockId`). A headless editor (Markdown conversion, viewer,
|
|
11
|
+
* validation) is `coreContentFeature()` plus other features without `coreUiFeature()`.
|
|
13
12
|
* Contributes no components (`EditorFeature<never>`), so it fits a preset of any framework layer.
|
|
14
13
|
*/
|
|
15
|
-
export declare function
|
|
14
|
+
export declare function coreContentFeature(): EditorFeature<never>;
|
|
15
|
+
/**
|
|
16
|
+
* What a framework layer binds to `core-ui`: the ⌘K palette component, mounted as an overlay of the surface (it reads
|
|
17
|
+
* `ui.paletteOpen` and the editor's commands; `EditorCommandPalette` of `/vue` and `/react`). `C` is the layer's component type.
|
|
18
|
+
*/
|
|
19
|
+
export interface CoreUi<C> {
|
|
20
|
+
palette: C;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The editing UX of a simple editor: Placeholder (marks empty textblocks `is-empty`), BlockFlash (`revealBlock`),
|
|
24
|
+
* BlockConvert, local DocAnchors, the `/` menu (the commands with a `slash` placement: the block types here, more from
|
|
25
|
+
* other features and the host), the undo/redo, formatting and block commands with their toolbar groups, and the
|
|
26
|
+
* duplicate/delete/convert block actions. Needs `core-content`.
|
|
27
|
+
* Given `ui` (the framework layer's palette component) it also has the ⌘K command palette: Mod-k and the overlay.
|
|
28
|
+
* Without `ui` it contributes no components (`EditorFeature<never>`), so it fits a headless preset of any framework layer.
|
|
29
|
+
*/
|
|
30
|
+
export declare function coreUiFeature<C = never>(ui?: CoreUi<C>): EditorFeature<C>;
|
|
16
31
|
//#endregion
|
|
17
32
|
//# sourceMappingURL=core-feature.d.ts.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ABILITY } from "./schema/abilities.js";
|
|
2
2
|
import { Abilities } from "./abilities.js";
|
|
3
|
+
import { Metadata } from "./metadata.js";
|
|
3
4
|
import { BlockId } from "./schema/block-ids.js";
|
|
4
5
|
import { NodeFlags } from "./schema/node-flags.js";
|
|
5
6
|
import { BlockConvert, convertMenuItems, coreConversions } from "./block-convert.js";
|
|
6
7
|
import { BlockFlash } from "./block-flash.js";
|
|
7
8
|
import { DocAnchors } from "./doc-anchors.js";
|
|
8
9
|
import { DocumentMarkdown } from "./document-markdown.js";
|
|
9
|
-
import { Metadata } from "./metadata.js";
|
|
10
10
|
import { OpaqueFence } from "./schema/opaque-fence.js";
|
|
11
11
|
import { StrikeX } from "./schema/strike.js";
|
|
12
|
+
import { coreContentSchemaExtensions } from "./schema/index.js";
|
|
12
13
|
import { SlashCommand } from "./slash.js";
|
|
13
|
-
import {
|
|
14
|
+
import { CORE_TOOLBAR_GROUPS, coreCommands } from "./toolbar-items.js";
|
|
15
|
+
import { Extension } from "@tiptap/core";
|
|
14
16
|
import { Placeholder } from "@tiptap/extensions";
|
|
15
17
|
import StarterKit from "@tiptap/starter-kit";
|
|
16
18
|
//#region src/core/core-feature.ts
|
|
@@ -48,17 +50,18 @@ const coreBlockActions = (ctx) => [
|
|
|
48
50
|
}
|
|
49
51
|
];
|
|
50
52
|
/**
|
|
51
|
-
* The base of every editor
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* StarterKit's undo history is off when a collaboration session brings its own.
|
|
53
|
+
* The content base of every editor: StarterKit with StrikeX, block IDs and node flags, the verbatim `OpaqueFence` for
|
|
54
|
+
* Markdown fences of unknown kinds, Markdown, abilities and metadata infrastructure and the standard conversions.
|
|
55
|
+
* StarterKit's undo history is off when a collaboration session brings its own. Its `schemaExtensions` are the base
|
|
56
|
+
* of the server schema (`schemaExtensionsOf` appends `BlockId`). A headless editor (Markdown conversion, viewer,
|
|
57
|
+
* validation) is `coreContentFeature()` plus other features without `coreUiFeature()`.
|
|
57
58
|
* Contributes no components (`EditorFeature<never>`), so it fits a preset of any framework layer.
|
|
58
59
|
*/
|
|
59
|
-
function
|
|
60
|
+
function coreContentFeature() {
|
|
60
61
|
return {
|
|
61
|
-
id: "core",
|
|
62
|
+
id: "core-content",
|
|
63
|
+
dimension: "content",
|
|
64
|
+
schemaExtensions: coreContentSchemaExtensions,
|
|
62
65
|
extensions: (ctx) => [
|
|
63
66
|
Abilities.configure(ctx.abilities),
|
|
64
67
|
StarterKit.configure({
|
|
@@ -72,29 +75,59 @@ function coreFeature() {
|
|
|
72
75
|
StrikeX,
|
|
73
76
|
NodeFlags,
|
|
74
77
|
OpaqueFence,
|
|
78
|
+
Metadata.configure({ registry: ctx.metadata }),
|
|
79
|
+
BlockId,
|
|
80
|
+
DocumentMarkdown
|
|
81
|
+
],
|
|
82
|
+
conversions: [coreConversions]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Mod-k toggles the palette of this editor's surface. */
|
|
86
|
+
function paletteShortcut(ctx) {
|
|
87
|
+
return Extension.create({
|
|
88
|
+
name: "commandPaletteShortcut",
|
|
89
|
+
addKeyboardShortcuts: () => ({ "Mod-k": () => {
|
|
90
|
+
ctx.ui.togglePalette();
|
|
91
|
+
return true;
|
|
92
|
+
} })
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The editing UX of a simple editor: Placeholder (marks empty textblocks `is-empty`), BlockFlash (`revealBlock`),
|
|
97
|
+
* BlockConvert, local DocAnchors, the `/` menu (the commands with a `slash` placement: the block types here, more from
|
|
98
|
+
* other features and the host), the undo/redo, formatting and block commands with their toolbar groups, and the
|
|
99
|
+
* duplicate/delete/convert block actions. Needs `core-content`.
|
|
100
|
+
* Given `ui` (the framework layer's palette component) it also has the ⌘K command palette: Mod-k and the overlay.
|
|
101
|
+
* Without `ui` it contributes no components (`EditorFeature<never>`), so it fits a headless preset of any framework layer.
|
|
102
|
+
*/
|
|
103
|
+
function coreUiFeature(ui) {
|
|
104
|
+
return {
|
|
105
|
+
id: "core-ui",
|
|
106
|
+
dimension: "interaction",
|
|
107
|
+
requires: ["core-content"],
|
|
108
|
+
extensions: (ctx) => [
|
|
75
109
|
Placeholder.configure({
|
|
76
110
|
includeChildren: true,
|
|
77
111
|
showOnlyCurrent: false,
|
|
78
112
|
placeholder: ""
|
|
79
113
|
}),
|
|
80
|
-
Metadata.configure({ registry: ctx.metadata }),
|
|
81
114
|
SlashCommand.configure({
|
|
82
|
-
|
|
115
|
+
commands: ctx.commands(),
|
|
83
116
|
emptyText: ctx.t("slash.empty"),
|
|
84
117
|
loadingText: ctx.t("common.loading")
|
|
85
118
|
}),
|
|
86
|
-
BlockId,
|
|
87
|
-
DocumentMarkdown,
|
|
88
119
|
BlockFlash,
|
|
89
120
|
BlockConvert,
|
|
90
|
-
DocAnchors.configure({ resolver: ctx.anchorResolver })
|
|
121
|
+
DocAnchors.configure({ resolver: ctx.anchorResolver }),
|
|
122
|
+
...ui ? [paletteShortcut(ctx)] : []
|
|
91
123
|
],
|
|
92
|
-
|
|
124
|
+
toolbarGroups: CORE_TOOLBAR_GROUPS,
|
|
125
|
+
commands: coreCommands,
|
|
93
126
|
blockActions: (ctx) => [...coreBlockActions(ctx)],
|
|
94
|
-
|
|
127
|
+
...ui && { overlays: [ui.palette] }
|
|
95
128
|
};
|
|
96
129
|
}
|
|
97
130
|
//#endregion
|
|
98
|
-
export { coreBlockActions,
|
|
131
|
+
export { coreBlockActions, coreContentFeature, coreUiFeature };
|
|
99
132
|
|
|
100
133
|
//# sourceMappingURL=core-feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-feature.js","names":[],"sources":["../../src/core/core-feature.ts"],"sourcesContent":["import { Placeholder } from '@tiptap/extensions'\nimport StarterKit from '@tiptap/starter-kit'\nimport { Abilities } from './abilities'\nimport { BlockConvert, coreConversions, convertMenuItems } from './block-convert'\nimport { BlockFlash } from './block-flash'\nimport { DocAnchors } from './doc-anchors'\nimport { DocumentMarkdown } from './document-markdown'\nimport type { BlockAction } from './extension-points'\nimport type { EditorFeature, FeatureContext } from './feature'\nimport { Metadata } from './metadata'\nimport { ABILITY } from './schema/abilities'\nimport { BlockId } from './schema/block-ids'\nimport { NodeFlags } from './schema/node-flags'\nimport { OpaqueFence } from './schema/opaque-fence'\nimport { StrikeX } from './schema/strike'\nimport { SlashCommand } from './slash'\nimport {
|
|
1
|
+
{"version":3,"file":"core-feature.js","names":[],"sources":["../../src/core/core-feature.ts"],"sourcesContent":["import { type AnyExtension, Extension } from '@tiptap/core'\nimport { Placeholder } from '@tiptap/extensions'\nimport StarterKit from '@tiptap/starter-kit'\nimport { Abilities } from './abilities'\nimport { BlockConvert, coreConversions, convertMenuItems } from './block-convert'\nimport { BlockFlash } from './block-flash'\nimport { DocAnchors } from './doc-anchors'\nimport { DocumentMarkdown } from './document-markdown'\nimport type { BlockAction } from './extension-points'\nimport type { EditorFeature, FeatureContext } from './feature'\nimport { Metadata } from './metadata'\nimport { coreContentSchemaExtensions } from './schema'\nimport { ABILITY } from './schema/abilities'\nimport { BlockId } from './schema/block-ids'\nimport { NodeFlags } from './schema/node-flags'\nimport { OpaqueFence } from './schema/opaque-fence'\nimport { StrikeX } from './schema/strike'\nimport { SlashCommand } from './slash'\nimport { CORE_TOOLBAR_GROUPS, coreCommands } from './toolbar-items'\n\n/** Hover actions every editor with block UI has: „Umwandeln in …“, duplicate, delete (in this order, after features' own). */\nexport const coreBlockActions = (ctx: FeatureContext): readonly BlockAction[] => [\n {\n id: 'convert',\n label: ctx.t('block.convert'),\n icon: 'i-lucide-replace',\n ability: ABILITY.blockConvert,\n order: 1000,\n menu: ({ editor, node, pos }) => convertMenuItems(editor, { node, pos }, ctx.t),\n },\n {\n id: 'duplicate',\n label: ctx.t('block.duplicate'),\n icon: 'i-lucide-copy',\n ability: ABILITY.blockDuplicate,\n order: 1010,\n // BlockId's dedupe plugin gives the copy (and every block nested in it) fresh ids.\n run: ({ editor, node, pos }) => editor.chain().insertContentAt(pos + node.nodeSize, node.toJSON()).run(),\n },\n {\n id: 'delete',\n label: ctx.t('block.delete'),\n icon: 'i-lucide-trash-2',\n ability: ABILITY.blockDelete,\n order: 1020,\n run: ({ editor, node, pos }) => editor.chain().focus().deleteRange({ from: pos, to: pos + node.nodeSize }).run(),\n },\n]\n\n/**\n * The content base of every editor: StarterKit with StrikeX, block IDs and node flags, the verbatim `OpaqueFence` for\n * Markdown fences of unknown kinds, Markdown, abilities and metadata infrastructure and the standard conversions.\n * StarterKit's undo history is off when a collaboration session brings its own. Its `schemaExtensions` are the base\n * of the server schema (`schemaExtensionsOf` appends `BlockId`). A headless editor (Markdown conversion, viewer,\n * validation) is `coreContentFeature()` plus other features without `coreUiFeature()`.\n * Contributes no components (`EditorFeature<never>`), so it fits a preset of any framework layer.\n */\nexport function coreContentFeature(): EditorFeature<never> {\n return {\n id: 'core-content',\n dimension: 'content',\n schemaExtensions: coreContentSchemaExtensions,\n extensions: ctx => [\n Abilities.configure(ctx.abilities),\n StarterKit.configure({ strike: false, undoRedo: ctx.collaboration ? false : undefined, dropcursor: { color: 'var(--sk-primary)', width: 2 } }),\n StrikeX,\n NodeFlags,\n OpaqueFence,\n Metadata.configure({ registry: ctx.metadata }),\n BlockId,\n DocumentMarkdown,\n ],\n conversions: [coreConversions],\n }\n}\n\n/**\n * What a framework layer binds to `core-ui`: the ⌘K palette component, mounted as an overlay of the surface (it reads\n * `ui.paletteOpen` and the editor's commands; `EditorCommandPalette` of `/vue` and `/react`). `C` is the layer's component type.\n */\nexport interface CoreUi<C> {\n palette: C\n}\n\n/** Mod-k toggles the palette of this editor's surface. */\nfunction paletteShortcut(ctx: FeatureContext): AnyExtension {\n return Extension.create({\n name: 'commandPaletteShortcut',\n addKeyboardShortcuts: () => ({\n 'Mod-k': () => {\n ctx.ui.togglePalette()\n return true\n },\n }),\n })\n}\n\n/**\n * The editing UX of a simple editor: Placeholder (marks empty textblocks `is-empty`), BlockFlash (`revealBlock`),\n * BlockConvert, local DocAnchors, the `/` menu (the commands with a `slash` placement: the block types here, more from\n * other features and the host), the undo/redo, formatting and block commands with their toolbar groups, and the\n * duplicate/delete/convert block actions. Needs `core-content`.\n * Given `ui` (the framework layer's palette component) it also has the ⌘K command palette: Mod-k and the overlay.\n * Without `ui` it contributes no components (`EditorFeature<never>`), so it fits a headless preset of any framework layer.\n */\nexport function coreUiFeature<C = never>(ui?: CoreUi<C>): EditorFeature<C> {\n return {\n id: 'core-ui',\n dimension: 'interaction',\n requires: ['core-content'],\n extensions: ctx => [\n Placeholder.configure({ includeChildren: true, showOnlyCurrent: false, placeholder: '' }),\n SlashCommand.configure({ commands: ctx.commands(), emptyText: ctx.t('slash.empty'), loadingText: ctx.t('common.loading') }),\n BlockFlash,\n BlockConvert,\n DocAnchors.configure({ resolver: ctx.anchorResolver }),\n ...(ui ? [paletteShortcut(ctx)] : []),\n ],\n toolbarGroups: CORE_TOOLBAR_GROUPS,\n commands: coreCommands,\n blockActions: ctx => [...coreBlockActions(ctx)],\n ...(ui && { overlays: [ui.palette] }),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAa,oBAAoB,QAAgD;CAC/E;EACE,IAAI;EACJ,OAAO,IAAI,EAAE,eAAe;EAC5B,MAAM;EACN,SAAS,QAAQ;EACjB,OAAO;EACP,OAAO,EAAE,QAAQ,MAAM,UAAU,iBAAiB,QAAQ;GAAE;GAAM;EAAI,GAAG,IAAI,CAAC;CAChF;CACA;EACE,IAAI;EACJ,OAAO,IAAI,EAAE,iBAAiB;EAC9B,MAAM;EACN,SAAS,QAAQ;EACjB,OAAO;EAEP,MAAM,EAAE,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC,CAAC,gBAAgB,MAAM,KAAK,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI;CACzG;CACA;EACE,IAAI;EACJ,OAAO,IAAI,EAAE,cAAc;EAC3B,MAAM;EACN,SAAS,QAAQ;EACjB,OAAO;EACP,MAAM,EAAE,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;GAAE,MAAM;GAAK,IAAI,MAAM,KAAK;EAAS,CAAC,CAAC,CAAC,IAAI;CACjH;AACF;;;;;;;;;AAUA,SAAgB,qBAA2C;CACzD,OAAO;EACL,IAAI;EACJ,WAAW;EACX,kBAAkB;EAClB,aAAY,QAAO;GACjB,UAAU,UAAU,IAAI,SAAS;GACjC,WAAW,UAAU;IAAE,QAAQ;IAAO,UAAU,IAAI,gBAAgB,QAAQ,KAAA;IAAW,YAAY;KAAE,OAAO;KAAqB,OAAO;IAAE;GAAE,CAAC;GAC7I;GACA;GACA;GACA,SAAS,UAAU,EAAE,UAAU,IAAI,SAAS,CAAC;GAC7C;GACA;EACF;EACA,aAAa,CAAC,eAAe;CAC/B;AACF;;AAWA,SAAS,gBAAgB,KAAmC;CAC1D,OAAO,UAAU,OAAO;EACtB,MAAM;EACN,6BAA6B,EAC3B,eAAe;GACb,IAAI,GAAG,cAAc;GACrB,OAAO;EACT,EACF;CACF,CAAC;AACH;;;;;;;;;AAUA,SAAgB,cAAyB,IAAkC;CACzE,OAAO;EACL,IAAI;EACJ,WAAW;EACX,UAAU,CAAC,cAAc;EACzB,aAAY,QAAO;GACjB,YAAY,UAAU;IAAE,iBAAiB;IAAM,iBAAiB;IAAO,aAAa;GAAG,CAAC;GACxF,aAAa,UAAU;IAAE,UAAU,IAAI,SAAS;IAAG,WAAW,IAAI,EAAE,aAAa;IAAG,aAAa,IAAI,EAAE,gBAAgB;GAAE,CAAC;GAC1H;GACA;GACA,WAAW,UAAU,EAAE,UAAU,IAAI,eAAe,CAAC;GACrD,GAAI,KAAK,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC;EACrC;EACA,eAAe;EACf,UAAU;EACV,eAAc,QAAO,CAAC,GAAG,iBAAiB,GAAG,CAAC;EAC9C,GAAI,MAAM,EAAE,UAAU,CAAC,GAAG,OAAO,EAAE;CACrC;AACF"}
|
|
@@ -3,9 +3,10 @@ import { EditorFeature, EditorPreset, SettingsTab } from "./feature.js";
|
|
|
3
3
|
//#region src/core/define-editor.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Validates `features` and resolves their pipeline and conversion providers. Keeps the given order; neither
|
|
6
|
-
* deduplicates nor installs missing dependencies. Throws on duplicate ids, a `requires` entry that is not installed
|
|
7
|
-
* and a singleton hook (`parseMarkdown`, `segment`, `structure`, `wrapImport`, `migrateContent`, `anchorResolver`,
|
|
8
|
-
* `formatAiResult`) contributed twice.
|
|
6
|
+
* deduplicates nor installs missing dependencies. Throws on duplicate ids, a `requires` entry that is not installed,
|
|
7
|
+
* a toolbar group declared by two features (`toolbarGroups`) and a singleton hook (`parseMarkdown`, `segment`, `structure`, `wrapImport`, `migrateContent`, `anchorResolver`,
|
|
8
|
+
* `formatAiResult`) contributed twice. A command naming a toolbar group no feature declares needs the feature context
|
|
9
|
+
* to build the commands: `toolbarOf` throws it. `normalize` hooks chain left to right. `aiContext` contributions merge (`kinds` and `blocks`
|
|
9
10
|
* concatenated in feature order, `structure` from one feature only); their conflicts surface when the merged `aiContext` reads the editor.
|
|
10
11
|
* `aiBlockData` contributions are additive too: they run in parallel per block and their data concatenate in feature order.
|
|
11
12
|
*/
|
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import { DEFAULT_BLOCK_PIPELINE } from "./pipeline.js";
|
|
2
1
|
import { SINGLETON_PIPELINE_HOOKS } from "./feature.js";
|
|
2
|
+
import { DEFAULT_BLOCK_PIPELINE } from "./pipeline.js";
|
|
3
|
+
import { fail as fail$1 } from "./util.js";
|
|
3
4
|
//#region src/core/define-editor.ts
|
|
4
5
|
const FEATURE_SINGLETONS = ["anchorResolver", "formatAiResult"];
|
|
5
|
-
|
|
6
|
-
throw new Error(`@ecsplico/editor: defineEditor: ${message}`);
|
|
7
|
-
}
|
|
6
|
+
const fail = (message) => fail$1(message, "defineEditor");
|
|
8
7
|
/**
|
|
9
8
|
* Validates `features` and resolves their pipeline and conversion providers. Keeps the given order; neither
|
|
10
|
-
* deduplicates nor installs missing dependencies. Throws on duplicate ids, a `requires` entry that is not installed
|
|
11
|
-
* and a singleton hook (`parseMarkdown`, `segment`, `structure`, `wrapImport`, `migrateContent`, `anchorResolver`,
|
|
12
|
-
* `formatAiResult`) contributed twice.
|
|
9
|
+
* deduplicates nor installs missing dependencies. Throws on duplicate ids, a `requires` entry that is not installed,
|
|
10
|
+
* a toolbar group declared by two features (`toolbarGroups`) and a singleton hook (`parseMarkdown`, `segment`, `structure`, `wrapImport`, `migrateContent`, `anchorResolver`,
|
|
11
|
+
* `formatAiResult`) contributed twice. A command naming a toolbar group no feature declares needs the feature context
|
|
12
|
+
* to build the commands: `toolbarOf` throws it. `normalize` hooks chain left to right. `aiContext` contributions merge (`kinds` and `blocks`
|
|
13
13
|
* concatenated in feature order, `structure` from one feature only); their conflicts surface when the merged `aiContext` reads the editor.
|
|
14
14
|
* `aiBlockData` contributions are additive too: they run in parallel per block and their data concatenate in feature order.
|
|
15
15
|
*/
|
|
16
16
|
function defineEditor(config) {
|
|
17
17
|
const features = Object.freeze([...config.features]);
|
|
18
18
|
const ids = /* @__PURE__ */ new Set();
|
|
19
|
+
for (const feature of features) if (!feature.dimension) fail(`feature "${feature.id}" declares no dimension`);
|
|
19
20
|
for (const feature of features) {
|
|
20
21
|
if (ids.has(feature.id)) fail(`duplicate feature id "${feature.id}"`);
|
|
21
22
|
ids.add(feature.id);
|
|
22
23
|
}
|
|
23
24
|
for (const feature of features) for (const required of feature.requires ?? []) if (!ids.has(required)) fail(`feature "${feature.id}" requires "${required}", which is not installed`);
|
|
25
|
+
const groups = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const feature of features) for (const group of feature.toolbarGroups ?? []) {
|
|
27
|
+
const owner = groups.get(group.id);
|
|
28
|
+
if (owner) fail(`features "${owner}" and "${feature.id}" both declare toolbar group "${group.id}"`);
|
|
29
|
+
groups.set(group.id, feature.id);
|
|
30
|
+
}
|
|
24
31
|
const owners = /* @__PURE__ */ new Map();
|
|
25
32
|
const claim = (hook, feature) => {
|
|
26
33
|
const owner = owners.get(hook);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-editor.js","names":[],"sources":["../../src/core/define-editor.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { EditorContext } from './context'\nimport { type AiBlock, type AiBlockDataProvider, type AiContext, type AiContextKind, type BlockPipeline, type ConversionProvider, type EditorFeature, type EditorPreset, type SettingsTab, SINGLETON_PIPELINE_HOOKS } from './feature'\nimport { DEFAULT_BLOCK_PIPELINE } from './pipeline'\n\nconst FEATURE_SINGLETONS = ['anchorResolver', 'formatAiResult'] as const satisfies readonly (keyof EditorFeature)[]\n\
|
|
1
|
+
{"version":3,"file":"define-editor.js","names":["failWith"],"sources":["../../src/core/define-editor.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { EditorContext } from './context'\nimport { type AiBlock, type AiBlockDataProvider, type AiContext, type AiContextKind, type BlockPipeline, type ConversionProvider, type EditorFeature, type EditorPreset, type SettingsTab, SINGLETON_PIPELINE_HOOKS } from './feature'\nimport { DEFAULT_BLOCK_PIPELINE } from './pipeline'\nimport { fail as failWith } from './util'\n\nconst FEATURE_SINGLETONS = ['anchorResolver', 'formatAiResult'] as const satisfies readonly (keyof EditorFeature)[]\n\nconst fail = (message: string): never => failWith(message, 'defineEditor')\n\n/**\n * Validates `features` and resolves their pipeline and conversion providers. Keeps the given order; neither\n * deduplicates nor installs missing dependencies. Throws on duplicate ids, a `requires` entry that is not installed,\n * a toolbar group declared by two features (`toolbarGroups`) and a singleton hook (`parseMarkdown`, `segment`, `structure`, `wrapImport`, `migrateContent`, `anchorResolver`,\n * `formatAiResult`) contributed twice. A command naming a toolbar group no feature declares needs the feature context\n * to build the commands: `toolbarOf` throws it. `normalize` hooks chain left to right. `aiContext` contributions merge (`kinds` and `blocks`\n * concatenated in feature order, `structure` from one feature only); their conflicts surface when the merged `aiContext` reads the editor.\n * `aiBlockData` contributions are additive too: they run in parallel per block and their data concatenate in feature order.\n */\nexport function defineEditor<C = unknown>(config: { features: readonly EditorFeature<C>[] }): EditorPreset<C> {\n const features = Object.freeze([...config.features])\n const ids = new Set<string>()\n for (const feature of features) {\n if (!feature.dimension) fail(`feature \"${feature.id}\" declares no dimension`)\n }\n for (const feature of features) {\n if (ids.has(feature.id)) fail(`duplicate feature id \"${feature.id}\"`)\n ids.add(feature.id)\n }\n for (const feature of features) {\n for (const required of feature.requires ?? []) {\n if (!ids.has(required)) fail(`feature \"${feature.id}\" requires \"${required}\", which is not installed`)\n }\n }\n const groups = new Map<string, string>()\n for (const feature of features) {\n for (const group of feature.toolbarGroups ?? []) {\n const owner = groups.get(group.id)\n if (owner) fail(`features \"${owner}\" and \"${feature.id}\" both declare toolbar group \"${group.id}\"`)\n groups.set(group.id, feature.id)\n }\n }\n\n const owners = new Map<string, string>()\n const claim = (hook: string, feature: EditorFeature<C>) => {\n const owner = owners.get(hook)\n if (owner) fail(`features \"${owner}\" and \"${feature.id}\" both contribute the singleton hook \"${hook}\"`)\n owners.set(hook, feature.id)\n }\n const pipeline: BlockPipeline = { ...DEFAULT_BLOCK_PIPELINE }\n const normalizers: BlockPipeline['normalize'][] = []\n for (const feature of features) {\n for (const hook of FEATURE_SINGLETONS) if (feature[hook]) claim(hook, feature)\n const blocks = feature.blocks\n if (!blocks) continue\n if (blocks.normalize) normalizers.push(blocks.normalize)\n for (const hook of SINGLETON_PIPELINE_HOOKS) {\n const fn = blocks[hook]\n if (!fn) continue\n claim(hook, feature)\n Object.assign(pipeline, { [hook]: fn })\n }\n }\n if (normalizers.length) pipeline.normalize = (editor, blocks) => normalizers.reduce((current, normalize) => normalize(editor, current), blocks)\n\n const conversions: ConversionProvider[] = features.flatMap(feature => [...(feature.conversions ?? [])])\n const contexts = features.flatMap(feature => feature.aiContext ? [{ id: feature.id, read: feature.aiContext }] : [])\n const aiContext = contexts.length\n ? (editor: Editor): AiContext => {\n const merged: { kinds: AiContextKind[], blocks: AiBlock[], structure?: AiContext['structure'], owner?: string } = { kinds: [], blocks: [] }\n const blockIds = new Set<string>()\n for (const { id, read } of contexts) {\n const context = read(editor)\n merged.kinds.push(...(context.kinds ?? []))\n for (const block of context.blocks ?? []) {\n if (blockIds.has(block.id)) fail(`the AI block \"${block.id}\" is described by more than one feature`)\n blockIds.add(block.id)\n merged.blocks.push(block)\n }\n if (context.structure === undefined) continue\n if (merged.owner) fail(`features \"${merged.owner}\" and \"${id}\" both set aiContext.structure`)\n merged.owner = id\n merged.structure = context.structure\n }\n return { kinds: merged.kinds, blocks: merged.blocks, ...(merged.structure && { structure: merged.structure }) }\n }\n : undefined\n const dataProviders = features.flatMap(feature => feature.aiBlockData ? [feature.aiBlockData] : [])\n const aiBlockData: AiBlockDataProvider | undefined = dataProviders.length\n ? async request => (await Promise.all(dataProviders.map(provide => provide(request)))).flat()\n : undefined\n const formatAiResult = features.find(feature => feature.formatAiResult)?.formatAiResult\n return Object.freeze({\n features,\n pipeline: Object.freeze(pipeline),\n conversions: Object.freeze(conversions),\n ...(aiContext && { aiContext }),\n ...(aiBlockData && { aiBlockData }),\n ...(formatAiResult && { formatAiResult }),\n })\n}\n\n/**\n * The settings tabs the features of `preset` contribute for the app context `ctx` (labels in its language), in feature\n * order; none means there is no settings UI. Throws when two features contribute the same tab id.\n */\nexport function settingsTabsOf<C = unknown>(preset: EditorPreset<C>, ctx: EditorContext): readonly SettingsTab<C>[] {\n const owners = new Map<string, string>()\n return preset.features.flatMap((feature) => {\n const tabs = feature.settingsTabs?.(ctx) ?? []\n for (const tab of tabs) {\n const owner = owners.get(tab.id)\n if (owner) fail(`features \"${owner}\" and \"${feature.id}\" both contribute the settings tab \"${tab.id}\"`)\n owners.set(tab.id, feature.id)\n }\n return tabs\n })\n}\n\n/** Features of `preset` that fill the contribution `key`, in order. */\nexport function contributions<C, K extends keyof EditorFeature<C>>(preset: EditorPreset<C>, key: K): NonNullable<EditorFeature<C>[K]>[] {\n return preset.features.flatMap(feature => feature[key] ? [feature[key] as NonNullable<EditorFeature<C>[K]>] : [])\n}\n"],"mappings":";;;;AAMA,MAAM,qBAAqB,CAAC,kBAAkB,gBAAgB;AAE9D,MAAM,QAAQ,YAA2BA,OAAS,SAAS,cAAc;;;;;;;;;;AAWzE,SAAgB,aAA0B,QAAoE;CAC5G,MAAM,WAAW,OAAO,OAAO,CAAC,GAAG,OAAO,QAAQ,CAAC;CACnD,MAAM,sBAAM,IAAI,IAAY;CAC5B,KAAK,MAAM,WAAW,UACpB,IAAI,CAAC,QAAQ,WAAW,KAAK,YAAY,QAAQ,GAAG,wBAAwB;CAE9E,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,IAAI,IAAI,QAAQ,EAAE,GAAG,KAAK,yBAAyB,QAAQ,GAAG,EAAE;EACpE,IAAI,IAAI,QAAQ,EAAE;CACpB;CACA,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,YAAY,QAAQ,YAAY,CAAC,GAC1C,IAAI,CAAC,IAAI,IAAI,QAAQ,GAAG,KAAK,YAAY,QAAQ,GAAG,cAAc,SAAS,0BAA0B;CAGzG,MAAM,yBAAS,IAAI,IAAoB;CACvC,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,SAAS,QAAQ,iBAAiB,CAAC,GAAG;EAC/C,MAAM,QAAQ,OAAO,IAAI,MAAM,EAAE;EACjC,IAAI,OAAO,KAAK,aAAa,MAAM,SAAS,QAAQ,GAAG,gCAAgC,MAAM,GAAG,EAAE;EAClG,OAAO,IAAI,MAAM,IAAI,QAAQ,EAAE;CACjC;CAGF,MAAM,yBAAS,IAAI,IAAoB;CACvC,MAAM,SAAS,MAAc,YAA8B;EACzD,MAAM,QAAQ,OAAO,IAAI,IAAI;EAC7B,IAAI,OAAO,KAAK,aAAa,MAAM,SAAS,QAAQ,GAAG,wCAAwC,KAAK,EAAE;EACtG,OAAO,IAAI,MAAM,QAAQ,EAAE;CAC7B;CACA,MAAM,WAA0B,EAAE,GAAG,uBAAuB;CAC5D,MAAM,cAA4C,CAAC;CACnD,KAAK,MAAM,WAAW,UAAU;EAC9B,KAAK,MAAM,QAAQ,oBAAoB,IAAI,QAAQ,OAAO,MAAM,MAAM,OAAO;EAC7E,MAAM,SAAS,QAAQ;EACvB,IAAI,CAAC,QAAQ;EACb,IAAI,OAAO,WAAW,YAAY,KAAK,OAAO,SAAS;EACvD,KAAK,MAAM,QAAQ,0BAA0B;GAC3C,MAAM,KAAK,OAAO;GAClB,IAAI,CAAC,IAAI;GACT,MAAM,MAAM,OAAO;GACnB,OAAO,OAAO,UAAU,GAAG,OAAO,GAAG,CAAC;EACxC;CACF;CACA,IAAI,YAAY,QAAQ,SAAS,aAAa,QAAQ,WAAW,YAAY,QAAQ,SAAS,cAAc,UAAU,QAAQ,OAAO,GAAG,MAAM;CAE9I,MAAM,cAAoC,SAAS,SAAQ,YAAW,CAAC,GAAI,QAAQ,eAAe,CAAC,CAAE,CAAC;CACtG,MAAM,WAAW,SAAS,SAAQ,YAAW,QAAQ,YAAY,CAAC;EAAE,IAAI,QAAQ;EAAI,MAAM,QAAQ;CAAU,CAAC,IAAI,CAAC,CAAC;CACnH,MAAM,YAAY,SAAS,UACtB,WAA8B;EAC7B,MAAM,SAA4G;GAAE,OAAO,CAAC;GAAG,QAAQ,CAAC;EAAE;EAC1I,MAAM,2BAAW,IAAI,IAAY;EACjC,KAAK,MAAM,EAAE,IAAI,UAAU,UAAU;GACnC,MAAM,UAAU,KAAK,MAAM;GAC3B,OAAO,MAAM,KAAK,GAAI,QAAQ,SAAS,CAAC,CAAE;GAC1C,KAAK,MAAM,SAAS,QAAQ,UAAU,CAAC,GAAG;IACxC,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,KAAK,iBAAiB,MAAM,GAAG,wCAAwC;IACnG,SAAS,IAAI,MAAM,EAAE;IACrB,OAAO,OAAO,KAAK,KAAK;GAC1B;GACA,IAAI,QAAQ,cAAc,KAAA,GAAW;GACrC,IAAI,OAAO,OAAO,KAAK,aAAa,OAAO,MAAM,SAAS,GAAG,+BAA+B;GAC5F,OAAO,QAAQ;GACf,OAAO,YAAY,QAAQ;EAC7B;EACA,OAAO;GAAE,OAAO,OAAO;GAAO,QAAQ,OAAO;GAAQ,GAAI,OAAO,aAAa,EAAE,WAAW,OAAO,UAAU;EAAG;CAChH,IACA,KAAA;CACJ,MAAM,gBAAgB,SAAS,SAAQ,YAAW,QAAQ,cAAc,CAAC,QAAQ,WAAW,IAAI,CAAC,CAAC;CAClG,MAAM,cAA+C,cAAc,SAC/D,OAAM,aAAY,MAAM,QAAQ,IAAI,cAAc,KAAI,YAAW,QAAQ,OAAO,CAAC,CAAC,EAAA,CAAG,KAAK,IAC1F,KAAA;CACJ,MAAM,iBAAiB,SAAS,MAAK,YAAW,QAAQ,cAAc,CAAC,EAAE;CACzE,OAAO,OAAO,OAAO;EACnB;EACA,UAAU,OAAO,OAAO,QAAQ;EAChC,aAAa,OAAO,OAAO,WAAW;EACtC,GAAI,aAAa,EAAE,UAAU;EAC7B,GAAI,eAAe,EAAE,YAAY;EACjC,GAAI,kBAAkB,EAAE,eAAe;CACzC,CAAC;AACH;;;;;AAMA,SAAgB,eAA4B,QAAyB,KAA+C;CAClH,MAAM,yBAAS,IAAI,IAAoB;CACvC,OAAO,OAAO,SAAS,SAAS,YAAY;EAC1C,MAAM,OAAO,QAAQ,eAAe,GAAG,KAAK,CAAC;EAC7C,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,QAAQ,OAAO,IAAI,IAAI,EAAE;GAC/B,IAAI,OAAO,KAAK,aAAa,MAAM,SAAS,QAAQ,GAAG,sCAAsC,IAAI,GAAG,EAAE;GACtG,OAAO,IAAI,IAAI,IAAI,QAAQ,EAAE;EAC/B;EACA,OAAO;CACT,CAAC;AACH;;AAGA,SAAgB,cAAmD,QAAyB,KAA4C;CACtI,OAAO,OAAO,SAAS,SAAQ,YAAW,QAAQ,OAAO,CAAC,QAAQ,IAAwC,IAAI,CAAC,CAAC;AAClH"}
|
|
@@ -19,11 +19,20 @@ function withoutMarks(json, invisible) {
|
|
|
19
19
|
*/
|
|
20
20
|
const DocumentMarkdown = Markdown.extend({ onBeforeCreate(event) {
|
|
21
21
|
this.parent?.(event);
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const extensions = this.editor.extensionManager.extensions;
|
|
23
|
+
const invisible = new Set(extensions.filter((extension) => extension.type === "mark" && getExtensionField(extension, "markdownInvisible")).map((extension) => extension.name));
|
|
24
|
+
const prepares = extensions.flatMap((extension) => {
|
|
25
|
+
const prepare = extension.type === "node" ? getExtensionField(extension, "markdownPrepare") : void 0;
|
|
26
|
+
return prepare ? [prepare] : [];
|
|
27
|
+
});
|
|
28
|
+
if (!invisible.size && !prepares.length) return;
|
|
24
29
|
const manager = this.storage.manager;
|
|
25
30
|
const serialize = manager.serialize.bind(manager);
|
|
26
|
-
manager.serialize = (json) =>
|
|
31
|
+
manager.serialize = (json) => {
|
|
32
|
+
if (!json) return serialize(json);
|
|
33
|
+
const prepared = prepares.reduce((current, prepare) => prepare(current, this.editor), json);
|
|
34
|
+
return serialize(invisible.size ? withoutMarks(prepared, invisible) : prepared);
|
|
35
|
+
};
|
|
27
36
|
} });
|
|
28
37
|
//#endregion
|
|
29
38
|
export { DocumentMarkdown };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-markdown.js","names":[],"sources":["../../src/core/document-markdown.ts"],"sourcesContent":["import { getExtensionField, type JSONContent } from '@tiptap/core'\nimport { Markdown } from '@tiptap/markdown'\nimport './schema/mark-flags'\n\n/** `json` without the marks named in `invisible` on any node; the runs they split become identically marked neighbours. */\nfunction withoutMarks(json: JSONContent, invisible: ReadonlySet<string>): JSONContent {\n return {\n ...json,\n ...(json.marks && { marks: json.marks.filter(mark => !invisible.has(mark.type)) }),\n ...(json.content && { content: json.content.map(child => withoutMarks(child, invisible)) }),\n }\n}\n\n/**\n * `@tiptap/markdown`'s `Markdown` whose serializer ignores every mark that declares `markdownInvisible` (author and\n * comment marks): `editor.getMarkdown()` and every `editor.markdown.serialize()` (AI context and selection, chat\n * blocks, summaries, transcript cleanup) render as if those marks did not exist. `@tiptap/markdown` already renders\n * marks without a handler as nothing, but they still split text runs, and its mark-boundary logic then closes and\n * reopens the formatting around the split (`Ein **Sa**<strong>btz</strong>` for one bold word with another author's\n * letter inside). The document keeps the marks. Use it instead of `Markdown` in every editor of a preset.\n */\nexport const DocumentMarkdown = Markdown.extend({\n onBeforeCreate(event) {\n this.parent?.(event)\n const invisible = new Set(\n
|
|
1
|
+
{"version":3,"file":"document-markdown.js","names":[],"sources":["../../src/core/document-markdown.ts"],"sourcesContent":["import { getExtensionField, type JSONContent, type NodeConfig } from '@tiptap/core'\nimport { Markdown } from '@tiptap/markdown'\nimport './schema/mark-flags'\n\n/** `json` without the marks named in `invisible` on any node; the runs they split become identically marked neighbours. */\nfunction withoutMarks(json: JSONContent, invisible: ReadonlySet<string>): JSONContent {\n return {\n ...json,\n ...(json.marks && { marks: json.marks.filter(mark => !invisible.has(mark.type)) }),\n ...(json.content && { content: json.content.map(child => withoutMarks(child, invisible)) }),\n }\n}\n\n/**\n * `@tiptap/markdown`'s `Markdown` whose serializer ignores every mark that declares `markdownInvisible` (author and\n * comment marks): `editor.getMarkdown()` and every `editor.markdown.serialize()` (AI context and selection, chat\n * blocks, summaries, transcript cleanup) render as if those marks did not exist. `@tiptap/markdown` already renders\n * marks without a handler as nothing, but they still split text runs, and its mark-boundary logic then closes and\n * reopens the formatting around the split (`Ein **Sa**<strong>btz</strong>` for one bold word with another author's\n * letter inside). The document keeps the marks. Use it instead of `Markdown` in every editor of a preset.\n */\nexport const DocumentMarkdown = Markdown.extend({\n onBeforeCreate(event) {\n this.parent?.(event)\n const extensions = this.editor.extensionManager.extensions\n const invisible = new Set(\n extensions\n .filter(extension => extension.type === 'mark' && getExtensionField<boolean | undefined>(extension, 'markdownInvisible'))\n .map(extension => extension.name),\n )\n const prepares = extensions.flatMap((extension) => {\n const prepare = extension.type === 'node' ? getExtensionField<NodeConfig['markdownPrepare']>(extension, 'markdownPrepare') : undefined\n return prepare ? [prepare] : []\n })\n if (!invisible.size && !prepares.length) return\n // `getMarkdown()` serializes through the same manager instance as `editor.markdown`.\n const manager = this.storage.manager\n const serialize = manager.serialize.bind(manager)\n manager.serialize = (json) => {\n if (!json) return serialize(json)\n const prepared = prepares.reduce((current, prepare) => prepare(current, this.editor), json)\n return serialize(invisible.size ? withoutMarks(prepared, invisible) : prepared)\n }\n },\n})\n"],"mappings":";;;;AAKA,SAAS,aAAa,MAAmB,WAA6C;CACpF,OAAO;EACL,GAAG;EACH,GAAI,KAAK,SAAS,EAAE,OAAO,KAAK,MAAM,QAAO,SAAQ,CAAC,UAAU,IAAI,KAAK,IAAI,CAAC,EAAE;EAChF,GAAI,KAAK,WAAW,EAAE,SAAS,KAAK,QAAQ,KAAI,UAAS,aAAa,OAAO,SAAS,CAAC,EAAE;CAC3F;AACF;;;;;;;;;AAUA,MAAa,mBAAmB,SAAS,OAAO,EAC9C,eAAe,OAAO;CACpB,KAAK,SAAS,KAAK;CACnB,MAAM,aAAa,KAAK,OAAO,iBAAiB;CAChD,MAAM,YAAY,IAAI,IACpB,WACG,QAAO,cAAa,UAAU,SAAS,UAAU,kBAAuC,WAAW,mBAAmB,CAAC,CAAC,CACxH,KAAI,cAAa,UAAU,IAAI,CACpC;CACA,MAAM,WAAW,WAAW,SAAS,cAAc;EACjD,MAAM,UAAU,UAAU,SAAS,SAAS,kBAAiD,WAAW,iBAAiB,IAAI,KAAA;EAC7H,OAAO,UAAU,CAAC,OAAO,IAAI,CAAC;CAChC,CAAC;CACD,IAAI,CAAC,UAAU,QAAQ,CAAC,SAAS,QAAQ;CAEzC,MAAM,UAAU,KAAK,QAAQ;CAC7B,MAAM,YAAY,QAAQ,UAAU,KAAK,OAAO;CAChD,QAAQ,aAAa,SAAS;EAC5B,IAAI,CAAC,MAAM,OAAO,UAAU,IAAI;EAChC,MAAM,WAAW,SAAS,QAAQ,SAAS,YAAY,QAAQ,SAAS,KAAK,MAAM,GAAG,IAAI;EAC1F,OAAO,UAAU,UAAU,OAAO,aAAa,UAAU,SAAS,IAAI,QAAQ;CAChF;AACF,EACF,CAAC"}
|
package/dist/core/editor-ui.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BlockAction } from "./extension-points.js";
|
|
2
1
|
import { Notifier } from "./notify.js";
|
|
3
2
|
import { EditorContext } from "./context.js";
|
|
3
|
+
import { BlockAction } from "./extension-points.js";
|
|
4
4
|
import { EditorPreset, FeatureContext } from "./feature.js";
|
|
5
5
|
import { Editor } from "@tiptap/core";
|
|
6
6
|
//#region src/core/editor-ui.d.ts
|
|
@@ -17,6 +17,13 @@ export interface EditorUi {
|
|
|
17
17
|
toggleComments: () => void;
|
|
18
18
|
/** Whether the comments margin is open (read-only; for toggles' active state). */
|
|
19
19
|
readonly commentsOpen: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Opens or closes the editor's ⌘K command palette (the surface's own state; the `core-ui` feature binds Mod-k to it
|
|
22
|
+
* when it was given a palette component).
|
|
23
|
+
*/
|
|
24
|
+
togglePalette: () => void;
|
|
25
|
+
/** Whether the command palette is open (read-only). */
|
|
26
|
+
readonly paletteOpen: boolean;
|
|
20
27
|
}
|
|
21
28
|
/** What a mounted surface registers for its editor instance: the components beside it read it by `editor`. */
|
|
22
29
|
export interface EditorEntry {
|
package/dist/core/editor-ui.js
CHANGED
|
@@ -35,10 +35,10 @@ function notifierOf(editor, app) {
|
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* The `FeatureContext` a component placed beside an editor (the toolbar) hands feature factories. App-level members
|
|
38
|
-
* (`app`, `locale`, `t`, `settings`, `
|
|
39
|
-
* `
|
|
38
|
+
* (`app`, `locale`, `t`, `settings`, `backend`, `ai`) come from the app context; everything per-surface (`metadata`, `ui`, `documentId`,
|
|
39
|
+
* `collaboration`, `anchorResolver`, `abilities`, `commands`) is read from the entry registered for
|
|
40
40
|
* `getEditor()` each time it is used, so the context follows the editor while it changes and falls back to inert values
|
|
41
|
-
* (an empty metadata registry, no-op chrome, `commentsOpen: false`) while there is none. `notify` is `notifierOf`.
|
|
41
|
+
* (an empty metadata registry, no-op chrome, `commentsOpen: false`, `paletteOpen: false`) while there is none. `notify` is `notifierOf`.
|
|
42
42
|
*/
|
|
43
43
|
function borrowedFeatureContext(options) {
|
|
44
44
|
const { app, getEditor } = options;
|
|
@@ -56,7 +56,7 @@ function borrowedFeatureContext(options) {
|
|
|
56
56
|
t: app.t,
|
|
57
57
|
settings: options.settings ?? app.settings,
|
|
58
58
|
notify: notifierOf(rawEditor, app),
|
|
59
|
-
|
|
59
|
+
backend: app.backend,
|
|
60
60
|
ai: app.ai,
|
|
61
61
|
get metadata() {
|
|
62
62
|
return entry()?.ctx.metadata ?? fallbackMetadata;
|
|
@@ -67,14 +67,15 @@ function borrowedFeatureContext(options) {
|
|
|
67
67
|
toggleComments: () => ui()?.toggleComments(),
|
|
68
68
|
get commentsOpen() {
|
|
69
69
|
return ui()?.commentsOpen ?? false;
|
|
70
|
+
},
|
|
71
|
+
togglePalette: () => ui()?.togglePalette(),
|
|
72
|
+
get paletteOpen() {
|
|
73
|
+
return ui()?.paletteOpen ?? false;
|
|
70
74
|
}
|
|
71
75
|
},
|
|
72
76
|
get documentId() {
|
|
73
77
|
return entry()?.ctx.documentId;
|
|
74
78
|
},
|
|
75
|
-
get upload() {
|
|
76
|
-
return entry()?.ctx.upload;
|
|
77
|
-
},
|
|
78
79
|
get collaboration() {
|
|
79
80
|
return entry()?.ctx.collaboration;
|
|
80
81
|
},
|
|
@@ -84,7 +85,7 @@ function borrowedFeatureContext(options) {
|
|
|
84
85
|
get abilities() {
|
|
85
86
|
return entry()?.ctx.abilities ?? {};
|
|
86
87
|
},
|
|
87
|
-
|
|
88
|
+
commands: () => entry()?.ctx.commands() ?? [],
|
|
88
89
|
getEditor
|
|
89
90
|
};
|
|
90
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-ui.js","names":[],"sources":["../../src/core/editor-ui.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { EditorContext } from './context'\nimport type { EditorPreset, FeatureContext } from './feature'\nimport type { BlockAction } from './extension-points'\nimport { createMetadataRegistry } from './metadata'\nimport type { Notifier } from './notify'\n\n/** Editor chrome an `EditorSurface` owns, for the components around it. Settings tabs are the ids features contribute. */\nexport interface EditorUi {\n /** Opens the settings UI, on `tab` when given (else on the tab shown last). */\n openSettings: (tab?: string) => void\n /** Opens or closes the editor's AI sidebar (the surface's `sidebarOpen` model, which the host binds). */\n toggleSidebar: () => void\n /**\n * Opens or closes the editor's comments margin (the surface's `commentsOpen` model, which the host binds). Opening it\n * closes the AI sidebar and vice versa.\n */\n toggleComments: () => void\n /** Whether the comments margin is open (read-only; for toggles' active state). */\n readonly commentsOpen: boolean\n}\n\n/** What a mounted surface registers for its editor instance: the components beside it read it by `editor`. */\nexport interface EditorEntry {\n ui: EditorUi\n preset: EditorPreset\n ctx: FeatureContext\n /** Features' block actions followed by the host's, for the overlay that renders them. */\n blockActions: readonly BlockAction[]\n}\n\n/** Each mounted surface's entry by its Tiptap editor (raw, unproxied instance), for components outside its subtree. */\nconst entries = new WeakMap<Editor, EditorEntry>()\n\n/**\n * Makes `entry` reachable through `editorEntryOf(editor)` (and the framework layers' `useEditorUi(editor)`); returns the\n * unregister function. The surface registers once its editor exists (before emitting `ready`) and unregisters on unmount.\n * Pass the raw editor: framework proxies (e.g. Vue reactive wrappers) are different WeakMap keys.\n */\nexport function registerEditor(editor: Editor, entry: EditorEntry): () => void {\n entries.set(editor, entry)\n return () => {\n if (entries.get(editor) === entry) entries.delete(editor)\n }\n}\n\n/** The surface entry registered for `editor` (the raw instance); undefined for an unregistered or missing editor. */\nexport function editorEntryOf(editor: Editor | undefined): EditorEntry | undefined {\n return editor ? entries.get(editor) : undefined\n}\n\n/**\n * The one notifier policy: a notice goes to the surface notifier of `editor` (`createEditor`/`EditorSurface` of the\n * host) while it has one, else to the app context's. Both are resolved when a notice is shown (also `dismiss`), so a\n * request that finishes after an await still reaches the current surface. Pass `editor` (the raw instance) and `app` as\n * getters when they change over the notifier's life.\n */\nexport function notifierOf(editor: Editor | undefined | (() => Editor | undefined), app: Pick<EditorContext, 'notify'> | (() => Pick<EditorContext, 'notify'>)): Notifier {\n const resolve = (): Notifier => {\n const instance = typeof editor === 'function' ? editor() : editor\n return editorEntryOf(instance)?.ctx.notify ?? (typeof app === 'function' ? app() : app).notify\n }\n const notify: Notifier = notice => resolve()(notice)\n notify.dismiss = (id) => { resolve().dismiss?.(id) }\n return notify\n}\n\nexport interface BorrowedFeatureContextOptions {\n app: EditorContext\n /** The editor the borrowing component works on, as its framework layer holds it; `undefined` while there is none. */\n getEditor: () => Editor | undefined\n /** Maps the held editor to the raw instance surfaces register (default: identity). Vue passes `toRaw`. */\n unwrap?: (editor: Editor) => Editor\n /** The `settings` the context exposes (default: the app's); a framework layer may wrap it so rendering tracks changes. */\n settings?: FeatureContext['settings']\n}\n\n/**\n * The `FeatureContext` a component placed beside an editor (the toolbar) hands feature factories. App-level members\n * (`app`, `locale`, `t`, `settings`, `
|
|
1
|
+
{"version":3,"file":"editor-ui.js","names":[],"sources":["../../src/core/editor-ui.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { EditorContext } from './context'\nimport type { EditorPreset, FeatureContext } from './feature'\nimport type { BlockAction } from './extension-points'\nimport { createMetadataRegistry } from './metadata'\nimport type { Notifier } from './notify'\n\n/** Editor chrome an `EditorSurface` owns, for the components around it. Settings tabs are the ids features contribute. */\nexport interface EditorUi {\n /** Opens the settings UI, on `tab` when given (else on the tab shown last). */\n openSettings: (tab?: string) => void\n /** Opens or closes the editor's AI sidebar (the surface's `sidebarOpen` model, which the host binds). */\n toggleSidebar: () => void\n /**\n * Opens or closes the editor's comments margin (the surface's `commentsOpen` model, which the host binds). Opening it\n * closes the AI sidebar and vice versa.\n */\n toggleComments: () => void\n /** Whether the comments margin is open (read-only; for toggles' active state). */\n readonly commentsOpen: boolean\n /**\n * Opens or closes the editor's ⌘K command palette (the surface's own state; the `core-ui` feature binds Mod-k to it\n * when it was given a palette component).\n */\n togglePalette: () => void\n /** Whether the command palette is open (read-only). */\n readonly paletteOpen: boolean\n}\n\n/** What a mounted surface registers for its editor instance: the components beside it read it by `editor`. */\nexport interface EditorEntry {\n ui: EditorUi\n preset: EditorPreset\n ctx: FeatureContext\n /** Features' block actions followed by the host's, for the overlay that renders them. */\n blockActions: readonly BlockAction[]\n}\n\n/** Each mounted surface's entry by its Tiptap editor (raw, unproxied instance), for components outside its subtree. */\nconst entries = new WeakMap<Editor, EditorEntry>()\n\n/**\n * Makes `entry` reachable through `editorEntryOf(editor)` (and the framework layers' `useEditorUi(editor)`); returns the\n * unregister function. The surface registers once its editor exists (before emitting `ready`) and unregisters on unmount.\n * Pass the raw editor: framework proxies (e.g. Vue reactive wrappers) are different WeakMap keys.\n */\nexport function registerEditor(editor: Editor, entry: EditorEntry): () => void {\n entries.set(editor, entry)\n return () => {\n if (entries.get(editor) === entry) entries.delete(editor)\n }\n}\n\n/** The surface entry registered for `editor` (the raw instance); undefined for an unregistered or missing editor. */\nexport function editorEntryOf(editor: Editor | undefined): EditorEntry | undefined {\n return editor ? entries.get(editor) : undefined\n}\n\n/**\n * The one notifier policy: a notice goes to the surface notifier of `editor` (`createEditor`/`EditorSurface` of the\n * host) while it has one, else to the app context's. Both are resolved when a notice is shown (also `dismiss`), so a\n * request that finishes after an await still reaches the current surface. Pass `editor` (the raw instance) and `app` as\n * getters when they change over the notifier's life.\n */\nexport function notifierOf(editor: Editor | undefined | (() => Editor | undefined), app: Pick<EditorContext, 'notify'> | (() => Pick<EditorContext, 'notify'>)): Notifier {\n const resolve = (): Notifier => {\n const instance = typeof editor === 'function' ? editor() : editor\n return editorEntryOf(instance)?.ctx.notify ?? (typeof app === 'function' ? app() : app).notify\n }\n const notify: Notifier = notice => resolve()(notice)\n notify.dismiss = (id) => { resolve().dismiss?.(id) }\n return notify\n}\n\nexport interface BorrowedFeatureContextOptions {\n app: EditorContext\n /** The editor the borrowing component works on, as its framework layer holds it; `undefined` while there is none. */\n getEditor: () => Editor | undefined\n /** Maps the held editor to the raw instance surfaces register (default: identity). Vue passes `toRaw`. */\n unwrap?: (editor: Editor) => Editor\n /** The `settings` the context exposes (default: the app's); a framework layer may wrap it so rendering tracks changes. */\n settings?: FeatureContext['settings']\n}\n\n/**\n * The `FeatureContext` a component placed beside an editor (the toolbar) hands feature factories. App-level members\n * (`app`, `locale`, `t`, `settings`, `backend`, `ai`) come from the app context; everything per-surface (`metadata`, `ui`, `documentId`,\n * `collaboration`, `anchorResolver`, `abilities`, `commands`) is read from the entry registered for\n * `getEditor()` each time it is used, so the context follows the editor while it changes and falls back to inert values\n * (an empty metadata registry, no-op chrome, `commentsOpen: false`, `paletteOpen: false`) while there is none. `notify` is `notifierOf`.\n */\nexport function borrowedFeatureContext(options: BorrowedFeatureContextOptions): FeatureContext {\n const { app, getEditor } = options\n const unwrap = options.unwrap ?? (editor => editor)\n const rawEditor = () => {\n const editor = getEditor()\n return editor && unwrap(editor)\n }\n const fallbackMetadata = createMetadataRegistry()\n const entry = () => editorEntryOf(rawEditor())\n const ui = () => entry()?.ui\n return {\n app,\n locale: app.locale,\n t: app.t,\n settings: options.settings ?? app.settings,\n notify: notifierOf(rawEditor, app),\n backend: app.backend,\n ai: app.ai,\n get metadata() { return entry()?.ctx.metadata ?? fallbackMetadata },\n ui: {\n openSettings: tab => ui()?.openSettings(tab),\n toggleSidebar: () => ui()?.toggleSidebar(),\n toggleComments: () => ui()?.toggleComments(),\n get commentsOpen() { return ui()?.commentsOpen ?? false },\n togglePalette: () => ui()?.togglePalette(),\n get paletteOpen() { return ui()?.paletteOpen ?? false },\n },\n get documentId() { return entry()?.ctx.documentId },\n get collaboration() { return entry()?.ctx.collaboration },\n get anchorResolver() { return entry()?.ctx.anchorResolver ?? null },\n get abilities() { return entry()?.ctx.abilities ?? {} },\n commands: () => entry()?.ctx.commands() ?? [],\n getEditor,\n }\n}\n"],"mappings":";;;AAuCA,MAAM,0BAAU,IAAI,QAA6B;;;;;;AAOjD,SAAgB,eAAe,QAAgB,OAAgC;CAC7E,QAAQ,IAAI,QAAQ,KAAK;CACzB,aAAa;EACX,IAAI,QAAQ,IAAI,MAAM,MAAM,OAAO,QAAQ,OAAO,MAAM;CAC1D;AACF;;AAGA,SAAgB,cAAc,QAAqD;CACjF,OAAO,SAAS,QAAQ,IAAI,MAAM,IAAI,KAAA;AACxC;;;;;;;AAQA,SAAgB,WAAW,QAAyD,KAAsF;CACxK,MAAM,gBAA0B;EAE9B,OAAO,cADU,OAAO,WAAW,aAAa,OAAO,IAAI,MAC9B,CAAC,EAAE,IAAI,WAAW,OAAO,QAAQ,aAAa,IAAI,IAAI,IAAA,CAAK;CAC1F;CACA,MAAM,UAAmB,WAAU,QAAQ,CAAC,CAAC,MAAM;CACnD,OAAO,WAAW,OAAO;EAAE,QAAQ,CAAC,CAAC,UAAU,EAAE;CAAE;CACnD,OAAO;AACT;;;;;;;;AAmBA,SAAgB,uBAAuB,SAAwD;CAC7F,MAAM,EAAE,KAAK,cAAc;CAC3B,MAAM,SAAS,QAAQ,YAAW,WAAU;CAC5C,MAAM,kBAAkB;EACtB,MAAM,SAAS,UAAU;EACzB,OAAO,UAAU,OAAO,MAAM;CAChC;CACA,MAAM,mBAAmB,uBAAuB;CAChD,MAAM,cAAc,cAAc,UAAU,CAAC;CAC7C,MAAM,WAAW,MAAM,CAAC,EAAE;CAC1B,OAAO;EACL;EACA,QAAQ,IAAI;EACZ,GAAG,IAAI;EACP,UAAU,QAAQ,YAAY,IAAI;EAClC,QAAQ,WAAW,WAAW,GAAG;EACjC,SAAS,IAAI;EACb,IAAI,IAAI;EACR,IAAI,WAAW;GAAE,OAAO,MAAM,CAAC,EAAE,IAAI,YAAY;EAAiB;EAClE,IAAI;GACF,eAAc,QAAO,GAAG,CAAC,EAAE,aAAa,GAAG;GAC3C,qBAAqB,GAAG,CAAC,EAAE,cAAc;GACzC,sBAAsB,GAAG,CAAC,EAAE,eAAe;GAC3C,IAAI,eAAe;IAAE,OAAO,GAAG,CAAC,EAAE,gBAAgB;GAAM;GACxD,qBAAqB,GAAG,CAAC,EAAE,cAAc;GACzC,IAAI,cAAc;IAAE,OAAO,GAAG,CAAC,EAAE,eAAe;GAAM;EACxD;EACA,IAAI,aAAa;GAAE,OAAO,MAAM,CAAC,EAAE,IAAI;EAAW;EAClD,IAAI,gBAAgB;GAAE,OAAO,MAAM,CAAC,EAAE,IAAI;EAAc;EACxD,IAAI,iBAAiB;GAAE,OAAO,MAAM,CAAC,EAAE,IAAI,kBAAkB;EAAK;EAClE,IAAI,YAAY;GAAE,OAAO,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC;EAAE;EACtD,gBAAgB,MAAM,CAAC,EAAE,IAAI,SAAS,KAAK,CAAC;EAC5C;CACF;AACF"}
|