@aquera/nile-elements 1.9.7 → 1.9.9
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 +6 -0
- package/dist/{index-249de90a.esm.js → index-289706c7.esm.js} +1 -1
- package/dist/{index-df196058.cjs.js → index-d7e6f1c6.cjs.js} +2 -2
- package/dist/index-d7e6f1c6.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1587 -1276
- package/dist/katex-44476ab4.esm.js +1 -0
- package/dist/katex-f4186f87.cjs.js +2 -0
- package/dist/katex-f4186f87.cjs.js.map +1 -0
- package/dist/nile-color-picker/index.cjs.js +1 -1
- package/dist/nile-color-picker/index.esm.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js.map +1 -1
- package/dist/nile-color-picker/nile-color-picker.esm.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +52 -44
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
- package/dist/nile-virtual-select/renderer.esm.js +23 -22
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/math-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/style-block-view.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/math/katex-renderer.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/math/katex-renderer.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +22 -3
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +7 -6
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.esm.js +33 -54
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +83 -95
- package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-item.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-item.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +23 -15
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +3 -3
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +0 -3
- package/dist/nile-wysiwyg-editor/ui/preview.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/ui/preview.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/ui/preview.esm.js +8 -0
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +225 -24
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +9 -9
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +115 -13
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +13 -12
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-color-picker/nile-color-picker.d.ts +1 -0
- package/dist/src/nile-color-picker/nile-color-picker.js +1 -0
- package/dist/src/nile-color-picker/nile-color-picker.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +9 -1
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-virtual-select/renderer.js +1 -0
- package/dist/src/nile-virtual-select/renderer.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js +3 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embed-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.d.ts +19 -4
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js +23 -18
- package/dist/src/nile-wysiwyg-editor/engine/plugins/embeds.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.d.ts +8 -3
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js +41 -4
- package/dist/src/nile-wysiwyg-editor/engine/plugins/math-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.d.ts +17 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js +174 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/style-block-view.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +33 -2
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +49 -8
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +12 -0
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +76 -8
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +154 -2
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/index.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/index.js +3 -0
- package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.d.ts +38 -0
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js +40 -0
- package/dist/src/nile-wysiwyg-editor/math/katex-renderer.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +22 -3
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +36 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +125 -8
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +5 -2
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.d.ts +55 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js +79 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js +33 -54
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.d.ts +50 -2
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js +158 -102
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/types.d.ts +4 -2
- package/dist/src/nile-wysiwyg-editor/types.js +2 -2
- package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.d.ts +48 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js +69 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-item.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.d.ts +17 -2
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +128 -35
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.d.ts +2 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +4 -3
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +0 -3
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/preview.d.ts +20 -0
- package/dist/src/nile-wysiwyg-editor/ui/preview.js +44 -0
- package/dist/src/nile-wysiwyg-editor/ui/preview.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/source-view.d.ts +35 -3
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +337 -24
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +9 -0
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.d.ts +13 -2
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +166 -10
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +10 -8
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/xml-25c4108a.esm.js +1 -0
- package/dist/xml-90fd974e.cjs.js +2 -0
- package/dist/xml-90fd974e.cjs.js.map +1 -0
- package/package.json +2 -1
- package/rollup.config.js +1 -0
- package/src/index.ts +8 -0
- package/src/nile-color-picker/nile-color-picker.ts +1 -0
- package/src/nile-select/virtual-scroll-helper.ts +9 -1
- package/src/nile-virtual-select/renderer.ts +1 -1
- package/src/nile-wysiwyg-editor/engine/index.ts +1 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embed-view.ts +3 -0
- package/src/nile-wysiwyg-editor/engine/plugins/embeds.ts +26 -20
- package/src/nile-wysiwyg-editor/engine/plugins/math-view.ts +45 -4
- package/src/nile-wysiwyg-editor/engine/plugins/style-block-view.ts +178 -0
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +34 -2
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +58 -8
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +71 -8
- package/src/nile-wysiwyg-editor/engine/schema.ts +158 -7
- package/src/nile-wysiwyg-editor/index.ts +5 -0
- package/src/nile-wysiwyg-editor/math/katex-renderer.ts +59 -0
- package/src/nile-wysiwyg-editor/math/katex.d.ts +17 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +22 -3
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +5 -2
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +142 -7
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.ts +2 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar-item.ts +68 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.css.ts +33 -54
- package/src/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.ts +202 -108
- package/src/nile-wysiwyg-editor/types.ts +6 -4
- package/src/nile-wysiwyg-editor/ui/bubble-item.ts +60 -0
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +147 -40
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +4 -3
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +0 -3
- package/src/nile-wysiwyg-editor/ui/preview.ts +42 -0
- package/src/nile-wysiwyg-editor/ui/source-view.ts +339 -31
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +10 -0
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +160 -10
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +10 -8
- package/vscode-html-custom-data.json +75 -6
- package/dist/index-df196058.cjs.js.map +0 -1
|
@@ -15,6 +15,7 @@ export const styles = css`
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.toolbar {
|
|
18
|
+
position: relative;
|
|
18
19
|
display: flex;
|
|
19
20
|
flex-wrap: wrap;
|
|
20
21
|
align-items: center;
|
|
@@ -173,13 +174,12 @@ export const styles = css`
|
|
|
173
174
|
box-sizing: border-box;
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
|
|
177
|
+
/* Floating panel that hosts the inline nile-color-picker. */
|
|
178
|
+
.toolbar__color-panel {
|
|
177
179
|
position: absolute;
|
|
178
180
|
top: calc(100% + 6px);
|
|
179
181
|
left: 0;
|
|
180
182
|
z-index: 30;
|
|
181
|
-
width: 235px;
|
|
182
|
-
padding: 12px;
|
|
183
183
|
background: var(--nile-colors-white-base, #ffffff);
|
|
184
184
|
border: 1px solid
|
|
185
185
|
var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));
|
|
@@ -188,64 +188,43 @@ export const styles = css`
|
|
|
188
188
|
box-sizing: border-box;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
margin-bottom: 8px;
|
|
195
|
-
color: var(--nile-colors-dark-900, #111);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.toolbar__swatch-panel .section {
|
|
199
|
-
margin-bottom: 12px;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.toolbar__swatch-panel .section:last-child {
|
|
203
|
-
margin-bottom: 0;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.toolbar__swatch-panel .swatches {
|
|
207
|
-
display: grid;
|
|
208
|
-
grid-template-columns: repeat(auto-fill, 24px);
|
|
209
|
-
gap: 8px;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.toolbar__swatch-panel .swatch {
|
|
213
|
-
width: 24px;
|
|
214
|
-
height: 24px;
|
|
215
|
-
border-radius: 50%;
|
|
216
|
-
border: 1px solid rgba(0, 0, 0, 0.25);
|
|
217
|
-
cursor: pointer;
|
|
191
|
+
/* --- Overflow ("more" / 3-dot) menu --- */
|
|
192
|
+
/* The 3-dot button stays in its normal place in the toolbar flow. */
|
|
193
|
+
.toolbar__overflow {
|
|
218
194
|
position: relative;
|
|
219
|
-
|
|
220
|
-
background-clip: content-box;
|
|
195
|
+
display: inline-flex;
|
|
221
196
|
}
|
|
222
197
|
|
|
223
|
-
|
|
198
|
+
/* Panel drops directly beneath the 3-dot button, aligned to its left edge and
|
|
199
|
+
extending right, so it opens wherever the button sits. width:max-content
|
|
200
|
+
sizes it to exactly its controls (rather than collapsing to the 32px
|
|
201
|
+
button's shrink-to-fit width); the max-width cap wraps a full menu onto
|
|
202
|
+
multiple rows instead of running off-screen. */
|
|
203
|
+
.toolbar__overflow-panel {
|
|
224
204
|
position: absolute;
|
|
225
|
-
top:
|
|
226
|
-
left:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.toolbar__swatch-panel .swatch.add {
|
|
205
|
+
top: calc(100% + 6px);
|
|
206
|
+
left: 0;
|
|
207
|
+
right: auto;
|
|
208
|
+
width: max-content;
|
|
209
|
+
max-width: min(360px, calc(100vw - 32px));
|
|
210
|
+
z-index: 31;
|
|
234
211
|
display: flex;
|
|
212
|
+
flex-wrap: wrap;
|
|
235
213
|
align-items: center;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
214
|
+
gap: 6px;
|
|
215
|
+
padding: 8px;
|
|
216
|
+
background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, #ffffff));
|
|
217
|
+
border: 1px solid
|
|
218
|
+
var(--nile-colors-neutral-300, var(--ng-colors-border-secondary, #e4e7ec));
|
|
219
|
+
border-radius: 8px;
|
|
220
|
+
box-shadow: 0 4px 12px rgba(16, 24, 40, 0.12);
|
|
221
|
+
box-sizing: border-box;
|
|
240
222
|
}
|
|
241
223
|
|
|
242
|
-
.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
height: 0;
|
|
248
|
-
border: 0;
|
|
249
|
-
padding: 0;
|
|
224
|
+
.toolbar__overflow-divider {
|
|
225
|
+
width: 1px;
|
|
226
|
+
height: 24px;
|
|
227
|
+
margin: 0 4px;
|
|
228
|
+
background: var(--nile-colors-neutral-400, var(--ng-colors-border-neutral, #d0d5dd));
|
|
250
229
|
}
|
|
251
230
|
`;
|
|
@@ -7,6 +7,7 @@ import type { ToolbarState } from '../engine/selection-state';
|
|
|
7
7
|
import type { CommandAttrs, CommandName } from '../engine/commands';
|
|
8
8
|
import { DEFAULT_TOOLBAR, UiCommandName } from '../types';
|
|
9
9
|
import '../ui/table-grid-picker';
|
|
10
|
+
import '../../nile-color-picker/nile-color-picker';
|
|
10
11
|
|
|
11
12
|
interface ButtonDef {
|
|
12
13
|
kind: 'button';
|
|
@@ -46,6 +47,27 @@ interface ColorDef {
|
|
|
46
47
|
|
|
47
48
|
type ItemDef = ButtonDef | SelectDef | ColorDef;
|
|
48
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A single control in an author-supplied (light-DOM) toolbar. `name` is a
|
|
52
|
+
* built-in control key (the same names the `config` string accepts) or `'|'`
|
|
53
|
+
* for a group divider; `label`/`icon` optionally override the built-in
|
|
54
|
+
* tooltip/glyph. Produced by the editor from `<nile-wysiwyg-toolbar-item>`
|
|
55
|
+
* children.
|
|
56
|
+
*/
|
|
57
|
+
export interface AuthoredToolbarItem {
|
|
58
|
+
name: string;
|
|
59
|
+
label?: string;
|
|
60
|
+
icon?: string;
|
|
61
|
+
/** When true, the control is placed in the 3-dot overflow menu. */
|
|
62
|
+
overflow?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Per-instance overrides applied to a built-in control at render time. */
|
|
66
|
+
interface ItemOverrides {
|
|
67
|
+
label?: string;
|
|
68
|
+
icon?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
49
71
|
const FONT_FAMILIES = [
|
|
50
72
|
'Arial',
|
|
51
73
|
'Georgia',
|
|
@@ -58,14 +80,6 @@ const FONT_FAMILIES = [
|
|
|
58
80
|
|
|
59
81
|
const FONT_SIZES = ['10px', '12px', '14px', '16px', '18px', '20px', '24px', '28px', '32px', '48px'];
|
|
60
82
|
|
|
61
|
-
|
|
62
|
-
/** Same default palette as nile-rte-color. */
|
|
63
|
-
const COLOR_PALETTE = [
|
|
64
|
-
'#000000', '#444444', '#666666', '#999999', '#cccccc', '#eeeeee', '#ffffff',
|
|
65
|
-
'#d32f2f', '#f44336', '#ff9800', '#ffeb3b', '#4caf50', '#2196f3', '#3f51b5', '#9c27b0',
|
|
66
|
-
'#03a9f4', '#00bcd4', '#009688', '#8bc34a', '#cddc39', '#ffc107', '#ff5722',
|
|
67
|
-
];
|
|
68
|
-
|
|
69
83
|
const ITEMS: Record<string, ItemDef> = {
|
|
70
84
|
undo: {
|
|
71
85
|
kind: 'button',
|
|
@@ -481,6 +495,14 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
481
495
|
/** Space-separated item names; `|` inserts a divider. */
|
|
482
496
|
@property({ type: String }) config = DEFAULT_TOOLBAR;
|
|
483
497
|
|
|
498
|
+
/**
|
|
499
|
+
* Structured item list authored in light DOM (from
|
|
500
|
+
* `<nile-wysiwyg-toolbar-item>` children). When set and non-empty it takes
|
|
501
|
+
* precedence over `config`, and each item may override the built-in
|
|
502
|
+
* label/icon.
|
|
503
|
+
*/
|
|
504
|
+
@property({ attribute: false }) items?: AuthoredToolbarItem[];
|
|
505
|
+
|
|
484
506
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
485
507
|
|
|
486
508
|
@property({ attribute: false }) toolbarState?: ToolbarState;
|
|
@@ -488,15 +510,29 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
488
510
|
/** Which dropdown/color panel is open (item name), if any. */
|
|
489
511
|
@state() private openMenu: string | null = null;
|
|
490
512
|
|
|
491
|
-
/**
|
|
492
|
-
@state() private
|
|
513
|
+
/** Whether the overflow ("more" / 3-dot) menu panel is open. */
|
|
514
|
+
@state() private overflowOpen = false;
|
|
493
515
|
|
|
494
516
|
public static get styles(): CSSResultArray {
|
|
495
517
|
return [styles];
|
|
496
518
|
}
|
|
497
519
|
|
|
520
|
+
/**
|
|
521
|
+
* True when this instance is an author's declarative `<nile-wysiwyg-toolbar>`
|
|
522
|
+
* container sitting in an editor's light DOM (holding
|
|
523
|
+
* `<nile-wysiwyg-toolbar-item>` children). Such an instance renders nothing
|
|
524
|
+
* and wires up no listeners — the editor reads the items and renders the real
|
|
525
|
+
* toolbar in its own shadow DOM. The editor's internal instance lives inside
|
|
526
|
+
* a shadow root, so `closest` (which stops at shadow boundaries) never
|
|
527
|
+
* matches it; a standalone toolbar on a page has no editor ancestor either.
|
|
528
|
+
*/
|
|
529
|
+
private get isAuthoringContainer(): boolean {
|
|
530
|
+
return !!this.closest('nile-wysiwyg-editor');
|
|
531
|
+
}
|
|
532
|
+
|
|
498
533
|
connectedCallback(): void {
|
|
499
534
|
super.connectedCallback();
|
|
535
|
+
if (this.isAuthoringContainer) return;
|
|
500
536
|
document.addEventListener('mousedown', this.handleOutsideClick);
|
|
501
537
|
}
|
|
502
538
|
|
|
@@ -506,14 +542,26 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
506
542
|
}
|
|
507
543
|
|
|
508
544
|
private handleOutsideClick = (event: MouseEvent): void => {
|
|
509
|
-
if (this.openMenu && !event.composedPath().includes(this))
|
|
545
|
+
if ((this.openMenu || this.overflowOpen) && !event.composedPath().includes(this)) {
|
|
546
|
+
this.openMenu = null;
|
|
547
|
+
this.overflowOpen = false;
|
|
548
|
+
}
|
|
510
549
|
};
|
|
511
550
|
|
|
512
551
|
private toggleMenu(name: string): void {
|
|
513
552
|
this.openMenu = this.openMenu === name ? null : name;
|
|
514
553
|
}
|
|
515
554
|
|
|
555
|
+
private toggleOverflow = (): void => {
|
|
556
|
+
this.overflowOpen = !this.overflowOpen;
|
|
557
|
+
this.openMenu = null;
|
|
558
|
+
};
|
|
559
|
+
|
|
516
560
|
private dispatchCommand(name: CommandName | UiCommandName, attrs?: CommandAttrs): void {
|
|
561
|
+
// A dispatched command means the user picked an action, so collapse the
|
|
562
|
+
// overflow "more" panel (a select/color trigger only opens a submenu — it
|
|
563
|
+
// doesn't dispatch — so it leaves the panel open until a value is chosen).
|
|
564
|
+
this.overflowOpen = false;
|
|
517
565
|
this.emit('wysiwyg-command', { name, attrs });
|
|
518
566
|
}
|
|
519
567
|
|
|
@@ -521,23 +569,25 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
521
569
|
* the legacy rich text editor's toolbar). */
|
|
522
570
|
private withTooltip(label: string, control: TemplateResult): TemplateResult {
|
|
523
571
|
return html`
|
|
524
|
-
<nile-lite-tooltip content=${label} placement="
|
|
572
|
+
<nile-lite-tooltip content=${label} placement="top">${control}</nile-lite-tooltip>
|
|
525
573
|
`;
|
|
526
574
|
}
|
|
527
575
|
|
|
528
|
-
private renderButton(def: ButtonDef): TemplateResult {
|
|
576
|
+
private renderButton(def: ButtonDef, overrides?: ItemOverrides): TemplateResult {
|
|
529
577
|
const state = this.toolbarState;
|
|
530
578
|
const isActive = state && def.active ? def.active(state) : false;
|
|
531
579
|
const isDisabled = this.disabled || (state && def.disabled ? def.disabled(state) : false);
|
|
532
|
-
const
|
|
580
|
+
const label = overrides?.label ?? def.label;
|
|
581
|
+
const baseIcon = overrides?.icon ?? def.icon;
|
|
582
|
+
const icon = isActive && def.iconActive ? def.iconActive : baseIcon;
|
|
533
583
|
return this.withTooltip(
|
|
534
|
-
|
|
584
|
+
label,
|
|
535
585
|
html`
|
|
536
586
|
<button
|
|
537
587
|
type="button"
|
|
538
588
|
class="toolbar__button"
|
|
539
589
|
part="button"
|
|
540
|
-
aria-label=${
|
|
590
|
+
aria-label=${label}
|
|
541
591
|
aria-pressed=${isActive ? 'true' : 'false'}
|
|
542
592
|
?data-active=${isActive}
|
|
543
593
|
?disabled=${isDisabled}
|
|
@@ -550,7 +600,7 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
550
600
|
);
|
|
551
601
|
}
|
|
552
602
|
|
|
553
|
-
private renderSelect(name: string, def: SelectDef): TemplateResult {
|
|
603
|
+
private renderSelect(name: string, def: SelectDef, overrides?: ItemOverrides): TemplateResult {
|
|
554
604
|
const value = this.toolbarState ? def.value(this.toolbarState) : '';
|
|
555
605
|
const options =
|
|
556
606
|
typeof def.options === 'function' ? def.options(this.toolbarState) : def.options;
|
|
@@ -559,15 +609,16 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
559
609
|
this.disabled ||
|
|
560
610
|
(this.toolbarState && def.disabled ? def.disabled(this.toolbarState) : false);
|
|
561
611
|
const isFont = name === 'fontFamily';
|
|
612
|
+
const label = overrides?.label ?? def.label;
|
|
562
613
|
return html`
|
|
563
614
|
<span class="toolbar__dropdown" part="select">
|
|
564
615
|
${this.withTooltip(
|
|
565
|
-
|
|
616
|
+
label,
|
|
566
617
|
html`
|
|
567
618
|
<button
|
|
568
619
|
type="button"
|
|
569
620
|
class="toolbar__dd-trigger"
|
|
570
|
-
aria-label=${
|
|
621
|
+
aria-label=${label}
|
|
571
622
|
aria-expanded=${this.openMenu === name ? 'true' : 'false'}
|
|
572
623
|
?disabled=${isDisabled}
|
|
573
624
|
style=${isFont && value ? `font-family: ${value}` : ''}
|
|
@@ -605,30 +656,26 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
605
656
|
`;
|
|
606
657
|
}
|
|
607
658
|
|
|
608
|
-
private setColor(
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
this.
|
|
612
|
-
...this.recentColors,
|
|
613
|
-
[name]: [color, ...recent.filter(c => c !== color)].slice(0, 8),
|
|
614
|
-
};
|
|
615
|
-
this.dispatchCommand(def.command, { color });
|
|
659
|
+
private setColor(def: ColorDef, color: string): void {
|
|
660
|
+
// nile-color-picker emits 'none' for the "No Fill" action; an empty color
|
|
661
|
+
// clears the mark in the command engine.
|
|
662
|
+
this.dispatchCommand(def.command, { color: color === 'none' ? '' : color });
|
|
616
663
|
}
|
|
617
664
|
|
|
618
|
-
private renderColor(name: string, def: ColorDef): TemplateResult {
|
|
665
|
+
private renderColor(name: string, def: ColorDef, overrides?: ItemOverrides): TemplateResult {
|
|
619
666
|
const current = this.toolbarState ? def.value(this.toolbarState) : null;
|
|
620
667
|
const shown = current ?? '#000000';
|
|
621
|
-
const recent = this.recentColors[name] ?? [];
|
|
622
668
|
const isBg = def.command === 'bgColor';
|
|
669
|
+
const label = overrides?.label ?? def.label;
|
|
623
670
|
return html`
|
|
624
671
|
<span class="toolbar__color" part="color">
|
|
625
672
|
${this.withTooltip(
|
|
626
|
-
|
|
673
|
+
label,
|
|
627
674
|
html`
|
|
628
675
|
<button
|
|
629
676
|
type="button"
|
|
630
677
|
class="toolbar__button"
|
|
631
|
-
aria-label=${
|
|
678
|
+
aria-label=${label}
|
|
632
679
|
aria-expanded=${this.openMenu === name ? 'true' : 'false'}
|
|
633
680
|
?disabled=${this.disabled}
|
|
634
681
|
@mousedown=${(e: Event) => e.preventDefault()}
|
|
@@ -647,83 +694,26 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
647
694
|
)}
|
|
648
695
|
${this.openMenu === name
|
|
649
696
|
? html`
|
|
650
|
-
<div class="
|
|
651
|
-
<
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
style="background: ${color}"
|
|
660
|
-
title=${color}
|
|
661
|
-
@click=${() => this.setColor(name, def, color)}
|
|
662
|
-
>
|
|
663
|
-
${current === color
|
|
664
|
-
? html`<span class="checkmark">✓</span>`
|
|
665
|
-
: nothing}
|
|
666
|
-
</button>
|
|
667
|
-
`
|
|
668
|
-
)}
|
|
669
|
-
</div>
|
|
670
|
-
</div>
|
|
671
|
-
${recent.length
|
|
672
|
-
? html`
|
|
673
|
-
<div class="section">
|
|
674
|
-
<div class="title">Recently Used</div>
|
|
675
|
-
<div class="swatches">
|
|
676
|
-
${recent.map(
|
|
677
|
-
color => html`
|
|
678
|
-
<button
|
|
679
|
-
type="button"
|
|
680
|
-
class="swatch"
|
|
681
|
-
style="background: ${color}"
|
|
682
|
-
title=${color}
|
|
683
|
-
@click=${() => this.setColor(name, def, color)}
|
|
684
|
-
></button>
|
|
685
|
-
`
|
|
686
|
-
)}
|
|
687
|
-
</div>
|
|
688
|
-
</div>
|
|
689
|
-
`
|
|
690
|
-
: nothing}
|
|
691
|
-
<div class="section">
|
|
692
|
-
<div class="title">Custom</div>
|
|
693
|
-
<div class="swatches">
|
|
694
|
-
<button
|
|
695
|
-
type="button"
|
|
696
|
-
class="swatch add"
|
|
697
|
-
@click=${(e: Event) => {
|
|
698
|
-
const input = (e.currentTarget as HTMLElement)
|
|
699
|
-
.closest('.toolbar__color')!
|
|
700
|
-
.querySelector<HTMLInputElement>('input[type="color"]');
|
|
701
|
-
input?.click();
|
|
702
|
-
}}
|
|
703
|
-
>
|
|
704
|
-
+
|
|
705
|
-
</button>
|
|
706
|
-
</div>
|
|
707
|
-
</div>
|
|
697
|
+
<div class="toolbar__color-panel">
|
|
698
|
+
<nile-color-picker
|
|
699
|
+
mode="inline"
|
|
700
|
+
type="swatches"
|
|
701
|
+
.noFill=${isBg}
|
|
702
|
+
.value=${shown}
|
|
703
|
+
@nile-change=${(e: CustomEvent<{ value: string }>) =>
|
|
704
|
+
this.setColor(def, e.detail.value)}
|
|
705
|
+
></nile-color-picker>
|
|
708
706
|
</div>
|
|
709
707
|
`
|
|
710
708
|
: nothing}
|
|
711
|
-
<input
|
|
712
|
-
type="color"
|
|
713
|
-
tabindex="-1"
|
|
714
|
-
aria-hidden="true"
|
|
715
|
-
.value=${shown}
|
|
716
|
-
@input=${(e: Event) =>
|
|
717
|
-
this.setColor(name, def, (e.target as HTMLInputElement).value)}
|
|
718
|
-
/>
|
|
719
709
|
</span>
|
|
720
710
|
`;
|
|
721
711
|
}
|
|
722
712
|
|
|
723
|
-
private renderItem(name: string): TemplateResult | typeof nothing {
|
|
713
|
+
private renderItem(name: string, overrides?: ItemOverrides): TemplateResult | typeof nothing {
|
|
724
714
|
if (name === 'table') {
|
|
725
715
|
return this.withTooltip(
|
|
726
|
-
'Insert table',
|
|
716
|
+
overrides?.label ?? 'Insert table',
|
|
727
717
|
html`
|
|
728
718
|
<nile-wysiwyg-table-picker
|
|
729
719
|
part="button"
|
|
@@ -736,30 +726,134 @@ export class NileWysiwygToolbar extends NileElement {
|
|
|
736
726
|
if (!def) return nothing;
|
|
737
727
|
switch (def.kind) {
|
|
738
728
|
case 'button':
|
|
739
|
-
return this.renderButton(def);
|
|
729
|
+
return this.renderButton(def, overrides);
|
|
740
730
|
case 'select':
|
|
741
|
-
return this.renderSelect(name, def);
|
|
731
|
+
return this.renderSelect(name, def, overrides);
|
|
742
732
|
case 'color':
|
|
743
|
-
return this.renderColor(name, def);
|
|
733
|
+
return this.renderColor(name, def, overrides);
|
|
744
734
|
default:
|
|
745
735
|
return nothing;
|
|
746
736
|
}
|
|
747
737
|
}
|
|
748
738
|
|
|
739
|
+
/** Parses the `config` string into a flat token list, keeping the `|`
|
|
740
|
+
* (divider) and `>>` (overflow) markers as items. */
|
|
741
|
+
private itemsFromConfig(config: string): AuthoredToolbarItem[] {
|
|
742
|
+
return config
|
|
743
|
+
.trim()
|
|
744
|
+
.split(/\s+/)
|
|
745
|
+
.filter(Boolean)
|
|
746
|
+
.map(name => ({ name }));
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/** Splits a flat item list into groups, breaking on `'|'` dividers. */
|
|
750
|
+
private groupItems(items: AuthoredToolbarItem[]): AuthoredToolbarItem[][] {
|
|
751
|
+
const groups: AuthoredToolbarItem[][] = [[]];
|
|
752
|
+
for (const item of items) {
|
|
753
|
+
if (item.name === '|') {
|
|
754
|
+
if (groups[groups.length - 1].length) groups.push([]);
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
groups[groups.length - 1].push(item);
|
|
758
|
+
}
|
|
759
|
+
return groups.filter(group => group.length > 0);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/** Partitions the flat item list into the always-visible main groups and the
|
|
763
|
+
* overflow (3-dot menu) groups. Two forms are supported: a positional `>>`
|
|
764
|
+
* token in the `config` string (everything after it overflows), or a
|
|
765
|
+
* per-item `overflow` flag on authored items (each flagged item overflows,
|
|
766
|
+
* wherever it sits). Without either, everything stays on the main bar. */
|
|
767
|
+
private partitionGroups(items: AuthoredToolbarItem[]): {
|
|
768
|
+
main: AuthoredToolbarItem[][];
|
|
769
|
+
overflow: AuthoredToolbarItem[][];
|
|
770
|
+
} {
|
|
771
|
+
const at = items.findIndex(item => item.name === '>>');
|
|
772
|
+
if (at !== -1) {
|
|
773
|
+
return {
|
|
774
|
+
main: this.groupItems(items.slice(0, at)),
|
|
775
|
+
overflow: this.groupItems(items.slice(at + 1)),
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
if (!items.some(item => item.overflow)) {
|
|
779
|
+
return { main: this.groupItems(items), overflow: [] };
|
|
780
|
+
}
|
|
781
|
+
return {
|
|
782
|
+
main: this.groupItems(items.filter(item => !item.overflow)),
|
|
783
|
+
overflow: this.groupItems(items.filter(item => item.overflow)),
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/** Renders the trailing 3-dot "more" button and its collapsible panel that
|
|
788
|
+
* hosts the overflow groups (everything after `>>` in the config). The panel
|
|
789
|
+
* drops directly beneath the button, wherever the button sits in the bar. */
|
|
790
|
+
private renderOverflow(hasMain: boolean, groups: AuthoredToolbarItem[][]): TemplateResult {
|
|
791
|
+
const open = this.overflowOpen;
|
|
792
|
+
return html`
|
|
793
|
+
${hasMain ? html`<span class="toolbar__divider"></span>` : nothing}
|
|
794
|
+
<span class="toolbar__overflow" part="overflow">
|
|
795
|
+
${this.withTooltip(
|
|
796
|
+
'More',
|
|
797
|
+
html`
|
|
798
|
+
<button
|
|
799
|
+
type="button"
|
|
800
|
+
class="toolbar__button"
|
|
801
|
+
aria-label="More"
|
|
802
|
+
aria-haspopup="true"
|
|
803
|
+
aria-expanded=${open ? 'true' : 'false'}
|
|
804
|
+
?data-active=${open}
|
|
805
|
+
?disabled=${this.disabled}
|
|
806
|
+
@mousedown=${(e: Event) => e.preventDefault()}
|
|
807
|
+
@click=${this.toggleOverflow}
|
|
808
|
+
>
|
|
809
|
+
${renderGlyph('ng-dots-vertical', 18)}
|
|
810
|
+
</button>
|
|
811
|
+
`
|
|
812
|
+
)}
|
|
813
|
+
${open
|
|
814
|
+
? html`
|
|
815
|
+
<div
|
|
816
|
+
class="toolbar__overflow-panel"
|
|
817
|
+
part="overflow-panel"
|
|
818
|
+
@mousedown=${(e: Event) => e.preventDefault()}
|
|
819
|
+
>
|
|
820
|
+
${groups.map(
|
|
821
|
+
(group, index) => html`
|
|
822
|
+
${index > 0
|
|
823
|
+
? html`<span class="toolbar__overflow-divider"></span>`
|
|
824
|
+
: nothing}
|
|
825
|
+
${group.map(item =>
|
|
826
|
+
this.renderItem(item.name, { label: item.label, icon: item.icon })
|
|
827
|
+
)}
|
|
828
|
+
`
|
|
829
|
+
)}
|
|
830
|
+
</div>
|
|
831
|
+
`
|
|
832
|
+
: nothing}
|
|
833
|
+
</span>
|
|
834
|
+
`;
|
|
835
|
+
}
|
|
836
|
+
|
|
749
837
|
public render(): TemplateResult {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
838
|
+
// A declarative container in an editor's light DOM only carries authored
|
|
839
|
+
// <nile-wysiwyg-toolbar-item> children; the editor renders the real bar.
|
|
840
|
+
if (this.isAuthoringContainer) return html``;
|
|
841
|
+
|
|
842
|
+
const items =
|
|
843
|
+
this.items && this.items.length ? this.items : this.itemsFromConfig(this.config);
|
|
844
|
+
const { main, overflow } = this.partitionGroups(items);
|
|
754
845
|
|
|
755
846
|
return html`
|
|
756
847
|
<div class="toolbar" part="toolbar" role="toolbar" aria-label="Text formatting">
|
|
757
|
-
${
|
|
848
|
+
${main.map(
|
|
758
849
|
(group, index) => html`
|
|
759
850
|
${index > 0 ? html`<span class="toolbar__divider"></span>` : nothing}
|
|
760
|
-
${group.map(
|
|
851
|
+
${group.map(item =>
|
|
852
|
+
this.renderItem(item.name, { label: item.label, icon: item.icon })
|
|
853
|
+
)}
|
|
761
854
|
`
|
|
762
855
|
)}
|
|
856
|
+
${overflow.length ? this.renderOverflow(main.length > 0, overflow) : nothing}
|
|
763
857
|
</div>
|
|
764
858
|
`;
|
|
765
859
|
}
|
|
@@ -2,8 +2,10 @@ import type { CommandAttrs, CommandName } from './engine/commands';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Toolbar configuration. The string form uses space-separated item names with
|
|
5
|
-
* `|` as a group divider, e.g. `"bold italic | heading | link"`.
|
|
6
|
-
*
|
|
5
|
+
* `|` as a group divider, e.g. `"bold italic | heading | link"`. A `>>` marker
|
|
6
|
+
* moves every item after it into a collapsible 3-dot "more" menu, e.g.
|
|
7
|
+
* `"bold italic | heading >> link image | sourceView"`. `"none"` hides the
|
|
8
|
+
* toolbar entirely.
|
|
7
9
|
*/
|
|
8
10
|
export type ToolbarConfig = string;
|
|
9
11
|
|
|
@@ -77,7 +79,7 @@ export const DEFAULT_TOOLBAR =
|
|
|
77
79
|
'undo redo findReplace | heading | bold italic underline strike subscript superscript | fontFamily fontSize lineHeight | ' +
|
|
78
80
|
'textColor bgColor | alignLeft alignCenter alignRight alignJustify | ' +
|
|
79
81
|
'bulletList orderedList taskList listStyle indent outdent blockquote | ' +
|
|
80
|
-
'link bookmark table image embed codeBlock math horizontalRule specialChars emoji
|
|
81
|
-
'mergeField template | ' +
|
|
82
|
+
'link bookmark table image embed codeBlock math horizontalRule specialChars emoji ' +
|
|
83
|
+
'>> mergeField template | ' +
|
|
82
84
|
'formatPainter caseChange clearFormatting pastePlainText showBlocks sourceView | ' +
|
|
83
85
|
'importMarkdown importWord exportInlineHtml exportWord exportPdf | shortcutHelp fullscreen';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Declarative, light-DOM marker for a single selection bubble-menu control.
|
|
6
|
+
*
|
|
7
|
+
* Author these as children of `<nile-wysiwyg-editor>` to build the bubble menu
|
|
8
|
+
* shown over a text selection by hand, instead of the built-in five
|
|
9
|
+
* (bold / italic / underline / strike / link) — the same pattern as
|
|
10
|
+
* `<nile-wysiwyg-toolbar-item>`:
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <nile-wysiwyg-editor bubble-menu>
|
|
14
|
+
* <nile-wysiwyg-bubble-item name="bold"></nile-wysiwyg-bubble-item>
|
|
15
|
+
* <nile-wysiwyg-bubble-item name="italic"></nile-wysiwyg-bubble-item>
|
|
16
|
+
* <nile-wysiwyg-bubble-item divider></nile-wysiwyg-bubble-item>
|
|
17
|
+
* <nile-wysiwyg-bubble-item name="link" label="Add link"></nile-wysiwyg-bubble-item>
|
|
18
|
+
* </nile-wysiwyg-editor>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* `name` maps to a built-in control (`bold`, `italic`, `underline`, `strike`,
|
|
22
|
+
* `code`, `subscript`, `superscript`, `link`, `bulletList`, `orderedList`,
|
|
23
|
+
* `alignLeft`, `alignCenter`, `alignRight`, `clearFormatting`). `label` and
|
|
24
|
+
* `icon` override the built-in tooltip/glyph; set `divider` for a separator.
|
|
25
|
+
*
|
|
26
|
+
* Any other `name` is dispatched as a raw `wysiwyg-command` (so custom editor
|
|
27
|
+
* commands work) as long as an `icon` is supplied.
|
|
28
|
+
*
|
|
29
|
+
* The element renders nothing itself — the editor discovers it and renders the
|
|
30
|
+
* real control inside the bubble menu's shadow DOM.
|
|
31
|
+
*
|
|
32
|
+
* @tag nile-wysiwyg-bubble-item
|
|
33
|
+
*/
|
|
34
|
+
@customElement('nile-wysiwyg-bubble-item')
|
|
35
|
+
export class NileWysiwygBubbleItem extends LitElement {
|
|
36
|
+
protected createRenderRoot(): this {
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
protected shouldUpdate(): boolean {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Built-in control name, or a raw command name when paired with `icon`. */
|
|
44
|
+
@property({ type: String, reflect: true }) name = '';
|
|
45
|
+
|
|
46
|
+
/** Overrides the control's tooltip / accessible label. */
|
|
47
|
+
@property({ type: String, reflect: true }) label = '';
|
|
48
|
+
|
|
49
|
+
/** Overrides the control's glyph (a `nile-glyph` name). */
|
|
50
|
+
@property({ type: String, reflect: true }) icon = '';
|
|
51
|
+
|
|
52
|
+
/** Renders a separator instead of a control. */
|
|
53
|
+
@property({ type: Boolean, reflect: true }) divider = false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare global {
|
|
57
|
+
interface HTMLElementTagNameMap {
|
|
58
|
+
'nile-wysiwyg-bubble-item': NileWysiwygBubbleItem;
|
|
59
|
+
}
|
|
60
|
+
}
|