@ecsplico/editor 3.5.1 → 4.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 +71 -0
- package/dist/adapters/direct-ai.d.ts +4 -4
- package/dist/adapters/direct-ai.js +2 -2
- package/dist/adapters/direct-ai.js.map +1 -1
- package/dist/adapters/document-state.d.ts +1 -1
- package/dist/adapters/document-state.js.map +1 -1
- package/dist/adapters/forge.d.ts +2 -2
- package/dist/adapters/forge.js.map +1 -1
- package/dist/adapters/nitro.d.ts +11 -3
- package/dist/adapters/nitro.js +3 -1
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +6 -6
- package/dist/adapters/shared.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +3 -3
- package/dist/config/index.d.ts +14 -14
- package/dist/config/index.js +8 -8
- package/dist/config/index.js.map +1 -1
- package/dist/core/backend-types.d.ts +3 -3
- package/dist/core/backend-types.js.map +1 -1
- package/dist/core/backend.d.ts +4 -4
- package/dist/core/backend.js.map +1 -1
- package/dist/core/block-convert.d.ts +1 -1
- package/dist/core/block-convert.js +5 -5
- package/dist/core/block-convert.js.map +1 -1
- package/dist/core/block-transfer.d.ts +8 -4
- package/dist/core/block-transfer.js +23 -14
- package/dist/core/block-transfer.js.map +1 -1
- package/dist/core/capabilities.d.ts +113 -0
- package/dist/core/capabilities.js +155 -0
- package/dist/core/capabilities.js.map +1 -0
- package/dist/core/command-types.d.ts +1 -1
- package/dist/core/context.js.map +1 -1
- package/dist/core/convert.d.ts +5 -5
- package/dist/core/convert.js +5 -5
- package/dist/core/convert.js.map +1 -1
- package/dist/core/core-feature.js +1 -1
- package/dist/core/define-editor.d.ts +2 -2
- package/dist/core/define-editor.js +34 -6
- package/dist/core/define-editor.js.map +1 -1
- package/dist/core/derivation.d.ts +119 -0
- package/dist/core/derivation.js +187 -0
- package/dist/core/derivation.js.map +1 -0
- package/dist/core/derive.d.ts +61 -0
- package/dist/core/derive.js +69 -0
- package/dist/core/derive.js.map +1 -0
- package/dist/core/extension-points.d.ts +16 -0
- package/dist/core/feature-context.d.ts +5 -1
- package/dist/core/feature-context.js +10 -3
- package/dist/core/feature-context.js.map +1 -1
- package/dist/core/feature.d.ts +41 -19
- package/dist/core/feature.js.map +1 -1
- package/dist/core/fences.js +1 -1
- package/dist/core/fences.js.map +1 -1
- package/dist/core/index.d.ts +6 -2
- package/dist/core/index.js +5 -1
- package/dist/core/pipeline.d.ts +14 -5
- package/dist/core/pipeline.js +19 -7
- package/dist/core/pipeline.js.map +1 -1
- package/dist/core/properties.d.ts +22 -0
- package/dist/core/properties.js +17 -0
- package/dist/core/properties.js.map +1 -0
- package/dist/core/schema/block-ids.js +5 -5
- package/dist/core/schema/block-ids.js.map +1 -1
- package/dist/core/schema/index.d.ts +2 -1
- package/dist/core/schema/index.js +2 -1
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/schema/opaque-fence.d.ts +4 -4
- package/dist/core/schema/opaque-fence.js +7 -7
- package/dist/core/schema/opaque-fence.js.map +1 -1
- package/dist/core/schema/persisted-names.d.ts +58 -0
- package/dist/core/schema/persisted-names.js +96 -0
- package/dist/core/schema/persisted-names.js.map +1 -0
- package/dist/core/toolbar-items.js +1 -1
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/core/util.js +5 -1
- package/dist/core/util.js.map +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +3 -3
- package/dist/features/ai/agent-ops.js +1 -1
- package/dist/features/ai/ai-review.js +1 -1
- package/dist/features/ai/assistant.d.ts +4 -4
- package/dist/features/ai/assistant.js +1 -1
- package/dist/features/ai/assistant.js.map +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js.map +1 -1
- package/dist/features/ai/components/ModelQuickSwitch.js +7 -7
- package/dist/features/ai/components/ModelQuickSwitch.js.map +1 -1
- package/dist/features/ai/components/ModelQuickSwitch.vue.d.ts +4 -4
- package/dist/features/ai/components/SettingsAiTab.js +8 -8
- package/dist/features/ai/components/SettingsAiTab.js.map +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/document-chat-model.d.ts +2 -2
- 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 +2 -2
- package/dist/features/ai/document-chat.js.map +1 -1
- package/dist/features/ai/feature.d.ts +2 -2
- package/dist/features/ai/feature.js +2 -2
- package/dist/features/ai/feature.js.map +1 -1
- package/dist/features/ai/ghost-autocomplete.d.ts +4 -4
- package/dist/features/ai/ghost-autocomplete.js +1 -1
- package/dist/features/ai/ghost-autocomplete.js.map +1 -1
- package/dist/features/ai/index.d.ts +3 -3
- package/dist/features/ai/index.js +2 -2
- package/dist/features/ai/model-profiles.d.ts +9 -9
- package/dist/features/ai/model-profiles.js +13 -13
- package/dist/features/ai/model-profiles.js.map +1 -1
- package/dist/features/ai/protocol/agent-ops.d.ts +2 -2
- package/dist/features/ai/protocol/agent-ops.js +1 -1
- package/dist/features/ai/protocol/agent-ops.js.map +1 -1
- package/dist/features/ai/protocol/block-lines.d.ts +7 -7
- package/dist/features/ai/protocol/block-lines.js +10 -10
- package/dist/features/ai/protocol/block-lines.js.map +1 -1
- package/dist/features/ai/protocol/chat.d.ts +5 -5
- package/dist/features/ai/protocol/chat.js +12 -12
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/generate.d.ts +1 -1
- package/dist/features/ai/protocol/generate.js +1 -1
- package/dist/features/ai/protocol/generate.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +3 -3
- package/dist/features/ai/protocol/index.js +2 -2
- package/dist/features/ai/protocol/models.d.ts +3 -3
- package/dist/features/ai/protocol/models.js +3 -3
- package/dist/features/ai/protocol/models.js.map +1 -1
- package/dist/features/ai/protocol/schemas.d.ts +1 -1
- package/dist/features/ai/protocol/schemas.js +1 -1
- package/dist/features/ai/protocol/schemas.js.map +1 -1
- package/dist/features/ai/protocol/tasks.d.ts +5 -5
- package/dist/features/ai/protocol/tasks.js +12 -12
- package/dist/features/ai/protocol/tasks.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js.map +1 -1
- package/dist/features/ai/react/ModelQuickSwitch.d.ts +4 -4
- package/dist/features/ai/react/ModelQuickSwitch.js +6 -6
- package/dist/features/ai/react/ModelQuickSwitch.js.map +1 -1
- package/dist/features/ai/react/SettingsAiTab.d.ts +1 -1
- package/dist/features/ai/react/SettingsAiTab.js +8 -8
- package/dist/features/ai/react/SettingsAiTab.js.map +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.d.ts +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +1 -1
- 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 +1 -1
- package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/react/use-model-profiles.d.ts +5 -5
- package/dist/features/ai/react/use-model-profiles.js +2 -2
- package/dist/features/ai/react/use-model-profiles.js.map +1 -1
- package/dist/features/ai/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/use-ai-assistant.js +1 -1
- package/dist/features/ai/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/use-model-profiles.d.ts +4 -4
- package/dist/features/ai/use-model-profiles.js +2 -2
- package/dist/features/ai/use-model-profiles.js.map +1 -1
- package/dist/features/block-ui/block-actions.d.ts +8 -4
- package/dist/features/block-ui/block-actions.js +38 -22
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/block-target.d.ts +29 -0
- package/dist/features/block-ui/block-target.js +63 -0
- package/dist/features/block-ui/block-target.js.map +1 -0
- package/dist/features/block-ui/components/BlockHandles.js +3 -3
- package/dist/features/block-ui/components/BlockHandles.js.map +1 -1
- package/dist/features/block-ui/components/BlockUi.js +11 -23
- package/dist/features/block-ui/components/BlockUi.js.map +1 -1
- package/dist/features/block-ui/feature.d.ts +3 -2
- package/dist/features/block-ui/feature.js +3 -2
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/handle-geometry.js +12 -23
- package/dist/features/block-ui/handle-geometry.js.map +1 -1
- package/dist/features/block-ui/index.d.ts +2 -1
- package/dist/features/block-ui/index.js +2 -1
- package/dist/features/block-ui/react/BlockHandles.d.ts +1 -1
- package/dist/features/block-ui/react/BlockHandles.js +4 -4
- package/dist/features/block-ui/react/BlockHandles.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +13 -25
- package/dist/features/block-ui/react/BlockUi.js.map +1 -1
- package/dist/features/comments/model.js +1 -1
- package/dist/features/composites/accepted-children.d.ts +5 -4
- package/dist/features/composites/accepted-children.js +26 -26
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.d.ts +4 -4
- package/dist/features/composites/ai-brief.js +14 -12
- package/dist/features/composites/ai-brief.js.map +1 -1
- package/dist/features/composites/anchors.d.ts +1 -1
- package/dist/features/composites/anchors.js.map +1 -1
- package/dist/features/composites/baskets.d.ts +1 -1
- package/dist/features/composites/baskets.js.map +1 -1
- package/dist/features/composites/bibliography-command.d.ts +1 -1
- package/dist/features/composites/bibliography-form.js +1 -1
- package/dist/features/composites/bibliography-form.js.map +1 -1
- package/dist/features/composites/bibliography.js.map +1 -1
- package/dist/features/composites/block-types-json.d.ts +38 -0
- package/dist/features/composites/block-types-json.js +122 -0
- package/dist/features/composites/block-types-json.js.map +1 -0
- package/dist/features/composites/block-types.d.ts +119 -0
- package/dist/features/composites/block-types.js +343 -0
- package/dist/features/composites/block-types.js.map +1 -0
- package/dist/features/composites/capabilities.js +109 -0
- package/dist/features/composites/capabilities.js.map +1 -0
- package/dist/features/composites/components/BibliographyEditor.js +5 -5
- package/dist/features/composites/components/BibliographyEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeBasketMenu.js +2 -2
- package/dist/features/composites/components/CompositeBasketMenu.js.map +1 -1
- package/dist/features/composites/components/CompositeChrome.js +18 -8
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeChrome.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeDetails.js +11 -10
- package/dist/features/composites/components/CompositeDetails.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeFieldEditor.js +7 -7
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeFieldEditor.vue.d.ts +5 -5
- package/dist/features/composites/components/CompositeInspector.js +136 -113
- package/dist/features/composites/components/CompositeInspector.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.vue.d.ts +3 -3
- package/dist/features/composites/components/CompositeStatusMenu.js +2 -2
- package/dist/features/composites/components/CompositeStatusMenu.js.map +1 -1
- package/dist/features/composites/components/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/components/CompositeSummaryEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeSummaryEditor.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeTable.js +2 -2
- package/dist/features/composites/components/CompositeTable.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeView.js +19 -17
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +15 -6
- package/dist/features/composites/components/DerivationBadge.js.map +1 -1
- package/dist/features/composites/components/FocusChip.js +1 -1
- package/dist/features/composites/components/FocusChip.js.map +1 -1
- package/dist/features/composites/components/FocusChip.vue.d.ts +1 -1
- package/dist/features/composites/components/ReferenceFieldSelect.js +3 -3
- package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -1
- package/dist/features/composites/components/ReferenceView.js +1 -1
- package/dist/features/composites/components/ReferenceView.js.map +1 -1
- package/dist/features/composites/components/SettingsEditingTab.js +18 -18
- package/dist/features/composites/components/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/components/SettingsEditingTab.vue.d.ts +3 -3
- package/dist/features/composites/convert.d.ts +4 -4
- package/dist/features/composites/convert.js +27 -28
- package/dist/features/composites/convert.js.map +1 -1
- package/dist/features/composites/derived-chrome.js +34 -28
- package/dist/features/composites/derived-chrome.js.map +1 -1
- package/dist/features/composites/editing-settings-keys.js +6 -6
- package/dist/features/composites/editing-settings-keys.js.map +1 -1
- package/dist/features/composites/feature.d.ts +10 -10
- package/dist/features/composites/feature.js +58 -46
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/fences.d.ts +3 -3
- package/dist/features/composites/fences.js +18 -13
- package/dist/features/composites/fences.js.map +1 -1
- package/dist/features/composites/focus.d.ts +10 -10
- package/dist/features/composites/focus.js +11 -11
- package/dist/features/composites/focus.js.map +1 -1
- package/dist/features/composites/heading-composites.d.ts +5 -5
- package/dist/features/composites/heading-composites.js +13 -16
- package/dist/features/composites/heading-composites.js.map +1 -1
- package/dist/features/composites/index.d.ts +20 -18
- package/dist/features/composites/index.js +9 -7
- package/dist/features/composites/inspector-model.d.ts +45 -22
- package/dist/features/composites/inspector-model.js +53 -14
- package/dist/features/composites/inspector-model.js.map +1 -1
- package/dist/features/composites/legacy.d.ts +5 -4
- package/dist/features/composites/legacy.js +16 -23
- package/dist/features/composites/legacy.js.map +1 -1
- package/dist/features/composites/markdown-export.js +3 -3
- package/dist/features/composites/markdown-export.js.map +1 -1
- package/dist/features/composites/merge.d.ts +8 -7
- package/dist/features/composites/merge.js +39 -12
- package/dist/features/composites/merge.js.map +1 -1
- package/dist/features/composites/meta-display.js +5 -5
- package/dist/features/composites/meta-display.js.map +1 -1
- package/dist/features/composites/meta-keys.d.ts +5 -5
- package/dist/features/composites/meta-keys.js +8 -8
- package/dist/features/composites/meta-keys.js.map +1 -1
- package/dist/features/composites/node-views.d.ts +3 -3
- package/dist/features/composites/node-views.js +2 -2
- package/dist/features/composites/node-views.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +13 -13
- package/dist/features/composites/nodes.js +100 -77
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/outline.d.ts +15 -12
- package/dist/features/composites/outline.js +24 -21
- package/dist/features/composites/outline.js.map +1 -1
- package/dist/features/composites/properties.d.ts +51 -0
- package/dist/features/composites/properties.js +89 -0
- package/dist/features/composites/properties.js.map +1 -0
- package/dist/features/composites/react/BibliographyEditor.js +5 -5
- package/dist/features/composites/react/BibliographyEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeBasketMenu.js +2 -2
- package/dist/features/composites/react/CompositeBasketMenu.js.map +1 -1
- package/dist/features/composites/react/CompositeChrome.d.ts +1 -1
- package/dist/features/composites/react/CompositeChrome.js +15 -6
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeDetails.d.ts +1 -1
- package/dist/features/composites/react/CompositeDetails.js +11 -10
- package/dist/features/composites/react/CompositeDetails.js.map +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.d.ts +5 -5
- package/dist/features/composites/react/CompositeFieldEditor.js +6 -6
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.d.ts +3 -3
- package/dist/features/composites/react/CompositeInspector.js +142 -128
- package/dist/features/composites/react/CompositeInspector.js.map +1 -1
- package/dist/features/composites/react/CompositeStatusMenu.js +2 -2
- package/dist/features/composites/react/CompositeStatusMenu.js.map +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeTable.d.ts +1 -1
- package/dist/features/composites/react/CompositeTable.js +3 -3
- package/dist/features/composites/react/CompositeTable.js.map +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeView.js +17 -15
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +13 -4
- package/dist/features/composites/react/DerivationBadge.js.map +1 -1
- package/dist/features/composites/react/FocusChip.d.ts +1 -1
- package/dist/features/composites/react/FocusChip.js +1 -1
- package/dist/features/composites/react/FocusChip.js.map +1 -1
- package/dist/features/composites/react/ReferenceFieldSelect.js +3 -3
- package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -1
- package/dist/features/composites/react/ReferenceView.d.ts +1 -1
- package/dist/features/composites/react/ReferenceView.js +1 -1
- package/dist/features/composites/react/ReferenceView.js.map +1 -1
- package/dist/features/composites/react/SettingsEditingTab.d.ts +4 -4
- package/dist/features/composites/react/SettingsEditingTab.js +20 -20
- package/dist/features/composites/react/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/react.js +1 -1
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/reference-ai.js +1 -1
- package/dist/features/composites/reference-ai.js.map +1 -1
- package/dist/features/composites/reference-label.d.ts +3 -3
- package/dist/features/composites/reference-label.js +6 -6
- package/dist/features/composites/reference-label.js.map +1 -1
- package/dist/features/composites/reference-suggestion.d.ts +1 -1
- package/dist/features/composites/reference-suggestion.js +3 -3
- package/dist/features/composites/reference-suggestion.js.map +1 -1
- package/dist/features/composites/reference-text.d.ts +2 -2
- package/dist/features/composites/reference-text.js +4 -4
- package/dist/features/composites/reference-text.js.map +1 -1
- package/dist/features/composites/reference.d.ts +3 -3
- package/dist/features/composites/reference.js +1 -1
- package/dist/features/composites/reference.js.map +1 -1
- package/dist/features/composites/reveal-source.d.ts +3 -3
- package/dist/features/composites/reveal-source.js +6 -6
- package/dist/features/composites/reveal-source.js.map +1 -1
- package/dist/features/composites/rows-model.d.ts +2 -2
- package/dist/features/composites/rows-model.js +4 -3
- package/dist/features/composites/rows-model.js.map +1 -1
- package/dist/features/composites/rows.d.ts +16 -28
- package/dist/features/composites/rows.js +20 -54
- package/dist/features/composites/rows.js.map +1 -1
- package/dist/features/composites/schema.d.ts +12 -11
- package/dist/features/composites/schema.js +10 -9
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/source.d.ts +20 -0
- package/dist/features/composites/source.js +40 -0
- package/dist/features/composites/source.js.map +1 -0
- package/dist/features/composites/split.d.ts +11 -11
- package/dist/features/composites/split.js +20 -20
- package/dist/features/composites/split.js.map +1 -1
- package/dist/features/composites/structure-mode.js +3 -3
- package/dist/features/composites/structure-mode.js.map +1 -1
- package/dist/features/composites/table-model.js +2 -2
- package/dist/features/composites/table-model.js.map +1 -1
- package/dist/features/composites/use-composite-inspector.js +3 -1
- package/dist/features/composites/use-composite-inspector.js.map +1 -1
- package/dist/features/composites/use-composite-rows.d.ts +2 -2
- package/dist/features/composites/use-composite-rows.js.map +1 -1
- package/dist/features/composites/vue.js +1 -1
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.js +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.js.map +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.vue.d.ts +1 -1
- package/dist/features/image-studio/components/ImageStudioView.js.map +1 -1
- package/dist/features/image-studio/feature.d.ts +1 -1
- package/dist/features/image-studio/feature.js +1 -1
- package/dist/features/image-studio/feature.js.map +1 -1
- package/dist/features/image-studio/node-core.d.ts +3 -3
- package/dist/features/image-studio/node-core.js +1 -1
- package/dist/features/image-studio/node-core.js.map +1 -1
- package/dist/features/image-studio/node-store.d.ts +1 -1
- package/dist/features/image-studio/node-store.js +1 -1
- package/dist/features/image-studio/node-store.js.map +1 -1
- package/dist/features/image-studio/react/ImageStudioDialog.d.ts +1 -1
- package/dist/features/image-studio/react/ImageStudioDialog.js +1 -1
- package/dist/features/image-studio/react/ImageStudioDialog.js.map +1 -1
- package/dist/features/image-studio/react/ImageStudioView.js +1 -1
- package/dist/features/image-studio/react/ImageStudioView.js.map +1 -1
- package/dist/features/image-studio/react/store.d.ts +3 -3
- package/dist/features/image-studio/react/store.js.map +1 -1
- package/dist/features/image-studio/react.d.ts +1 -1
- package/dist/features/image-studio/react.js +1 -1
- package/dist/features/image-studio/react.js.map +1 -1
- package/dist/features/image-studio/schema.d.ts +1 -1
- package/dist/features/image-studio/schema.js +1 -1
- package/dist/features/image-studio/schema.js.map +1 -1
- package/dist/features/image-studio/state.d.ts +3 -3
- package/dist/features/image-studio/state.js +2 -2
- package/dist/features/image-studio/state.js.map +1 -1
- package/dist/features/image-studio/store.d.ts +3 -3
- package/dist/features/image-studio/vue.d.ts +1 -1
- package/dist/features/image-studio/vue.js +1 -1
- package/dist/features/image-studio/vue.js.map +1 -1
- package/dist/features/media/index.js +1 -1
- package/dist/features/media/react/AudioRecorderModal.js +1 -1
- package/dist/features/media/react.js +1 -1
- package/dist/features/mentions/tag.js +2 -1
- package/dist/features/mentions/tag.js.map +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/feature.d.ts +1 -1
- package/dist/features/themes/feature.js.map +1 -1
- package/dist/features/themes/react/SettingsAppearanceTab.d.ts +1 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js +1 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/theme-runtime.js +1 -1
- package/dist/features/themes/theme-runtime.js.map +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/segment-node.js.map +1 -1
- package/dist/features/transfer/feature.js +1 -1
- package/dist/features/transfer/feature.js.map +1 -1
- package/dist/features/transfer/transforms.d.ts +4 -4
- package/dist/features/transfer/transforms.js +12 -12
- package/dist/features/transfer/transforms.js.map +1 -1
- package/dist/i18n/de/ai.js +4 -4
- package/dist/i18n/de/ai.js.map +1 -1
- package/dist/i18n/de/authors.js +1 -1
- package/dist/i18n/de/authors.js.map +1 -1
- package/dist/i18n/de/comments.js +1 -1
- package/dist/i18n/de/comments.js.map +1 -1
- package/dist/i18n/de/composites.js +62 -59
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/image-studio.js +2 -2
- package/dist/i18n/de/image-studio.js.map +1 -1
- package/dist/i18n/de/integrations.js +20 -20
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/markdown.js +1 -1
- package/dist/i18n/de/markdown.js.map +1 -1
- package/dist/i18n/de/palette.js +1 -1
- package/dist/i18n/de/palette.js.map +1 -1
- package/dist/i18n/de/themes.js +3 -3
- package/dist/i18n/de/themes.js.map +1 -1
- package/dist/i18n/de/transfer.js +2 -2
- package/dist/i18n/de/transfer.js.map +1 -1
- package/dist/i18n/de/tree.js +6 -6
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +101 -98
- package/dist/i18n/en/ai.js +2 -2
- package/dist/i18n/en/ai.js.map +1 -1
- package/dist/i18n/en/composites.js +64 -61
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/integrations.js +9 -9
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/markdown.js +1 -1
- package/dist/i18n/en/markdown.js.map +1 -1
- package/dist/i18n/en/palette.js +1 -1
- package/dist/i18n/en/palette.js.map +1 -1
- package/dist/i18n/en/themes.js +4 -4
- package/dist/i18n/en/themes.js.map +1 -1
- package/dist/i18n/en/tree.js +5 -5
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/integrations/composite-ai/bibliography-fetch.d.ts +6 -6
- package/dist/integrations/composite-ai/bibliography-fetch.js +19 -19
- package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -1
- package/dist/integrations/composite-ai/composite-fill.d.ts +4 -4
- package/dist/integrations/composite-ai/composite-fill.js +5 -5
- package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
- package/dist/integrations/composite-ai/composite-summary.d.ts +2 -2
- package/dist/integrations/composite-ai/composite-summary.js +5 -5
- package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +17 -17
- package/dist/integrations/composite-ai/derive.js +27 -26
- package/dist/integrations/composite-ai/derive.js.map +1 -1
- package/dist/integrations/composite-ai/index.d.ts +14 -15
- package/dist/integrations/composite-ai/index.js +98 -77
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.d.ts +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.js +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.js.map +1 -1
- package/dist/integrations/composite-ai/rendition.d.ts +9 -9
- package/dist/integrations/composite-ai/rendition.js +27 -27
- package/dist/integrations/composite-ai/rendition.js.map +1 -1
- package/dist/integrations/composite-ai/split.d.ts +8 -8
- package/dist/integrations/composite-ai/split.js +12 -12
- package/dist/integrations/composite-ai/split.js.map +1 -1
- package/dist/integrations/composite-ai/transfer-transforms.d.ts +2 -2
- package/dist/integrations/composite-ai/transfer-transforms.js +12 -12
- package/dist/integrations/composite-ai/transfer-transforms.js.map +1 -1
- package/dist/integrations/composite-media/index.d.ts +4 -3
- package/dist/integrations/composite-media/index.js +20 -14
- package/dist/integrations/composite-media/index.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +7 -7
- package/dist/markdown/document.js +1 -1
- package/dist/markdown/document.js.map +1 -1
- package/dist/nuxt/module.d.ts +30 -24
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/runtime/server/plugins/editor-server.js +3 -2
- package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
- package/dist/presets/compose.d.ts +6 -6
- package/dist/presets/compose.js +8 -5
- package/dist/presets/compose.js.map +1 -1
- package/dist/react/AdvancedEditor.d.ts +2 -2
- package/dist/react/AdvancedEditor.js +1 -1
- package/dist/react/AdvancedEditor.js.map +1 -1
- package/dist/react/compose.d.ts +1 -1
- package/dist/react/compose.js +2 -2
- package/dist/react/compose.js.map +1 -1
- package/dist/react/composed-surface.d.ts +5 -5
- package/dist/react/composed-surface.js +2 -2
- package/dist/react/composed-surface.js.map +1 -1
- package/dist/server/ai.d.ts +7 -7
- package/dist/server/ai.js +1 -1
- package/dist/server/ai.js.map +1 -1
- package/dist/server/auth.d.ts +1 -1
- package/dist/server/collab-state.d.ts +1 -1
- package/dist/server/collab-state.js.map +1 -1
- package/dist/server/collab.d.ts +4 -4
- package/dist/server/collab.js +22 -17
- package/dist/server/collab.js.map +1 -1
- package/dist/server/handlers/ai.d.ts +9 -6
- package/dist/server/handlers/ai.js +13 -17
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +4 -0
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +33 -32
- package/dist/server/handlers/editor.js +13 -8
- package/dist/server/handlers/editor.js.map +1 -1
- package/dist/server/handlers/images.d.ts +1 -1
- package/dist/server/handlers/images.js +1 -1
- package/dist/server/handlers/images.js.map +1 -1
- package/dist/server/host.d.ts +4 -0
- package/dist/server/host.js +10 -2
- package/dist/server/host.js.map +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/ports.d.ts +8 -8
- package/dist/server/ports.js.map +1 -1
- package/dist/settings/index.d.ts +20 -19
- package/dist/settings/index.js +25 -24
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/migrate.d.ts +18 -0
- package/dist/settings/migrate.js +46 -0
- package/dist/settings/migrate.js.map +1 -0
- package/dist/settings/values.d.ts +12 -12
- package/dist/settings/values.js +11 -11
- package/dist/settings/values.js.map +1 -1
- package/dist/styles/composites.css +10 -10
- package/dist/tree/DocumentTree.js +12 -5
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/drop-rules.js +5 -5
- package/dist/tree/drop-rules.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +14 -5
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +6 -6
- package/dist/tree/tree-host.js.map +1 -1
- package/dist/tree/tree-items.js +34 -28
- package/dist/tree/tree-items.js.map +1 -1
- package/dist/tree/tree-model.js +16 -16
- package/dist/tree/tree-model.js.map +1 -1
- package/dist/tree/tree-rows.js +2 -2
- package/dist/tree/tree-rows.js.map +1 -1
- package/dist/tree/tree-view-model.d.ts +2 -2
- package/dist/tree/tree-view-model.js.map +1 -1
- package/dist/vue/AdvancedEditor.js +2 -2
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +10 -10
- package/dist/vue/SimpleEditor.vue.d.ts +4 -4
- package/dist/vue/components/EditorSurface.vue.d.ts +4 -4
- package/dist/vue/compose.d.ts +1 -1
- package/dist/vue/compose.js +2 -2
- package/dist/vue/compose.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/composites/derivation.d.ts +0 -62
- package/dist/features/composites/derivation.js +0 -102
- package/dist/features/composites/derivation.js.map +0 -1
- package/dist/features/composites/kinds.d.ts +0 -83
- package/dist/features/composites/kinds.js +0 -285
- package/dist/features/composites/kinds.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-display.js","names":[],"sources":["../../../src/features/composites/meta-display.ts"],"sourcesContent":["import type { Node as PMNode } from '@tiptap/pm/model'\nimport { findBlockById } from '../../core/schema/block-ids'\nimport type { Translate } from '../../i18n'\nimport { type CslItem, citeShort } from './bibliography'\nimport type { Derivation } from '
|
|
1
|
+
{"version":3,"file":"meta-display.js","names":[],"sources":["../../../src/features/composites/meta-display.ts"],"sourcesContent":["import type { Node as PMNode } from '@tiptap/pm/model'\nimport { findBlockById } from '../../core/schema/block-ids'\nimport type { Translate } from '../../i18n'\nimport { type CslItem, citeShort } from './bibliography'\nimport type { Derivation } from '../../core/derivation'\nimport { derivationMethodLabel } from './derived-chrome'\nimport { type BlockType, blockTypeOf } from './block-types'\nimport type { PropertyDefinition } from '../../core/properties'\nimport type { BlockProperties } from './properties'\nimport type { CompositeRow } from './rows'\n\n/**\n * The stored value of a meta field as text (`''` when unset). An array (`multiselect`) reads as its entries joined by\n * `, `: the labels of the matching `options`, else the stored values.\n */\nexport function metaText(row: Pick<BlockProperties, 'meta'>, field: Pick<PropertyDefinition, 'key'> & { options?: PropertyDefinition['options'] }): string {\n const value = row.meta[field.key]\n if (Array.isArray(value)) return value.filter((item): item is string => typeof item === 'string').map(item => field.options?.find(option => option.value === item)?.label ?? item).join(', ')\n return typeof value === 'string' || typeof value === 'number' ? String(value) : ''\n}\n\nconst dateFormat = new Intl.DateTimeFormat('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })\n\n/** `2026-05-01` → `01.05.2026`; parsed by hand because `new Date('2026-05-01')` is UTC and can show the previous day. */\nexport function formatDate(value: string): string {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(value)\n const date = match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : new Date(value)\n return Number.isNaN(date.getTime()) ? value : dateFormat.format(date)\n}\n\n/**\n * The text a field's value stands for in a table cell: `reference` the title of the Typed block it points to (its Block type label\n * when untitled, `''` when it is gone or `doc` is unknown), `bibliography` the short citation, `derivation`\n * `method · date` (the method as words when `t` is given, else its stored id); every other type its stored text.\n */\nexport function fieldDisplay(row: Pick<CompositeRow, 'meta' | 'title'>, field: Pick<PropertyDefinition, 'key' | 'type' | 'options'>, doc: PMNode | null, kinds: readonly BlockType[], t?: Translate): string {\n const value = row.meta[field.key]\n if (field.type === 'reference') {\n if (typeof value !== 'string' || !value || !doc) return ''\n const target = findBlockById(doc, value)?.node\n if (target?.type.name !== 'typedBlock') return ''\n return target.child(0).textContent.trim() || blockTypeOf(kinds, String(target.attrs.blockType)).label\n }\n if (field.type === 'bibliography') {\n const bib = value as Partial<CslItem> | null | undefined\n return bib && typeof bib === 'object' && typeof bib.type === 'string' ? citeShort(bib, row.title) : ''\n }\n if (field.type === 'derivation') {\n const derivation = value as Partial<Derivation> | null | undefined\n if (!derivation || typeof derivation !== 'object' || typeof derivation.method !== 'string') return ''\n return [t ? derivationMethodLabel(t, derivation.method) : derivation.method, derivation.createdAt ? formatDate(derivation.createdAt) : ''].filter(Boolean).join(' · ')\n }\n return metaText(row, field)\n}\n\n/** Icon and color class of the known status values; unknown values read as neutral. */\nconst STATUS_STYLE: Record<string, { icon: string, color: string }> = {\n open: { icon: 'i-lucide-circle', color: 'text-[var(--sk-muted)]' },\n doing: { icon: 'i-lucide-circle-dot', color: 'text-[var(--sk-info)]' },\n done: { icon: 'i-lucide-circle-check', color: 'text-[var(--sk-success)]' },\n}\nconst STATUS_UNSET = { icon: 'i-lucide-circle-dashed', color: 'text-[var(--sk-fg-dimmed)]' }\nconst STATUS_OTHER = { icon: 'i-lucide-circle', color: 'text-[var(--sk-muted)]' }\n\nexport const statusStyle = (value: string) => STATUS_STYLE[value] ?? (value ? STATUS_OTHER : STATUS_UNSET)\n\n/** A row's `status` field with its current value. */\nexport interface RowStatus {\n field: PropertyDefinition\n value: string\n label: string\n icon: string\n color: string\n}\n\n/** The row's `status` select field with its current value, `null` for a kind without one; `t` words an unset status. */\nexport function rowStatus(row: CompositeRow, t: Translate): RowStatus | null {\n const field = row.definitions.find(candidate => candidate.key === 'status' && candidate.type === 'select')\n if (!field) return null\n const value = metaText(row, field)\n return { field, value, label: field.options?.find(option => option.value === value)?.label ?? (value || t('composites.status.none')), ...statusStyle(value) }\n}\n"],"mappings":";;;;;;;;;AAeA,SAAgB,SAAS,KAAoC,OAA8F;CACzJ,MAAM,QAAQ,IAAI,KAAK,MAAM;CAC7B,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,QAAQ,SAAyB,OAAO,SAAS,QAAQ,CAAC,CAAC,KAAI,SAAQ,MAAM,SAAS,MAAK,WAAU,OAAO,UAAU,IAAI,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC,KAAK,IAAI;CAC5L,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,KAAK,IAAI;AAClF;AAEA,MAAM,aAAa,IAAI,KAAK,eAAe,SAAS;CAAE,KAAK;CAAW,OAAO;CAAW,MAAM;AAAU,CAAC;;AAGzG,SAAgB,WAAW,OAAuB;CAChD,MAAM,QAAQ,2BAA2B,KAAK,KAAK;CACnD,MAAM,OAAO,QAAQ,IAAI,KAAK,OAAO,MAAM,EAAE,GAAG,OAAO,MAAM,EAAE,IAAI,GAAG,OAAO,MAAM,EAAE,CAAC,IAAI,IAAI,KAAK,KAAK;CACxG,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,IAAI,QAAQ,WAAW,OAAO,IAAI;AACtE;;;;;;AAOA,SAAgB,aAAa,KAA2C,OAA6D,KAAoB,OAA6B,GAAuB;CAC3M,MAAM,QAAQ,IAAI,KAAK,MAAM;CAC7B,IAAI,MAAM,SAAS,aAAa;EAC9B,IAAI,OAAO,UAAU,YAAY,CAAC,SAAS,CAAC,KAAK,OAAO;EACxD,MAAM,SAAS,cAAc,KAAK,KAAK,CAAC,EAAE;EAC1C,IAAI,QAAQ,KAAK,SAAS,cAAc,OAAO;EAC/C,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,YAAY,KAAK,KAAK,YAAY,OAAO,OAAO,OAAO,MAAM,SAAS,CAAC,CAAC,CAAC;CAClG;CACA,IAAI,MAAM,SAAS,gBAAgB;EACjC,MAAM,MAAM;EACZ,OAAO,OAAO,OAAO,QAAQ,YAAY,OAAO,IAAI,SAAS,WAAW,UAAU,KAAK,IAAI,KAAK,IAAI;CACtG;CACA,IAAI,MAAM,SAAS,cAAc;EAC/B,MAAM,aAAa;EACnB,IAAI,CAAC,cAAc,OAAO,eAAe,YAAY,OAAO,WAAW,WAAW,UAAU,OAAO;EACnG,OAAO,CAAC,IAAI,sBAAsB,GAAG,WAAW,MAAM,IAAI,WAAW,QAAQ,WAAW,YAAY,WAAW,WAAW,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;CACvK;CACA,OAAO,SAAS,KAAK,KAAK;AAC5B;;AAGA,MAAM,eAAgE;CACpE,MAAM;EAAE,MAAM;EAAmB,OAAO;CAAyB;CACjE,OAAO;EAAE,MAAM;EAAuB,OAAO;CAAwB;CACrE,MAAM;EAAE,MAAM;EAAyB,OAAO;CAA2B;AAC3E;AACA,MAAM,eAAe;CAAE,MAAM;CAA0B,OAAO;AAA6B;AAC3F,MAAM,eAAe;CAAE,MAAM;CAAmB,OAAO;AAAyB;AAEhF,MAAa,eAAe,UAAkB,aAAa,WAAW,QAAQ,eAAe;;AAY7F,SAAgB,UAAU,KAAmB,GAAgC;CAC3E,MAAM,QAAQ,IAAI,YAAY,MAAK,cAAa,UAAU,QAAQ,YAAY,UAAU,SAAS,QAAQ;CACzG,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,QAAQ,SAAS,KAAK,KAAK;CACjC,OAAO;EAAE;EAAO;EAAO,OAAO,MAAM,SAAS,MAAK,WAAU,OAAO,UAAU,KAAK,CAAC,EAAE,UAAU,SAAS,EAAE,wBAAwB;EAAI,GAAG,YAAY,KAAK;CAAE;AAC9J"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import "../../core/capabilities.js";
|
|
2
|
+
import { DERIVATION_KEY } from "../../core/derivation.js";
|
|
1
3
|
//#region src/features/composites/meta-keys.d.ts
|
|
2
|
-
/** Key of the
|
|
3
|
-
export declare const DERIVATION_KEY = "derivation";
|
|
4
|
-
/** Key of the bibliographic record (`CslItem`) in a composite's `meta`. */
|
|
4
|
+
/** Key of the bibliographic record (`CslItem`) in a block's `meta`. */
|
|
5
5
|
export declare const BIB_KEY = "bib";
|
|
6
|
-
/** Key of the hidden-title flag in a
|
|
6
|
+
/** Key of the hidden-title flag in a block's `meta`: `true` while the title is hidden, absent otherwise. */
|
|
7
7
|
export declare const TITLE_HIDDEN_KEY = "titleHidden";
|
|
8
|
-
/** Key of the colour basket in a
|
|
8
|
+
/** Key of the colour basket in a block's `meta`: the id of one of the editor's baskets. */
|
|
9
9
|
export declare const BASKET_KEY = "basket";
|
|
10
10
|
//#endregion
|
|
11
11
|
//# sourceMappingURL=meta-keys.d.ts.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import { DERIVATION_KEY } from "../../core/derivation.js";
|
|
2
|
+
import { propertiesOf } from "./block-types.js";
|
|
1
3
|
//#region src/features/composites/meta-keys.ts
|
|
2
|
-
/** Key of the
|
|
3
|
-
const DERIVATION_KEY = "derivation";
|
|
4
|
-
/** Key of the bibliographic record (`CslItem`) in a composite's `meta`. */
|
|
4
|
+
/** Key of the bibliographic record (`CslItem`) in a block's `meta`. */
|
|
5
5
|
const BIB_KEY = "bib";
|
|
6
|
-
/** Key of the hidden-title flag in a
|
|
6
|
+
/** Key of the hidden-title flag in a block's `meta`: `true` while the title is hidden, absent otherwise. */
|
|
7
7
|
const TITLE_HIDDEN_KEY = "titleHidden";
|
|
8
|
-
/** Key of the colour basket in a
|
|
8
|
+
/** Key of the colour basket in a block's `meta`: the id of one of the editor's baskets. */
|
|
9
9
|
const BASKET_KEY = "basket";
|
|
10
10
|
/**
|
|
11
|
-
* Whether a
|
|
11
|
+
* Whether a block of Block type `kind` keeps the `meta` entry `key`: the fields the kind declares, plus provenance
|
|
12
12
|
* (`derivation`), the bibliographic record (`bib`), the hidden-title flag (`titleHidden`) and the basket (`basket`),
|
|
13
13
|
* which any kind may carry (a kind switch, a conversion and a Markdown round trip must not drop them).
|
|
14
14
|
*/
|
|
15
15
|
function keepsMetaKey(kind, key) {
|
|
16
|
-
return key === "derivation" || key === "bib" || key === "titleHidden" || key === "basket" || kind.
|
|
16
|
+
return key === "derivation" || key === "bib" || key === "titleHidden" || key === "basket" || propertiesOf(kind).some((field) => field.key === key);
|
|
17
17
|
}
|
|
18
|
-
/** `meta` reduced to the entries a
|
|
18
|
+
/** `meta` reduced to the entries a block of Block type `kind` keeps (`keepsMetaKey`). */
|
|
19
19
|
function keptMeta(kind, meta) {
|
|
20
20
|
return Object.fromEntries(Object.entries(meta).filter(([key]) => keepsMetaKey(kind, key)));
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta-keys.js","names":[],"sources":["../../../src/features/composites/meta-keys.ts"],"sourcesContent":["// Vue-free and server-importable: the `meta` keys a
|
|
1
|
+
{"version":3,"file":"meta-keys.js","names":[],"sources":["../../../src/features/composites/meta-keys.ts"],"sourcesContent":["// Vue-free and server-importable: the `meta` keys a Typed block of any Block type may carry, and which meta keys a Block type keeps.\nimport type { BlockTypeData } from '../../core/capabilities'\nimport { DERIVATION_KEY } from '../../core/derivation'\nimport { propertiesOf } from './block-types'\n\nexport { DERIVATION_KEY }\n\n/** Key of the bibliographic record (`CslItem`) in a block's `meta`. */\nexport const BIB_KEY = 'bib'\n\n/** Key of the hidden-title flag in a block's `meta`: `true` while the title is hidden, absent otherwise. */\nexport const TITLE_HIDDEN_KEY = 'titleHidden'\n\n/** Key of the colour basket in a block's `meta`: the id of one of the editor's baskets. */\nexport const BASKET_KEY = 'basket'\n\n/**\n * Whether a block of Block type `kind` keeps the `meta` entry `key`: the fields the kind declares, plus provenance\n * (`derivation`), the bibliographic record (`bib`), the hidden-title flag (`titleHidden`) and the basket (`basket`),\n * which any kind may carry (a kind switch, a conversion and a Markdown round trip must not drop them).\n */\nexport function keepsMetaKey(kind: BlockTypeData, key: string): boolean {\n return key === DERIVATION_KEY || key === BIB_KEY || key === TITLE_HIDDEN_KEY || key === BASKET_KEY || propertiesOf(kind).some(field => field.key === key)\n}\n\n/** `meta` reduced to the entries a block of Block type `kind` keeps (`keepsMetaKey`). */\nexport function keptMeta(kind: BlockTypeData, meta: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(Object.entries(meta).filter(([key]) => keepsMetaKey(kind, key)))\n}\n"],"mappings":";;;;AAQA,MAAa,UAAU;;AAGvB,MAAa,mBAAmB;;AAGhC,MAAa,aAAa;;;;;;AAO1B,SAAgB,aAAa,MAAqB,KAAsB;CACtE,OAAO,QAAA,gBAA0B,QAAA,SAAmB,QAAA,iBAA4B,QAAA,YAAsB,aAAa,IAAI,CAAC,CAAC,MAAK,UAAS,MAAM,QAAQ,GAAG;AAC1J;;AAGA,SAAgB,SAAS,MAAqB,MAAwD;CACpG,OAAO,OAAO,YAAY,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,aAAa,MAAM,GAAG,CAAC,CAAC;AAC3F"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { CompositeOptions, CompositeStorage } from "./nodes.js";
|
|
2
1
|
import { ReferenceOptions } from "./reference.js";
|
|
2
|
+
import { CompositeOptions, CompositeStorage } from "./nodes.js";
|
|
3
3
|
import { NodeViewRenderer } from "@tiptap/core";
|
|
4
4
|
//#region src/features/composites/node-views.d.ts
|
|
5
5
|
/** The node view renderers a framework binding supplies for the composite block and the reference chip. */
|
|
6
6
|
export interface CompositeNodeViews {
|
|
7
|
-
|
|
7
|
+
typedBlock: NodeViewRenderer;
|
|
8
8
|
reference: NodeViewRenderer;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* The composite node with the node view of a framework binding, the tags row (data: hidden, `CompositeChrome`
|
|
12
|
-
* shows and edits it, so it needs no node view) and the reference chip. Configure the
|
|
12
|
+
* shows and edits it, so it needs no node view) and the reference chip. Configure the Block types with `Composite.configure({ blockTypes: [...defaultBlockTypes(t), myType] })`.
|
|
13
13
|
*/
|
|
14
14
|
export declare function compositeNodes(nodeViews: CompositeNodeViews): {
|
|
15
15
|
Composite: import("@tiptap/core").Node<CompositeOptions, CompositeStorage>;
|
|
@@ -3,12 +3,12 @@ import { ReferenceNode } from "./reference.js";
|
|
|
3
3
|
//#region src/features/composites/node-views.ts
|
|
4
4
|
/**
|
|
5
5
|
* The composite node with the node view of a framework binding, the tags row (data: hidden, `CompositeChrome`
|
|
6
|
-
* shows and edits it, so it needs no node view) and the reference chip. Configure the
|
|
6
|
+
* shows and edits it, so it needs no node view) and the reference chip. Configure the Block types with `Composite.configure({ blockTypes: [...defaultBlockTypes(t), myType] })`.
|
|
7
7
|
*/
|
|
8
8
|
function compositeNodes(nodeViews) {
|
|
9
9
|
return {
|
|
10
10
|
Composite: CompositeNode.extend({ addNodeView() {
|
|
11
|
-
return nodeViews.
|
|
11
|
+
return nodeViews.typedBlock;
|
|
12
12
|
} }),
|
|
13
13
|
CompositeTags: CompositeTagsNode,
|
|
14
14
|
Reference: ReferenceNode.extend({ addNodeView() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-views.js","names":[],"sources":["../../../src/features/composites/node-views.ts"],"sourcesContent":["import type { NodeViewRenderer } from '@tiptap/core'\nimport { CompositeNode, CompositeTagsNode } from './nodes'\nimport { ReferenceNode } from './reference'\n\n/** The node view renderers a framework binding supplies for the composite block and the reference chip. */\nexport interface CompositeNodeViews {\n
|
|
1
|
+
{"version":3,"file":"node-views.js","names":[],"sources":["../../../src/features/composites/node-views.ts"],"sourcesContent":["import type { NodeViewRenderer } from '@tiptap/core'\nimport { CompositeNode, CompositeTagsNode } from './nodes'\nimport { ReferenceNode } from './reference'\n\n/** The node view renderers a framework binding supplies for the composite block and the reference chip. */\nexport interface CompositeNodeViews {\n typedBlock: NodeViewRenderer\n reference: NodeViewRenderer\n}\n\n/**\n * The composite node with the node view of a framework binding, the tags row (data: hidden, `CompositeChrome`\n * shows and edits it, so it needs no node view) and the reference chip. Configure the Block types with `Composite.configure({ blockTypes: [...defaultBlockTypes(t), myType] })`.\n */\nexport function compositeNodes(nodeViews: CompositeNodeViews) {\n return {\n // Explicit return type: the node views import `blockTypesOf`, so inference would otherwise be circular.\n Composite: CompositeNode.extend({\n addNodeView(): NodeViewRenderer {\n return nodeViews.typedBlock\n },\n }),\n CompositeTags: CompositeTagsNode,\n Reference: ReferenceNode.extend({\n addNodeView(): NodeViewRenderer {\n return nodeViews.reference\n },\n }),\n }\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,eAAe,WAA+B;CAC5D,OAAO;EAEL,WAAW,cAAc,OAAO,EAC9B,cAAgC;GAC9B,OAAO,UAAU;EACnB,EACF,CAAC;EACD,eAAe;EACf,WAAW,cAAc,OAAO,EAC9B,cAAgC;GAC9B,OAAO,UAAU;EACnB,EACF,CAAC;CACH;AACF"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { Store } from "../../core/store.js";
|
|
2
2
|
import { HeadingConversionScope } from "../../settings/values.js";
|
|
3
3
|
import "../../settings/index.js";
|
|
4
|
-
import { CompositeKind } from "./kinds.js";
|
|
5
4
|
import { Basket } from "./baskets.js";
|
|
5
|
+
import { BlockType } from "./block-types.js";
|
|
6
6
|
import { Editor, JSONContent, Node } from "@tiptap/core";
|
|
7
7
|
import { EditorState } from "@tiptap/pm/state";
|
|
8
8
|
import { Node as Node$1, ResolvedPos } from "@tiptap/pm/model";
|
|
9
9
|
//#region src/features/composites/nodes.d.ts
|
|
10
|
-
/** Options of the `
|
|
10
|
+
/** Options of the `typedBlock` node: the Block types its `blockType` attribute selects from and the baskets its `meta.basket` selects from. */
|
|
11
11
|
export interface CompositeOptions {
|
|
12
|
-
|
|
12
|
+
blockTypes: readonly BlockType[];
|
|
13
13
|
baskets: readonly Basket[];
|
|
14
14
|
}
|
|
15
|
-
/** Storage of the `
|
|
15
|
+
/** Storage of the `typedBlock` node: mirrors `options.blockTypes` and `options.baskets` for code that only has the editor. */
|
|
16
16
|
export interface CompositeStorage {
|
|
17
|
-
|
|
17
|
+
blockTypes: readonly BlockType[];
|
|
18
18
|
baskets: readonly Basket[];
|
|
19
|
-
/** Ids of the
|
|
19
|
+
/** Ids of the Typed blocks with a hidden title (`meta.titleHidden`) whose title the caret entered; they show it for the rest of the editor session. */
|
|
20
20
|
revealedTitles: Store<ReadonlySet<string>>;
|
|
21
|
-
/** Ids of the derived
|
|
21
|
+
/** Ids of the derived Typed blocks (those with a `meta.derivation`) the user opened; every other derived Typed block shows collapsed. */
|
|
22
22
|
expanded: Store<ReadonlySet<string>>;
|
|
23
23
|
}
|
|
24
24
|
declare module '@tiptap/core' {
|
|
@@ -41,9 +41,9 @@ declare module '@tiptap/core' {
|
|
|
41
41
|
recursive: boolean;
|
|
42
42
|
scope: HeadingConversionScope;
|
|
43
43
|
}) => ReturnType;
|
|
44
|
-
/** Switch the composite at `pos` (default: the caret's innermost composite) to `
|
|
45
|
-
|
|
46
|
-
/** Open the derived
|
|
44
|
+
/** Switch the composite at `pos` (default: the caret's innermost composite) to the Block type `blockTypeId`; `meta` keeps the new Block type's properties plus `derivation` and `bib`. */
|
|
45
|
+
changeBlockType: (blockTypeId: string, pos?: number) => ReturnType;
|
|
46
|
+
/** Open the derived Typed block with block id `id` if it is collapsed, collapse it if it is open. */
|
|
47
47
|
toggleCompositeExpanded: (id: string) => ReturnType;
|
|
48
48
|
/** Put the composite at `pos` (default: the caret's innermost composite) into the basket `basket` (an id of the editor's baskets; false for an unknown id), or take it out with `null`. */
|
|
49
49
|
setCompositeBasket: (basket: string | null, pos?: number) => ReturnType;
|
|
@@ -52,16 +52,16 @@ declare module '@tiptap/core' {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
interface Storage {
|
|
55
|
-
|
|
55
|
+
typedBlock: CompositeStorage;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
/** Title, description and tags: the fixed children in front of a composite's body. */
|
|
59
59
|
export declare const COMPOSITE_CHROME_COUNT = 3;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Block types `editor` was configured with. An editor without the composite node gets the built-in Block types in the
|
|
62
62
|
* language of its surface (the default language without one).
|
|
63
63
|
*/
|
|
64
|
-
export declare function
|
|
64
|
+
export declare function blockTypesOf(editor: Editor): readonly BlockType[];
|
|
65
65
|
/** Baskets `editor` was configured with (the built-in ones in the default language for an editor without the composite node). */
|
|
66
66
|
export declare function compositeBasketsOf(editor: Editor): readonly Basket[];
|
|
67
67
|
/** JSON of a fresh composite of `kind` (empty title/description/tags, hidden meta) with `body`. */
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { ABILITY, TEXT_ABILITIES } from "../../core/schema/abilities.js";
|
|
2
|
-
import { editorEntryOf } from "../../core/editor-ui.js";
|
|
3
2
|
import { isChromeNode } from "../../core/schema/node-flags.js";
|
|
3
|
+
import { OLD_HTML, TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from "../../core/schema/persisted-names.js";
|
|
4
|
+
import { editorEntryOf } from "../../core/editor-ui.js";
|
|
5
|
+
import { derivationOf } from "../../core/derivation.js";
|
|
4
6
|
import { createStore } from "../../core/store.js";
|
|
5
|
-
import {
|
|
7
|
+
import { blockTypeOf, defaultBlockTypes, fallbackBlockTypes } from "./block-types.js";
|
|
6
8
|
import { BASKET_KEY, TITLE_HIDDEN_KEY, keptMeta } from "./meta-keys.js";
|
|
7
9
|
import { compositeFence, withReferencedFenceIds } from "./fences.js";
|
|
8
10
|
import { basketById, defaultBaskets, fallbackBaskets, titleHiddenOf } from "./baskets.js";
|
|
9
|
-
import { derivationOf } from "./derivation.js";
|
|
10
11
|
import { flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange } from "./heading-composites.js";
|
|
11
12
|
import { Node, mergeAttributes } from "@tiptap/core";
|
|
12
13
|
import { Selection, TextSelection } from "@tiptap/pm/state";
|
|
13
14
|
//#region src/features/composites/nodes.ts
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
15
|
+
/** The `data-type` of the chrome elements of a Typed block (title, description, tags) in the HTML the nodes render and parse. */
|
|
16
|
+
const TITLE_DATA_TYPE = "typed-block-title";
|
|
17
|
+
const DESCRIPTION_DATA_TYPE = "typed-block-description";
|
|
18
|
+
const TAGS_DATA_TYPE = "typed-block-tags";
|
|
18
19
|
/** Kind of a composite created without an explicit one (also the attribute default). */
|
|
19
20
|
const DEFAULT_KIND = "section";
|
|
20
21
|
/** Title, description and tags: the fixed children in front of a composite's body. */
|
|
21
22
|
const COMPOSITE_CHROME_COUNT = 3;
|
|
22
23
|
const CHROME_COUNT = 3;
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
+
* Block types `editor` was configured with. An editor without the composite node gets the built-in Block types in the
|
|
25
26
|
* language of its surface (the default language without one).
|
|
26
27
|
*/
|
|
27
|
-
function
|
|
28
|
-
const configured = editor.storage.
|
|
28
|
+
function blockTypesOf(editor) {
|
|
29
|
+
const configured = editor.storage.typedBlock?.blockTypes;
|
|
29
30
|
if (configured) return configured;
|
|
30
31
|
const entry = editorEntryOf(editor);
|
|
31
|
-
return entry ?
|
|
32
|
+
return entry ? defaultBlockTypes(entry.ctx.t) : fallbackBlockTypes();
|
|
32
33
|
}
|
|
33
34
|
/** Baskets `editor` was configured with (the built-in ones in the default language for an editor without the composite node). */
|
|
34
35
|
function compositeBasketsOf(editor) {
|
|
35
|
-
const configured = editor.storage.
|
|
36
|
+
const configured = editor.storage.typedBlock?.baskets;
|
|
36
37
|
if (configured) return configured;
|
|
37
38
|
const entry = editorEntryOf(editor);
|
|
38
39
|
return entry ? defaultBaskets(entry.ctx.t) : fallbackBaskets();
|
|
@@ -40,12 +41,12 @@ function compositeBasketsOf(editor) {
|
|
|
40
41
|
/** JSON of a fresh composite of `kind` (empty title/description/tags, hidden meta) with `body`. */
|
|
41
42
|
function compositeJSON(kind, body = [{ type: "paragraph" }]) {
|
|
42
43
|
return {
|
|
43
|
-
type:
|
|
44
|
-
attrs: { kind },
|
|
44
|
+
type: TYPED_BLOCK,
|
|
45
|
+
attrs: { blockType: kind },
|
|
45
46
|
content: [
|
|
46
|
-
{ type:
|
|
47
|
-
{ type:
|
|
48
|
-
{ type:
|
|
47
|
+
{ type: TYPED_BLOCK_TITLE },
|
|
48
|
+
{ type: TYPED_BLOCK_DESCRIPTION },
|
|
49
|
+
{ type: TYPED_BLOCK_TAGS },
|
|
49
50
|
...body
|
|
50
51
|
]
|
|
51
52
|
};
|
|
@@ -54,7 +55,7 @@ function compositeJSON(kind, body = [{ type: "paragraph" }]) {
|
|
|
54
55
|
function compositeAround($pos) {
|
|
55
56
|
for (let depth = $pos.depth; depth > 0; depth--) {
|
|
56
57
|
const node = $pos.node(depth);
|
|
57
|
-
if (node.type.name ===
|
|
58
|
+
if (node.type.name === "typedBlock") return {
|
|
58
59
|
depth,
|
|
59
60
|
pos: $pos.before(depth),
|
|
60
61
|
node
|
|
@@ -66,7 +67,7 @@ function compositeAround($pos) {
|
|
|
66
67
|
function compositeAt(state, pos) {
|
|
67
68
|
if (pos === void 0) return compositeAround(state.selection.$head);
|
|
68
69
|
const node = state.doc.nodeAt(pos);
|
|
69
|
-
return node?.type.name ===
|
|
70
|
+
return node?.type.name === "typedBlock" ? {
|
|
70
71
|
pos,
|
|
71
72
|
node
|
|
72
73
|
} : null;
|
|
@@ -82,7 +83,7 @@ const isEmptyParagraph = (node) => node.type.name === "paragraph" && node.conten
|
|
|
82
83
|
function inTrailingEmptyParagraph($head) {
|
|
83
84
|
if ($head.depth < 2 || !isEmptyParagraph($head.parent)) return false;
|
|
84
85
|
const composite = $head.node($head.depth - 1);
|
|
85
|
-
return composite.type.name ===
|
|
86
|
+
return composite.type.name === "typedBlock" && $head.index($head.depth - 1) === composite.childCount - 1 && composite.childCount > 4;
|
|
86
87
|
}
|
|
87
88
|
/** Nothing typed yet: empty title and description, no tags, body is one empty paragraph. */
|
|
88
89
|
function isEmptyComposite(composite) {
|
|
@@ -93,10 +94,10 @@ function isEmptyComposite(composite) {
|
|
|
93
94
|
function structureRange(state, scope, direction) {
|
|
94
95
|
const { $from, $to, $head, empty } = state.selection;
|
|
95
96
|
if (!empty) {
|
|
96
|
-
const range = $from.blockRange($to, (node) => node.type.name === "doc" || node.type.name ===
|
|
97
|
+
const range = $from.blockRange($to, (node) => node.type.name === "doc" || node.type.name === "typedBlock");
|
|
97
98
|
if (!range) return null;
|
|
98
99
|
const parent = range.parent;
|
|
99
|
-
const fromIndex = Math.max(range.startIndex, parent.type.name ===
|
|
100
|
+
const fromIndex = Math.max(range.startIndex, parent.type.name === "typedBlock" ? CHROME_COUNT : 0);
|
|
100
101
|
const toIndex = range.endIndex;
|
|
101
102
|
if (fromIndex >= toIndex) return null;
|
|
102
103
|
return {
|
|
@@ -139,10 +140,10 @@ function structureRange(state, scope, direction) {
|
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
142
|
let depth = $head.depth;
|
|
142
|
-
while (depth > 0 && !["doc",
|
|
143
|
+
while (depth > 0 && !["doc", "typedBlock"].includes($head.node(depth - 1).type.name)) depth--;
|
|
143
144
|
if (depth === 0) return null;
|
|
144
145
|
const parent = $head.node(depth - 1);
|
|
145
|
-
const minIndex = parent.type.name ===
|
|
146
|
+
const minIndex = parent.type.name === "typedBlock" ? CHROME_COUNT : 0;
|
|
146
147
|
let index = $head.index(depth - 1);
|
|
147
148
|
while (index >= minIndex && parent.child(index).type.name !== "heading") index--;
|
|
148
149
|
if (index < minIndex) return null;
|
|
@@ -194,10 +195,10 @@ const CHROME_REVOKES = [
|
|
|
194
195
|
ABILITY.blockDuplicate
|
|
195
196
|
];
|
|
196
197
|
const CompositeNode = Node.create({
|
|
197
|
-
name:
|
|
198
|
+
name: TYPED_BLOCK,
|
|
198
199
|
priority: 101,
|
|
199
200
|
group: "block",
|
|
200
|
-
content: `${
|
|
201
|
+
content: `${TYPED_BLOCK_TITLE} ${TYPED_BLOCK_DESCRIPTION} ${TYPED_BLOCK_TAGS} block+`,
|
|
201
202
|
isolating: true,
|
|
202
203
|
defining: true,
|
|
203
204
|
editorBlockContainer: true,
|
|
@@ -208,12 +209,12 @@ const CompositeNode = Node.create({
|
|
|
208
209
|
ABILITY.compositeDerive
|
|
209
210
|
] },
|
|
210
211
|
addOptions: () => ({
|
|
211
|
-
|
|
212
|
+
blockTypes: fallbackBlockTypes(),
|
|
212
213
|
baskets: fallbackBaskets()
|
|
213
214
|
}),
|
|
214
215
|
addStorage() {
|
|
215
216
|
return {
|
|
216
|
-
|
|
217
|
+
blockTypes: this.options.blockTypes,
|
|
217
218
|
baskets: this.options.baskets,
|
|
218
219
|
expanded: createStore(/* @__PURE__ */ new Set()),
|
|
219
220
|
revealedTitles: createStore(/* @__PURE__ */ new Set())
|
|
@@ -226,22 +227,22 @@ const CompositeNode = Node.create({
|
|
|
226
227
|
for (let depth = $head.depth; depth > 0; depth--) {
|
|
227
228
|
const node = $head.node(depth);
|
|
228
229
|
const id = node.attrs.id;
|
|
229
|
-
if (node.type.name !==
|
|
230
|
+
if (node.type.name !== "typedBlock" || typeof id !== "string" || !id || $head.index(depth) < CHROME_COUNT) continue;
|
|
230
231
|
if (derivationOf(node) && !expanded.get().has(id)) (open ??= new Set(expanded.get())).add(id);
|
|
231
232
|
}
|
|
232
233
|
if (open) expanded.set(open);
|
|
233
|
-
if ($head.parent.type.name ===
|
|
234
|
+
if ($head.parent.type.name === "typedBlockTitle" && $head.depth > 0) {
|
|
234
235
|
const composite = $head.node($head.depth - 1);
|
|
235
236
|
const id = composite.attrs.id;
|
|
236
|
-
if (composite.type.name ===
|
|
237
|
+
if (composite.type.name === "typedBlock" && typeof id === "string" && id && titleHiddenOf(composite) && !revealedTitles.get().has(id)) revealedTitles.set(new Set(revealedTitles.get()).add(id));
|
|
237
238
|
}
|
|
238
239
|
},
|
|
239
|
-
markdownPrepare: (json, editor) => withReferencedFenceIds(json,
|
|
240
|
+
markdownPrepare: (json, editor) => withReferencedFenceIds(json, blockTypesOf(editor)),
|
|
240
241
|
addAttributes: () => ({
|
|
241
|
-
|
|
242
|
+
blockType: {
|
|
242
243
|
default: DEFAULT_KIND,
|
|
243
|
-
parseHTML: (el) => el.getAttribute("data-
|
|
244
|
-
renderHTML: (attrs) => ({ "data-
|
|
244
|
+
parseHTML: (el) => el.getAttribute("data-block-type") || el.getAttribute(OLD_HTML.blockTypeAttr) || null,
|
|
245
|
+
renderHTML: (attrs) => ({ "data-block-type": attrs.blockType })
|
|
245
246
|
},
|
|
246
247
|
meta: {
|
|
247
248
|
default: {},
|
|
@@ -256,14 +257,18 @@ const CompositeNode = Node.create({
|
|
|
256
257
|
renderHTML: (attrs) => ({ "data-meta": JSON.stringify(attrs.meta) })
|
|
257
258
|
}
|
|
258
259
|
}),
|
|
259
|
-
parseHTML: () => [
|
|
260
|
+
parseHTML: () => [
|
|
261
|
+
{ tag: `section[data-type="${TYPED_BLOCK}"]` },
|
|
262
|
+
{ tag: `section[data-type="${OLD_HTML.typedBlock}"]` },
|
|
263
|
+
{ tag: `section[data-type="${OLD_HTML.earliestBlock}"]` }
|
|
264
|
+
],
|
|
260
265
|
renderHTML: ({ HTMLAttributes }) => [
|
|
261
266
|
"section",
|
|
262
|
-
mergeAttributes(HTMLAttributes, { "data-type":
|
|
267
|
+
mergeAttributes(HTMLAttributes, { "data-type": TYPED_BLOCK }),
|
|
263
268
|
0
|
|
264
269
|
],
|
|
265
270
|
renderMarkdown: (node, h) => {
|
|
266
|
-
const kind = typeof node.attrs?.
|
|
271
|
+
const kind = typeof node.attrs?.blockType === "string" && node.attrs.blockType ? node.attrs.blockType : DEFAULT_KIND;
|
|
267
272
|
const meta = node.attrs?.meta;
|
|
268
273
|
const body = (node.content ?? []).map((child, index) => h.renderChild?.(child, index) ?? h.renderChildren([child])).filter(Boolean).join("\n\n");
|
|
269
274
|
const id = node.attrs?.id;
|
|
@@ -319,7 +324,7 @@ const CompositeNode = Node.create({
|
|
|
319
324
|
insertComposite: (kind = DEFAULT_KIND) => ({ state, tr, dispatch }) => {
|
|
320
325
|
const { $head } = state.selection;
|
|
321
326
|
let depth = $head.depth;
|
|
322
|
-
while (depth > 0 && !["doc",
|
|
327
|
+
while (depth > 0 && !["doc", "typedBlock"].includes($head.node(depth - 1).type.name)) depth--;
|
|
323
328
|
let from = $head.pos;
|
|
324
329
|
let to = from;
|
|
325
330
|
if (depth > 0) {
|
|
@@ -341,16 +346,16 @@ const CompositeNode = Node.create({
|
|
|
341
346
|
},
|
|
342
347
|
wrapInComposite: (kind = DEFAULT_KIND) => ({ state, tr, dispatch }) => {
|
|
343
348
|
const { $from, $to } = state.selection;
|
|
344
|
-
const range = $from.blockRange($to, (node) => node.type.name === "doc" || node.type.name ===
|
|
349
|
+
const range = $from.blockRange($to, (node) => node.type.name === "doc" || node.type.name === "typedBlock");
|
|
345
350
|
if (!range) return false;
|
|
346
|
-
if (range.parent.type.name ===
|
|
351
|
+
if (range.parent.type.name === "typedBlock" && range.startIndex < CHROME_COUNT) return false;
|
|
347
352
|
if (!range.parent.canReplaceWith(range.startIndex, range.endIndex, this.type)) return false;
|
|
348
353
|
if (dispatch) {
|
|
349
354
|
const { nodes } = state.schema;
|
|
350
|
-
const composite = this.type.create({ kind }, [
|
|
351
|
-
nodes[
|
|
352
|
-
nodes[
|
|
353
|
-
nodes[
|
|
355
|
+
const composite = this.type.create({ blockType: kind }, [
|
|
356
|
+
nodes[TYPED_BLOCK_TITLE].create(),
|
|
357
|
+
nodes[TYPED_BLOCK_DESCRIPTION].create(),
|
|
358
|
+
nodes[TYPED_BLOCK_TAGS].create(),
|
|
354
359
|
...state.doc.slice(range.start, range.end).content.content
|
|
355
360
|
]);
|
|
356
361
|
tr.replaceWith(range.start, range.end, composite);
|
|
@@ -358,14 +363,14 @@ const CompositeNode = Node.create({
|
|
|
358
363
|
}
|
|
359
364
|
return true;
|
|
360
365
|
},
|
|
361
|
-
|
|
366
|
+
changeBlockType: (blockTypeId, pos) => ({ state, tr, dispatch }) => {
|
|
362
367
|
const found = compositeAt(state, pos);
|
|
363
368
|
if (!found) return false;
|
|
364
369
|
if (dispatch) {
|
|
365
|
-
const meta = keptMeta(
|
|
370
|
+
const meta = keptMeta(blockTypeOf(this.options.blockTypes, blockTypeId), found.node.attrs.meta);
|
|
366
371
|
tr.setNodeMarkup(found.pos, void 0, {
|
|
367
372
|
...found.node.attrs,
|
|
368
|
-
|
|
373
|
+
blockType: blockTypeId,
|
|
369
374
|
meta
|
|
370
375
|
});
|
|
371
376
|
}
|
|
@@ -400,9 +405,9 @@ const CompositeNode = Node.create({
|
|
|
400
405
|
if (!range) return false;
|
|
401
406
|
const $pos = state.selection.empty ? state.selection.$head : state.selection.$from;
|
|
402
407
|
let level = 1;
|
|
403
|
-
for (let depth = 1; depth <= range.parentDepth; depth++) if ($pos.node(depth).type.name ===
|
|
408
|
+
for (let depth = 1; depth <= range.parentDepth; depth++) if ($pos.node(depth).type.name === "typedBlock") level++;
|
|
404
409
|
const { blocks, from, to } = rangeBlocks(range.parent, range.parentStart, range.fromIndex, range.toIndex);
|
|
405
|
-
const result = flattenCompositesToHeadings(state.schema, blocks, recursive, level, this.options.
|
|
410
|
+
const result = flattenCompositesToHeadings(state.schema, blocks, recursive, level, this.options.blockTypes);
|
|
406
411
|
if (!result) return false;
|
|
407
412
|
if (dispatch) {
|
|
408
413
|
tr.replaceWith(from, to, result);
|
|
@@ -417,7 +422,7 @@ const CompositeNode = Node.create({
|
|
|
417
422
|
Enter: () => {
|
|
418
423
|
const { $head } = this.editor.state.selection;
|
|
419
424
|
const type = $head.parent.type.name;
|
|
420
|
-
if (type ===
|
|
425
|
+
if (type === "typedBlockTitle" || type === "typedBlockDescription") {
|
|
421
426
|
const depth = $head.depth - 1;
|
|
422
427
|
const composite = $head.node(depth);
|
|
423
428
|
const start = $head.start(depth);
|
|
@@ -437,14 +442,14 @@ const CompositeNode = Node.create({
|
|
|
437
442
|
if (!selection.empty || !$head.parent.isTextblock || $head.parentOffset !== 0 || $head.depth < 2) return false;
|
|
438
443
|
const depth = $head.depth - 1;
|
|
439
444
|
const composite = $head.node(depth);
|
|
440
|
-
if (composite.type.name !==
|
|
445
|
+
if (composite.type.name !== "typedBlock") return false;
|
|
441
446
|
const titleEnd = $head.start(depth) + composite.child(0).nodeSize - 1;
|
|
442
447
|
const type = $head.parent.type.name;
|
|
443
|
-
if (type ===
|
|
448
|
+
if (type === "typedBlockDescription") return this.editor.commands.command(({ tr }) => {
|
|
444
449
|
tr.setSelection(TextSelection.create(tr.doc, titleEnd));
|
|
445
450
|
return true;
|
|
446
451
|
});
|
|
447
|
-
if (type ===
|
|
452
|
+
if (type === "typedBlockTitle") {
|
|
448
453
|
if (!isEmptyComposite(composite)) return true;
|
|
449
454
|
return this.editor.commands.command(({ tr, state }) => {
|
|
450
455
|
const from = $head.before(depth);
|
|
@@ -464,30 +469,37 @@ const CompositeNode = Node.create({
|
|
|
464
469
|
const { selection } = this.editor.state;
|
|
465
470
|
const { $head } = selection;
|
|
466
471
|
const type = $head.parent.type.name;
|
|
467
|
-
return selection.empty && (type ===
|
|
472
|
+
return selection.empty && (type === "typedBlockTitle" || type === "typedBlockDescription") && $head.parentOffset === $head.parent.content.size;
|
|
468
473
|
},
|
|
469
474
|
"Mod-Shift-a": () => this.editor.commands.insertComposite(DEFAULT_KIND)
|
|
470
475
|
};
|
|
471
476
|
}
|
|
472
477
|
});
|
|
473
478
|
const CompositeTitleNode = Node.create({
|
|
474
|
-
name:
|
|
479
|
+
name: TYPED_BLOCK_TITLE,
|
|
475
480
|
priority: 101,
|
|
476
481
|
content: "inline*",
|
|
477
482
|
defining: true,
|
|
478
483
|
editorChrome: true,
|
|
479
484
|
abilities: { revokes: CHROME_REVOKES },
|
|
480
|
-
parseHTML: () => [
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
parseHTML: () => [
|
|
486
|
+
{
|
|
487
|
+
tag: `h2[data-type="${TITLE_DATA_TYPE}"]`,
|
|
488
|
+
priority: 60
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
tag: `h2[data-type="${OLD_HTML.title}"]`,
|
|
492
|
+
priority: 60
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
tag: `h2[data-type="${OLD_HTML.earliestTitle}"]`,
|
|
496
|
+
priority: 60
|
|
497
|
+
}
|
|
498
|
+
],
|
|
487
499
|
renderHTML: ({ HTMLAttributes }) => [
|
|
488
500
|
"h2",
|
|
489
501
|
mergeAttributes(HTMLAttributes, {
|
|
490
|
-
"data-type":
|
|
502
|
+
"data-type": TITLE_DATA_TYPE,
|
|
491
503
|
class: "composite-title"
|
|
492
504
|
}),
|
|
493
505
|
0
|
|
@@ -498,22 +510,29 @@ const CompositeTitleNode = Node.create({
|
|
|
498
510
|
}
|
|
499
511
|
});
|
|
500
512
|
const CompositeDescriptionNode = Node.create({
|
|
501
|
-
name:
|
|
513
|
+
name: TYPED_BLOCK_DESCRIPTION,
|
|
502
514
|
content: "inline*",
|
|
503
515
|
defining: true,
|
|
504
516
|
editorChrome: true,
|
|
505
517
|
abilities: { revokes: CHROME_REVOKES },
|
|
506
|
-
parseHTML: () => [
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
518
|
+
parseHTML: () => [
|
|
519
|
+
{
|
|
520
|
+
tag: `p[data-type="${DESCRIPTION_DATA_TYPE}"]`,
|
|
521
|
+
priority: 60
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
tag: `p[data-type="${OLD_HTML.description}"]`,
|
|
525
|
+
priority: 60
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
tag: `p[data-type="${OLD_HTML.earliestDescription}"]`,
|
|
529
|
+
priority: 60
|
|
530
|
+
}
|
|
531
|
+
],
|
|
513
532
|
renderHTML: ({ HTMLAttributes }) => [
|
|
514
533
|
"p",
|
|
515
534
|
mergeAttributes(HTMLAttributes, {
|
|
516
|
-
"data-type":
|
|
535
|
+
"data-type": DESCRIPTION_DATA_TYPE,
|
|
517
536
|
class: "composite-description"
|
|
518
537
|
}),
|
|
519
538
|
0
|
|
@@ -524,7 +543,7 @@ const CompositeDescriptionNode = Node.create({
|
|
|
524
543
|
}
|
|
525
544
|
});
|
|
526
545
|
const CompositeTagsNode = Node.create({
|
|
527
|
-
name:
|
|
546
|
+
name: TYPED_BLOCK_TAGS,
|
|
528
547
|
atom: true,
|
|
529
548
|
selectable: false,
|
|
530
549
|
draggable: false,
|
|
@@ -547,9 +566,13 @@ const CompositeTagsNode = Node.create({
|
|
|
547
566
|
},
|
|
548
567
|
renderHTML: (attrs) => ({ "data-tags": JSON.stringify(attrs.tags) })
|
|
549
568
|
} }),
|
|
550
|
-
parseHTML: () => [
|
|
569
|
+
parseHTML: () => [
|
|
570
|
+
{ tag: `div[data-type="${TAGS_DATA_TYPE}"]` },
|
|
571
|
+
{ tag: `div[data-type="${OLD_HTML.tags}"]` },
|
|
572
|
+
{ tag: `div[data-type="${OLD_HTML.earliestTags}"]` }
|
|
573
|
+
],
|
|
551
574
|
renderHTML: ({ HTMLAttributes }) => ["div", mergeAttributes(HTMLAttributes, {
|
|
552
|
-
"data-type":
|
|
575
|
+
"data-type": TAGS_DATA_TYPE,
|
|
553
576
|
class: "composite-tags"
|
|
554
577
|
})],
|
|
555
578
|
renderMarkdown: (node) => {
|
|
@@ -558,6 +581,6 @@ const CompositeTagsNode = Node.create({
|
|
|
558
581
|
}
|
|
559
582
|
});
|
|
560
583
|
//#endregion
|
|
561
|
-
export { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeTagsNode, CompositeTitleNode, compositeAround, compositeAt, compositeBasketsOf, compositeJSON
|
|
584
|
+
export { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeTagsNode, CompositeTitleNode, blockTypesOf, compositeAround, compositeAt, compositeBasketsOf, compositeJSON };
|
|
562
585
|
|
|
563
586
|
//# sourceMappingURL=nodes.js.map
|