@delali/web-editor 0.0.0-stage → 0.4.3
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 +46 -0
- package/LICENSE +201 -0
- package/README.md +167 -2
- package/dist/components/editor/chat-comment-effects.d.ts +2 -0
- package/dist/components/editor/chat-types.d.ts +20 -0
- package/dist/components/editor/collaboration/base-collaboration-plugin.d.ts +14 -0
- package/dist/components/editor/collaboration/collaboration-plugin.d.ts +6 -0
- package/dist/components/editor/collaboration/collaboration-session.d.ts +30 -0
- package/dist/components/editor/collaboration/collaboration-starter.d.ts +9 -0
- package/dist/components/editor/collaboration/editor-collaboration.d.ts +16 -0
- package/dist/components/editor/collaboration/editor-collaboration.js +293 -0
- package/dist/components/editor/collaboration/remote-cursor-overlay.d.ts +1 -0
- package/dist/components/editor/collaboration/shared-document.d.ts +18 -0
- package/dist/components/editor/create-editor-plugins.d.ts +3 -0
- package/dist/components/editor/create-editor-plugins.js +25243 -0
- package/dist/components/editor/create-viewer-plugins.d.ts +3 -0
- package/dist/components/editor/editor-base-kit.d.ts +329 -0
- package/dist/components/editor/editor-base-kit.js +3136 -0
- package/dist/components/editor/editor-config.d.ts +14 -0
- package/dist/components/editor/editor-config.js +145 -0
- package/dist/components/editor/editor-kit.d.ts +3978 -0
- package/dist/components/editor/editor-kit.js +18820 -0
- package/dist/components/editor/plate-types.d.ts +99 -0
- package/dist/components/editor/plugins/accordion-group-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/accordion-group-kit.d.ts +3 -0
- package/dist/components/editor/plugins/accordion-types.d.ts +14 -0
- package/dist/components/editor/plugins/ai-kit.d.ts +248 -0
- package/dist/components/editor/plugins/align-base-kit.d.ts +3 -0
- package/dist/components/editor/plugins/api-doc/expandable-base-kit.d.ts +24 -0
- package/dist/components/editor/plugins/api-doc/expandable-kit.d.ts +29 -0
- package/dist/components/editor/plugins/api-doc/expandable-types.d.ts +7 -0
- package/dist/components/editor/plugins/api-doc/panel-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/api-doc/panel-kit.d.ts +3 -0
- package/dist/components/editor/plugins/api-doc/panel-types.d.ts +7 -0
- package/dist/components/editor/plugins/api-doc/response-field-base-kit.d.ts +3 -0
- package/dist/components/editor/plugins/api-doc/response-field-kit.d.ts +4 -0
- package/dist/components/editor/plugins/api-doc/response-field-types.d.ts +17 -0
- package/dist/components/editor/plugins/autoformat-kit.d.ts +1 -0
- package/dist/components/editor/plugins/badge-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/badge-kit.d.ts +3 -0
- package/dist/components/editor/plugins/badge-types.d.ts +24 -0
- package/dist/components/editor/plugins/banner-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/banner-kit.d.ts +3 -0
- package/dist/components/editor/plugins/banner-types.d.ts +15 -0
- package/dist/components/editor/plugins/basic-blocks-base-kit.d.ts +5 -0
- package/dist/components/editor/plugins/basic-blocks-kit.d.ts +5 -0
- package/dist/components/editor/plugins/basic-marks-base-kit.d.ts +19 -0
- package/dist/components/editor/plugins/basic-marks-kit.d.ts +35 -0
- package/dist/components/editor/plugins/basic-nodes-kit.d.ts +21 -0
- package/dist/components/editor/plugins/block-menu-kit.d.ts +165 -0
- package/dist/components/editor/plugins/block-placeholder-kit.d.ts +14 -0
- package/dist/components/editor/plugins/block-selection-kit.d.ts +137 -0
- package/dist/components/editor/plugins/callout-base-kit.d.ts +20 -0
- package/dist/components/editor/plugins/callout-kit.d.ts +20 -0
- package/dist/components/editor/plugins/callout-types.d.ts +18 -0
- package/dist/components/editor/plugins/card-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/card-kit.d.ts +3 -0
- package/dist/components/editor/plugins/card-types.d.ts +14 -0
- package/dist/components/editor/plugins/caret-placement-kit.d.ts +8 -0
- package/dist/components/editor/plugins/code-block-base-kit.d.ts +7 -0
- package/dist/components/editor/plugins/code-block-input-rule-gate.d.ts +4 -0
- package/dist/components/editor/plugins/code-block-kit.d.ts +7 -0
- package/dist/components/editor/plugins/color-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/color-kit.d.ts +3 -0
- package/dist/components/editor/plugins/color-types.d.ts +18 -0
- package/dist/components/editor/plugins/column-base-kit.d.ts +1 -0
- package/dist/components/editor/plugins/column-kit.d.ts +1 -0
- package/dist/components/editor/plugins/comment-base-kit.d.ts +47 -0
- package/dist/components/editor/plugins/comment-kit.d.ts +71 -0
- package/dist/components/editor/plugins/copilot-kit.d.ts +72 -0
- package/dist/components/editor/plugins/cursor-overlay-kit.d.ts +11 -0
- package/dist/components/editor/plugins/date-base-kit.d.ts +19 -0
- package/dist/components/editor/plugins/date-kit.d.ts +19 -0
- package/dist/components/editor/plugins/discussion-kit.d.ts +31 -0
- package/dist/components/editor/plugins/dnd-kit.d.ts +20 -0
- package/dist/components/editor/plugins/docx-kit.d.ts +1 -0
- package/dist/components/editor/plugins/emoji-kit.d.ts +9 -0
- package/dist/components/editor/plugins/exit-break-kit.d.ts +4 -0
- package/dist/components/editor/plugins/floating-toolbar-kit.d.ts +1 -0
- package/dist/components/editor/plugins/font-base-kit.d.ts +9 -0
- package/dist/components/editor/plugins/font-kit.d.ts +9 -0
- package/dist/components/editor/plugins/fraction-input-rule.d.ts +12 -0
- package/dist/components/editor/plugins/frame-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/frame-kit.d.ts +3 -0
- package/dist/components/editor/plugins/frame-types.d.ts +10 -0
- package/dist/components/editor/plugins/icon-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/icon-kit.d.ts +3 -0
- package/dist/components/editor/plugins/icon-types.d.ts +15 -0
- package/dist/components/editor/plugins/indent-base-kit.d.ts +1 -0
- package/dist/components/editor/plugins/indent-kit.d.ts +5 -0
- package/dist/components/editor/plugins/input-rule-gate.d.ts +8 -0
- package/dist/components/editor/plugins/line-height-base-kit.d.ts +3 -0
- package/dist/components/editor/plugins/link-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/link-kit.d.ts +89 -0
- package/dist/components/editor/plugins/list-base-kit.d.ts +1 -0
- package/dist/components/editor/plugins/list-kit.d.ts +16 -0
- package/dist/components/editor/plugins/mark-input-rule-gate.d.ts +2 -0
- package/dist/components/editor/plugins/markdown-kit.d.ts +19 -0
- package/dist/components/editor/plugins/math-base-kit.d.ts +9 -0
- package/dist/components/editor/plugins/math-kit.d.ts +9 -0
- package/dist/components/editor/plugins/media-base-kit.d.ts +25 -0
- package/dist/components/editor/plugins/media-kit.d.ts +38 -0
- package/dist/components/editor/plugins/mention-base-kit.d.ts +11 -0
- package/dist/components/editor/plugins/mention-kit.d.ts +11 -0
- package/dist/components/editor/plugins/mermaid-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/mermaid-kit.d.ts +3 -0
- package/dist/components/editor/plugins/mermaid-types.d.ts +14 -0
- package/dist/components/editor/plugins/shared/color-selector.d.ts +9 -0
- package/dist/components/editor/plugins/shared/component-popover.d.ts +12 -0
- package/dist/components/editor/plugins/slash-kit.d.ts +1 -0
- package/dist/components/editor/plugins/steps-base-kit.d.ts +3 -0
- package/dist/components/editor/plugins/steps-kit.d.ts +4 -0
- package/dist/components/editor/plugins/steps-types.d.ts +18 -0
- package/dist/components/editor/plugins/suggestion-base-kit.d.ts +32 -0
- package/dist/components/editor/plugins/suggestion-kit.d.ts +53 -0
- package/dist/components/editor/plugins/tabbed-code-block-base-kit.d.ts +32 -0
- package/dist/components/editor/plugins/tabbed-code-block-kit.d.ts +33 -0
- package/dist/components/editor/plugins/tabbed-code-block-types.d.ts +29 -0
- package/dist/components/editor/plugins/table-base-kit.d.ts +94 -0
- package/dist/components/editor/plugins/table-kit.d.ts +162 -0
- package/dist/components/editor/plugins/tabs-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/tabs-kit.d.ts +3 -0
- package/dist/components/editor/plugins/tabs-types.d.ts +14 -0
- package/dist/components/editor/plugins/text-substitution-input-rule-gate.d.ts +4 -0
- package/dist/components/editor/plugins/tiles-base-kit.d.ts +3 -0
- package/dist/components/editor/plugins/tiles-kit.d.ts +4 -0
- package/dist/components/editor/plugins/tiles-types.d.ts +16 -0
- package/dist/components/editor/plugins/toc-base-kit.d.ts +1 -0
- package/dist/components/editor/plugins/toc-kit.d.ts +5 -0
- package/dist/components/editor/plugins/todo-to-bullet-kit.d.ts +7 -0
- package/dist/components/editor/plugins/toggle-base-kit.d.ts +12 -0
- package/dist/components/editor/plugins/toggle-kit.d.ts +16 -0
- package/dist/components/editor/plugins/tooltip-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/tooltip-html.d.ts +27 -0
- package/dist/components/editor/plugins/tooltip-kit.d.ts +3 -0
- package/dist/components/editor/plugins/tooltip-types.d.ts +10 -0
- package/dist/components/editor/plugins/tree-base-kit.d.ts +2 -0
- package/dist/components/editor/plugins/tree-kit.d.ts +3 -0
- package/dist/components/editor/plugins/tree-types.d.ts +26 -0
- package/dist/components/editor/plugins/typed-conversion-options.d.ts +13 -0
- package/dist/components/editor/plugins/update-base-kit.d.ts +1 -0
- package/dist/components/editor/plugins/update-kit.d.ts +4 -0
- package/dist/components/editor/plugins/update-types.d.ts +19 -0
- package/dist/components/editor/plugins/web-address-text.d.ts +1 -0
- package/dist/components/editor/transforms.d.ts +8 -0
- package/dist/components/editor/use-chat.d.ts +3 -0
- package/dist/components/editor/use-chat.js +3315 -0
- package/dist/components/editor/use-typed-conversion-options.d.ts +3 -0
- package/dist/components/editor/version-history/chunk-node.d.ts +7 -0
- package/dist/components/editor/version-history/chunk-plugin.d.ts +6 -0
- package/dist/components/editor/version-history/collapse-blocks-without-diff.d.ts +4 -0
- package/dist/components/editor/version-history/diff-node.d.ts +9 -0
- package/dist/components/editor/version-history/diff-plate.d.ts +7 -0
- package/dist/components/editor/version-history/diff-plugin.d.ts +8 -0
- package/dist/components/editor/version-history/index.d.ts +9 -0
- package/dist/components/editor/version-history/index.js +19218 -0
- package/dist/components/editor/version-history/use-object-version.d.ts +1 -0
- package/dist/components/editor/version-history/use-reset-editor-on-change.d.ts +7 -0
- package/dist/components/editor/version-history/version-plate.d.ts +7 -0
- package/dist/components/editor/web-editor.d.ts +6 -0
- package/dist/components/editor/web-editor.js +27334 -0
- package/dist/context/editor-adapter-context.d.ts +13 -0
- package/dist/context/editor-adapter-context.js +124 -0
- package/dist/context/editor-adapter.d.ts +262 -0
- package/dist/context/editor-toc-context.d.ts +16 -0
- package/dist/context/heading-slug-context.d.ts +11 -0
- package/dist/context/link-resolution-context.d.ts +24 -0
- package/dist/context/link-resolution-store.d.ts +20 -0
- package/dist/context/portal-container.d.ts +7 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +10 -0
- package/dist/hooks/use-dark-mode.d.ts +1 -0
- package/dist/hooks/use-debounce-callback.d.ts +108 -0
- package/dist/hooks/use-debounce.d.ts +1 -0
- package/dist/hooks/use-is-touch-device.d.ts +1 -0
- package/dist/hooks/use-lock-scroll.d.ts +1 -0
- package/dist/hooks/use-media-query.d.ts +2 -0
- package/dist/hooks/use-mounted.d.ts +6 -0
- package/dist/hooks/use-on-click-outside.d.ts +26 -0
- package/dist/hooks/use-return-focus-to-editor-on-input-removal.d.ts +3 -0
- package/dist/hooks/use-shield-input-selection-from-editor.d.ts +3 -0
- package/dist/hooks/use-upload-file.d.ts +25 -0
- package/dist/hooks/use-upload-file.js +129 -0
- package/dist/lib/accepted-file-types.d.ts +1 -0
- package/dist/lib/block-features.d.ts +11 -0
- package/dist/lib/comment-mark-strip.d.ts +24 -0
- package/dist/lib/comment-mark-strip.js +56 -0
- package/dist/lib/download-file.d.ts +1 -0
- package/dist/lib/editor-element-path.d.ts +8 -0
- package/dist/lib/extract-headings.d.ts +13 -0
- package/dist/lib/extract-headings.js +79 -0
- package/dist/lib/file-size-limit.d.ts +7 -0
- package/dist/lib/html-serialize-hast.d.ts +18 -0
- package/dist/lib/html-serialize-rules.d.ts +15 -0
- package/dist/lib/html-serialize-utils.d.ts +24 -0
- package/dist/lib/html-serialize-utils.js +392 -0
- package/dist/lib/line-marking-context.d.ts +13 -0
- package/dist/lib/line-marking.d.ts +47 -0
- package/dist/lib/list-html.d.ts +30 -0
- package/dist/lib/markdown-joiner-transform.d.ts +31 -0
- package/dist/lib/markdown-utils.d.ts +4 -0
- package/dist/lib/markdown-utils.js +25314 -0
- package/dist/lib/mdx/mdx-archetype-rules.d.ts +2 -0
- package/dist/lib/mdx/mdx-attribute-codec.d.ts +23 -0
- package/dist/lib/mdx/mdx-color-rules.d.ts +2 -0
- package/dist/lib/mdx/mdx-component-rules.d.ts +2 -0
- package/dist/lib/mdx/mdx-mermaid-rules.d.ts +10 -0
- package/dist/lib/mdx/mdx-reference-rules.d.ts +11 -0
- package/dist/lib/mdx/mdx-round-trip.d.ts +3 -0
- package/dist/lib/mdx/mdx-round-trip.js +1397 -0
- package/dist/lib/mdx/mdx-rule-builder.d.ts +45 -0
- package/dist/lib/mdx/mdx-server-plugins.d.ts +8 -0
- package/dist/lib/mdx/mdx-tabbed-code-rules.d.ts +2 -0
- package/dist/lib/mdx/mdx-tabs-rules.d.ts +2 -0
- package/dist/lib/mdx/mdx-toggle-rules.d.ts +9 -0
- package/dist/lib/mdx/mdx-tree-rules.d.ts +2 -0
- package/dist/lib/media-html.d.ts +121 -0
- package/dist/lib/paragraph-html.d.ts +26 -0
- package/dist/lib/server-plugins.d.ts +199 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +25 -0
- package/dist/lib/video-embeds.d.ts +9 -0
- package/dist/styles.css +6726 -0
- package/dist/types/editor.d.ts +161 -0
- package/dist/types/editor.js +77 -0
- package/dist/ui/accordion-group-node-static.d.ts +11 -0
- package/dist/ui/accordion-group-node.d.ts +10 -0
- package/dist/ui/ai-chat-editor.d.ts +4 -0
- package/dist/ui/ai-menu.d.ts +2 -0
- package/dist/ui/ai-node.d.ts +3 -0
- package/dist/ui/ai-toolbar-button.d.ts +3 -0
- package/dist/ui/alert-dialog.d.ts +20 -0
- package/dist/ui/api-doc/expandable-node-static.d.ts +4 -0
- package/dist/ui/api-doc/expandable-node.d.ts +3 -0
- package/dist/ui/api-doc/expandable-settings.d.ts +17 -0
- package/dist/ui/api-doc/panel-node-static.d.ts +3 -0
- package/dist/ui/api-doc/panel-node.d.ts +3 -0
- package/dist/ui/api-doc/response-field-item-node-static.d.ts +3 -0
- package/dist/ui/api-doc/response-field-item-node.d.ts +3 -0
- package/dist/ui/api-doc/response-field-node-static.d.ts +9 -0
- package/dist/ui/api-doc/response-field-node.d.ts +9 -0
- package/dist/ui/avatar.d.ts +16 -0
- package/dist/ui/badge-node-static.d.ts +3 -0
- package/dist/ui/badge-node.d.ts +3 -0
- package/dist/ui/badge-settings-options.d.ts +24 -0
- package/dist/ui/badge-settings.d.ts +19 -0
- package/dist/ui/badge.d.ts +9 -0
- package/dist/ui/banner-node-static.d.ts +4 -0
- package/dist/ui/banner-node.d.ts +3 -0
- package/dist/ui/block-context-menu.d.ts +8 -0
- package/dist/ui/block-discussion.d.ts +3 -0
- package/dist/ui/block-draggable.d.ts +2 -0
- package/dist/ui/block-list-static.d.ts +2 -0
- package/dist/ui/block-list.d.ts +2 -0
- package/dist/ui/block-menu.d.ts +167 -0
- package/dist/ui/block-selection.d.ts +5 -0
- package/dist/ui/block-suggestion.d.ts +17 -0
- package/dist/ui/blockquote-node-static.d.ts +2 -0
- package/dist/ui/blockquote-node.d.ts +2 -0
- package/dist/ui/button.d.ts +81 -0
- package/dist/ui/calendar.d.ts +5 -0
- package/dist/ui/callout-detail-settings.d.ts +15 -0
- package/dist/ui/callout-icon.d.ts +9 -0
- package/dist/ui/callout-node-static.d.ts +2 -0
- package/dist/ui/callout-node.d.ts +3 -0
- package/dist/ui/callout-settings.d.ts +19 -0
- package/dist/ui/callout-type-button.d.ts +9 -0
- package/dist/ui/caption.d.ts +72 -0
- package/dist/ui/card-element-actions.d.ts +7 -0
- package/dist/ui/card-icon-settings.d.ts +11 -0
- package/dist/ui/card-node-static.d.ts +3 -0
- package/dist/ui/card-node.d.ts +3 -0
- package/dist/ui/card-settings.d.ts +24 -0
- package/dist/ui/card-title-row.d.ts +14 -0
- package/dist/ui/checkbox.d.ts +4 -0
- package/dist/ui/code-block-line-marking-form.d.ts +9 -0
- package/dist/ui/code-block-line-marking-input.d.ts +8 -0
- package/dist/ui/code-block-line-marking-popover.d.ts +12 -0
- package/dist/ui/code-block-line-marking-state.d.ts +11 -0
- package/dist/ui/code-block-node-static.d.ts +10 -0
- package/dist/ui/code-block-node.d.ts +5 -0
- package/dist/ui/code-line-selection-toolbar.d.ts +10 -0
- package/dist/ui/code-line-wrapper.d.ts +22 -0
- package/dist/ui/code-node-static.d.ts +2 -0
- package/dist/ui/code-node.d.ts +2 -0
- package/dist/ui/collapsible.d.ts +6 -0
- package/dist/ui/color-copy-icon.d.ts +9 -0
- package/dist/ui/color-element-actions.d.ts +7 -0
- package/dist/ui/color-item-settings.d.ts +11 -0
- package/dist/ui/color-node-static.d.ts +3 -0
- package/dist/ui/color-node.d.ts +3 -0
- package/dist/ui/color-settings.d.ts +18 -0
- package/dist/ui/color-swatch-editable.d.ts +12 -0
- package/dist/ui/color-table-row-editable.d.ts +10 -0
- package/dist/ui/column-node-static.d.ts +4 -0
- package/dist/ui/column-node.d.ts +3 -0
- package/dist/ui/command.d.ts +25 -0
- package/dist/ui/comment-node-static.d.ts +3 -0
- package/dist/ui/comment-node.d.ts +3 -0
- package/dist/ui/comment-toolbar-button.d.ts +1 -0
- package/dist/ui/comment.d.ts +45 -0
- package/dist/ui/cursor-overlay.d.ts +4 -0
- package/dist/ui/date-node-static.d.ts +2 -0
- package/dist/ui/date-node.d.ts +2 -0
- package/dist/ui/dialog.d.ts +90 -0
- package/dist/ui/dropdown-menu.d.ts +35 -0
- package/dist/ui/editor-inspector-panel.d.ts +6 -0
- package/dist/ui/editor-static.d.ts +8 -0
- package/dist/ui/editor.d.ts +15 -0
- package/dist/ui/emoji-node.d.ts +3 -0
- package/dist/ui/emoji-toolbar-button.d.ts +16 -0
- package/dist/ui/equation-node-static.d.ts +4 -0
- package/dist/ui/equation-node.d.ts +5 -0
- package/dist/ui/equation-toolbar-button.d.ts +2 -0
- package/dist/ui/floating-discussion.d.ts +8 -0
- package/dist/ui/floating-toolbar-buttons.d.ts +1 -0
- package/dist/ui/floating-toolbar.d.ts +6 -0
- package/dist/ui/font-color-toolbar-button.d.ts +15 -0
- package/dist/ui/frame-node-static.d.ts +3 -0
- package/dist/ui/frame-node.d.ts +3 -0
- package/dist/ui/frame-settings.d.ts +19 -0
- package/dist/ui/ghost-text.d.ts +1 -0
- package/dist/ui/heading-node-static.d.ts +10 -0
- package/dist/ui/heading-node.d.ts +14 -0
- package/dist/ui/highlight-node-static.d.ts +2 -0
- package/dist/ui/highlight-node.d.ts +2 -0
- package/dist/ui/hover-card.d.ts +6 -0
- package/dist/ui/hr-node-static.d.ts +2 -0
- package/dist/ui/hr-node.d.ts +2 -0
- package/dist/ui/icon-node-static.d.ts +3 -0
- package/dist/ui/icon-node.d.ts +3 -0
- package/dist/ui/icon-picker.d.ts +16 -0
- package/dist/ui/icon-settings.d.ts +17 -0
- package/dist/ui/inline-combobox.d.ts +38 -0
- package/dist/ui/input.d.ts +7 -0
- package/dist/ui/kbd-node-static.d.ts +2 -0
- package/dist/ui/kbd-node.d.ts +2 -0
- package/dist/ui/label.d.ts +8 -0
- package/dist/ui/link-node-static.d.ts +11 -0
- package/dist/ui/link-node.d.ts +11 -0
- package/dist/ui/link-reference.d.ts +39 -0
- package/dist/ui/link-reference.js +84 -0
- package/dist/ui/link-search-panel.d.ts +5 -0
- package/dist/ui/link-toolbar-button.d.ts +3 -0
- package/dist/ui/link-toolbar-edit-command.d.ts +7 -0
- package/dist/ui/link-toolbar-shared.d.ts +18 -0
- package/dist/ui/link-toolbar.d.ts +1 -0
- package/dist/ui/mark-toolbar-button.d.ts +6 -0
- package/dist/ui/media-align-button.d.ts +5 -0
- package/dist/ui/media-audio-node-static.d.ts +3 -0
- package/dist/ui/media-audio-node.d.ts +2 -0
- package/dist/ui/media-card.d.ts +11 -0
- package/dist/ui/media-embed-node-static.d.ts +6 -0
- package/dist/ui/media-embed-node.d.ts +2 -0
- package/dist/ui/media-file-display.d.ts +11 -0
- package/dist/ui/media-file-mode-dropdown.d.ts +10 -0
- package/dist/ui/media-file-node-static.d.ts +3 -0
- package/dist/ui/media-file-node.d.ts +2 -0
- package/dist/ui/media-hint-icon-picker.d.ts +5 -0
- package/dist/ui/media-hint-settings.d.ts +2 -0
- package/dist/ui/media-image-lightbox.d.ts +17 -0
- package/dist/ui/media-image-node-static.d.ts +6 -0
- package/dist/ui/media-image-node.d.ts +7 -0
- package/dist/ui/media-placeholder-node.d.ts +3 -0
- package/dist/ui/media-preview-dialog.d.ts +12 -0
- package/dist/ui/media-toolbar.d.ts +3 -0
- package/dist/ui/media-upload-toast.d.ts +1 -0
- package/dist/ui/media-video-node-static.d.ts +6 -0
- package/dist/ui/media-video-node.d.ts +2 -0
- package/dist/ui/member-profile-card.d.ts +17 -0
- package/dist/ui/mention-document-element.d.ts +5 -0
- package/dist/ui/mention-document-hover-card.d.ts +17 -0
- package/dist/ui/mention-document-link.d.ts +13 -0
- package/dist/ui/mention-element.d.ts +5 -0
- package/dist/ui/mention-input-element.d.ts +2 -0
- package/dist/ui/mention-node-static.d.ts +7 -0
- package/dist/ui/mention-page-combobox-group.d.ts +8 -0
- package/dist/ui/mention-people-combobox-group.d.ts +8 -0
- package/dist/ui/menu.d.ts +103 -0
- package/dist/ui/mermaid-node-static.d.ts +4 -0
- package/dist/ui/mermaid-node.d.ts +3 -0
- package/dist/ui/more-toolbar-button.d.ts +3 -0
- package/dist/ui/paragraph-node-static.d.ts +2 -0
- package/dist/ui/paragraph-node.d.ts +2 -0
- package/dist/ui/popover.d.ts +11 -0
- package/dist/ui/progress.d.ts +3 -0
- package/dist/ui/resize-handle.d.ts +15 -0
- package/dist/ui/select.d.ts +13 -0
- package/dist/ui/separator.d.ts +8 -0
- package/dist/ui/slash-node.d.ts +20 -0
- package/dist/ui/smart-link-clipboard.d.ts +1 -0
- package/dist/ui/smart-link-copy-button.d.ts +6 -0
- package/dist/ui/smart-link-mode-dropdown.d.ts +9 -0
- package/dist/ui/smart-link-toolbar.d.ts +17 -0
- package/dist/ui/smart-link-view.d.ts +23 -0
- package/dist/ui/smart-link.d.ts +43 -0
- package/dist/ui/spinner.d.ts +7 -0
- package/dist/ui/step-node-static.d.ts +3 -0
- package/dist/ui/step-node.d.ts +3 -0
- package/dist/ui/step-settings.d.ts +19 -0
- package/dist/ui/steps-node-static.d.ts +10 -0
- package/dist/ui/steps-node.d.ts +10 -0
- package/dist/ui/suggestion-node-static.d.ts +3 -0
- package/dist/ui/suggestion-node.d.ts +6 -0
- package/dist/ui/suggestion-toolbar-button.d.ts +1 -0
- package/dist/ui/switch.d.ts +4 -0
- package/dist/ui/tabbed-code-block-actions.d.ts +24 -0
- package/dist/ui/tabbed-code-block-header.d.ts +23 -0
- package/dist/ui/tabbed-code-block-language-selector.d.ts +7 -0
- package/dist/ui/tabbed-code-block-languages.d.ts +6 -0
- package/dist/ui/tabbed-code-block-node-static.d.ts +4 -0
- package/dist/ui/tabbed-code-block-node.d.ts +4 -0
- package/dist/ui/tabbed-code-block-settings.d.ts +18 -0
- package/dist/ui/tabbed-code-block-sync.d.ts +10 -0
- package/dist/ui/tabbed-code-block-tab-dropdown.d.ts +10 -0
- package/dist/ui/tabbed-code-block-tab-strip.d.ts +27 -0
- package/dist/ui/tabbed-code-block-tab-trigger.d.ts +14 -0
- package/dist/ui/tabbed-code-block-utils.d.ts +9 -0
- package/dist/ui/table-icons.d.ts +7 -0
- package/dist/ui/table-node-static.d.ts +9 -0
- package/dist/ui/table-node.d.ts +9 -0
- package/dist/ui/tabs-node-static.d.ts +4 -0
- package/dist/ui/tabs-node.d.ts +3 -0
- package/dist/ui/tabs.d.ts +10 -0
- package/dist/ui/textarea.d.ts +10 -0
- package/dist/ui/tile-node-static.d.ts +3 -0
- package/dist/ui/tile-node.d.ts +3 -0
- package/dist/ui/tile-settings.d.ts +18 -0
- package/dist/ui/tiles-node-static.d.ts +3 -0
- package/dist/ui/tiles-node.d.ts +3 -0
- package/dist/ui/toc-node-static.d.ts +2 -0
- package/dist/ui/toc-node.d.ts +2 -0
- package/dist/ui/toc-sidebar.d.ts +6 -0
- package/dist/ui/toc-state-sync.d.ts +5 -0
- package/dist/ui/toggle-node-static.d.ts +3 -0
- package/dist/ui/toggle-node-views.d.ts +35 -0
- package/dist/ui/toggle-node.d.ts +3 -0
- package/dist/ui/toggle-settings.d.ts +23 -0
- package/dist/ui/toggle.d.ts +8 -0
- package/dist/ui/toolbar.d.ts +37 -0
- package/dist/ui/tooltip-node-static.d.ts +3 -0
- package/dist/ui/tooltip-node.d.ts +3 -0
- package/dist/ui/tooltip-preview-content.d.ts +6 -0
- package/dist/ui/tooltip-settings.d.ts +21 -0
- package/dist/ui/tooltip-toolbar-button.d.ts +3 -0
- package/dist/ui/tooltip.d.ts +19 -0
- package/dist/ui/tree-context-value.d.ts +22 -0
- package/dist/ui/tree-context.d.ts +32 -0
- package/dist/ui/tree-file-node-static.d.ts +8 -0
- package/dist/ui/tree-file-node.d.ts +11 -0
- package/dist/ui/tree-folder-node-static.d.ts +9 -0
- package/dist/ui/tree-folder-node.d.ts +12 -0
- package/dist/ui/tree-item-utils.d.ts +11 -0
- package/dist/ui/tree-items-list.d.ts +11 -0
- package/dist/ui/tree-node-events.d.ts +19 -0
- package/dist/ui/tree-node-state.d.ts +14 -0
- package/dist/ui/tree-node-static.d.ts +12 -0
- package/dist/ui/tree-node.d.ts +5 -0
- package/dist/ui/tree-root-actions.d.ts +11 -0
- package/dist/ui/tree-settings.d.ts +18 -0
- package/dist/ui/turn-into-toolbar-button.d.ts +129 -0
- package/dist/ui/update-display-tags.d.ts +5 -0
- package/dist/ui/update-node-static.d.ts +2 -0
- package/dist/ui/update-node.d.ts +3 -0
- package/dist/ui/update-rss-settings.d.ts +9 -0
- package/dist/ui/update-settings.d.ts +21 -0
- package/dist/ui/update-tags-settings.d.ts +8 -0
- package/dist/ui/updates-node-static.d.ts +2 -0
- package/dist/ui/updates-node.d.ts +2 -0
- package/dist/ui/use-member-profile.d.ts +22 -0
- package/dist/ui/use-placeholder-max-file-size.d.ts +3 -0
- package/dist/vendor/slate-yjs-core.d.ts +1 -0
- package/dist/vendor/slate-yjs-core.js +2 -0
- package/dist/vendor/y-protocols-awareness.d.ts +1 -0
- package/dist/vendor/y-protocols-awareness.js +2 -0
- package/dist/vendor/yjs.d.ts +1 -0
- package/dist/vendor/yjs.js +2 -0
- package/package.json +255 -4
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/lib/html-serialize-utils.ts
|
|
22
|
+
import { convertNodesSerialize as convertNodesSerialize2, getMergedOptionsSerialize } from "@platejs/markdown";
|
|
23
|
+
import { createSlateEditor } from "platejs";
|
|
24
|
+
import rehypeStringify from "rehype-stringify";
|
|
25
|
+
import remarkRehype from "remark-rehype";
|
|
26
|
+
import { unified } from "unified";
|
|
27
|
+
|
|
28
|
+
// src/lib/html-serialize-hast.ts
|
|
29
|
+
var hastElement = (tagName, properties, children = []) => ({
|
|
30
|
+
type: "element",
|
|
31
|
+
tagName,
|
|
32
|
+
properties,
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
var hastText = (value) => ({ type: "text", value });
|
|
36
|
+
var INLINE_TAGS = /* @__PURE__ */ new Set(["u", "sub", "sup", "kbd", "mark", "span"]);
|
|
37
|
+
var BREAK_HTML = /^\s*<br\s*\/?>\s*$/;
|
|
38
|
+
var readStyle = (attributes) => {
|
|
39
|
+
for (const attribute of attributes) {
|
|
40
|
+
if (typeof attribute === "object" && attribute !== null && "name" in attribute && attribute.name === "style" && "value" in attribute && typeof attribute.value === "string") {
|
|
41
|
+
return attribute.value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return void 0;
|
|
45
|
+
};
|
|
46
|
+
var jsxElementToHast = (state, node) => {
|
|
47
|
+
const children = state.all(node);
|
|
48
|
+
if (node.type !== "mdxJsxTextElement" || !node.name || !INLINE_TAGS.has(node.name)) return children;
|
|
49
|
+
return hastElement(node.name, { style: readStyle(node.attributes) }, children);
|
|
50
|
+
};
|
|
51
|
+
var HTML_HANDLERS = {
|
|
52
|
+
break: () => hastElement("br", {}),
|
|
53
|
+
html: (_state, node) => BREAK_HTML.test(node.value) ? hastElement("br", {}) : hastText(node.value),
|
|
54
|
+
mdxJsxFlowElement: jsxElementToHast,
|
|
55
|
+
mdxJsxTextElement: jsxElementToHast
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/lib/html-serialize-rules.ts
|
|
59
|
+
import { convertNodesSerialize, defaultRules } from "@platejs/markdown";
|
|
60
|
+
import { ElementApi, KEYS, NodeApi, TextApi } from "platejs";
|
|
61
|
+
|
|
62
|
+
// src/lib/video-embeds.ts
|
|
63
|
+
import { parseVideoUrl } from "@platejs/media";
|
|
64
|
+
var LOOM_PROVIDER = "loom";
|
|
65
|
+
var LOOM_VIDEO_PATH = /^\/(?:share|embed)\/([0-9a-f]{32})\/?$/;
|
|
66
|
+
var LOOM_HOSTS = /* @__PURE__ */ new Set(["loom.com", "www.loom.com"]);
|
|
67
|
+
var parseLoomUrl = (url) => {
|
|
68
|
+
var _a;
|
|
69
|
+
if (!URL.canParse(url)) return void 0;
|
|
70
|
+
const parsed = new URL(url);
|
|
71
|
+
if (parsed.protocol !== "https:" || !LOOM_HOSTS.has(parsed.hostname)) return void 0;
|
|
72
|
+
const id = (_a = LOOM_VIDEO_PATH.exec(parsed.pathname)) == null ? void 0 : _a[1];
|
|
73
|
+
if (id === void 0) return void 0;
|
|
74
|
+
const embedUrl = `https://www.loom.com/embed/${id}`;
|
|
75
|
+
return {
|
|
76
|
+
id,
|
|
77
|
+
provider: LOOM_PROVIDER,
|
|
78
|
+
sourceKind: "url",
|
|
79
|
+
sourceUrl: embedUrl === url ? void 0 : url,
|
|
80
|
+
url: embedUrl
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var parseVideoEmbedUrl = (url) => {
|
|
84
|
+
var _a;
|
|
85
|
+
return (_a = parseVideoUrl(url)) != null ? _a : parseLoomUrl(url);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/lib/html-serialize-rules.ts
|
|
89
|
+
var MEDIA_ALIGNS = ["left", "center", "right"];
|
|
90
|
+
var htmlElementNode = (hName, hProperties, children, hChildren) => ({
|
|
91
|
+
type: "plateHtmlElement",
|
|
92
|
+
children,
|
|
93
|
+
data: hChildren ? { hName, hProperties, hChildren } : { hName, hProperties }
|
|
94
|
+
});
|
|
95
|
+
var readString = (node, key) => {
|
|
96
|
+
const value = node[key];
|
|
97
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
98
|
+
};
|
|
99
|
+
var readWidth = (node) => {
|
|
100
|
+
const { width } = node;
|
|
101
|
+
return typeof width === "number" && width > 0 ? Math.round(width) : void 0;
|
|
102
|
+
};
|
|
103
|
+
var readAlign = (node) => MEDIA_ALIGNS.find((align) => align === node.align);
|
|
104
|
+
var readCaption = (node) => {
|
|
105
|
+
const { caption } = node;
|
|
106
|
+
if (!Array.isArray(caption)) return "";
|
|
107
|
+
return caption.map((child) => NodeApi.isNode(child) ? NodeApi.string(child) : "").join("");
|
|
108
|
+
};
|
|
109
|
+
var readSpan = (cell, key, attribute) => {
|
|
110
|
+
const { attributes } = cell;
|
|
111
|
+
const fromAttribute = typeof attributes === "object" && attributes !== null && attribute in attributes ? Number(attributes[attribute]) : void 0;
|
|
112
|
+
const span = Number(cell[key]) || fromAttribute || 1;
|
|
113
|
+
return span > 1 ? span : void 0;
|
|
114
|
+
};
|
|
115
|
+
var readInlineCellContent = (cell, blocks) => {
|
|
116
|
+
const [first] = blocks;
|
|
117
|
+
const isSingleParagraph = blocks.length === 1 && (first == null ? void 0 : first.type) === "paragraph" && "children" in first && Array.isArray(first.children);
|
|
118
|
+
return isSingleParagraph && !NodeApi.string(cell).includes("\n") ? first.children : void 0;
|
|
119
|
+
};
|
|
120
|
+
var serializeCell = (cell, options) => {
|
|
121
|
+
var _a;
|
|
122
|
+
const blocks = convertNodesSerialize(cell.children, __spreadProps(__spreadValues({}, options), { preserveEmptyParagraphs: false }));
|
|
123
|
+
return htmlElementNode(
|
|
124
|
+
cell.type === KEYS.th ? "th" : "td",
|
|
125
|
+
{ colSpan: readSpan(cell, "colSpan", "colspan"), rowSpan: readSpan(cell, "rowSpan", "rowspan") },
|
|
126
|
+
(_a = readInlineCellContent(cell, blocks)) != null ? _a : blocks
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
var getElements = (node) => node.children.filter((child) => ElementApi.isElement(child));
|
|
130
|
+
var isHeaderRow = (row) => {
|
|
131
|
+
const cells = getElements(row);
|
|
132
|
+
return cells.length > 0 && cells.every((cell) => cell.type === KEYS.th);
|
|
133
|
+
};
|
|
134
|
+
var countHeaderRows = (rows) => {
|
|
135
|
+
const firstBodyRow = rows.findIndex((row) => !isHeaderRow(row));
|
|
136
|
+
const headerRows = firstBodyRow === -1 ? rows.length : firstBodyRow;
|
|
137
|
+
const isSpanCrossing = rows.slice(0, headerRows).some(
|
|
138
|
+
(row, index) => getElements(row).some((cell) => {
|
|
139
|
+
var _a;
|
|
140
|
+
return index + ((_a = readSpan(cell, "rowSpan", "rowspan")) != null ? _a : 1) > headerRows;
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
return isSpanCrossing ? 0 : headerRows;
|
|
144
|
+
};
|
|
145
|
+
var serializeTable = (table, options) => {
|
|
146
|
+
const rows = getElements(table);
|
|
147
|
+
const headerRows = countHeaderRows(rows);
|
|
148
|
+
const toSection = (tagName, sectionRows) => sectionRows.length === 0 ? [] : [
|
|
149
|
+
htmlElementNode(
|
|
150
|
+
tagName,
|
|
151
|
+
{},
|
|
152
|
+
sectionRows.map(
|
|
153
|
+
(row) => htmlElementNode(
|
|
154
|
+
"tr",
|
|
155
|
+
{},
|
|
156
|
+
getElements(row).map((cell) => serializeCell(cell, options))
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
];
|
|
161
|
+
return htmlElementNode("table", {}, [
|
|
162
|
+
...toSection("thead", rows.slice(0, headerRows)),
|
|
163
|
+
...toSection("tbody", rows.slice(headerRows))
|
|
164
|
+
]);
|
|
165
|
+
};
|
|
166
|
+
var serializeFigure = (node, media) => {
|
|
167
|
+
const caption = readCaption(node);
|
|
168
|
+
const align = readAlign(node);
|
|
169
|
+
const figcaption = caption === "" ? [] : [hastElement("figcaption", {}, [hastText(caption)])];
|
|
170
|
+
return htmlElementNode("figure", { style: align ? `text-align: ${align}` : void 0 }, [], [media, ...figcaption]);
|
|
171
|
+
};
|
|
172
|
+
var serializeMediaEmbed = (node) => {
|
|
173
|
+
var _a, _b, _c;
|
|
174
|
+
const url = (_a = readString(node, "url")) != null ? _a : "";
|
|
175
|
+
const playerUrl = (_c = (_b = parseVideoEmbedUrl(url)) == null ? void 0 : _b.url) != null ? _c : url;
|
|
176
|
+
return serializeFigure(
|
|
177
|
+
node,
|
|
178
|
+
hastElement("iframe", {
|
|
179
|
+
src: playerUrl,
|
|
180
|
+
dataUrl: playerUrl === url ? void 0 : url,
|
|
181
|
+
width: readWidth(node),
|
|
182
|
+
allowFullScreen: true
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
var serializeFile = (node) => {
|
|
187
|
+
var _a, _b;
|
|
188
|
+
const url = (_a = readString(node, "url")) != null ? _a : "";
|
|
189
|
+
const name = (_b = readString(node, "name")) != null ? _b : url;
|
|
190
|
+
return htmlElementNode("figure", {}, [], [hastElement("a", { href: url, download: true }, [hastText(name)])]);
|
|
191
|
+
};
|
|
192
|
+
var serializeTooltip = (node, options) => {
|
|
193
|
+
const tip = readString(node, "tip");
|
|
194
|
+
return htmlElementNode(
|
|
195
|
+
"span",
|
|
196
|
+
{
|
|
197
|
+
dataTooltip: tip != null ? tip : "",
|
|
198
|
+
dataTooltipHeadline: readString(node, "headline"),
|
|
199
|
+
dataTooltipCta: readString(node, "cta"),
|
|
200
|
+
dataTooltipHref: readString(node, "href"),
|
|
201
|
+
title: tip
|
|
202
|
+
},
|
|
203
|
+
convertNodesSerialize(node.children, options)
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
var isEmptyParagraph = (node) => node.children.every((child) => TextApi.isText(child) && child.text === "");
|
|
207
|
+
var serializeParagraph = (node, options) => {
|
|
208
|
+
var _a, _b;
|
|
209
|
+
return (_b = (_a = defaultRules.p) == null ? void 0 : _a.serialize) == null ? void 0 : _b.call(_a, node, isEmptyParagraph(node) ? options : __spreadProps(__spreadValues({}, options), { preserveEmptyParagraphs: false }));
|
|
210
|
+
};
|
|
211
|
+
var HTML_RULES = {
|
|
212
|
+
[KEYS.p]: { serialize: serializeParagraph },
|
|
213
|
+
[KEYS.blockquote]: {
|
|
214
|
+
serialize: (node, options) => htmlElementNode("blockquote", {}, convertNodesSerialize(node.children, options))
|
|
215
|
+
},
|
|
216
|
+
[KEYS.table]: { serialize: serializeTable },
|
|
217
|
+
[KEYS.img]: {
|
|
218
|
+
serialize: (node) => {
|
|
219
|
+
var _a;
|
|
220
|
+
return serializeFigure(
|
|
221
|
+
node,
|
|
222
|
+
hastElement("img", { src: (_a = readString(node, "url")) != null ? _a : "", alt: readCaption(node), width: readWidth(node) })
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
[KEYS.video]: {
|
|
227
|
+
serialize: (node) => {
|
|
228
|
+
var _a;
|
|
229
|
+
return serializeFigure(
|
|
230
|
+
node,
|
|
231
|
+
hastElement("video", { src: (_a = readString(node, "url")) != null ? _a : "", controls: true, width: readWidth(node) })
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
[KEYS.audio]: {
|
|
236
|
+
serialize: (node) => {
|
|
237
|
+
var _a;
|
|
238
|
+
return serializeFigure(node, hastElement("audio", { src: (_a = readString(node, "url")) != null ? _a : "", controls: true }));
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
[KEYS.file]: { serialize: serializeFile },
|
|
242
|
+
[KEYS.mediaEmbed]: { serialize: serializeMediaEmbed },
|
|
243
|
+
[KEYS.placeholder]: { serialize: () => void 0 },
|
|
244
|
+
[KEYS.slashInput]: { serialize: () => void 0 },
|
|
245
|
+
tooltip: { serialize: serializeTooltip }
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// src/lib/server-plugins.ts
|
|
249
|
+
import {
|
|
250
|
+
BaseBlockquotePlugin,
|
|
251
|
+
BaseBoldPlugin,
|
|
252
|
+
BaseCodePlugin,
|
|
253
|
+
BaseH1Plugin,
|
|
254
|
+
BaseH2Plugin,
|
|
255
|
+
BaseH3Plugin,
|
|
256
|
+
BaseHighlightPlugin,
|
|
257
|
+
BaseHorizontalRulePlugin,
|
|
258
|
+
BaseItalicPlugin,
|
|
259
|
+
BaseKbdPlugin,
|
|
260
|
+
BaseStrikethroughPlugin,
|
|
261
|
+
BaseSubscriptPlugin,
|
|
262
|
+
BaseSuperscriptPlugin,
|
|
263
|
+
BaseUnderlinePlugin
|
|
264
|
+
} from "@platejs/basic-nodes";
|
|
265
|
+
import { BaseCalloutPlugin } from "@platejs/callout";
|
|
266
|
+
import { BaseCodeBlockPlugin, BaseCodeLinePlugin } from "@platejs/code-block";
|
|
267
|
+
import { BaseDatePlugin } from "@platejs/date";
|
|
268
|
+
import { BaseIndentPlugin } from "@platejs/indent";
|
|
269
|
+
import { BaseColumnItemPlugin, BaseColumnPlugin } from "@platejs/layout";
|
|
270
|
+
import { BaseLinkPlugin } from "@platejs/link";
|
|
271
|
+
import { BaseListPlugin } from "@platejs/list";
|
|
272
|
+
import { BaseEquationPlugin, BaseInlineEquationPlugin } from "@platejs/math";
|
|
273
|
+
import { BaseAudioPlugin, BaseFilePlugin, BaseImagePlugin, BaseMediaEmbedPlugin, BaseVideoPlugin } from "@platejs/media";
|
|
274
|
+
import { BaseMentionPlugin } from "@platejs/mention";
|
|
275
|
+
import { BaseTableCellPlugin, BaseTablePlugin, BaseTableRowPlugin } from "@platejs/table";
|
|
276
|
+
import { BaseTocPlugin } from "@platejs/toc";
|
|
277
|
+
import { BaseTogglePlugin } from "@platejs/toggle";
|
|
278
|
+
import { BaseParagraphPlugin } from "platejs";
|
|
279
|
+
var ServerPlugins = [
|
|
280
|
+
// Basic blocks
|
|
281
|
+
BaseParagraphPlugin,
|
|
282
|
+
BaseH1Plugin,
|
|
283
|
+
BaseH2Plugin,
|
|
284
|
+
BaseH3Plugin,
|
|
285
|
+
BaseBlockquotePlugin,
|
|
286
|
+
BaseHorizontalRulePlugin,
|
|
287
|
+
// Basic marks
|
|
288
|
+
BaseBoldPlugin,
|
|
289
|
+
BaseItalicPlugin,
|
|
290
|
+
BaseUnderlinePlugin,
|
|
291
|
+
BaseCodePlugin,
|
|
292
|
+
BaseStrikethroughPlugin,
|
|
293
|
+
BaseSubscriptPlugin,
|
|
294
|
+
BaseSuperscriptPlugin,
|
|
295
|
+
BaseHighlightPlugin,
|
|
296
|
+
BaseKbdPlugin,
|
|
297
|
+
// Code block
|
|
298
|
+
BaseCodeBlockPlugin,
|
|
299
|
+
BaseCodeLinePlugin,
|
|
300
|
+
// Table
|
|
301
|
+
BaseTablePlugin,
|
|
302
|
+
BaseTableRowPlugin,
|
|
303
|
+
BaseTableCellPlugin,
|
|
304
|
+
// Lists and indentation
|
|
305
|
+
BaseIndentPlugin,
|
|
306
|
+
BaseListPlugin,
|
|
307
|
+
// Media
|
|
308
|
+
BaseImagePlugin,
|
|
309
|
+
BaseVideoPlugin,
|
|
310
|
+
BaseAudioPlugin,
|
|
311
|
+
BaseFilePlugin,
|
|
312
|
+
BaseMediaEmbedPlugin,
|
|
313
|
+
// Layout
|
|
314
|
+
BaseColumnPlugin,
|
|
315
|
+
BaseColumnItemPlugin,
|
|
316
|
+
// Other
|
|
317
|
+
BaseLinkPlugin,
|
|
318
|
+
BaseCalloutPlugin,
|
|
319
|
+
BaseTogglePlugin,
|
|
320
|
+
BaseTocPlugin,
|
|
321
|
+
BaseMentionPlugin,
|
|
322
|
+
BaseDatePlugin,
|
|
323
|
+
BaseEquationPlugin,
|
|
324
|
+
BaseInlineEquationPlugin
|
|
325
|
+
];
|
|
326
|
+
|
|
327
|
+
// src/lib/html-serialize-utils.ts
|
|
328
|
+
function isValidPlateValue(content) {
|
|
329
|
+
try {
|
|
330
|
+
const parsed = JSON.parse(content);
|
|
331
|
+
return Array.isArray(parsed) && parsed.length > 0 && typeof parsed[0] === "object" && "type" in parsed[0];
|
|
332
|
+
} catch (e) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function parseContentToValue(content) {
|
|
337
|
+
if (isValidPlateValue(content)) {
|
|
338
|
+
return JSON.parse(content);
|
|
339
|
+
}
|
|
340
|
+
return [
|
|
341
|
+
{
|
|
342
|
+
type: "p",
|
|
343
|
+
children: [{ text: content }]
|
|
344
|
+
}
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
var HTML_PROCESSOR = unified().use(remarkRehype, { handlers: HTML_HANDLERS }).use(rehypeStringify);
|
|
348
|
+
var SOFT_BREAK = /(\n)/;
|
|
349
|
+
var splitSoftBreaks = (nodes) => nodes.flatMap((node) => {
|
|
350
|
+
if (node.type === "text" && "value" in node && typeof node.value === "string" && node.value.includes("\n")) {
|
|
351
|
+
return node.value.split(SOFT_BREAK).filter((part) => part !== "").map((part) => part === "\n" ? { type: "break" } : { type: "text", value: part });
|
|
352
|
+
}
|
|
353
|
+
if ("children" in node && Array.isArray(node.children)) {
|
|
354
|
+
return [__spreadProps(__spreadValues({}, node), { children: splitSoftBreaks(node.children) })];
|
|
355
|
+
}
|
|
356
|
+
return [node];
|
|
357
|
+
});
|
|
358
|
+
async function serializePlateToHtml(content) {
|
|
359
|
+
const value = typeof content === "string" ? parseContentToValue(content) : content;
|
|
360
|
+
if (!value || value.length === 0) {
|
|
361
|
+
return "";
|
|
362
|
+
}
|
|
363
|
+
const editor = createSlateEditor({
|
|
364
|
+
plugins: ServerPlugins,
|
|
365
|
+
value
|
|
366
|
+
});
|
|
367
|
+
const options = getMergedOptionsSerialize(editor, { rules: HTML_RULES, value });
|
|
368
|
+
const children = splitSoftBreaks(convertNodesSerialize2(value, options, true));
|
|
369
|
+
const tree = await HTML_PROCESSOR.run({ type: "root", children });
|
|
370
|
+
return HTML_PROCESSOR.stringify(tree);
|
|
371
|
+
}
|
|
372
|
+
function extractPlainText(content) {
|
|
373
|
+
const value = typeof content === "string" ? parseContentToValue(content) : content;
|
|
374
|
+
function extractText(nodes) {
|
|
375
|
+
return nodes.map((node) => {
|
|
376
|
+
if ("text" in node) {
|
|
377
|
+
return node.text;
|
|
378
|
+
}
|
|
379
|
+
if ("children" in node && Array.isArray(node.children)) {
|
|
380
|
+
return extractText(node.children);
|
|
381
|
+
}
|
|
382
|
+
return "";
|
|
383
|
+
}).join(" ");
|
|
384
|
+
}
|
|
385
|
+
return extractText(value).replace(/\s+/g, " ").trim();
|
|
386
|
+
}
|
|
387
|
+
export {
|
|
388
|
+
extractPlainText,
|
|
389
|
+
isValidPlateValue,
|
|
390
|
+
parseContentToValue,
|
|
391
|
+
serializePlateToHtml
|
|
392
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { LineMarkingConfig, LineMarkType } from './line-marking';
|
|
3
|
+
interface LineMarkingProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
config: LineMarkingConfig;
|
|
6
|
+
}
|
|
7
|
+
export declare function LineMarkingProvider({ children, config }: LineMarkingProviderProps): React.JSX.Element;
|
|
8
|
+
export declare function useLineMarking(): {
|
|
9
|
+
markType: LineMarkType | undefined;
|
|
10
|
+
lineIndex: number;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function useLineMarkingConfig(): LineMarkingConfig | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const LineMarkTypes: readonly ["add", "remove", "highlight"];
|
|
2
|
+
export type LineMarkType = (typeof LineMarkTypes)[number];
|
|
3
|
+
export interface LineMarking {
|
|
4
|
+
line: number;
|
|
5
|
+
type: LineMarkType;
|
|
6
|
+
}
|
|
7
|
+
export interface LineMarkingConfig {
|
|
8
|
+
markings: LineMarking[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse range string like "1,3-5,8" into array [1,3,4,5,8]
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseLineRanges(rangeString: string): number[];
|
|
14
|
+
/**
|
|
15
|
+
* Parse metadata string like "highlight=1,3-5 add=2" into LineMarkingConfig
|
|
16
|
+
* Format: type=ranges type=ranges
|
|
17
|
+
* Examples:
|
|
18
|
+
* - "highlight=1,3-5" -> highlight lines 1, 3, 4, 5
|
|
19
|
+
* - "add=2,4 remove=6" -> add lines 2, 4 and remove line 6
|
|
20
|
+
* - "1,3-5" -> highlight lines 1, 3, 4, 5 (highlight is default)
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseLineMarkingMeta(meta: string | undefined): LineMarkingConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Serialize LineMarkingConfig back to meta string
|
|
25
|
+
*/
|
|
26
|
+
export declare function serializeLineMarkingMeta(config: LineMarkingConfig): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get mark type for a specific line index (0-based index -> 1-based line number)
|
|
29
|
+
*/
|
|
30
|
+
export declare function getLineMarkType(index: number, config: LineMarkingConfig | undefined): LineMarkType | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Toggle a line marking. If the line already has the same type, remove it.
|
|
33
|
+
* If it has a different type, replace it. If it has no marking, add it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toggleLineMarking(config: LineMarkingConfig, lineNumber: number, type: LineMarkType): LineMarkingConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Remove marking from a specific line
|
|
38
|
+
*/
|
|
39
|
+
export declare function removeLineMarking(config: LineMarkingConfig, lineNumber: number): LineMarkingConfig;
|
|
40
|
+
/**
|
|
41
|
+
* Add markings to multiple lines at once
|
|
42
|
+
*/
|
|
43
|
+
export declare function addLineMarkings(config: LineMarkingConfig, lineNumbers: number[], type: LineMarkType): LineMarkingConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Clear all markings
|
|
46
|
+
*/
|
|
47
|
+
export declare function clearLineMarkings(): LineMarkingConfig;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type SlateEditor } from 'platejs';
|
|
2
|
+
/**
|
|
3
|
+
* Marks every `<li>` in an HTML string with the list type and depth that Plate's list plugin reads, so that
|
|
4
|
+
* `editor.tf.setValue(html)` and `editor.api.html.deserialize` load `<ul>` and `<ol>` as lists. Plate does the same
|
|
5
|
+
* work only when HTML is pasted. A nested list moves out of its parent item, and a block such as `<p>` inside an item
|
|
6
|
+
* unwraps, because each list item becomes a single paragraph. The whitespace between an item's blocks goes with
|
|
7
|
+
* them, so that it does not load as a space at the end of the item's text.
|
|
8
|
+
*/
|
|
9
|
+
export declare const prepareListHtml: (html: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Runs `prepareListHtml` before the editor parses an HTML string. Element input passes through untouched, because
|
|
12
|
+
* pasted HTML already went through the same step and the caller's DOM should stay as it is.
|
|
13
|
+
*/
|
|
14
|
+
export declare const overrideListHtmlDeserialize: ({ editor }: {
|
|
15
|
+
editor: SlateEditor;
|
|
16
|
+
}) => {
|
|
17
|
+
api: {
|
|
18
|
+
html: {
|
|
19
|
+
deserialize: (options: Parameters<((args_0: {
|
|
20
|
+
element: HTMLElement | string;
|
|
21
|
+
collapseWhiteSpace?: boolean;
|
|
22
|
+
defaultElementPlugin?: import("platejs").WithRequiredKey;
|
|
23
|
+
}) => import("platejs").Descendant[]) & ((args_0: {
|
|
24
|
+
element: HTMLElement | string;
|
|
25
|
+
collapseWhiteSpace?: boolean;
|
|
26
|
+
defaultElementPlugin?: import("platejs").WithRequiredKey;
|
|
27
|
+
}) => import("platejs").Descendant[])>[0]) => import("platejs").Descendant[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TextStreamPart, ToolSet } from 'ai';
|
|
2
|
+
/**
|
|
3
|
+
* Transform chunks like [**,bold,**] to [**bold**] make the md deserializer
|
|
4
|
+
* happy.
|
|
5
|
+
*
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
export declare const markdownJoinerTransform: <TOOLS extends ToolSet>() => () => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
|
|
9
|
+
export declare class MarkdownJoiner {
|
|
10
|
+
private buffer;
|
|
11
|
+
private documentCharacterCount;
|
|
12
|
+
private isBuffering;
|
|
13
|
+
private streamingCodeBlock;
|
|
14
|
+
private streamingLargeDocument;
|
|
15
|
+
private streamingTable;
|
|
16
|
+
delayInMs: number;
|
|
17
|
+
private clearBuffer;
|
|
18
|
+
private isCompleteBold;
|
|
19
|
+
private isCompleteCodeBlockEnd;
|
|
20
|
+
private isCompleteCodeBlockStart;
|
|
21
|
+
private isCompleteLink;
|
|
22
|
+
private isCompleteList;
|
|
23
|
+
private isCompleteMdxTag;
|
|
24
|
+
private isCompleteTableStart;
|
|
25
|
+
private isFalsePositive;
|
|
26
|
+
private isLargeDocumentStart;
|
|
27
|
+
private isListStartChar;
|
|
28
|
+
private isTableExisted;
|
|
29
|
+
flush(): string;
|
|
30
|
+
processText(text: string): string;
|
|
31
|
+
}
|