@aquera/nile-elements 1.9.6 → 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 +3 -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 +3595 -629
- 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-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 +1 -1
- 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-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-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-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-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 +450 -0
- 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,349 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css } from 'lit';
|
|
3
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
+
import NileElement from '../../internal/nile-element';
|
|
5
|
+
import '../../nile-input/index';
|
|
6
|
+
import '../../nile-button/index';
|
|
7
|
+
/**
|
|
8
|
+
* Floating image insert/edit panel, matching nile-rich-text-editor's image
|
|
9
|
+
* dialog: URL + alt + caption (nile-input) and an Insert action. When
|
|
10
|
+
* `upload-from-computer` is set it also offers an "or / Upload from computer"
|
|
11
|
+
* button (with max-size validation), matching the RTE's `uploadfromcomputer`
|
|
12
|
+
* flag. An edit mode pre-fills the fields and adds Remove.
|
|
13
|
+
*
|
|
14
|
+
* The host positions it and listens for:
|
|
15
|
+
* - `wysiwyg-image-apply` detail: { src, alt, caption } (insert / edit)
|
|
16
|
+
* - `wysiwyg-image-file` detail: { file, alt, caption } (upload)
|
|
17
|
+
* - `wysiwyg-image-remove` (delete active image)
|
|
18
|
+
* - `wysiwyg-image-cancel` (Escape)
|
|
19
|
+
*/
|
|
20
|
+
let NileWysiwygImagePanel = class NileWysiwygImagePanel extends NileElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.open = false;
|
|
24
|
+
/** True when editing an already-inserted image (shows Remove, "Save"). */
|
|
25
|
+
this.editing = false;
|
|
26
|
+
/** Shows the "Upload from computer" button below the URL field. */
|
|
27
|
+
this.uploadFromComputer = false;
|
|
28
|
+
/** Maximum allowed upload size in bytes (default 2 MB). */
|
|
29
|
+
this.maxFileSize = 2 * 1024 * 1024;
|
|
30
|
+
this.srcValue = '';
|
|
31
|
+
this.altValue = '';
|
|
32
|
+
this.captionValue = '';
|
|
33
|
+
this.uploadedFileName = '';
|
|
34
|
+
this.errorMessage = '';
|
|
35
|
+
/** File staged by "Upload from computer", applied on Insert. */
|
|
36
|
+
this.stagedFile = null;
|
|
37
|
+
}
|
|
38
|
+
static get styles() {
|
|
39
|
+
return [
|
|
40
|
+
css `
|
|
41
|
+
:host {
|
|
42
|
+
font-family: var(
|
|
43
|
+
--nile-font-family-sans-serif,
|
|
44
|
+
var(--ng-font-family-body, system-ui, -apple-system, sans-serif)
|
|
45
|
+
);
|
|
46
|
+
position: absolute;
|
|
47
|
+
z-index: 20;
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([open]) {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.image-panel {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
min-width: 340px;
|
|
60
|
+
max-width: 420px;
|
|
61
|
+
padding: 12px;
|
|
62
|
+
background: var(--nile-wysiwyg-popover-bg, #ffffff);
|
|
63
|
+
border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);
|
|
64
|
+
border-radius: 8px;
|
|
65
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
|
66
|
+
font-size: 13px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
nile-input {
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.divider {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 8px;
|
|
77
|
+
color: var(--nile-colors-neutral-500, #98a2b3);
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.divider::before,
|
|
82
|
+
.divider::after {
|
|
83
|
+
content: '';
|
|
84
|
+
flex: 1;
|
|
85
|
+
height: 1px;
|
|
86
|
+
background: var(--nile-colors-neutral-300, #e4e7ec);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.upload-row {
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
align-items: stretch;
|
|
93
|
+
gap: 6px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.upload-btn {
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Center the icon + label within the full-width upload button. */
|
|
101
|
+
.upload-btn::part(base) {
|
|
102
|
+
width: 100%;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.upload-filename {
|
|
107
|
+
color: var(--nile-colors-neutral-600, #475467);
|
|
108
|
+
font-size: 12px;
|
|
109
|
+
text-align: center;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.hidden-file {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.error {
|
|
120
|
+
color: var(--nile-colors-danger-600, #d92d20);
|
|
121
|
+
font-size: 12px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.actions {
|
|
125
|
+
display: flex;
|
|
126
|
+
justify-content: flex-end;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: 8px;
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.actions .spacer {
|
|
133
|
+
flex: 1;
|
|
134
|
+
}
|
|
135
|
+
`,
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
focusInput() {
|
|
139
|
+
this.updateComplete.then(() => {
|
|
140
|
+
const input = this.shadowRoot?.querySelector('nile-input');
|
|
141
|
+
input?.focus();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/** Clears every field and returns to insert (non-editing) mode. */
|
|
145
|
+
reset() {
|
|
146
|
+
this.editing = false;
|
|
147
|
+
this.srcValue = '';
|
|
148
|
+
this.altValue = '';
|
|
149
|
+
this.captionValue = '';
|
|
150
|
+
this.uploadedFileName = '';
|
|
151
|
+
this.errorMessage = '';
|
|
152
|
+
this.stagedFile = null;
|
|
153
|
+
}
|
|
154
|
+
/** Pre-fills the panel for editing an existing image. */
|
|
155
|
+
prefill(data) {
|
|
156
|
+
this.editing = true;
|
|
157
|
+
this.srcValue = data.src ?? '';
|
|
158
|
+
this.altValue = data.alt ?? '';
|
|
159
|
+
this.captionValue = data.caption ?? '';
|
|
160
|
+
this.uploadedFileName = '';
|
|
161
|
+
this.errorMessage = '';
|
|
162
|
+
this.stagedFile = null;
|
|
163
|
+
}
|
|
164
|
+
onSrc(event) {
|
|
165
|
+
this.srcValue = (event.detail?.value ?? '');
|
|
166
|
+
if (this.srcValue && this.stagedFile) {
|
|
167
|
+
this.stagedFile = null;
|
|
168
|
+
this.uploadedFileName = '';
|
|
169
|
+
}
|
|
170
|
+
this.errorMessage = '';
|
|
171
|
+
}
|
|
172
|
+
onAlt(event) {
|
|
173
|
+
this.altValue = (event.detail?.value ?? '');
|
|
174
|
+
}
|
|
175
|
+
onCaption(event) {
|
|
176
|
+
this.captionValue = (event.detail?.value ?? '');
|
|
177
|
+
}
|
|
178
|
+
triggerFilePicker() {
|
|
179
|
+
const input = this.shadowRoot?.querySelector('.hidden-file');
|
|
180
|
+
input?.click();
|
|
181
|
+
}
|
|
182
|
+
onFileChange(event) {
|
|
183
|
+
const input = event.target;
|
|
184
|
+
const file = input.files?.[0];
|
|
185
|
+
if (!file)
|
|
186
|
+
return;
|
|
187
|
+
if (!file.type.startsWith('image/')) {
|
|
188
|
+
this.errorMessage = 'Please choose an image file.';
|
|
189
|
+
input.value = '';
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (file.size > this.maxFileSize) {
|
|
193
|
+
const mb = Math.round((this.maxFileSize / (1024 * 1024)) * 10) / 10;
|
|
194
|
+
this.errorMessage = `Image must be under ${mb} MB.`;
|
|
195
|
+
input.value = '';
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.stagedFile = file;
|
|
199
|
+
this.uploadedFileName = file.name;
|
|
200
|
+
this.srcValue = '';
|
|
201
|
+
this.errorMessage = '';
|
|
202
|
+
input.value = '';
|
|
203
|
+
}
|
|
204
|
+
handleSubmit() {
|
|
205
|
+
const alt = this.altValue.trim();
|
|
206
|
+
const caption = this.captionValue.trim();
|
|
207
|
+
if (this.stagedFile) {
|
|
208
|
+
this.emit('wysiwyg-image-file', { file: this.stagedFile, alt, caption });
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const src = this.srcValue.trim();
|
|
212
|
+
if (!src) {
|
|
213
|
+
this.errorMessage = this.uploadFromComputer
|
|
214
|
+
? 'Add an image URL or upload a file.'
|
|
215
|
+
: 'Add an image URL.';
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
this.emit('wysiwyg-image-apply', { src, alt, caption });
|
|
219
|
+
}
|
|
220
|
+
handleKeydown(event) {
|
|
221
|
+
if (event.key === 'Escape') {
|
|
222
|
+
event.stopPropagation();
|
|
223
|
+
this.emit('wysiwyg-image-cancel');
|
|
224
|
+
}
|
|
225
|
+
else if (event.key === 'Enter') {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
event.stopPropagation();
|
|
228
|
+
this.handleSubmit();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
render() {
|
|
232
|
+
return html `
|
|
233
|
+
<div class="image-panel" part="image-panel" @keydown=${this.handleKeydown}>
|
|
234
|
+
<nile-input
|
|
235
|
+
label="Image URL"
|
|
236
|
+
placeholder="Paste image link here"
|
|
237
|
+
.value=${this.srcValue}
|
|
238
|
+
@nile-input=${this.onSrc}
|
|
239
|
+
></nile-input>
|
|
240
|
+
|
|
241
|
+
${this.uploadFromComputer
|
|
242
|
+
? html `
|
|
243
|
+
<div class="divider">or</div>
|
|
244
|
+
<div class="upload-row">
|
|
245
|
+
<nile-button
|
|
246
|
+
class="upload-btn"
|
|
247
|
+
variant="secondary"
|
|
248
|
+
@click=${this.triggerFilePicker}
|
|
249
|
+
>
|
|
250
|
+
<svg
|
|
251
|
+
slot="prefix"
|
|
252
|
+
width="14"
|
|
253
|
+
height="14"
|
|
254
|
+
viewBox="0 0 24 24"
|
|
255
|
+
fill="none"
|
|
256
|
+
stroke="currentColor"
|
|
257
|
+
stroke-width="2"
|
|
258
|
+
stroke-linecap="round"
|
|
259
|
+
stroke-linejoin="round"
|
|
260
|
+
aria-hidden="true"
|
|
261
|
+
>
|
|
262
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
263
|
+
<polyline points="17 8 12 3 7 8" />
|
|
264
|
+
<line x1="12" y1="3" x2="12" y2="15" />
|
|
265
|
+
</svg>
|
|
266
|
+
Upload from computer
|
|
267
|
+
</nile-button>
|
|
268
|
+
${this.uploadedFileName
|
|
269
|
+
? html `<span class="upload-filename" title=${this.uploadedFileName}
|
|
270
|
+
>${this.uploadedFileName}</span
|
|
271
|
+
>`
|
|
272
|
+
: null}
|
|
273
|
+
</div>
|
|
274
|
+
<input
|
|
275
|
+
class="hidden-file"
|
|
276
|
+
type="file"
|
|
277
|
+
accept="image/*"
|
|
278
|
+
@change=${this.onFileChange}
|
|
279
|
+
/>
|
|
280
|
+
`
|
|
281
|
+
: null}
|
|
282
|
+
|
|
283
|
+
${this.errorMessage
|
|
284
|
+
? html `<span class="error" part="error">${this.errorMessage}</span>`
|
|
285
|
+
: null}
|
|
286
|
+
|
|
287
|
+
<nile-input
|
|
288
|
+
label="Alt text"
|
|
289
|
+
placeholder="Describe the image"
|
|
290
|
+
.value=${this.altValue}
|
|
291
|
+
@nile-input=${this.onAlt}
|
|
292
|
+
></nile-input>
|
|
293
|
+
|
|
294
|
+
<nile-input
|
|
295
|
+
label="Caption"
|
|
296
|
+
placeholder="Add a caption (optional)"
|
|
297
|
+
.value=${this.captionValue}
|
|
298
|
+
@nile-input=${this.onCaption}
|
|
299
|
+
></nile-input>
|
|
300
|
+
|
|
301
|
+
<div class="actions">
|
|
302
|
+
${this.editing
|
|
303
|
+
? html `<nile-button
|
|
304
|
+
variant="destructive"
|
|
305
|
+
@click=${() => this.emit('wysiwyg-image-remove')}
|
|
306
|
+
>Remove</nile-button
|
|
307
|
+
>
|
|
308
|
+
<span class="spacer"></span>`
|
|
309
|
+
: null}
|
|
310
|
+
<nile-button variant="primary" @click=${() => this.handleSubmit()}
|
|
311
|
+
>${this.editing ? 'Save' : 'Insert'}</nile-button
|
|
312
|
+
>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
`;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: Boolean, reflect: true })
|
|
320
|
+
], NileWysiwygImagePanel.prototype, "open", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: Boolean })
|
|
323
|
+
], NileWysiwygImagePanel.prototype, "editing", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: Boolean, attribute: 'upload-from-computer' })
|
|
326
|
+
], NileWysiwygImagePanel.prototype, "uploadFromComputer", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: Number, attribute: 'max-file-size' })
|
|
329
|
+
], NileWysiwygImagePanel.prototype, "maxFileSize", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
state()
|
|
332
|
+
], NileWysiwygImagePanel.prototype, "srcValue", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
state()
|
|
335
|
+
], NileWysiwygImagePanel.prototype, "altValue", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
state()
|
|
338
|
+
], NileWysiwygImagePanel.prototype, "captionValue", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
state()
|
|
341
|
+
], NileWysiwygImagePanel.prototype, "uploadedFileName", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
state()
|
|
344
|
+
], NileWysiwygImagePanel.prototype, "errorMessage", void 0);
|
|
345
|
+
NileWysiwygImagePanel = __decorate([
|
|
346
|
+
customElement('nile-wysiwyg-image-panel')
|
|
347
|
+
], NileWysiwygImagePanel);
|
|
348
|
+
export { NileWysiwygImagePanel };
|
|
349
|
+
//# sourceMappingURL=image-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-panel.js","sourceRoot":"","sources":["../../../../src/nile-wysiwyg-editor/ui/image-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,wBAAwB,CAAC;AAChC,OAAO,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;GAYG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,WAAW;IAA/C;;QACuC,SAAI,GAAG,KAAK,CAAC;QAEzD,0EAA0E;QAC7C,YAAO,GAAG,KAAK,CAAC;QAE7C,mEAAmE;QAEnE,uBAAkB,GAAG,KAAK,CAAC;QAE3B,2DAA2D;QACH,gBAA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AAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;;;6CAGrB;YACjC,CAAC,CAAC,IAAI;kDACgC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;eAC5D,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;;;;KAI1C,CAAC;IACJ,CAAC;CACF,CAAA;AArT6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAAc;AAG5B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sDAAiB;AAI7C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC;iEACpC;AAG6B;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;0DAA+B;AAErE;IAAhB,KAAK,EAAE;uDAAuB;AACd;IAAhB,KAAK,EAAE;uDAAuB;AACd;IAAhB,KAAK,EAAE;2DAA2B;AAClB;IAAhB,KAAK,EAAE;+DAA+B;AACtB;IAAhB,KAAK,EAAE;2DAA2B;AAjBxB,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAsTjC","sourcesContent":["import { html, css, TemplateResult, CSSResultArray } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport NileElement from '../../internal/nile-element';\nimport '../../nile-input/index';\nimport '../../nile-button/index';\n\n/**\n * Floating image insert/edit panel, matching nile-rich-text-editor's image\n * dialog: URL + alt + caption (nile-input) and an Insert action. When\n * `upload-from-computer` is set it also offers an \"or / Upload from computer\"\n * button (with max-size validation), matching the RTE's `uploadfromcomputer`\n * flag. An edit mode pre-fills the fields and adds Remove.\n *\n * The host positions it and listens for:\n * - `wysiwyg-image-apply` detail: { src, alt, caption } (insert / edit)\n * - `wysiwyg-image-file` detail: { file, alt, caption } (upload)\n * - `wysiwyg-image-remove` (delete active image)\n * - `wysiwyg-image-cancel` (Escape)\n */\n@customElement('nile-wysiwyg-image-panel')\nexport class NileWysiwygImagePanel extends NileElement {\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** True when editing an already-inserted image (shows Remove, \"Save\"). */\n @property({ type: Boolean }) editing = false;\n\n /** Shows the \"Upload from computer\" button below the URL field. */\n @property({ type: Boolean, attribute: 'upload-from-computer' })\n uploadFromComputer = false;\n\n /** Maximum allowed upload size in bytes (default 2 MB). */\n @property({ type: Number, attribute: 'max-file-size' }) maxFileSize = 2 * 1024 * 1024;\n\n @state() private srcValue = '';\n @state() private altValue = '';\n @state() private captionValue = '';\n @state() private uploadedFileName = '';\n @state() private errorMessage = '';\n\n /** File staged by \"Upload from computer\", applied on Insert. */\n private stagedFile: File | null = null;\n\n public static get styles(): CSSResultArray {\n return [\n css`\n :host {\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n position: absolute;\n z-index: 20;\n display: none;\n }\n\n :host([open]) {\n display: block;\n }\n\n .image-panel {\n display: flex;\n flex-direction: column;\n gap: 12px;\n min-width: 340px;\n max-width: 420px;\n padding: 12px;\n background: var(--nile-wysiwyg-popover-bg, #ffffff);\n border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);\n border-radius: 8px;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);\n font-size: 13px;\n }\n\n nile-input {\n width: 100%;\n }\n\n .divider {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--nile-colors-neutral-500, #98a2b3);\n font-size: 12px;\n }\n\n .divider::before,\n .divider::after {\n content: '';\n flex: 1;\n height: 1px;\n background: var(--nile-colors-neutral-300, #e4e7ec);\n }\n\n .upload-row {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n gap: 6px;\n }\n\n .upload-btn {\n width: 100%;\n }\n\n /* Center the icon + label within the full-width upload button. */\n .upload-btn::part(base) {\n width: 100%;\n justify-content: center;\n }\n\n .upload-filename {\n color: var(--nile-colors-neutral-600, #475467);\n font-size: 12px;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .hidden-file {\n display: none;\n }\n\n .error {\n color: var(--nile-colors-danger-600, #d92d20);\n font-size: 12px;\n }\n\n .actions {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n width: 100%;\n }\n\n .actions .spacer {\n flex: 1;\n }\n `,\n ];\n }\n\n public focusInput(): void {\n this.updateComplete.then(() => {\n const input = this.shadowRoot?.querySelector('nile-input') as HTMLElement | null;\n input?.focus();\n });\n }\n\n /** Clears every field and returns to insert (non-editing) mode. */\n public reset(): void {\n this.editing = false;\n this.srcValue = '';\n this.altValue = '';\n this.captionValue = '';\n this.uploadedFileName = '';\n this.errorMessage = '';\n this.stagedFile = null;\n }\n\n /** Pre-fills the panel for editing an existing image. */\n public prefill(data: { src?: string; alt?: string; caption?: string }): void {\n this.editing = true;\n this.srcValue = data.src ?? '';\n this.altValue = data.alt ?? '';\n this.captionValue = data.caption ?? '';\n this.uploadedFileName = '';\n this.errorMessage = '';\n this.stagedFile = null;\n }\n\n private onSrc(event: CustomEvent): void {\n this.srcValue = (event.detail?.value ?? '') as string;\n if (this.srcValue && this.stagedFile) {\n this.stagedFile = null;\n this.uploadedFileName = '';\n }\n this.errorMessage = '';\n }\n\n private onAlt(event: CustomEvent): void {\n this.altValue = (event.detail?.value ?? '') as string;\n }\n\n private onCaption(event: CustomEvent): void {\n this.captionValue = (event.detail?.value ?? '') as string;\n }\n\n private triggerFilePicker(): void {\n const input = this.shadowRoot?.querySelector('.hidden-file') as HTMLInputElement | null;\n input?.click();\n }\n\n private onFileChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n const file = input.files?.[0];\n if (!file) return;\n if (!file.type.startsWith('image/')) {\n this.errorMessage = 'Please choose an image file.';\n input.value = '';\n return;\n }\n if (file.size > this.maxFileSize) {\n const mb = Math.round((this.maxFileSize / (1024 * 1024)) * 10) / 10;\n this.errorMessage = `Image must be under ${mb} MB.`;\n input.value = '';\n return;\n }\n this.stagedFile = file;\n this.uploadedFileName = file.name;\n this.srcValue = '';\n this.errorMessage = '';\n input.value = '';\n }\n\n private handleSubmit(): void {\n const alt = this.altValue.trim();\n const caption = this.captionValue.trim();\n if (this.stagedFile) {\n this.emit('wysiwyg-image-file', { file: this.stagedFile, alt, caption });\n return;\n }\n const src = this.srcValue.trim();\n if (!src) {\n this.errorMessage = this.uploadFromComputer\n ? 'Add an image URL or upload a file.'\n : 'Add an image URL.';\n return;\n }\n this.emit('wysiwyg-image-apply', { src, alt, caption });\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n event.stopPropagation();\n this.emit('wysiwyg-image-cancel');\n } else if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n this.handleSubmit();\n }\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"image-panel\" part=\"image-panel\" @keydown=${this.handleKeydown}>\n <nile-input\n label=\"Image URL\"\n placeholder=\"Paste image link here\"\n .value=${this.srcValue}\n @nile-input=${this.onSrc}\n ></nile-input>\n\n ${this.uploadFromComputer\n ? html`\n <div class=\"divider\">or</div>\n <div class=\"upload-row\">\n <nile-button\n class=\"upload-btn\"\n variant=\"secondary\"\n @click=${this.triggerFilePicker}\n >\n <svg\n slot=\"prefix\"\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <polyline points=\"17 8 12 3 7 8\" />\n <line x1=\"12\" y1=\"3\" x2=\"12\" y2=\"15\" />\n </svg>\n Upload from computer\n </nile-button>\n ${this.uploadedFileName\n ? html`<span class=\"upload-filename\" title=${this.uploadedFileName}\n >${this.uploadedFileName}</span\n >`\n : null}\n </div>\n <input\n class=\"hidden-file\"\n type=\"file\"\n accept=\"image/*\"\n @change=${this.onFileChange}\n />\n `\n : null}\n\n ${this.errorMessage\n ? html`<span class=\"error\" part=\"error\">${this.errorMessage}</span>`\n : null}\n\n <nile-input\n label=\"Alt text\"\n placeholder=\"Describe the image\"\n .value=${this.altValue}\n @nile-input=${this.onAlt}\n ></nile-input>\n\n <nile-input\n label=\"Caption\"\n placeholder=\"Add a caption (optional)\"\n .value=${this.captionValue}\n @nile-input=${this.onCaption}\n ></nile-input>\n\n <div class=\"actions\">\n ${this.editing\n ? html`<nile-button\n variant=\"destructive\"\n @click=${() => this.emit('wysiwyg-image-remove')}\n >Remove</nile-button\n >\n <span class=\"spacer\"></span>`\n : null}\n <nile-button variant=\"primary\" @click=${() => this.handleSubmit()}\n >${this.editing ? 'Save' : 'Insert'}</nile-button\n >\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-wysiwyg-image-panel': NileWysiwygImagePanel;\n }\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TemplateResult, CSSResultArray } from 'lit';
|
|
2
|
+
import NileElement from '../../internal/nile-element';
|
|
3
|
+
export interface InsertMenuItem {
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generic list popover for "pick one and insert" toolbar actions — used by the
|
|
9
|
+
* template and merge-field pickers. Emits `wysiwyg-insert-select` { index } and
|
|
10
|
+
* `wysiwyg-insert-cancel`. Never takes focus, so the editor selection survives.
|
|
11
|
+
*/
|
|
12
|
+
export declare class NileWysiwygInsertMenu extends NileElement {
|
|
13
|
+
open: boolean;
|
|
14
|
+
heading: string;
|
|
15
|
+
emptyText: string;
|
|
16
|
+
items: InsertMenuItem[];
|
|
17
|
+
static get styles(): CSSResultArray;
|
|
18
|
+
private handleKeydown;
|
|
19
|
+
render(): TemplateResult;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'nile-wysiwyg-insert-menu': NileWysiwygInsertMenu;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, nothing } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import NileElement from '../../internal/nile-element';
|
|
5
|
+
/**
|
|
6
|
+
* Generic list popover for "pick one and insert" toolbar actions — used by the
|
|
7
|
+
* template and merge-field pickers. Emits `wysiwyg-insert-select` { index } and
|
|
8
|
+
* `wysiwyg-insert-cancel`. Never takes focus, so the editor selection survives.
|
|
9
|
+
*/
|
|
10
|
+
let NileWysiwygInsertMenu = class NileWysiwygInsertMenu extends NileElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.open = false;
|
|
14
|
+
this.heading = '';
|
|
15
|
+
this.emptyText = 'Nothing configured.';
|
|
16
|
+
this.items = [];
|
|
17
|
+
}
|
|
18
|
+
static get styles() {
|
|
19
|
+
return [
|
|
20
|
+
css `
|
|
21
|
+
:host {
|
|
22
|
+
font-family: var(
|
|
23
|
+
--nile-font-family-sans-serif,
|
|
24
|
+
var(--ng-font-family-body, system-ui, -apple-system, sans-serif)
|
|
25
|
+
);
|
|
26
|
+
position: absolute;
|
|
27
|
+
z-index: 20;
|
|
28
|
+
display: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([open]) {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.panel {
|
|
36
|
+
width: 260px;
|
|
37
|
+
max-height: 300px;
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
overscroll-behavior: contain;
|
|
40
|
+
padding: 6px;
|
|
41
|
+
background: var(--nile-wysiwyg-popover-bg, #ffffff);
|
|
42
|
+
border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.heading {
|
|
48
|
+
font-size: 11px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
text-transform: uppercase;
|
|
51
|
+
letter-spacing: 0.04em;
|
|
52
|
+
color: var(--nile-colors-neutral-600, #667085);
|
|
53
|
+
padding: 4px 8px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.item {
|
|
57
|
+
display: block;
|
|
58
|
+
width: 100%;
|
|
59
|
+
text-align: left;
|
|
60
|
+
font: inherit;
|
|
61
|
+
padding: 6px 8px;
|
|
62
|
+
border: none;
|
|
63
|
+
border-radius: 6px;
|
|
64
|
+
background: transparent;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
color: var(--nile-colors-dark-900, #101828);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.item:hover {
|
|
70
|
+
background: var(--nile-colors-neutral-100, #f2f4f7);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.item .label {
|
|
74
|
+
font-size: 13px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.item .desc {
|
|
78
|
+
font-size: 11px;
|
|
79
|
+
color: var(--nile-colors-neutral-600, #667085);
|
|
80
|
+
margin-top: 1px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.empty {
|
|
84
|
+
font-size: 12px;
|
|
85
|
+
color: var(--nile-colors-neutral-600, #667085);
|
|
86
|
+
padding: 8px;
|
|
87
|
+
}
|
|
88
|
+
`,
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
handleKeydown(event) {
|
|
92
|
+
if (event.key === 'Escape') {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
this.emit('wysiwyg-insert-cancel');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
render() {
|
|
98
|
+
return html `
|
|
99
|
+
<div
|
|
100
|
+
class="panel"
|
|
101
|
+
part="insert-menu"
|
|
102
|
+
role="menu"
|
|
103
|
+
@keydown=${this.handleKeydown}
|
|
104
|
+
@mousedown=${(e) => e.preventDefault()}
|
|
105
|
+
>
|
|
106
|
+
${this.heading ? html `<div class="heading">${this.heading}</div>` : nothing}
|
|
107
|
+
${this.items.length === 0
|
|
108
|
+
? html `<div class="empty">${this.emptyText}</div>`
|
|
109
|
+
: this.items.map((item, index) => html `
|
|
110
|
+
<button
|
|
111
|
+
type="button"
|
|
112
|
+
class="item"
|
|
113
|
+
role="menuitem"
|
|
114
|
+
@click=${() => this.emit('wysiwyg-insert-select', { index })}
|
|
115
|
+
>
|
|
116
|
+
<div class="label">${item.label}</div>
|
|
117
|
+
${item.description
|
|
118
|
+
? html `<div class="desc">${item.description}</div>`
|
|
119
|
+
: nothing}
|
|
120
|
+
</button>
|
|
121
|
+
`)}
|
|
122
|
+
</div>
|
|
123
|
+
`;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
__decorate([
|
|
127
|
+
property({ type: Boolean, reflect: true })
|
|
128
|
+
], NileWysiwygInsertMenu.prototype, "open", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
property({ type: String })
|
|
131
|
+
], NileWysiwygInsertMenu.prototype, "heading", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
property({ type: String, attribute: 'empty-text' })
|
|
134
|
+
], NileWysiwygInsertMenu.prototype, "emptyText", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
property({ attribute: false })
|
|
137
|
+
], NileWysiwygInsertMenu.prototype, "items", void 0);
|
|
138
|
+
NileWysiwygInsertMenu = __decorate([
|
|
139
|
+
customElement('nile-wysiwyg-insert-menu')
|
|
140
|
+
], NileWysiwygInsertMenu);
|
|
141
|
+
export { NileWysiwygInsertMenu };
|
|
142
|
+
//# sourceMappingURL=insert-menu.js.map
|
|
@@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,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CACZ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;2BAKR,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,CAAC;;uCAEvC,IAAI,CAAC,KAAK;oBAC7B,IAAI,CAAC,WAAW;gBAChB,CAAC,CAAC,IAAI,CAAA,qBAAqB,IAAI,CAAC,WAAW,QAAQ;gBACnD,CAAC,CAAC,OAAO;;eAEd,CACF;;KAER,CAAC;IACJ,CAAC;CACF,CAAA;AAvH6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAAc;AAE7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAc;AAEY;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;wDAAmC;AAEvD;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDAA8B;AAPlD,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAwHjC","sourcesContent":["import { html, css, TemplateResult, CSSResultArray, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport NileElement from '../../internal/nile-element';\n\nexport interface InsertMenuItem {\n label: string;\n description?: string;\n}\n\n/**\n * Generic list popover for \"pick one and insert\" toolbar actions — used by the\n * template and merge-field pickers. Emits `wysiwyg-insert-select` { index } and\n * `wysiwyg-insert-cancel`. Never takes focus, so the editor selection survives.\n */\n@customElement('nile-wysiwyg-insert-menu')\nexport class NileWysiwygInsertMenu extends NileElement {\n @property({ type: Boolean, reflect: true }) open = false;\n\n @property({ type: String }) heading = '';\n\n @property({ type: String, attribute: 'empty-text' }) emptyText = 'Nothing configured.';\n\n @property({ attribute: false }) items: InsertMenuItem[] = [];\n\n public static get styles(): CSSResultArray {\n return [\n css`\n :host {\n font-family: var(\n --nile-font-family-sans-serif,\n var(--ng-font-family-body, system-ui, -apple-system, sans-serif)\n );\n position: absolute;\n z-index: 20;\n display: none;\n }\n\n :host([open]) {\n display: block;\n }\n\n .panel {\n width: 260px;\n max-height: 300px;\n overflow-y: auto;\n overscroll-behavior: contain;\n padding: 6px;\n background: var(--nile-wysiwyg-popover-bg, #ffffff);\n border: 1px solid var(--nile-colors-neutral-400, #d0d5dd);\n border-radius: 8px;\n box-shadow: var(--nile-wysiwyg-popover-shadow, 0 4px 12px rgba(16, 24, 40, 0.12));\n }\n\n .heading {\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n color: var(--nile-colors-neutral-600, #667085);\n padding: 4px 8px;\n }\n\n .item {\n display: block;\n width: 100%;\n text-align: left;\n font: inherit;\n padding: 6px 8px;\n border: none;\n border-radius: 6px;\n background: transparent;\n cursor: pointer;\n color: var(--nile-colors-dark-900, #101828);\n }\n\n .item:hover {\n background: var(--nile-colors-neutral-100, #f2f4f7);\n }\n\n .item .label {\n font-size: 13px;\n }\n\n .item .desc {\n font-size: 11px;\n color: var(--nile-colors-neutral-600, #667085);\n margin-top: 1px;\n }\n\n .empty {\n font-size: 12px;\n color: var(--nile-colors-neutral-600, #667085);\n padding: 8px;\n }\n `,\n ];\n }\n\n private handleKeydown(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n event.stopPropagation();\n this.emit('wysiwyg-insert-cancel');\n }\n }\n\n public render(): TemplateResult {\n return html`\n <div\n class=\"panel\"\n part=\"insert-menu\"\n role=\"menu\"\n @keydown=${this.handleKeydown}\n @mousedown=${(e: Event) => e.preventDefault()}\n >\n ${this.heading ? html`<div class=\"heading\">${this.heading}</div>` : nothing}\n ${this.items.length === 0\n ? html`<div class=\"empty\">${this.emptyText}</div>`\n : this.items.map(\n (item, index) => html`\n <button\n type=\"button\"\n class=\"item\"\n role=\"menuitem\"\n @click=${() => this.emit('wysiwyg-insert-select', { index })}\n >\n <div class=\"label\">${item.label}</div>\n ${item.description\n ? html`<div class=\"desc\">${item.description}</div>`\n : nothing}\n </button>\n `\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-wysiwyg-insert-menu': NileWysiwygInsertMenu;\n }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TemplateResult, CSSResultArray } from 'lit';
|
|
2
|
+
import NileElement from '../../internal/nile-element';
|
|
3
|
+
/**
|
|
4
|
+
* Floating link create/edit panel. The host positions it absolutely inside
|
|
5
|
+
* the editor chrome and listens for:
|
|
6
|
+
* - `wysiwyg-link-apply` detail: { href, text }
|
|
7
|
+
* - `wysiwyg-link-remove`
|
|
8
|
+
* - `wysiwyg-link-cancel`
|
|
9
|
+
*/
|
|
10
|
+
export declare class NileWysiwygLinkEditor extends NileElement {
|
|
11
|
+
open: boolean;
|
|
12
|
+
href: string;
|
|
13
|
+
text: string;
|
|
14
|
+
/** Show the text field (only when creating a link from a cursor). */
|
|
15
|
+
allowText: boolean;
|
|
16
|
+
/** Show the remove button (when editing an existing link). */
|
|
17
|
+
canRemove: boolean;
|
|
18
|
+
hrefInput?: HTMLInputElement;
|
|
19
|
+
static get styles(): CSSResultArray;
|
|
20
|
+
/** Focuses the URL field; called by the host after opening. */
|
|
21
|
+
focusInput(): void;
|
|
22
|
+
private handleSubmit;
|
|
23
|
+
private handleKeydown;
|
|
24
|
+
render(): TemplateResult;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
'nile-wysiwyg-link-editor': NileWysiwygLinkEditor;
|
|
29
|
+
}
|
|
30
|
+
}
|