@aquera/nile-elements 1.9.5 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/index-178e1e57.cjs.js +2 -0
- package/dist/index-178e1e57.cjs.js.map +1 -0
- package/dist/index-1faa963c.esm.js +1 -0
- package/dist/index-249de90a.esm.js +1 -0
- package/dist/index-353172ed.esm.js +1 -0
- package/dist/index-6f3fa4ab.esm.js +1 -0
- package/dist/index-89c520e9.cjs.js +5 -0
- package/dist/index-89c520e9.cjs.js.map +1 -0
- package/dist/index-920675c4.esm.js +1 -0
- package/dist/index-b387a9f4.cjs.js +2 -0
- package/dist/index-b387a9f4.cjs.js.map +1 -0
- package/dist/index-cc1385e0.cjs.js +2 -0
- package/dist/index-cc1385e0.cjs.js.map +1 -0
- package/dist/index-dedc38a6.esm.js +1 -0
- package/dist/index-df196058.cjs.js +2 -0
- package/dist/index-df196058.cjs.js.map +1 -0
- package/dist/index-f956f56d.cjs.js +7 -0
- package/dist/index-f956f56d.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +3802 -664
- package/dist/internal/glyph.cjs.js +2 -0
- package/dist/internal/glyph.cjs.js.map +1 -0
- package/dist/internal/glyph.esm.js +5 -0
- package/dist/nile-auto-complete/index.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
- package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
- package/dist/nile-auto-complete/portal-utils.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.css.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.css.esm.js +8 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/index.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +4 -4
- package/dist/nile-color-picker/index.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
- package/dist/nile-combobox/index.cjs.js +1 -1
- package/dist/nile-combobox/index.esm.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.esm.js +1 -1
- package/dist/nile-combobox/portal-manager.cjs.js +1 -1
- package/dist/nile-context-menu/index.cjs.js +1 -1
- package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
- package/dist/nile-context-submenu/index.cjs.js +1 -1
- package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/index.esm.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.esm.js +1 -1
- package/dist/nile-dropdown/index.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
- package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
- package/dist/nile-file-upload/index.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
- package/dist/nile-floating-panel/index.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.esm.js +14 -14
- package/dist/nile-hero/nile-hero.esm.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
- package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
- package/dist/nile-lite-tooltip/index.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
- package/dist/nile-markdown-editor/index.cjs.js +1 -1
- package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
- package/dist/nile-popover/index.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/portal-manager.cjs.js +1 -1
- package/dist/nile-popup/index.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.cjs.js +1 -1
- package/dist/nile-rich-text-editor/index.cjs.js +1 -1
- package/dist/nile-rich-text-editor/index.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
- package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
- package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/portal-manager.cjs.js +1 -1
- package/dist/nile-side-bar-action/index.cjs.js +1 -1
- package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
- package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
- package/dist/nile-tooltip/index.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
- package/dist/nile-virtual-select/index.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
- package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/emoji.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/emoji.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/emoji.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/export.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/export.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/export.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/markdown-parse.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown-parse.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/markdown.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/markdown.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/office-paste.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/office-paste.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/task-list.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/task-list.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/index.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/index.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +780 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +97 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +244 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +137 -0
- package/dist/nile-wysiwyg-editor/types.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/types.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +97 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +67 -0
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +65 -0
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +64 -0
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +68 -0
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +96 -0
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +112 -0
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +64 -0
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +171 -0
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +90 -0
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +114 -0
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +80 -0
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +92 -0
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +147 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +79 -0
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +96 -0
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +67 -0
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +100 -0
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +58 -0
- package/dist/src/index.d.ts +24 -0
- package/dist/src/index.js +19 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/glyph.d.ts +6 -0
- package/dist/src/internal/glyph.js +13 -0
- package/dist/src/internal/glyph.js.map +1 -0
- package/dist/src/nile-chip/nile-chip.css.js +8 -1
- package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.css.js +12 -12
- package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.js +1 -1
- package/dist/src/nile-hero/nile-hero.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
- package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/emoji.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/emoji.js +138 -0
- package/dist/src/nile-wysiwyg-editor/emoji.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/commands.d.ts +69 -0
- package/dist/src/nile-wysiwyg-editor/engine/commands.js +863 -0
- package/dist/src/nile-wysiwyg-editor/engine/commands.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +35 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js +67 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.d.ts +38 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.js +208 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.test.js +96 -0
- package/dist/src/nile-wysiwyg-editor/engine/export.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +37 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js +29 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +12 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +144 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/keymap.d.ts +15 -0
- package/dist/src/nile-wysiwyg-editor/engine/keymap.js +94 -0
- package/dist/src/nile-wysiwyg-editor/engine/keymap.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.d.ts +22 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js +287 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js +106 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown-parse.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown.d.ts +10 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown.js +162 -0
- package/dist/src/nile-wysiwyg-editor/engine/markdown.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/office-paste.d.ts +13 -0
- package/dist/src/nile-wysiwyg-editor/engine/office-paste.js +182 -0
- package/dist/src/nile-wysiwyg-editor/engine/office-paste.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.d.ts +10 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js +165 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/code-highlight.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +69 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +96 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.d.ts +26 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js +123 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/find-replace.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.d.ts +28 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js +72 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/format-painter.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.d.ts +41 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +176 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image.d.ts +15 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js +64 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +11 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +42 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +46 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.d.ts +7 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js +26 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/max-length.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +31 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +55 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.d.ts +7 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js +25 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/placeholder.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.d.ts +10 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js +48 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/single-line.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.d.ts +29 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js +87 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/suggestions.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.d.ts +8 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +11 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.d.ts +16 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js +49 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/task-list.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +883 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/productivity.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js +129 -0
- package/dist/src/nile-wysiwyg-editor/engine/productivity.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +13 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +155 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +823 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.d.ts +70 -0
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +138 -0
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js +63 -0
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/index.d.ts +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +782 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +364 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +2038 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +636 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +2 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.d.ts +6 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +251 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +41 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +700 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/types.d.ts +49 -0
- package/dist/src/nile-wysiwyg-editor/types.js +8 -0
- package/dist/src/nile-wysiwyg-editor/types.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +159 -0
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +21 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +125 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js +107 -0
- package/dist/src/nile-wysiwyg-editor/ui/code-block-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.d.ts +19 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +123 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +27 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +146 -0
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.d.ts +21 -0
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +154 -0
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.d.ts +26 -0
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +178 -0
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.d.ts +18 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +129 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.d.ts +56 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +349 -0
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.d.ts +25 -0
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +142 -0
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.d.ts +30 -0
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +189 -0
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.d.ts +24 -0
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +144 -0
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.d.ts +31 -0
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +172 -0
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.d.ts +30 -0
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +296 -0
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +19 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +120 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +199 -0
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +31 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +133 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +23 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +177 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +16 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +101 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -0
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -2
- package/src/index.ts +57 -1
- package/src/internal/glyph.ts +13 -0
- package/src/nile-chip/nile-chip.css.ts +8 -1
- package/src/nile-code-editor/nile-code-editor.ts +3 -3
- package/src/nile-hero/nile-hero.css.ts +12 -12
- package/src/nile-hero/nile-hero.ts +1 -1
- package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
- package/src/nile-hero-header/nile-hero-header.ts +1 -1
- package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
- package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
- package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
- package/src/nile-wysiwyg-editor/emoji.ts +137 -0
- package/src/nile-wysiwyg-editor/engine/commands.ts +1035 -0
- package/src/nile-wysiwyg-editor/engine/create-state.ts +117 -0
- package/src/nile-wysiwyg-editor/engine/export.test.ts +113 -0
- package/src/nile-wysiwyg-editor/engine/export.ts +242 -0
- package/src/nile-wysiwyg-editor/engine/index.ts +69 -0
- package/src/nile-wysiwyg-editor/engine/inputrules.ts +169 -0
- package/src/nile-wysiwyg-editor/engine/keymap.ts +146 -0
- package/src/nile-wysiwyg-editor/engine/markdown-parse.test.ts +148 -0
- package/src/nile-wysiwyg-editor/engine/markdown-parse.ts +337 -0
- package/src/nile-wysiwyg-editor/engine/markdown.ts +165 -0
- package/src/nile-wysiwyg-editor/engine/office-paste.ts +199 -0
- package/src/nile-wysiwyg-editor/engine/plugins/code-highlight.ts +173 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +85 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +99 -0
- package/src/nile-wysiwyg-editor/engine/plugins/find-replace.ts +155 -0
- package/src/nile-wysiwyg-editor/engine/plugins/format-painter.ts +80 -0
- package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +220 -0
- package/src/nile-wysiwyg-editor/engine/plugins/image.ts +80 -0
- package/src/nile-wysiwyg-editor/engine/plugins/link.ts +42 -0
- package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +56 -0
- package/src/nile-wysiwyg-editor/engine/plugins/max-length.ts +24 -0
- package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +74 -0
- package/src/nile-wysiwyg-editor/engine/plugins/placeholder.ts +24 -0
- package/src/nile-wysiwyg-editor/engine/plugins/single-line.ts +47 -0
- package/src/nile-wysiwyg-editor/engine/plugins/suggestions.ts +110 -0
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +12 -0
- package/src/nile-wysiwyg-editor/engine/plugins/task-list.ts +65 -0
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +1088 -0
- package/src/nile-wysiwyg-editor/engine/productivity.test.ts +163 -0
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +156 -0
- package/src/nile-wysiwyg-editor/engine/schema.ts +859 -0
- package/src/nile-wysiwyg-editor/engine/selection-state.ts +210 -0
- package/src/nile-wysiwyg-editor/engine/serializer.ts +78 -0
- package/src/nile-wysiwyg-editor/index.ts +3 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +782 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +750 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +2155 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +1 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +251 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +772 -0
- package/src/nile-wysiwyg-editor/types.ts +83 -0
- package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +155 -0
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +135 -0
- package/src/nile-wysiwyg-editor/ui/code-block-menu.ts +105 -0
- package/src/nile-wysiwyg-editor/ui/embed-menu.ts +133 -0
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +143 -0
- package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +152 -0
- package/src/nile-wysiwyg-editor/ui/find-replace.ts +174 -0
- package/src/nile-wysiwyg-editor/ui/image-menu.ts +140 -0
- package/src/nile-wysiwyg-editor/ui/image-panel.ts +337 -0
- package/src/nile-wysiwyg-editor/ui/insert-menu.ts +142 -0
- package/src/nile-wysiwyg-editor/ui/link-editor.ts +180 -0
- package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +143 -0
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +169 -0
- package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +311 -0
- package/src/nile-wysiwyg-editor/ui/source-view.ts +119 -0
- package/src/nile-wysiwyg-editor/ui/special-chars.ts +209 -0
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +138 -0
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +173 -0
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +109 -0
- package/vscode-html-custom-data.json +491 -1
- package/web-dev-server.config.mjs +6 -2
- package/dist/index-5fef1a0d.esm.js +0 -1
- package/dist/index-8f38fae3.cjs.js +0 -2
- package/dist/index-8f38fae3.cjs.js.map +0 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown → HTML conversion, the import counterpart of ./markdown
|
|
3
|
+
* (docToMarkdown). Dependency-free and scoped to the same structural subset
|
|
4
|
+
* the serializer emits: headings, blockquotes, bullet/ordered/task lists
|
|
5
|
+
* (nested), fenced code blocks, GFM tables, horizontal rules, and the inline
|
|
6
|
+
* marks (**bold**, *italic*, ~~strike~~, `code`, [links](…), images).
|
|
7
|
+
*
|
|
8
|
+
* The output is intentionally plain HTML that the schema's parseDOM rules
|
|
9
|
+
* understand (e.g. <pre data-language>, <ul data-task-list>), and every
|
|
10
|
+
* consumer feeds it through htmlToDoc/htmlToSlice — so the schema and the
|
|
11
|
+
* sanitizer stay the single source of truth for what lands in the document.
|
|
12
|
+
*/
|
|
13
|
+
const BULLET_RE = /^(\s*)([-*+])\s+(.*)$/;
|
|
14
|
+
const ORDERED_RE = /^(\s*)(\d+)[.)]\s+(.*)$/;
|
|
15
|
+
const TASK_RE = /^\[([ xX])\]\s+(.*)$/;
|
|
16
|
+
const FENCE_RE = /^\s{0,3}(```+|~~~+)\s*(\S*)\s*$/;
|
|
17
|
+
const HEADING_RE = /^\s{0,3}(#{1,6})\s+(.*)$/;
|
|
18
|
+
const HR_RE = /^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/;
|
|
19
|
+
const QUOTE_RE = /^\s{0,3}>\s?/;
|
|
20
|
+
const TABLE_DIVIDER_RE = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
|
|
21
|
+
function escapeHtml(text) {
|
|
22
|
+
return text
|
|
23
|
+
.replace(/&/g, '&')
|
|
24
|
+
.replace(/</g, '<')
|
|
25
|
+
.replace(/>/g, '>')
|
|
26
|
+
.replace(/"/g, '"');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Swaps backslash-escaped Markdown characters for placeholders so the inline
|
|
30
|
+
* formatter never reads them as syntax; restoreEscapes() puts them back.
|
|
31
|
+
*/
|
|
32
|
+
function protectEscapes(text) {
|
|
33
|
+
return text.replace(/\\([\\`*_[\]()#+\-.!~|])/g, (_, ch) => `\u0000${ch.charCodeAt(0)}\u0000`);
|
|
34
|
+
}
|
|
35
|
+
function restoreEscapes(text) {
|
|
36
|
+
return text.replace(/\u0000(\d+)\u0000/g, (_, code) => String.fromCharCode(Number(code)));
|
|
37
|
+
}
|
|
38
|
+
/** Inline formatting for one already-HTML-escaped, code-span-free segment. */
|
|
39
|
+
function formatSpans(escaped) {
|
|
40
|
+
let out = escaped;
|
|
41
|
+
// Images before links so  is never read as a link.
|
|
42
|
+
out = out.replace(/!\[([^\]]*)\]\(([^()\s]+)(?:\s+[^)]*)?\)/g, (_, alt, src) => `<img src="${src}" alt="${alt}">`);
|
|
43
|
+
out = out.replace(/\[([^\]]+)\]\(([^()\s]+)(?:\s+[^)]*)?\)/g, (_, label, href) => `<a href="${href}">${label}</a>`);
|
|
44
|
+
// Bold before italic so '**' is never read as two italics.
|
|
45
|
+
out = out.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
|
|
46
|
+
out = out.replace(/__([^_]+)__/g, '<strong>$1</strong>');
|
|
47
|
+
out = out.replace(/(^|[^*\w])\*([^*\s](?:[^*]*[^*\s])?)\*/g, '$1<em>$2</em>');
|
|
48
|
+
out = out.replace(/(^|[^_\w])_([^_\s](?:[^_]*[^_\s])?)_(?![\w])/g, '$1<em>$2</em>');
|
|
49
|
+
out = out.replace(/~~([^~]+)~~/g, '<s>$1</s>');
|
|
50
|
+
// Newlines inside one paragraph become hard breaks.
|
|
51
|
+
out = out.replace(/ *\n/g, '<br>');
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** Inline Markdown → HTML. Code spans are lifted out first to stay literal. */
|
|
55
|
+
export function inlineToHtml(source) {
|
|
56
|
+
const protectedSrc = protectEscapes(source);
|
|
57
|
+
const codeRe = /(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
58
|
+
let rest = protectedSrc;
|
|
59
|
+
let out = '';
|
|
60
|
+
for (;;) {
|
|
61
|
+
const match = codeRe.exec(rest);
|
|
62
|
+
if (!match) {
|
|
63
|
+
out += formatSpans(escapeHtml(rest));
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
out += formatSpans(escapeHtml(rest.slice(0, match.index)));
|
|
67
|
+
out += `<code>${escapeHtml(match[2])}</code>`;
|
|
68
|
+
rest = rest.slice(match.index + match[0].length);
|
|
69
|
+
}
|
|
70
|
+
return restoreEscapes(out);
|
|
71
|
+
}
|
|
72
|
+
/** True when a line begins a new block construct (ends a paragraph). */
|
|
73
|
+
function isBlockStart(line) {
|
|
74
|
+
return (HEADING_RE.test(line) ||
|
|
75
|
+
FENCE_RE.test(line) ||
|
|
76
|
+
HR_RE.test(line) ||
|
|
77
|
+
QUOTE_RE.test(line) ||
|
|
78
|
+
BULLET_RE.test(line) ||
|
|
79
|
+
ORDERED_RE.test(line));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* One list region → <ul>/<ol>/task <ul>. Items deeper than the base indent
|
|
83
|
+
* are re-parsed recursively, so nested and mixed lists come out right. A
|
|
84
|
+
* base-indent item of the other marker type (bullet vs ordered) ends the
|
|
85
|
+
* list and starts a sibling one, matching GFM.
|
|
86
|
+
*/
|
|
87
|
+
function parseListRegion(lines) {
|
|
88
|
+
const firstMatch = BULLET_RE.exec(lines[0]) ?? ORDERED_RE.exec(lines[0]);
|
|
89
|
+
const baseIndent = firstMatch[1].length;
|
|
90
|
+
const ordered = ORDERED_RE.test(lines[0]) && !BULLET_RE.test(lines[0]);
|
|
91
|
+
const startOrder = ordered ? Number(firstMatch[2]) : 1;
|
|
92
|
+
const items = [];
|
|
93
|
+
let rest = null;
|
|
94
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
95
|
+
const line = lines[index];
|
|
96
|
+
const match = ordered ? ORDERED_RE.exec(line) : BULLET_RE.exec(line);
|
|
97
|
+
const other = ordered ? BULLET_RE.exec(line) : ORDERED_RE.exec(line);
|
|
98
|
+
if (match && match[1].length <= baseIndent) {
|
|
99
|
+
let text = match[3];
|
|
100
|
+
let checked = null;
|
|
101
|
+
if (!ordered) {
|
|
102
|
+
const task = TASK_RE.exec(text);
|
|
103
|
+
if (task) {
|
|
104
|
+
checked = task[1].toLowerCase() === 'x';
|
|
105
|
+
text = task[2];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
items.push({ lines: [text], checked });
|
|
109
|
+
}
|
|
110
|
+
else if (other && other[1].length <= baseIndent) {
|
|
111
|
+
// Marker type switched at base level: a sibling list starts here.
|
|
112
|
+
rest = lines.slice(index);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
else if (items.length > 0) {
|
|
116
|
+
// Continuation or nested content: drop the base marker's indent and
|
|
117
|
+
// keep the relative indent so recursion sees the nesting.
|
|
118
|
+
items[items.length - 1].lines.push(line.replace(new RegExp(`^\\s{0,${baseIndent + 2}}`), ''));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Consecutive runs of task/non-task items become separate lists, so a
|
|
122
|
+
// checklist after a plain list never converts its neighbours.
|
|
123
|
+
const runs = [];
|
|
124
|
+
for (const item of items) {
|
|
125
|
+
const task = item.checked !== null;
|
|
126
|
+
const lastRun = runs[runs.length - 1];
|
|
127
|
+
if (lastRun && lastRun.task === task)
|
|
128
|
+
lastRun.items.push(item);
|
|
129
|
+
else
|
|
130
|
+
runs.push({ task, items: [item] });
|
|
131
|
+
}
|
|
132
|
+
const rendered = runs
|
|
133
|
+
.map(run => {
|
|
134
|
+
const body = run.items
|
|
135
|
+
.map(item => {
|
|
136
|
+
const content = parseBlocks(item.lines);
|
|
137
|
+
return run.task
|
|
138
|
+
? `<li data-task-item="true" data-checked="${item.checked === true}">${content}</li>`
|
|
139
|
+
: `<li>${content}</li>`;
|
|
140
|
+
})
|
|
141
|
+
.join('');
|
|
142
|
+
if (run.task)
|
|
143
|
+
return `<ul data-task-list="true">${body}</ul>`;
|
|
144
|
+
if (ordered) {
|
|
145
|
+
const startAttr = startOrder !== 1 ? ` start="${startOrder}"` : '';
|
|
146
|
+
return `<ol${startAttr}>${body}</ol>`;
|
|
147
|
+
}
|
|
148
|
+
return `<ul>${body}</ul>`;
|
|
149
|
+
})
|
|
150
|
+
.join('');
|
|
151
|
+
return rest ? rendered + parseListRegion(rest) : rendered;
|
|
152
|
+
}
|
|
153
|
+
/** A GFM table region (header, divider, body rows) → <table>. */
|
|
154
|
+
function parseTableRegion(lines) {
|
|
155
|
+
const splitRow = (line) => line
|
|
156
|
+
.trim()
|
|
157
|
+
.replace(/^\|/, '')
|
|
158
|
+
.replace(/\|$/, '')
|
|
159
|
+
.split(/(?<!\\)\|/)
|
|
160
|
+
.map(cell => cell.trim().replace(/\\\|/g, '|'));
|
|
161
|
+
const header = splitRow(lines[0]);
|
|
162
|
+
const rows = lines.slice(2).map(splitRow);
|
|
163
|
+
const renderRow = (cells, tag) => `<tr>${header
|
|
164
|
+
.map((_, index) => `<${tag}><p>${inlineToHtml(cells[index] ?? '')}</p></${tag}>`)
|
|
165
|
+
.join('')}</tr>`;
|
|
166
|
+
return `<table>${renderRow(header, 'th')}${rows
|
|
167
|
+
.map(row => renderRow(row, 'td'))
|
|
168
|
+
.join('')}</table>`;
|
|
169
|
+
}
|
|
170
|
+
function parseBlocks(lines) {
|
|
171
|
+
const out = [];
|
|
172
|
+
let i = 0;
|
|
173
|
+
while (i < lines.length) {
|
|
174
|
+
const line = lines[i];
|
|
175
|
+
if (!line.trim()) {
|
|
176
|
+
i += 1;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
// Fenced code block.
|
|
180
|
+
const fence = FENCE_RE.exec(line);
|
|
181
|
+
if (fence) {
|
|
182
|
+
const closing = new RegExp(`^\\s{0,3}${fence[1]}\\s*$`);
|
|
183
|
+
const buffer = [];
|
|
184
|
+
i += 1;
|
|
185
|
+
while (i < lines.length && !closing.test(lines[i])) {
|
|
186
|
+
buffer.push(lines[i]);
|
|
187
|
+
i += 1;
|
|
188
|
+
}
|
|
189
|
+
i += 1; // Skip the closing fence.
|
|
190
|
+
const langAttr = fence[2] ? ` data-language="${escapeHtml(fence[2])}"` : '';
|
|
191
|
+
out.push(`<pre${langAttr}><code>${escapeHtml(buffer.join('\n'))}</code></pre>`);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
// Heading (with optional trailing #'s, per CommonMark).
|
|
195
|
+
const heading = HEADING_RE.exec(line);
|
|
196
|
+
if (heading) {
|
|
197
|
+
const level = heading[1].length;
|
|
198
|
+
const text = heading[2].replace(/\s+#+\s*$/, '');
|
|
199
|
+
out.push(`<h${level}>${inlineToHtml(text)}</h${level}>`);
|
|
200
|
+
i += 1;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
// Horizontal rule (checked before lists: "---" vs "- item").
|
|
204
|
+
if (HR_RE.test(line)) {
|
|
205
|
+
out.push('<hr>');
|
|
206
|
+
i += 1;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
// Blockquote: consecutive quoted lines, including lazy continuations.
|
|
210
|
+
if (QUOTE_RE.test(line)) {
|
|
211
|
+
const buffer = [];
|
|
212
|
+
while (i < lines.length &&
|
|
213
|
+
(QUOTE_RE.test(lines[i]) ||
|
|
214
|
+
(buffer.length > 0 && lines[i].trim() !== '' && !isBlockStart(lines[i])))) {
|
|
215
|
+
buffer.push(lines[i].replace(QUOTE_RE, ''));
|
|
216
|
+
i += 1;
|
|
217
|
+
}
|
|
218
|
+
out.push(`<blockquote>${parseBlocks(buffer)}</blockquote>`);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
// List: the region runs until a blank line not followed by more list
|
|
222
|
+
// content, or a non-indented non-list line.
|
|
223
|
+
if (BULLET_RE.test(line) || ORDERED_RE.test(line)) {
|
|
224
|
+
const buffer = [];
|
|
225
|
+
while (i < lines.length) {
|
|
226
|
+
const current = lines[i];
|
|
227
|
+
if (current.trim() === '') {
|
|
228
|
+
const next = lines[i + 1];
|
|
229
|
+
if (next !== undefined && (BULLET_RE.test(next) || ORDERED_RE.test(next) || /^\s{2,}\S/.test(next))) {
|
|
230
|
+
i += 1;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
if (!BULLET_RE.test(current) &&
|
|
236
|
+
!ORDERED_RE.test(current) &&
|
|
237
|
+
!/^\s{2,}\S/.test(current)) {
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
buffer.push(current);
|
|
241
|
+
i += 1;
|
|
242
|
+
}
|
|
243
|
+
out.push(parseListRegion(buffer));
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
// GFM table: a pipe row followed by a divider row.
|
|
247
|
+
if (line.includes('|') &&
|
|
248
|
+
i + 1 < lines.length &&
|
|
249
|
+
TABLE_DIVIDER_RE.test(lines[i + 1]) &&
|
|
250
|
+
lines[i + 1].includes('|')) {
|
|
251
|
+
const buffer = [lines[i], lines[i + 1]];
|
|
252
|
+
i += 2;
|
|
253
|
+
while (i < lines.length && lines[i].includes('|') && lines[i].trim() !== '') {
|
|
254
|
+
buffer.push(lines[i]);
|
|
255
|
+
i += 1;
|
|
256
|
+
}
|
|
257
|
+
out.push(parseTableRegion(buffer));
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
// Paragraph: collect until a blank line or the start of another block.
|
|
261
|
+
const buffer = [line];
|
|
262
|
+
i += 1;
|
|
263
|
+
while (i < lines.length && lines[i].trim() !== '' && !isBlockStart(lines[i])) {
|
|
264
|
+
buffer.push(lines[i]);
|
|
265
|
+
i += 1;
|
|
266
|
+
}
|
|
267
|
+
out.push(`<p>${inlineToHtml(buffer.join('\n'))}</p>`);
|
|
268
|
+
}
|
|
269
|
+
return out.join('');
|
|
270
|
+
}
|
|
271
|
+
/** Parses a Markdown string into schema-compatible HTML. */
|
|
272
|
+
export function markdownToHtml(markdown) {
|
|
273
|
+
return parseBlocks(markdown.replace(/\r\n?/g, '\n').split('\n'));
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Conservative sniff for "this plain text is probably Markdown": one block
|
|
277
|
+
* construct or one unambiguous inline construct is required. HTML-looking
|
|
278
|
+
* text is never treated as Markdown.
|
|
279
|
+
*/
|
|
280
|
+
export function looksLikeMarkdown(text) {
|
|
281
|
+
if (/<\/?[a-z][^>]*>/i.test(text))
|
|
282
|
+
return false;
|
|
283
|
+
const block = /^\s{0,3}(#{1,6}\s+\S|```|(?:[-*+]|\d+[.)])\s+\S|>\s?\S|\|.+\|)/m;
|
|
284
|
+
const inline = /\*\*[^*\n]+\*\*|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\n]+\)|`[^`\n]+`/;
|
|
285
|
+
return block.test(text) || inline.test(text);
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=markdown-parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-parse.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/engine/markdown-parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAC1C,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAC7C,MAAM,OAAO,GAAG,sBAAsB,CAAC;AACvC,MAAM,QAAQ,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ACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAChD,MAAM,KAAK,GACT,iEAAiE,CAAC;IACpE,MAAM,MAAM,GACV,+DAA+D,CAAC;IAClE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/**\n * Markdown → HTML conversion, the import counterpart of ./markdown\n * (docToMarkdown). Dependency-free and scoped to the same structural subset\n * the serializer emits: headings, blockquotes, bullet/ordered/task lists\n * (nested), fenced code blocks, GFM tables, horizontal rules, and the inline\n * marks (**bold**, *italic*, ~~strike~~, `code`, [links](…), images).\n *\n * The output is intentionally plain HTML that the schema's parseDOM rules\n * understand (e.g. <pre data-language>, <ul data-task-list>), and every\n * consumer feeds it through htmlToDoc/htmlToSlice — so the schema and the\n * sanitizer stay the single source of truth for what lands in the document.\n */\n\nconst BULLET_RE = /^(\\s*)([-*+])\\s+(.*)$/;\nconst ORDERED_RE = /^(\\s*)(\\d+)[.)]\\s+(.*)$/;\nconst TASK_RE = /^\\[([ xX])\\]\\s+(.*)$/;\nconst FENCE_RE = /^\\s{0,3}(```+|~~~+)\\s*(\\S*)\\s*$/;\nconst HEADING_RE = /^\\s{0,3}(#{1,6})\\s+(.*)$/;\nconst HR_RE = /^\\s{0,3}(?:-{3,}|\\*{3,}|_{3,})\\s*$/;\nconst QUOTE_RE = /^\\s{0,3}>\\s?/;\nconst TABLE_DIVIDER_RE = /^\\s*\\|?\\s*:?-+:?\\s*(\\|\\s*:?-+:?\\s*)*\\|?\\s*$/;\n\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/**\n * Swaps backslash-escaped Markdown characters for placeholders so the inline\n * formatter never reads them as syntax; restoreEscapes() puts them back.\n */\nfunction protectEscapes(text: string): string {\n return text.replace(\n /\\\\([\\\\`*_[\\]()#+\\-.!~|])/g,\n (_, ch: string) => `\\u0000${ch.charCodeAt(0)}\\u0000`\n );\n}\n\nfunction restoreEscapes(text: string): string {\n return text.replace(/\\u0000(\\d+)\\u0000/g, (_, code: string) =>\n String.fromCharCode(Number(code))\n );\n}\n\n/** Inline formatting for one already-HTML-escaped, code-span-free segment. */\nfunction formatSpans(escaped: string): string {\n let out = escaped;\n // Images before links so  is never read as a link.\n out = out.replace(\n /!\\[([^\\]]*)\\]\\(([^()\\s]+)(?:\\s+[^)]*)?\\)/g,\n (_, alt: string, src: string) => `<img src=\"${src}\" alt=\"${alt}\">`\n );\n out = out.replace(\n /\\[([^\\]]+)\\]\\(([^()\\s]+)(?:\\s+[^)]*)?\\)/g,\n (_, label: string, href: string) => `<a href=\"${href}\">${label}</a>`\n );\n // Bold before italic so '**' is never read as two italics.\n out = out.replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>');\n out = out.replace(/__([^_]+)__/g, '<strong>$1</strong>');\n out = out.replace(/(^|[^*\\w])\\*([^*\\s](?:[^*]*[^*\\s])?)\\*/g, '$1<em>$2</em>');\n out = out.replace(/(^|[^_\\w])_([^_\\s](?:[^_]*[^_\\s])?)_(?![\\w])/g, '$1<em>$2</em>');\n out = out.replace(/~~([^~]+)~~/g, '<s>$1</s>');\n // Newlines inside one paragraph become hard breaks.\n out = out.replace(/ *\\n/g, '<br>');\n return out;\n}\n\n/** Inline Markdown → HTML. Code spans are lifted out first to stay literal. */\nexport function inlineToHtml(source: string): string {\n const protectedSrc = protectEscapes(source);\n const codeRe = /(`+)([^`]|[^`][\\s\\S]*?[^`])\\1(?!`)/;\n let rest = protectedSrc;\n let out = '';\n for (;;) {\n const match = codeRe.exec(rest);\n if (!match) {\n out += formatSpans(escapeHtml(rest));\n break;\n }\n out += formatSpans(escapeHtml(rest.slice(0, match.index)));\n out += `<code>${escapeHtml(match[2])}</code>`;\n rest = rest.slice(match.index + match[0].length);\n }\n return restoreEscapes(out);\n}\n\n/** True when a line begins a new block construct (ends a paragraph). */\nfunction isBlockStart(line: string): boolean {\n return (\n HEADING_RE.test(line) ||\n FENCE_RE.test(line) ||\n HR_RE.test(line) ||\n QUOTE_RE.test(line) ||\n BULLET_RE.test(line) ||\n ORDERED_RE.test(line)\n );\n}\n\ninterface ListItem {\n lines: string[];\n checked: boolean | null;\n}\n\n/**\n * One list region → <ul>/<ol>/task <ul>. Items deeper than the base indent\n * are re-parsed recursively, so nested and mixed lists come out right. A\n * base-indent item of the other marker type (bullet vs ordered) ends the\n * list and starts a sibling one, matching GFM.\n */\nfunction parseListRegion(lines: string[]): string {\n const firstMatch = BULLET_RE.exec(lines[0]) ?? ORDERED_RE.exec(lines[0])!;\n const baseIndent = firstMatch[1].length;\n const ordered = ORDERED_RE.test(lines[0]) && !BULLET_RE.test(lines[0]);\n const startOrder = ordered ? Number(firstMatch[2]) : 1;\n\n const items: ListItem[] = [];\n let rest: string[] | null = null;\n for (let index = 0; index < lines.length; index += 1) {\n const line = lines[index];\n const match = ordered ? ORDERED_RE.exec(line) : BULLET_RE.exec(line);\n const other = ordered ? BULLET_RE.exec(line) : ORDERED_RE.exec(line);\n if (match && match[1].length <= baseIndent) {\n let text = match[3];\n let checked: boolean | null = null;\n if (!ordered) {\n const task = TASK_RE.exec(text);\n if (task) {\n checked = task[1].toLowerCase() === 'x';\n text = task[2];\n }\n }\n items.push({ lines: [text], checked });\n } else if (other && other[1].length <= baseIndent) {\n // Marker type switched at base level: a sibling list starts here.\n rest = lines.slice(index);\n break;\n } else if (items.length > 0) {\n // Continuation or nested content: drop the base marker's indent and\n // keep the relative indent so recursion sees the nesting.\n items[items.length - 1].lines.push(\n line.replace(new RegExp(`^\\\\s{0,${baseIndent + 2}}`), '')\n );\n }\n }\n\n // Consecutive runs of task/non-task items become separate lists, so a\n // checklist after a plain list never converts its neighbours.\n const runs: { task: boolean; items: ListItem[] }[] = [];\n for (const item of items) {\n const task = item.checked !== null;\n const lastRun = runs[runs.length - 1];\n if (lastRun && lastRun.task === task) lastRun.items.push(item);\n else runs.push({ task, items: [item] });\n }\n\n const rendered = runs\n .map(run => {\n const body = run.items\n .map(item => {\n const content = parseBlocks(item.lines);\n return run.task\n ? `<li data-task-item=\"true\" data-checked=\"${item.checked === true}\">${content}</li>`\n : `<li>${content}</li>`;\n })\n .join('');\n if (run.task) return `<ul data-task-list=\"true\">${body}</ul>`;\n if (ordered) {\n const startAttr = startOrder !== 1 ? ` start=\"${startOrder}\"` : '';\n return `<ol${startAttr}>${body}</ol>`;\n }\n return `<ul>${body}</ul>`;\n })\n .join('');\n\n return rest ? rendered + parseListRegion(rest) : rendered;\n}\n\n/** A GFM table region (header, divider, body rows) → <table>. */\nfunction parseTableRegion(lines: string[]): string {\n const splitRow = (line: string): string[] =>\n line\n .trim()\n .replace(/^\\|/, '')\n .replace(/\\|$/, '')\n .split(/(?<!\\\\)\\|/)\n .map(cell => cell.trim().replace(/\\\\\\|/g, '|'));\n\n const header = splitRow(lines[0]);\n const rows = lines.slice(2).map(splitRow);\n const renderRow = (cells: string[], tag: 'th' | 'td'): string =>\n `<tr>${header\n .map((_, index) => `<${tag}><p>${inlineToHtml(cells[index] ?? '')}</p></${tag}>`)\n .join('')}</tr>`;\n\n return `<table>${renderRow(header, 'th')}${rows\n .map(row => renderRow(row, 'td'))\n .join('')}</table>`;\n}\n\nfunction parseBlocks(lines: string[]): string {\n const out: string[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i];\n if (!line.trim()) {\n i += 1;\n continue;\n }\n\n // Fenced code block.\n const fence = FENCE_RE.exec(line);\n if (fence) {\n const closing = new RegExp(`^\\\\s{0,3}${fence[1]}\\\\s*$`);\n const buffer: string[] = [];\n i += 1;\n while (i < lines.length && !closing.test(lines[i])) {\n buffer.push(lines[i]);\n i += 1;\n }\n i += 1; // Skip the closing fence.\n const langAttr = fence[2] ? ` data-language=\"${escapeHtml(fence[2])}\"` : '';\n out.push(`<pre${langAttr}><code>${escapeHtml(buffer.join('\\n'))}</code></pre>`);\n continue;\n }\n\n // Heading (with optional trailing #'s, per CommonMark).\n const heading = HEADING_RE.exec(line);\n if (heading) {\n const level = heading[1].length;\n const text = heading[2].replace(/\\s+#+\\s*$/, '');\n out.push(`<h${level}>${inlineToHtml(text)}</h${level}>`);\n i += 1;\n continue;\n }\n\n // Horizontal rule (checked before lists: \"---\" vs \"- item\").\n if (HR_RE.test(line)) {\n out.push('<hr>');\n i += 1;\n continue;\n }\n\n // Blockquote: consecutive quoted lines, including lazy continuations.\n if (QUOTE_RE.test(line)) {\n const buffer: string[] = [];\n while (\n i < lines.length &&\n (QUOTE_RE.test(lines[i]) ||\n (buffer.length > 0 && lines[i].trim() !== '' && !isBlockStart(lines[i])))\n ) {\n buffer.push(lines[i].replace(QUOTE_RE, ''));\n i += 1;\n }\n out.push(`<blockquote>${parseBlocks(buffer)}</blockquote>`);\n continue;\n }\n\n // List: the region runs until a blank line not followed by more list\n // content, or a non-indented non-list line.\n if (BULLET_RE.test(line) || ORDERED_RE.test(line)) {\n const buffer: string[] = [];\n while (i < lines.length) {\n const current = lines[i];\n if (current.trim() === '') {\n const next = lines[i + 1];\n if (next !== undefined && (BULLET_RE.test(next) || ORDERED_RE.test(next) || /^\\s{2,}\\S/.test(next))) {\n i += 1;\n continue;\n }\n break;\n }\n if (\n !BULLET_RE.test(current) &&\n !ORDERED_RE.test(current) &&\n !/^\\s{2,}\\S/.test(current)\n ) {\n break;\n }\n buffer.push(current);\n i += 1;\n }\n out.push(parseListRegion(buffer));\n continue;\n }\n\n // GFM table: a pipe row followed by a divider row.\n if (\n line.includes('|') &&\n i + 1 < lines.length &&\n TABLE_DIVIDER_RE.test(lines[i + 1]) &&\n lines[i + 1].includes('|')\n ) {\n const buffer: string[] = [lines[i], lines[i + 1]];\n i += 2;\n while (i < lines.length && lines[i].includes('|') && lines[i].trim() !== '') {\n buffer.push(lines[i]);\n i += 1;\n }\n out.push(parseTableRegion(buffer));\n continue;\n }\n\n // Paragraph: collect until a blank line or the start of another block.\n const buffer: string[] = [line];\n i += 1;\n while (i < lines.length && lines[i].trim() !== '' && !isBlockStart(lines[i])) {\n buffer.push(lines[i]);\n i += 1;\n }\n out.push(`<p>${inlineToHtml(buffer.join('\\n'))}</p>`);\n }\n\n return out.join('');\n}\n\n/** Parses a Markdown string into schema-compatible HTML. */\nexport function markdownToHtml(markdown: string): string {\n return parseBlocks(markdown.replace(/\\r\\n?/g, '\\n').split('\\n'));\n}\n\n/**\n * Conservative sniff for \"this plain text is probably Markdown\": one block\n * construct or one unambiguous inline construct is required. HTML-looking\n * text is never treated as Markdown.\n */\nexport function looksLikeMarkdown(text: string): boolean {\n if (/<\\/?[a-z][^>]*>/i.test(text)) return false;\n const block =\n /^\\s{0,3}(#{1,6}\\s+\\S|```|(?:[-*+]|\\d+[.)])\\s+\\S|>\\s?\\S|\\|.+\\|)/m;\n const inline =\n /\\*\\*[^*\\n]+\\*\\*|~~[^~\\n]+~~|\\[[^\\]\\n]+\\]\\([^)\\n]+\\)|`[^`\\n]+`/;\n return block.test(text) || inline.test(text);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { markdownToHtml, looksLikeMarkdown, inlineToHtml } from './markdown-parse';
|
|
3
|
+
import { defaultSchema, htmlToDoc, docToMarkdown } from './index';
|
|
4
|
+
describe('markdown-parse', () => {
|
|
5
|
+
describe('markdownToHtml — blocks', () => {
|
|
6
|
+
it('parses headings', () => {
|
|
7
|
+
expect(markdownToHtml('# One')).to.equal('<h1>One</h1>');
|
|
8
|
+
expect(markdownToHtml('### Three')).to.equal('<h3>Three</h3>');
|
|
9
|
+
expect(markdownToHtml('## Trailing ##')).to.equal('<h2>Trailing</h2>');
|
|
10
|
+
});
|
|
11
|
+
it('parses paragraphs and hard breaks', () => {
|
|
12
|
+
expect(markdownToHtml('one\ntwo\n\nthree')).to.equal('<p>one<br>two</p><p>three</p>');
|
|
13
|
+
});
|
|
14
|
+
it('parses blockquotes with lazy continuation', () => {
|
|
15
|
+
expect(markdownToHtml('> quoted\ncontinues')).to.equal('<blockquote><p>quoted<br>continues</p></blockquote>');
|
|
16
|
+
});
|
|
17
|
+
it('parses fenced code blocks with language', () => {
|
|
18
|
+
expect(markdownToHtml('```js\nconst a = 1 < 2;\n```')).to.equal('<pre data-language="js"><code>const a = 1 < 2;</code></pre>');
|
|
19
|
+
});
|
|
20
|
+
it('keeps markdown syntax literal inside code fences', () => {
|
|
21
|
+
expect(markdownToHtml('```\n# not a heading\n**not bold**\n```')).to.equal('<pre><code># not a heading\n**not bold**</code></pre>');
|
|
22
|
+
});
|
|
23
|
+
it('parses horizontal rules but not list dashes', () => {
|
|
24
|
+
expect(markdownToHtml('---')).to.equal('<hr>');
|
|
25
|
+
expect(markdownToHtml('- item')).to.equal('<ul><li><p>item</p></li></ul>');
|
|
26
|
+
});
|
|
27
|
+
it('parses nested bullet lists', () => {
|
|
28
|
+
expect(markdownToHtml('- a\n - b')).to.equal('<ul><li><p>a</p><ul><li><p>b</p></li></ul></li></ul>');
|
|
29
|
+
});
|
|
30
|
+
it('parses ordered lists with a start offset', () => {
|
|
31
|
+
expect(markdownToHtml('3. three\n4. four')).to.equal('<ol start="3"><li><p>three</p></li><li><p>four</p></li></ol>');
|
|
32
|
+
});
|
|
33
|
+
it('splits sibling lists when the marker type changes', () => {
|
|
34
|
+
expect(markdownToHtml('- a\n1. b')).to.equal('<ul><li><p>a</p></li></ul><ol><li><p>b</p></li></ol>');
|
|
35
|
+
});
|
|
36
|
+
it('parses task lists without converting plain neighbours', () => {
|
|
37
|
+
expect(markdownToHtml('- plain\n- [x] done')).to.equal('<ul><li><p>plain</p></li></ul>' +
|
|
38
|
+
'<ul data-task-list="true"><li data-task-item="true" data-checked="true"><p>done</p></li></ul>');
|
|
39
|
+
});
|
|
40
|
+
it('parses GFM tables with header cells', () => {
|
|
41
|
+
expect(markdownToHtml('| A | B |\n| - | - |\n| 1 | 2 |')).to.equal('<table><tr><th><p>A</p></th><th><p>B</p></th></tr>' +
|
|
42
|
+
'<tr><td><p>1</p></td><td><p>2</p></td></tr></table>');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('inlineToHtml — marks', () => {
|
|
46
|
+
it('converts the inline marks', () => {
|
|
47
|
+
expect(inlineToHtml('**b** *i* ~~s~~ `c`')).to.equal('<strong>b</strong> <em>i</em> <s>s</s> <code>c</code>');
|
|
48
|
+
});
|
|
49
|
+
it('converts links and images', () => {
|
|
50
|
+
expect(inlineToHtml('[x](https://a.b)')).to.equal('<a href="https://a.b">x</a>');
|
|
51
|
+
expect(inlineToHtml('')).to.equal('<img src="https://a.b/i.png" alt="y">');
|
|
52
|
+
});
|
|
53
|
+
it('escapes HTML in text and keeps code spans literal', () => {
|
|
54
|
+
expect(inlineToHtml('<b>hi</b>')).to.equal('<b>hi</b>');
|
|
55
|
+
expect(inlineToHtml('`*literal*`')).to.equal('<code>*literal*</code>');
|
|
56
|
+
});
|
|
57
|
+
it('honors backslash escapes', () => {
|
|
58
|
+
expect(inlineToHtml('\\*not italic\\*')).to.equal('*not italic*');
|
|
59
|
+
});
|
|
60
|
+
it('does not read mid-word underscores as emphasis', () => {
|
|
61
|
+
expect(inlineToHtml('snake_case_name')).to.equal('snake_case_name');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('round-trip with docToMarkdown', () => {
|
|
65
|
+
it('survives a structural round-trip', () => {
|
|
66
|
+
const source = [
|
|
67
|
+
'# Title',
|
|
68
|
+
'',
|
|
69
|
+
'Some **bold** and *italic* text.',
|
|
70
|
+
'',
|
|
71
|
+
'- one',
|
|
72
|
+
'- two',
|
|
73
|
+
'',
|
|
74
|
+
'```js',
|
|
75
|
+
'const x = 1;',
|
|
76
|
+
'```',
|
|
77
|
+
].join('\n');
|
|
78
|
+
const doc = htmlToDoc(defaultSchema, markdownToHtml(source));
|
|
79
|
+
expect(docToMarkdown(doc).trim()).to.equal(source);
|
|
80
|
+
});
|
|
81
|
+
it('round-trips task lists', () => {
|
|
82
|
+
const source = '- [ ] todo\n- [x] done';
|
|
83
|
+
const doc = htmlToDoc(defaultSchema, markdownToHtml(source));
|
|
84
|
+
expect(docToMarkdown(doc).trim()).to.equal(source);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
describe('looksLikeMarkdown', () => {
|
|
88
|
+
it('detects block constructs', () => {
|
|
89
|
+
expect(looksLikeMarkdown('# Heading')).to.be.true;
|
|
90
|
+
expect(looksLikeMarkdown('- a list item')).to.be.true;
|
|
91
|
+
expect(looksLikeMarkdown('1. ordered')).to.be.true;
|
|
92
|
+
expect(looksLikeMarkdown('> quote')).to.be.true;
|
|
93
|
+
expect(looksLikeMarkdown('```\ncode\n```')).to.be.true;
|
|
94
|
+
});
|
|
95
|
+
it('detects unambiguous inline constructs', () => {
|
|
96
|
+
expect(looksLikeMarkdown('some **bold** text')).to.be.true;
|
|
97
|
+
expect(looksLikeMarkdown('a [link](https://x.y) here')).to.be.true;
|
|
98
|
+
});
|
|
99
|
+
it('rejects plain text and HTML', () => {
|
|
100
|
+
expect(looksLikeMarkdown('just a sentence.')).to.be.false;
|
|
101
|
+
expect(looksLikeMarkdown('2 * 3 = 6 and 4 - 2 = 2')).to.be.false;
|
|
102
|
+
expect(looksLikeMarkdown('<p>markup</p>')).to.be.false;
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=markdown-parse.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-parse.test.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/engine/markdown-parse.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,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,CAAC,EAAE,CAAC,IAAI,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAC3D,MAAM,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;QACrE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,MAAM,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YAC1D,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YACjE,MAAM,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { markdownToHtml, looksLikeMarkdown, inlineToHtml } from './markdown-parse';\nimport { defaultSchema, htmlToDoc, docToMarkdown } from './index';\n\ndescribe('markdown-parse', () => {\n describe('markdownToHtml — blocks', () => {\n it('parses headings', () => {\n expect(markdownToHtml('# One')).to.equal('<h1>One</h1>');\n expect(markdownToHtml('### Three')).to.equal('<h3>Three</h3>');\n expect(markdownToHtml('## Trailing ##')).to.equal('<h2>Trailing</h2>');\n });\n\n it('parses paragraphs and hard breaks', () => {\n expect(markdownToHtml('one\\ntwo\\n\\nthree')).to.equal(\n '<p>one<br>two</p><p>three</p>'\n );\n });\n\n it('parses blockquotes with lazy continuation', () => {\n expect(markdownToHtml('> quoted\\ncontinues')).to.equal(\n '<blockquote><p>quoted<br>continues</p></blockquote>'\n );\n });\n\n it('parses fenced code blocks with language', () => {\n expect(markdownToHtml('```js\\nconst a = 1 < 2;\\n```')).to.equal(\n '<pre data-language=\"js\"><code>const a = 1 < 2;</code></pre>'\n );\n });\n\n it('keeps markdown syntax literal inside code fences', () => {\n expect(markdownToHtml('```\\n# not a heading\\n**not bold**\\n```')).to.equal(\n '<pre><code># not a heading\\n**not bold**</code></pre>'\n );\n });\n\n it('parses horizontal rules but not list dashes', () => {\n expect(markdownToHtml('---')).to.equal('<hr>');\n expect(markdownToHtml('- item')).to.equal('<ul><li><p>item</p></li></ul>');\n });\n\n it('parses nested bullet lists', () => {\n expect(markdownToHtml('- a\\n - b')).to.equal(\n '<ul><li><p>a</p><ul><li><p>b</p></li></ul></li></ul>'\n );\n });\n\n it('parses ordered lists with a start offset', () => {\n expect(markdownToHtml('3. three\\n4. four')).to.equal(\n '<ol start=\"3\"><li><p>three</p></li><li><p>four</p></li></ol>'\n );\n });\n\n it('splits sibling lists when the marker type changes', () => {\n expect(markdownToHtml('- a\\n1. b')).to.equal(\n '<ul><li><p>a</p></li></ul><ol><li><p>b</p></li></ol>'\n );\n });\n\n it('parses task lists without converting plain neighbours', () => {\n expect(markdownToHtml('- plain\\n- [x] done')).to.equal(\n '<ul><li><p>plain</p></li></ul>' +\n '<ul data-task-list=\"true\"><li data-task-item=\"true\" data-checked=\"true\"><p>done</p></li></ul>'\n );\n });\n\n it('parses GFM tables with header cells', () => {\n expect(markdownToHtml('| A | B |\\n| - | - |\\n| 1 | 2 |')).to.equal(\n '<table><tr><th><p>A</p></th><th><p>B</p></th></tr>' +\n '<tr><td><p>1</p></td><td><p>2</p></td></tr></table>'\n );\n });\n });\n\n describe('inlineToHtml — marks', () => {\n it('converts the inline marks', () => {\n expect(inlineToHtml('**b** *i* ~~s~~ `c`')).to.equal(\n '<strong>b</strong> <em>i</em> <s>s</s> <code>c</code>'\n );\n });\n\n it('converts links and images', () => {\n expect(inlineToHtml('[x](https://a.b)')).to.equal('<a href=\"https://a.b\">x</a>');\n expect(inlineToHtml('')).to.equal(\n '<img src=\"https://a.b/i.png\" alt=\"y\">'\n );\n });\n\n it('escapes HTML in text and keeps code spans literal', () => {\n expect(inlineToHtml('<b>hi</b>')).to.equal('<b>hi</b>');\n expect(inlineToHtml('`*literal*`')).to.equal('<code>*literal*</code>');\n });\n\n it('honors backslash escapes', () => {\n expect(inlineToHtml('\\\\*not italic\\\\*')).to.equal('*not italic*');\n });\n\n it('does not read mid-word underscores as emphasis', () => {\n expect(inlineToHtml('snake_case_name')).to.equal('snake_case_name');\n });\n });\n\n describe('round-trip with docToMarkdown', () => {\n it('survives a structural round-trip', () => {\n const source = [\n '# Title',\n '',\n 'Some **bold** and *italic* text.',\n '',\n '- one',\n '- two',\n '',\n '```js',\n 'const x = 1;',\n '```',\n ].join('\\n');\n const doc = htmlToDoc(defaultSchema, markdownToHtml(source));\n expect(docToMarkdown(doc).trim()).to.equal(source);\n });\n\n it('round-trips task lists', () => {\n const source = '- [ ] todo\\n- [x] done';\n const doc = htmlToDoc(defaultSchema, markdownToHtml(source));\n expect(docToMarkdown(doc).trim()).to.equal(source);\n });\n });\n\n describe('looksLikeMarkdown', () => {\n it('detects block constructs', () => {\n expect(looksLikeMarkdown('# Heading')).to.be.true;\n expect(looksLikeMarkdown('- a list item')).to.be.true;\n expect(looksLikeMarkdown('1. ordered')).to.be.true;\n expect(looksLikeMarkdown('> quote')).to.be.true;\n expect(looksLikeMarkdown('```\\ncode\\n```')).to.be.true;\n });\n\n it('detects unambiguous inline constructs', () => {\n expect(looksLikeMarkdown('some **bold** text')).to.be.true;\n expect(looksLikeMarkdown('a [link](https://x.y) here')).to.be.true;\n });\n\n it('rejects plain text and HTML', () => {\n expect(looksLikeMarkdown('just a sentence.')).to.be.false;\n expect(looksLikeMarkdown('2 * 3 = 6 and 4 - 2 = 2')).to.be.false;\n expect(looksLikeMarkdown('<p>markup</p>')).to.be.false;\n });\n });\n});\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document → Markdown projection. A best-effort, dependency-free serializer
|
|
3
|
+
* covering the structural nodes and the marks Markdown can represent. Styling
|
|
4
|
+
* marks with no Markdown equivalent (color, background, font family/size) are
|
|
5
|
+
* dropped to plain text; underline/sub/sup fall back to inline HTML, which
|
|
6
|
+
* GitHub-flavored Markdown renders. For loss-free round-trips use getHTML().
|
|
7
|
+
*/
|
|
8
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
9
|
+
/** Serializes a document node to a Markdown string. */
|
|
10
|
+
export declare function docToMarkdown(doc: PMNode): string;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/** Escapes the inline characters that would otherwise be read as Markdown. */
|
|
2
|
+
function escapeText(text) {
|
|
3
|
+
return text.replace(/([\\`*_[\]<>])/g, '\\$1');
|
|
4
|
+
}
|
|
5
|
+
/** Wraps a text run in its marks, innermost (code) to outermost (link). */
|
|
6
|
+
function serializeMarks(text, marks) {
|
|
7
|
+
const has = (name) => marks.some(m => m.type.name === name);
|
|
8
|
+
let out;
|
|
9
|
+
if (has('code')) {
|
|
10
|
+
const ticks = text.includes('`') ? '``' : '`';
|
|
11
|
+
out = `${ticks}${text}${ticks}`;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
out = escapeText(text);
|
|
15
|
+
}
|
|
16
|
+
if (has('subscript'))
|
|
17
|
+
out = `<sub>${out}</sub>`;
|
|
18
|
+
if (has('superscript'))
|
|
19
|
+
out = `<sup>${out}</sup>`;
|
|
20
|
+
if (has('underline'))
|
|
21
|
+
out = `<u>${out}</u>`;
|
|
22
|
+
if (has('strike'))
|
|
23
|
+
out = `~~${out}~~`;
|
|
24
|
+
if (has('italic'))
|
|
25
|
+
out = `*${out}*`;
|
|
26
|
+
if (has('bold'))
|
|
27
|
+
out = `**${out}**`;
|
|
28
|
+
const link = marks.find(m => m.type.name === 'link');
|
|
29
|
+
if (link)
|
|
30
|
+
out = `[${out}](${link.attrs.href})`;
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
/** Inline content of a textblock (text runs, breaks, images, mentions). */
|
|
34
|
+
function serializeInline(node) {
|
|
35
|
+
let result = '';
|
|
36
|
+
node.forEach(child => {
|
|
37
|
+
if (child.isText) {
|
|
38
|
+
result += serializeMarks(child.text ?? '', child.marks);
|
|
39
|
+
}
|
|
40
|
+
else if (child.type.name === 'hard_break') {
|
|
41
|
+
result += ' \n';
|
|
42
|
+
}
|
|
43
|
+
else if (child.type.name === 'image') {
|
|
44
|
+
result += ``;
|
|
45
|
+
}
|
|
46
|
+
else if (child.type.name === 'mention') {
|
|
47
|
+
result += `${child.attrs.trigger}${child.attrs.label}`;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function serializeChildren(node) {
|
|
53
|
+
const parts = [];
|
|
54
|
+
node.forEach(child => parts.push(serializeBlock(child)));
|
|
55
|
+
return parts.join('\n\n');
|
|
56
|
+
}
|
|
57
|
+
/** One list item: first paragraph on the marker line, the rest indented. */
|
|
58
|
+
function serializeListItem(item, marker, indent) {
|
|
59
|
+
const contPad = indent + ' '.repeat(marker.length);
|
|
60
|
+
const parts = [];
|
|
61
|
+
item.forEach(child => {
|
|
62
|
+
const name = child.type.name;
|
|
63
|
+
if (name === 'bullet_list') {
|
|
64
|
+
parts.push(serializeList(child, contPad, null));
|
|
65
|
+
}
|
|
66
|
+
else if (name === 'ordered_list') {
|
|
67
|
+
parts.push(serializeList(child, contPad, child.attrs.order ?? 1));
|
|
68
|
+
}
|
|
69
|
+
else if (name === 'task_list') {
|
|
70
|
+
parts.push(serializeTaskList(child, contPad));
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
parts.push(serializeBlock(child)
|
|
74
|
+
.split('\n')
|
|
75
|
+
.map(line => contPad + line)
|
|
76
|
+
.join('\n'));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
// The first line was padded like a continuation; swap that pad for the
|
|
80
|
+
// marker (same width, so nested content stays aligned).
|
|
81
|
+
const body = parts.join('\n');
|
|
82
|
+
return indent + marker + body.slice(contPad.length);
|
|
83
|
+
}
|
|
84
|
+
function serializeList(list, indent, startOrder) {
|
|
85
|
+
const lines = [];
|
|
86
|
+
let order = startOrder ?? 1;
|
|
87
|
+
list.forEach(item => {
|
|
88
|
+
lines.push(serializeListItem(item, startOrder === null ? '- ' : `${order}. `, indent));
|
|
89
|
+
order += 1;
|
|
90
|
+
});
|
|
91
|
+
return lines.join('\n');
|
|
92
|
+
}
|
|
93
|
+
function serializeTaskList(list, indent) {
|
|
94
|
+
const lines = [];
|
|
95
|
+
list.forEach(item => {
|
|
96
|
+
const box = item.attrs.checked ? '[x] ' : '[ ] ';
|
|
97
|
+
lines.push(serializeListItem(item, `- ${box}`, indent));
|
|
98
|
+
});
|
|
99
|
+
return lines.join('\n');
|
|
100
|
+
}
|
|
101
|
+
/** GitHub-flavored table. Cells use the first paragraph's inline text. */
|
|
102
|
+
function serializeTable(table) {
|
|
103
|
+
const rows = [];
|
|
104
|
+
table.forEach(row => {
|
|
105
|
+
const cells = [];
|
|
106
|
+
row.forEach(cell => {
|
|
107
|
+
const text = cell.firstChild ? serializeInline(cell.firstChild) : '';
|
|
108
|
+
cells.push(text.replace(/\n/g, ' ').replace(/\|/g, '\\|').trim());
|
|
109
|
+
});
|
|
110
|
+
rows.push(cells);
|
|
111
|
+
});
|
|
112
|
+
if (rows.length === 0)
|
|
113
|
+
return '';
|
|
114
|
+
const cols = Math.max(...rows.map(r => r.length));
|
|
115
|
+
const pad = (r) => {
|
|
116
|
+
const copy = r.slice();
|
|
117
|
+
while (copy.length < cols)
|
|
118
|
+
copy.push('');
|
|
119
|
+
return copy;
|
|
120
|
+
};
|
|
121
|
+
const fmt = (r) => `| ${pad(r).join(' | ')} |`;
|
|
122
|
+
return [
|
|
123
|
+
fmt(rows[0]),
|
|
124
|
+
fmt(new Array(cols).fill('---')),
|
|
125
|
+
...rows.slice(1).map(fmt),
|
|
126
|
+
].join('\n');
|
|
127
|
+
}
|
|
128
|
+
function serializeBlock(node) {
|
|
129
|
+
switch (node.type.name) {
|
|
130
|
+
case 'paragraph':
|
|
131
|
+
return serializeInline(node);
|
|
132
|
+
case 'heading':
|
|
133
|
+
return `${'#'.repeat(node.attrs.level)} ${serializeInline(node)}`;
|
|
134
|
+
case 'blockquote':
|
|
135
|
+
return serializeChildren(node)
|
|
136
|
+
.split('\n')
|
|
137
|
+
.map(line => (line ? `> ${line}` : '>'))
|
|
138
|
+
.join('\n');
|
|
139
|
+
case 'code_block':
|
|
140
|
+
return `\`\`\`${node.attrs.language ?? ''}\n${node.textContent}\n\`\`\``;
|
|
141
|
+
case 'horizontal_rule':
|
|
142
|
+
return '---';
|
|
143
|
+
case 'bullet_list':
|
|
144
|
+
return serializeList(node, '', null);
|
|
145
|
+
case 'ordered_list':
|
|
146
|
+
return serializeList(node, '', node.attrs.order ?? 1);
|
|
147
|
+
case 'task_list':
|
|
148
|
+
return serializeTaskList(node, '');
|
|
149
|
+
case 'table':
|
|
150
|
+
return serializeTable(node);
|
|
151
|
+
case 'embed':
|
|
152
|
+
return node.attrs.src;
|
|
153
|
+
default:
|
|
154
|
+
return node.isTextblock ? serializeInline(node) : serializeChildren(node);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Serializes a document node to a Markdown string. */
|
|
158
|
+
export function docToMarkdown(doc) {
|
|
159
|
+
const body = serializeChildren(doc).replace(/\n{3,}/g, '\n\n').trim();
|
|
160
|
+
return body ? `${body}\n` : '';
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=markdown.js.map
|