@vonage/vivid 4.19.0-preview.0 → 4.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1616 -313
- package/index.cjs +5 -0
- package/index.d.ts +1 -0
- package/index.js +2 -2
- package/lib/accordion-item/accordion-item.d.ts +332 -5
- package/lib/action-group/action-group.d.ts +3 -120
- package/lib/alert/alert.d.ts +654 -6
- package/lib/audio-player/audio-player.d.ts +330 -5
- package/lib/avatar/avatar.d.ts +5 -4
- package/lib/badge/badge.d.ts +334 -7
- package/lib/banner/banner.d.ts +662 -133
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +0 -118
- package/lib/button/button.d.ts +335 -8
- package/lib/calendar-event/calendar-event.d.ts +3 -2
- package/lib/card/card.d.ts +2 -1
- package/lib/checkbox/checkbox.d.ts +2 -119
- package/lib/combobox/combobox.d.ts +335 -6
- package/lib/date-picker/date-picker.d.ts +12 -484
- package/lib/date-range-picker/date-range-picker.d.ts +6 -242
- package/lib/date-time-picker/date-time-picker.d.ts +12 -484
- package/lib/date-time-picker/definition.d.ts +2 -0
- package/lib/dial-pad/dial-pad.d.ts +328 -4
- package/lib/dialog/dialog.d.ts +326 -122
- package/lib/divider/divider.d.ts +0 -118
- package/lib/empty-state/empty-state.d.ts +3 -2
- package/lib/fab/fab.d.ts +333 -6
- package/lib/file-picker/file-picker.d.ts +334 -4
- package/lib/icon/icon.d.ts +2 -1
- package/lib/layout/layout.d.ts +6 -5
- package/lib/menu/menu.d.ts +0 -236
- package/lib/menu-item/menu-item.d.ts +332 -10
- package/lib/nav-disclosure/nav-disclosure.d.ts +330 -124
- package/lib/nav-item/nav-item.d.ts +329 -4
- package/lib/note/note.d.ts +329 -4
- package/lib/number-field/number-field.d.ts +658 -124
- package/lib/option/option.d.ts +332 -7
- package/lib/pagination/pagination.d.ts +4 -2
- package/lib/progress/progress.d.ts +0 -118
- package/lib/progress-ring/progress-ring.d.ts +0 -118
- package/lib/radio/radio.d.ts +2 -1
- package/lib/range-slider/range-slider.d.ts +330 -3
- package/lib/rich-text-editor/definition.d.ts +2 -0
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +3 -2
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +2 -0
- package/lib/rich-text-editor/menubar/definition.d.ts +2 -0
- package/lib/rich-text-editor/menubar/menubar.d.ts +4 -0
- package/lib/rich-text-editor/menubar/menubar.template.d.ts +4 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +8 -0
- package/lib/searchable-select/locale.d.ts +1 -0
- package/lib/searchable-select/option-tag.d.ts +330 -5
- package/lib/searchable-select/searchable-select.d.ts +661 -6
- package/lib/select/select.d.ts +336 -6
- package/lib/selectable-box/selectable-box.d.ts +0 -118
- package/lib/slider/slider.d.ts +326 -122
- package/lib/split-button/split-button.d.ts +667 -138
- package/lib/switch/switch.d.ts +0 -118
- package/lib/tab/tab.d.ts +658 -7
- package/lib/tabs/tabs.d.ts +2 -1
- package/lib/tag/tag.d.ts +333 -7
- package/lib/tag-group/tag-group.d.ts +0 -118
- package/lib/tag-name-map.d.ts +73 -0
- package/lib/text-anchor/text-anchor.d.ts +331 -123
- package/lib/text-area/text-area.d.ts +0 -118
- package/lib/text-field/text-field.d.ts +333 -124
- package/lib/time-picker/time-picker.d.ts +6 -242
- package/lib/toggletip/toggletip.d.ts +0 -118
- package/lib/tooltip/tooltip.d.ts +0 -118
- package/lib/tree-item/tree-item.d.ts +329 -4
- package/lib/video-player/video-player.d.ts +328 -4
- package/locales/de-DE.cjs +1 -0
- package/locales/de-DE.js +1 -0
- package/locales/en-GB.cjs +1 -0
- package/locales/en-GB.js +1 -0
- package/locales/en-US.cjs +1 -0
- package/locales/en-US.js +1 -0
- package/locales/ja-JP.cjs +1 -0
- package/locales/ja-JP.js +1 -0
- package/locales/zh-CN.cjs +1 -0
- package/locales/zh-CN.js +1 -0
- package/package.json +1 -1
- package/shared/_has.cjs +0 -4
- package/shared/_has.js +0 -4
- package/shared/affix.cjs +25 -19
- package/shared/affix.js +26 -20
- package/shared/apply-mixins.js +1 -1
- package/shared/aria/delegates-aria.d.ts +0 -118
- package/shared/calendar-picker.template.cjs +1 -1
- package/shared/calendar-picker.template.js +1 -1
- package/shared/children.js +1 -1
- package/shared/definition.cjs +2 -4
- package/shared/definition.js +2 -4
- package/shared/definition11.cjs +2 -4
- package/shared/definition11.js +2 -4
- package/shared/definition13.cjs +85 -159
- package/shared/definition13.js +85 -159
- package/shared/definition15.cjs +1 -1
- package/shared/definition15.js +1 -1
- package/shared/definition16.cjs +2 -3
- package/shared/definition16.js +2 -3
- package/shared/definition17.cjs +1 -1
- package/shared/definition17.js +1 -1
- package/shared/definition20.cjs +10 -10
- package/shared/definition20.js +1 -1
- package/shared/definition21.cjs +2 -4
- package/shared/definition21.js +2 -4
- package/shared/definition22.cjs +2 -4
- package/shared/definition22.js +2 -4
- package/shared/definition25.cjs +2 -4
- package/shared/definition25.js +2 -4
- package/shared/definition26.cjs +3 -3
- package/shared/definition26.js +3 -3
- package/shared/definition28.cjs +27 -38
- package/shared/definition28.js +27 -38
- package/shared/definition30.cjs +4 -11
- package/shared/definition30.js +4 -11
- package/shared/definition31.cjs +2 -4
- package/shared/definition31.js +2 -4
- package/shared/definition32.cjs +2 -4
- package/shared/definition32.js +2 -4
- package/shared/definition34.cjs +1 -3
- package/shared/definition34.js +1 -3
- package/shared/definition35.cjs +6 -6
- package/shared/definition35.js +6 -6
- package/shared/definition36.cjs +7 -7
- package/shared/definition36.js +7 -7
- package/shared/definition37.cjs +20 -2
- package/shared/definition37.js +20 -2
- package/shared/definition4.cjs +14 -19
- package/shared/definition4.js +14 -19
- package/shared/definition41.cjs +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition42.cjs +3 -5
- package/shared/definition42.js +3 -5
- package/shared/definition43.cjs +419 -19
- package/shared/definition43.js +420 -21
- package/shared/definition44.cjs +43 -48
- package/shared/definition44.js +43 -48
- package/shared/definition45.cjs +3 -4
- package/shared/definition45.js +3 -4
- package/shared/definition46.cjs +1 -1
- package/shared/definition46.js +1 -1
- package/shared/definition48.cjs +3 -5
- package/shared/definition48.js +3 -5
- package/shared/definition49.cjs +4 -7
- package/shared/definition49.js +4 -7
- package/shared/definition5.cjs +1 -3
- package/shared/definition5.js +2 -4
- package/shared/definition50.cjs +1 -1
- package/shared/definition50.js +1 -1
- package/shared/definition52.cjs +2 -5
- package/shared/definition52.js +2 -5
- package/shared/definition55.cjs +2 -4
- package/shared/definition55.js +2 -4
- package/shared/definition56.cjs +1 -1
- package/shared/definition56.js +1 -1
- package/shared/definition57.cjs +3 -2
- package/shared/definition57.js +3 -2
- package/shared/definition61.cjs +2 -4
- package/shared/definition61.js +2 -4
- package/shared/definition63.cjs +233 -160
- package/shared/definition63.js +233 -160
- package/shared/definition7.cjs +1 -3
- package/shared/definition7.js +1 -3
- package/shared/definition8.cjs +2 -5
- package/shared/definition8.js +2 -5
- package/shared/definition9.cjs +1 -1
- package/shared/definition9.js +1 -1
- package/shared/form-associated.js +1 -1
- package/shared/foundation/button/button.d.ts +0 -118
- package/shared/localized.cjs +10 -4
- package/shared/localized.js +10 -4
- package/shared/option.cjs +17 -22
- package/shared/option.js +18 -23
- package/shared/patterns/affix.d.ts +659 -7
- package/shared/patterns/anchored.d.ts +0 -236
- package/shared/patterns/localized.d.ts +328 -3
- package/shared/patterns/trapped-focus.d.ts +329 -6
- package/shared/picker-field/mixins/calendar-picker.d.ts +3 -121
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +3 -121
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +328 -4
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +6 -242
- package/shared/picker-field/mixins/single-date-picker.d.ts +9 -363
- package/shared/picker-field/mixins/single-value-picker.d.ts +3 -121
- package/shared/picker-field/mixins/time-selection-picker.d.ts +6 -242
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +6 -242
- package/shared/picker-field/picker-field.d.ts +655 -3
- package/shared/picker-field.template.cjs +33 -35
- package/shared/picker-field.template.js +34 -36
- package/shared/ref.js +1 -1
- package/shared/slotted.js +1 -1
- package/shared/text-anchor.cjs +2 -2
- package/shared/text-anchor.js +2 -2
- package/shared/text-field.cjs +1 -1
- package/shared/text-field.js +1 -1
- package/shared/time-selection-picker.template.cjs +3 -5
- package/shared/time-selection-picker.template.js +4 -6
- package/shared/utils/enums.d.ts +1 -0
- package/shared/vivid-element.cjs +1 -1
- package/shared/vivid-element.js +2 -2
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +1265 -1364
package/shared/definition43.cjs
CHANGED
|
@@ -1,9 +1,184 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const vividElement = require('./vivid-element.cjs');
|
|
4
|
+
const definition = require('./definition11.cjs');
|
|
5
|
+
const definition$3 = require('./definition30.cjs');
|
|
6
|
+
const definition$1 = require('./definition23.cjs');
|
|
7
|
+
const definition$2 = require('./definition60.cjs');
|
|
4
8
|
const classNames = require('./class-names.cjs');
|
|
9
|
+
const repeat = require('./repeat.cjs');
|
|
5
10
|
|
|
6
|
-
const styles = "@charset \"UTF-8\"
|
|
11
|
+
const styles$1 = "@charset \"UTF-8\";.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:\"\";position:absolute;inset:-2px -2px -2px -32px;border:2px solid #8cf;pointer-events:none}img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-menu{margin:0 -4px;line-height:1}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.ProseMirror-menuitem{margin-right:3px;display:inline-block}.ProseMirror-menuseparator{border-right:1px solid #ddd;margin-right:3px}.ProseMirror-menu-dropdown,.ProseMirror-menu-dropdown-menu{font-size:90%;white-space:nowrap}.ProseMirror-menu-dropdown{vertical-align:1px;cursor:pointer;position:relative;padding-right:15px}.ProseMirror-menu-dropdown-wrap{padding:1px 0 1px 4px;display:inline-block;position:relative}.ProseMirror-menu-dropdown:after{content:\"\";border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid currentColor;opacity:.6;position:absolute;right:4px;top:calc(50% - 2px)}.ProseMirror-menu-dropdown-menu,.ProseMirror-menu-submenu{position:absolute;background:#fff;color:#666;border:1px solid #aaa;padding:2px}.ProseMirror-menu-dropdown-menu{z-index:15;min-width:6em}.ProseMirror-menu-dropdown-item{cursor:pointer;padding:2px 8px 2px 4px}.ProseMirror-menu-dropdown-item:hover{background:#f2f2f2}.ProseMirror-menu-submenu-wrap{position:relative;margin-right:-4px}.ProseMirror-menu-submenu-label:after{content:\"\";border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid currentColor;opacity:.6;position:absolute;right:4px;top:calc(50% - 4px)}.ProseMirror-menu-submenu{display:none;min-width:4em;left:100%;top:-3px}.ProseMirror-menu-active{background:#eee;border-radius:4px}.ProseMirror-menu-disabled{opacity:.3}.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu,.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu{display:block}.ProseMirror-menubar{border-top-left-radius:inherit;border-top-right-radius:inherit;position:relative;min-height:1em;color:#666;padding:1px 6px;top:0;left:0;right:0;border-bottom:1px solid silver;background:#fff;z-index:10;-moz-box-sizing:border-box;box-sizing:border-box;overflow:visible}.ProseMirror-icon{display:inline-block;line-height:.8;vertical-align:-2px;padding:2px 8px;cursor:pointer}.ProseMirror-menu-disabled.ProseMirror-icon{cursor:default}.ProseMirror-icon svg{fill:currentColor;height:1em}.ProseMirror-icon span{vertical-align:text-top}.ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}.ProseMirror-gapcursor:after{content:\"\";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}.ProseMirror-focused .ProseMirror-gapcursor{display:block}.ProseMirror-example-setup-style hr{padding:2px 10px;border:none;margin:1em 0}.ProseMirror-example-setup-style hr:after{content:\"\";display:block;height:1px;background-color:silver;line-height:2px}.ProseMirror ul,.ProseMirror ol{padding-left:30px}.ProseMirror blockquote{padding-left:1em;border-left:3px solid #eee;margin-left:0;margin-right:0}.ProseMirror-example-setup-style img{cursor:default}.ProseMirror-prompt{background:#fff;padding:5px 10px 5px 15px;border:1px solid silver;position:fixed;border-radius:3px;z-index:11;box-shadow:-.5px 2px 5px #0003}.ProseMirror-prompt h5{margin:0;font-weight:400;font-size:100%;color:#444}.ProseMirror-prompt input[type=text],.ProseMirror-prompt textarea{background:#eee;border:none;outline:none}.ProseMirror-prompt input[type=text]{padding:0 4px}.ProseMirror-prompt-close{position:absolute;left:2px;top:1px;color:#666;border:none;background:transparent;padding:0}.ProseMirror-prompt-close:after{content:\"✕\";font-size:12px}.ProseMirror-invalid{background:#ffc;border:1px solid #cc7;border-radius:4px;padding:5px 10px;position:absolute;min-width:10em}.ProseMirror-prompt-buttons{margin-top:5px;display:none}.editor{box-sizing:border-box;background:var(--vvd-color-canvas);background-clip:padding-box;color:var(--vvd-color-canvas-text)}.ProseMirror{position:relative;box-sizing:border-box;padding:10px 16px;block-size:120px;font:var(--vvd-typography-base);font-feature-settings:\"liga\" 0;font-variant-ligatures:none;line-height:1.2;outline:none;overflow-y:auto;white-space:break-spaces;word-wrap:break-word}.ProseMirror pre{white-space:pre-wrap}.ProseMirror p{margin-bottom:1em}.ProseMirror p:first-child,.ProseMirror h1:first-child,.ProseMirror h2:first-child,.ProseMirror h3:first-child,.ProseMirror h4:first-child,.ProseMirror h5:first-child,.ProseMirror h6:first-child{margin-top:10px}h2{font:var(--vvd-typography-heading-4)}h3{font:var(--vvd-typography-base-extended)}p{font:var(--vvd-typography-base)}";
|
|
12
|
+
|
|
13
|
+
const styles = ":host{display:flex;align-items:center;padding:8px;background-color:var(--vvd-color-neutral-50);gap:4px}:host .hide-menubar{display:none}.title{--_text-primary-custom-size: var(--vvd-typography-heading-4)}.subtitle{--_text-primary-custom-size: var(--vvd-typography-base-extended)}.body{--_text-primary-custom-size: var(--vvd-typography-base)}.divider{align-self:stretch}";
|
|
14
|
+
|
|
15
|
+
var __defProp$1 = Object.defineProperty;
|
|
16
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
17
|
+
var result = void 0 ;
|
|
18
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
19
|
+
if (decorator = decorators[i])
|
|
20
|
+
result = (decorator(target, key, result) ) || result;
|
|
21
|
+
if (result) __defProp$1(target, key, result);
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
class MenuBar extends vividElement.VividElement {
|
|
25
|
+
}
|
|
26
|
+
__decorateClass$1([
|
|
27
|
+
vividElement.attr({ attribute: "menu-items" })
|
|
28
|
+
], MenuBar.prototype, "menuItems");
|
|
29
|
+
|
|
30
|
+
function notifyMenuBarChange(menuBar, eventName, payload) {
|
|
31
|
+
menuBar.$emit(eventName, payload, { bubbles: false, composed: false });
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
const TEXT_DECORATION_ITEMS = [
|
|
35
|
+
{
|
|
36
|
+
text: "Bold",
|
|
37
|
+
icon: "bold-line",
|
|
38
|
+
value: "bold"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
text: "Italic",
|
|
42
|
+
icon: "italic-line",
|
|
43
|
+
value: "italics"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
text: "Underline",
|
|
47
|
+
icon: "underline-line",
|
|
48
|
+
value: "underline"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
text: "Strikethrough",
|
|
52
|
+
icon: "strikethrough-line",
|
|
53
|
+
value: "strikethrough"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
text: "Monospace",
|
|
57
|
+
icon: "monospace-line",
|
|
58
|
+
value: "monospace"
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
const MENU_BAR_ITEMS = {
|
|
62
|
+
textSize: function(context) {
|
|
63
|
+
const buttonTag = context.tagFor(definition.Button);
|
|
64
|
+
const menuTag = context.tagFor(definition$3.Menu);
|
|
65
|
+
const menuItemTag = context.tagFor(definition$3.MenuItem);
|
|
66
|
+
const tooltipTag = context.tagFor(definition$2.Tooltip);
|
|
67
|
+
return vividElement.html`
|
|
68
|
+
<${menuTag}
|
|
69
|
+
trigger="auto"
|
|
70
|
+
id="text-size"
|
|
71
|
+
aria-label="Text Size"
|
|
72
|
+
placement="bottom-end"
|
|
73
|
+
>
|
|
74
|
+
<${tooltipTag} slot="anchor" text="Text Size" placement="top">
|
|
75
|
+
<${buttonTag}
|
|
76
|
+
slot="anchor"
|
|
77
|
+
aria-label="Open text size menu"
|
|
78
|
+
size="super-condensed"
|
|
79
|
+
appearance="ghost-light"
|
|
80
|
+
shape="pill"
|
|
81
|
+
icon="text-size-line"
|
|
82
|
+
></${buttonTag}>
|
|
83
|
+
</${tooltipTag}>
|
|
84
|
+
<${menuItemTag}
|
|
85
|
+
text="Title"
|
|
86
|
+
value="title"
|
|
87
|
+
internal-part
|
|
88
|
+
class="title"
|
|
89
|
+
connotation="cta"
|
|
90
|
+
@click="${(_, { parent }) => notifyMenuBarChange(parent, "text-size-selected", "title")}"
|
|
91
|
+
></${menuItemTag}>
|
|
92
|
+
<${menuItemTag}
|
|
93
|
+
text="Subtitle"
|
|
94
|
+
value="subtitle"
|
|
95
|
+
internal-part
|
|
96
|
+
class="subtitle"
|
|
97
|
+
connotation="cta"
|
|
98
|
+
@click="${(_, { parent }) => notifyMenuBarChange(parent, "text-size-selected", "subtitle")}"
|
|
99
|
+
></${menuItemTag}>
|
|
100
|
+
<${menuItemTag}
|
|
101
|
+
text="Body"
|
|
102
|
+
value="body"
|
|
103
|
+
internal-part
|
|
104
|
+
class="body"
|
|
105
|
+
connotation="cta"
|
|
106
|
+
@click="${(_, { parent }) => notifyMenuBarChange(parent, "text-size-selected", "body")}"
|
|
107
|
+
></${menuItemTag}>
|
|
108
|
+
</${menuTag}>
|
|
109
|
+
`;
|
|
110
|
+
},
|
|
111
|
+
textDecoration: function(context) {
|
|
112
|
+
const buttonTag = context.tagFor(definition.Button);
|
|
113
|
+
const dividerTag = context.tagFor(definition$1.Divider);
|
|
114
|
+
const tooltipTag = context.tagFor(definition$2.Tooltip);
|
|
115
|
+
return vividElement.html`
|
|
116
|
+
<${dividerTag} class="divider" orientation="vertical"></${dividerTag}>
|
|
117
|
+
${repeat.repeat(
|
|
118
|
+
(_) => TEXT_DECORATION_ITEMS,
|
|
119
|
+
vividElement.html`
|
|
120
|
+
<${tooltipTag} text="${(x) => x.text}" placement="top">
|
|
121
|
+
<${buttonTag}
|
|
122
|
+
slot="anchor"
|
|
123
|
+
aria-label="${(x) => x.text}"
|
|
124
|
+
size="super-condensed"
|
|
125
|
+
appearance="ghost-light"
|
|
126
|
+
shape="pill"
|
|
127
|
+
icon="${(x) => x.icon}"
|
|
128
|
+
@click="${(x, c) => notifyMenuBarChange(
|
|
129
|
+
c.parentContext.parent,
|
|
130
|
+
"text-decoration-selected",
|
|
131
|
+
x.value
|
|
132
|
+
)}"')}"
|
|
133
|
+
></${buttonTag}>
|
|
134
|
+
</${tooltipTag}>
|
|
135
|
+
`
|
|
136
|
+
)}
|
|
137
|
+
<${dividerTag} class="divider" orientation="vertical"></${dividerTag}>
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const getClasses$1 = (menuBar) => classNames.classNames("control", [
|
|
142
|
+
"hide-menubar",
|
|
143
|
+
getValidMenuItems(menuBar).length === 0
|
|
144
|
+
]);
|
|
145
|
+
const validItems = ["textSize", "textDecoration"];
|
|
146
|
+
function createMenuItem(item) {
|
|
147
|
+
return MENU_BAR_ITEMS[item];
|
|
148
|
+
}
|
|
149
|
+
function getValidMenuItems({ menuItems }) {
|
|
150
|
+
return menuItems ? menuItems.split(" ").filter((item) => validItems.includes(item)) : [];
|
|
151
|
+
}
|
|
152
|
+
function renderMenuItems(context) {
|
|
153
|
+
return () => vividElement.html`${repeat.repeat(
|
|
154
|
+
getValidMenuItems,
|
|
155
|
+
vividElement.html`${(menuItemName) => createMenuItem(menuItemName)(context)}`
|
|
156
|
+
)}`;
|
|
157
|
+
}
|
|
158
|
+
const MenuBarTemplate = (context) => {
|
|
159
|
+
return vividElement.html`<template class="${getClasses$1}">
|
|
160
|
+
${renderMenuItems(context)}
|
|
161
|
+
</template>`;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const menuBarDefinition = vividElement.defineVividComponent(
|
|
165
|
+
"menubar",
|
|
166
|
+
MenuBar,
|
|
167
|
+
MenuBarTemplate,
|
|
168
|
+
[
|
|
169
|
+
definition.buttonDefinition,
|
|
170
|
+
definition$3.menuDefinition,
|
|
171
|
+
definition$3.menuItemDefinition,
|
|
172
|
+
definition$1.dividerDefinition,
|
|
173
|
+
definition$2.tooltipDefinition
|
|
174
|
+
],
|
|
175
|
+
{
|
|
176
|
+
styles,
|
|
177
|
+
shadowOptions: {
|
|
178
|
+
delegatesFocus: true
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
);
|
|
7
182
|
|
|
8
183
|
// ::- Persistent data structure representing an ordered mapping from
|
|
9
184
|
// strings to values, with some convenient update methods.
|
|
@@ -1291,7 +1466,7 @@ structure between the old and new data as much as possible, which a
|
|
|
1291
1466
|
tree shape like this (without back pointers) makes easy.
|
|
1292
1467
|
|
|
1293
1468
|
**Do not** directly mutate the properties of a `Node` object. See
|
|
1294
|
-
[the guide](/docs/guide/#doc) for more information.
|
|
1469
|
+
[the guide](https://prosemirror.net/docs/guide/#doc) for more information.
|
|
1295
1470
|
*/
|
|
1296
1471
|
class Node {
|
|
1297
1472
|
/**
|
|
@@ -1326,7 +1501,7 @@ class Node {
|
|
|
1326
1501
|
get children() { return this.content.content; }
|
|
1327
1502
|
/**
|
|
1328
1503
|
The size of this node, as defined by the integer-based [indexing
|
|
1329
|
-
scheme](/docs/guide/#doc.indexing). For text nodes, this is the
|
|
1504
|
+
scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
|
|
1330
1505
|
amount of characters. For other leaf nodes, it is one. For
|
|
1331
1506
|
non-leaf nodes, it is the size of the content plus two (the
|
|
1332
1507
|
start and end token).
|
|
@@ -6852,11 +7027,13 @@ function clientRect(node) {
|
|
|
6852
7027
|
function scrollRectIntoView(view, rect, startDOM) {
|
|
6853
7028
|
let scrollThreshold = view.someProp("scrollThreshold") || 0, scrollMargin = view.someProp("scrollMargin") || 5;
|
|
6854
7029
|
let doc = view.dom.ownerDocument;
|
|
6855
|
-
for (let parent = startDOM || view.dom;;
|
|
7030
|
+
for (let parent = startDOM || view.dom;;) {
|
|
6856
7031
|
if (!parent)
|
|
6857
7032
|
break;
|
|
6858
|
-
if (parent.nodeType != 1)
|
|
7033
|
+
if (parent.nodeType != 1) {
|
|
7034
|
+
parent = parentNode(parent);
|
|
6859
7035
|
continue;
|
|
7036
|
+
}
|
|
6860
7037
|
let elt = parent;
|
|
6861
7038
|
let atTop = elt == doc.body;
|
|
6862
7039
|
let bounding = atTop ? windowRect(doc) : clientRect(elt);
|
|
@@ -6885,8 +7062,10 @@ function scrollRectIntoView(view, rect, startDOM) {
|
|
|
6885
7062
|
rect = { left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY };
|
|
6886
7063
|
}
|
|
6887
7064
|
}
|
|
6888
|
-
|
|
7065
|
+
let pos = atTop ? "fixed" : getComputedStyle(parent).position;
|
|
7066
|
+
if (/^(fixed|sticky)$/.test(pos))
|
|
6889
7067
|
break;
|
|
7068
|
+
parent = pos == "absolute" ? parent.offsetParent : parentNode(parent);
|
|
6890
7069
|
}
|
|
6891
7070
|
}
|
|
6892
7071
|
// Store the scroll position of the editor's parent nodes, along with
|
|
@@ -11355,6 +11534,7 @@ class DOMObserver {
|
|
|
11355
11534
|
view.input.lastFocus = 0;
|
|
11356
11535
|
selectionToDOM(view);
|
|
11357
11536
|
this.currentSelection.set(sel);
|
|
11537
|
+
view.scrollToSelection();
|
|
11358
11538
|
}
|
|
11359
11539
|
else if (from > -1 || newSel) {
|
|
11360
11540
|
if (from > -1) {
|
|
@@ -13122,6 +13302,68 @@ const selectTextblockStart = selectTextblockSide(-1);
|
|
|
13122
13302
|
Moves the cursor to the end of current text block.
|
|
13123
13303
|
*/
|
|
13124
13304
|
const selectTextblockEnd = selectTextblockSide(1);
|
|
13305
|
+
function markApplies(doc, ranges, type, enterAtoms) {
|
|
13306
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
13307
|
+
let { $from, $to } = ranges[i];
|
|
13308
|
+
let can = $from.depth == 0 ? doc.inlineContent && doc.type.allowsMarkType(type) : false;
|
|
13309
|
+
doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
|
|
13310
|
+
if (can || false)
|
|
13311
|
+
return false;
|
|
13312
|
+
can = node.inlineContent && node.type.allowsMarkType(type);
|
|
13313
|
+
});
|
|
13314
|
+
if (can)
|
|
13315
|
+
return true;
|
|
13316
|
+
}
|
|
13317
|
+
return false;
|
|
13318
|
+
}
|
|
13319
|
+
/**
|
|
13320
|
+
Create a command function that toggles the given mark with the
|
|
13321
|
+
given attributes. Will return `false` when the current selection
|
|
13322
|
+
doesn't support that mark. This will remove the mark if any marks
|
|
13323
|
+
of that type exist in the selection, or add it otherwise. If the
|
|
13324
|
+
selection is empty, this applies to the [stored
|
|
13325
|
+
marks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks) instead of a range of the
|
|
13326
|
+
document.
|
|
13327
|
+
*/
|
|
13328
|
+
function toggleMark(markType, attrs = null, options) {
|
|
13329
|
+
return function (state, dispatch) {
|
|
13330
|
+
let { empty, $cursor, ranges } = state.selection;
|
|
13331
|
+
if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType))
|
|
13332
|
+
return false;
|
|
13333
|
+
if (dispatch) {
|
|
13334
|
+
if ($cursor) {
|
|
13335
|
+
if (markType.isInSet(state.storedMarks || $cursor.marks()))
|
|
13336
|
+
dispatch(state.tr.removeStoredMark(markType));
|
|
13337
|
+
else
|
|
13338
|
+
dispatch(state.tr.addStoredMark(markType.create(attrs)));
|
|
13339
|
+
}
|
|
13340
|
+
else {
|
|
13341
|
+
let add, tr = state.tr;
|
|
13342
|
+
{
|
|
13343
|
+
add = !ranges.some(r => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType));
|
|
13344
|
+
}
|
|
13345
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
13346
|
+
let { $from, $to } = ranges[i];
|
|
13347
|
+
if (!add) {
|
|
13348
|
+
tr.removeMark($from.pos, $to.pos, markType);
|
|
13349
|
+
}
|
|
13350
|
+
else {
|
|
13351
|
+
let from = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;
|
|
13352
|
+
let spaceStart = start && start.isText ? /^\s*/.exec(start.text)[0].length : 0;
|
|
13353
|
+
let spaceEnd = end && end.isText ? /\s*$/.exec(end.text)[0].length : 0;
|
|
13354
|
+
if (from + spaceStart < to) {
|
|
13355
|
+
from += spaceStart;
|
|
13356
|
+
to -= spaceEnd;
|
|
13357
|
+
}
|
|
13358
|
+
tr.addMark(from, to, markType.create(attrs));
|
|
13359
|
+
}
|
|
13360
|
+
}
|
|
13361
|
+
dispatch(tr.scrollIntoView());
|
|
13362
|
+
}
|
|
13363
|
+
}
|
|
13364
|
+
return true;
|
|
13365
|
+
};
|
|
13366
|
+
}
|
|
13125
13367
|
/**
|
|
13126
13368
|
Combine a number of command functions into a single function (which
|
|
13127
13369
|
calls them one by one until one returns true).
|
|
@@ -13350,6 +13592,7 @@ const marks = {
|
|
|
13350
13592
|
Code font mark. Represented as a `<code>` element.
|
|
13351
13593
|
*/
|
|
13352
13594
|
code: {
|
|
13595
|
+
code: true,
|
|
13353
13596
|
parseDOM: [{ tag: "code" }],
|
|
13354
13597
|
toDOM() { return codeDOM; }
|
|
13355
13598
|
}
|
|
@@ -13365,10 +13608,58 @@ To reuse elements from this schema, extend or read from its
|
|
|
13365
13608
|
*/
|
|
13366
13609
|
const schema = new Schema({ nodes, marks });
|
|
13367
13610
|
|
|
13611
|
+
const customMarks = {
|
|
13612
|
+
u: {
|
|
13613
|
+
parseDOM: [{ tag: "u" }],
|
|
13614
|
+
toDOM() {
|
|
13615
|
+
return ["u", 0];
|
|
13616
|
+
}
|
|
13617
|
+
},
|
|
13618
|
+
s: {
|
|
13619
|
+
parseDOM: [{ tag: "s" }, { tag: "del" }],
|
|
13620
|
+
toDOM() {
|
|
13621
|
+
return ["s", 0];
|
|
13622
|
+
}
|
|
13623
|
+
},
|
|
13624
|
+
tt: {
|
|
13625
|
+
parseDOM: [{ tag: "tt" }, { tag: "code" }],
|
|
13626
|
+
toDOM() {
|
|
13627
|
+
return ["tt", 0];
|
|
13628
|
+
}
|
|
13629
|
+
}
|
|
13630
|
+
};
|
|
13631
|
+
const extendedSchema = new Schema({
|
|
13632
|
+
nodes: schema.spec.nodes,
|
|
13633
|
+
marks: {
|
|
13634
|
+
...schema.spec.marks.toObject(),
|
|
13635
|
+
...customMarks
|
|
13636
|
+
}
|
|
13637
|
+
});
|
|
13638
|
+
|
|
13368
13639
|
const NEGATIVE_SELECTION = {
|
|
13369
13640
|
start: -1,
|
|
13370
13641
|
end: -1
|
|
13371
13642
|
};
|
|
13643
|
+
class TagToSchemaMap {
|
|
13644
|
+
static get h2() {
|
|
13645
|
+
return {
|
|
13646
|
+
type: "heading",
|
|
13647
|
+
attrs: { level: 2 }
|
|
13648
|
+
};
|
|
13649
|
+
}
|
|
13650
|
+
static get h3() {
|
|
13651
|
+
return {
|
|
13652
|
+
type: "heading",
|
|
13653
|
+
attrs: { level: 3 }
|
|
13654
|
+
};
|
|
13655
|
+
}
|
|
13656
|
+
static get p() {
|
|
13657
|
+
return {
|
|
13658
|
+
type: "paragraph",
|
|
13659
|
+
attrs: {}
|
|
13660
|
+
};
|
|
13661
|
+
}
|
|
13662
|
+
}
|
|
13372
13663
|
function createSelectionChangePlugin(onSelectionChange) {
|
|
13373
13664
|
return new Plugin({
|
|
13374
13665
|
view: () => ({
|
|
@@ -13394,13 +13685,22 @@ function convertSelectionToVividFormat({
|
|
|
13394
13685
|
class ProseMirrorFacade {
|
|
13395
13686
|
#userContentChange = false;
|
|
13396
13687
|
#view;
|
|
13688
|
+
#verifyViewInitiation() {
|
|
13689
|
+
if (!this.#view) {
|
|
13690
|
+
throw new Error(
|
|
13691
|
+
"ProseMirror was not initiated. Please use the `init` method first."
|
|
13692
|
+
);
|
|
13693
|
+
}
|
|
13694
|
+
}
|
|
13397
13695
|
#onSelectionChange = () => {
|
|
13398
13696
|
this.#dispatchEvent("selection-changed");
|
|
13399
13697
|
};
|
|
13400
|
-
#handleInputEvent = () => {
|
|
13698
|
+
#handleInputEvent = (e) => {
|
|
13699
|
+
e.stopPropagation();
|
|
13401
13700
|
this.#userContentChange = true;
|
|
13701
|
+
this.#dispatchEvent("input");
|
|
13402
13702
|
};
|
|
13403
|
-
#
|
|
13703
|
+
#handleChangeEvent = () => {
|
|
13404
13704
|
if (!this.#userContentChange) {
|
|
13405
13705
|
return;
|
|
13406
13706
|
}
|
|
@@ -13417,20 +13717,16 @@ class ProseMirrorFacade {
|
|
|
13417
13717
|
keymap(baseKeymap)
|
|
13418
13718
|
];
|
|
13419
13719
|
const state = EditorState.create({
|
|
13420
|
-
schema:
|
|
13720
|
+
schema: extendedSchema,
|
|
13421
13721
|
plugins
|
|
13422
13722
|
});
|
|
13423
13723
|
this.#view = new EditorView(element, { state });
|
|
13424
13724
|
this.#view.dom.addEventListener("input", this.#handleInputEvent);
|
|
13425
|
-
this.#view.dom.addEventListener("blur", this.#
|
|
13725
|
+
this.#view.dom.addEventListener("blur", this.#handleChangeEvent);
|
|
13426
13726
|
}
|
|
13427
13727
|
replaceContent(content) {
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
"ProseMirror was not initiated. Please use the `init` method first."
|
|
13431
|
-
);
|
|
13432
|
-
}
|
|
13433
|
-
const parser = DOMParser.fromSchema(schema);
|
|
13728
|
+
this.#verifyViewInitiation();
|
|
13729
|
+
const parser = DOMParser.fromSchema(extendedSchema);
|
|
13434
13730
|
const doc = parser.parse(
|
|
13435
13731
|
new window.DOMParser().parseFromString(content, "text/html").body
|
|
13436
13732
|
);
|
|
@@ -13457,6 +13753,43 @@ class ProseMirrorFacade {
|
|
|
13457
13753
|
#dispatchEvent = (eventName, detail) => {
|
|
13458
13754
|
this.#eventHandler.dispatchEvent(new CustomEvent(eventName, { detail }));
|
|
13459
13755
|
};
|
|
13756
|
+
setSelectionTag(tag) {
|
|
13757
|
+
this.#verifyViewInitiation();
|
|
13758
|
+
const nodeDefinitions = TagToSchemaMap[tag] ?? {
|
|
13759
|
+
type: tag
|
|
13760
|
+
};
|
|
13761
|
+
const { state, dispatch } = this.#view;
|
|
13762
|
+
const { from, to } = state.selection;
|
|
13763
|
+
const tr = state.tr;
|
|
13764
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
13765
|
+
const nodeType = state.schema.nodes[nodeDefinitions.type];
|
|
13766
|
+
if (!nodeType) {
|
|
13767
|
+
throw new Error("Node type tag does not exist in the schema");
|
|
13768
|
+
}
|
|
13769
|
+
if (node.type === nodeType) {
|
|
13770
|
+
return;
|
|
13771
|
+
}
|
|
13772
|
+
tr.setBlockType(from, to, nodeType, nodeDefinitions.attrs);
|
|
13773
|
+
});
|
|
13774
|
+
dispatch(tr);
|
|
13775
|
+
}
|
|
13776
|
+
setSelectionDecoration(decoration) {
|
|
13777
|
+
const SUPPORTED_DECORATIONS = {
|
|
13778
|
+
bold: "strong",
|
|
13779
|
+
italics: "em",
|
|
13780
|
+
underline: "u",
|
|
13781
|
+
strikethrough: "s",
|
|
13782
|
+
monospace: "tt"
|
|
13783
|
+
};
|
|
13784
|
+
this.#verifyViewInitiation();
|
|
13785
|
+
const { state, dispatch } = this.#view;
|
|
13786
|
+
const decorationKey = decoration;
|
|
13787
|
+
const markType = state.schema.marks[SUPPORTED_DECORATIONS[decorationKey]];
|
|
13788
|
+
if (!markType) {
|
|
13789
|
+
throw new Error(`${decoration} is not a supported decoration`);
|
|
13790
|
+
}
|
|
13791
|
+
toggleMark(markType)(state, dispatch);
|
|
13792
|
+
}
|
|
13460
13793
|
}
|
|
13461
13794
|
|
|
13462
13795
|
var __defProp = Object.defineProperty;
|
|
@@ -13468,6 +13801,11 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13468
13801
|
if (result) __defProp(target, key, result);
|
|
13469
13802
|
return result;
|
|
13470
13803
|
};
|
|
13804
|
+
const RichTextEditorTextSizes = {
|
|
13805
|
+
title: "h2",
|
|
13806
|
+
subtitle: "h3",
|
|
13807
|
+
body: "p"
|
|
13808
|
+
};
|
|
13471
13809
|
class RichTextEditor extends vividElement.VividElement {
|
|
13472
13810
|
constructor() {
|
|
13473
13811
|
super();
|
|
@@ -13483,11 +13821,13 @@ class RichTextEditor extends vividElement.VividElement {
|
|
|
13483
13821
|
}
|
|
13484
13822
|
};
|
|
13485
13823
|
this.selectionEnd = null;
|
|
13824
|
+
this.#selectionChangedByUser = false;
|
|
13486
13825
|
this.#handleSelectionChange = () => {
|
|
13487
13826
|
if (!this.#editor.selection()) {
|
|
13488
13827
|
return;
|
|
13489
13828
|
}
|
|
13490
13829
|
const { start, end } = this.#editor.selection();
|
|
13830
|
+
this.#selectionChangedByUser = true;
|
|
13491
13831
|
this.selectionStart = start;
|
|
13492
13832
|
this.selectionEnd = end;
|
|
13493
13833
|
this.$emit("selection-changed");
|
|
@@ -13495,6 +13835,9 @@ class RichTextEditor extends vividElement.VividElement {
|
|
|
13495
13835
|
this.#handleChange = () => {
|
|
13496
13836
|
this.$emit("change");
|
|
13497
13837
|
};
|
|
13838
|
+
this.#handleInput = () => {
|
|
13839
|
+
this.$emit("input");
|
|
13840
|
+
};
|
|
13498
13841
|
}
|
|
13499
13842
|
/**
|
|
13500
13843
|
* Indicates the rich text editor's value.
|
|
@@ -13516,6 +13859,9 @@ class RichTextEditor extends vividElement.VividElement {
|
|
|
13516
13859
|
return this.shadowRoot.querySelector("#editor");
|
|
13517
13860
|
}
|
|
13518
13861
|
selectionStartChanged() {
|
|
13862
|
+
if (this.#selectionChangedByUser) {
|
|
13863
|
+
return;
|
|
13864
|
+
}
|
|
13519
13865
|
if (!this.selectionStart || this.selectionEnd && this.selectionStart > this.selectionEnd) {
|
|
13520
13866
|
return;
|
|
13521
13867
|
}
|
|
@@ -13523,13 +13869,19 @@ class RichTextEditor extends vividElement.VividElement {
|
|
|
13523
13869
|
}
|
|
13524
13870
|
#updateEditorSelection;
|
|
13525
13871
|
selectionEndChanged() {
|
|
13872
|
+
if (this.#selectionChangedByUser) {
|
|
13873
|
+
this.#selectionChangedByUser = false;
|
|
13874
|
+
return;
|
|
13875
|
+
}
|
|
13526
13876
|
if (this.selectionEnd && !this.selectionStart) {
|
|
13527
13877
|
this.selectionStart = 1;
|
|
13528
13878
|
}
|
|
13529
13879
|
this.#updateEditorSelection();
|
|
13530
13880
|
}
|
|
13881
|
+
#selectionChangedByUser;
|
|
13531
13882
|
#handleSelectionChange;
|
|
13532
13883
|
#handleChange;
|
|
13884
|
+
#handleInput;
|
|
13533
13885
|
connectedCallback() {
|
|
13534
13886
|
super.connectedCallback();
|
|
13535
13887
|
if (!this.#editor) {
|
|
@@ -13540,6 +13892,21 @@ class RichTextEditor extends vividElement.VividElement {
|
|
|
13540
13892
|
this.#handleSelectionChange
|
|
13541
13893
|
);
|
|
13542
13894
|
this.#editor.addEventListener("change", this.#handleChange);
|
|
13895
|
+
this.#editor.addEventListener("input", this.#handleInput);
|
|
13896
|
+
}
|
|
13897
|
+
}
|
|
13898
|
+
setTextSize(size) {
|
|
13899
|
+
try {
|
|
13900
|
+
this.#editor?.setSelectionTag(RichTextEditorTextSizes[size]);
|
|
13901
|
+
} catch (e) {
|
|
13902
|
+
console.warn(`Invalid text size: ${size}`);
|
|
13903
|
+
}
|
|
13904
|
+
}
|
|
13905
|
+
setSelectionDecoration(decoration) {
|
|
13906
|
+
try {
|
|
13907
|
+
this.#editor?.setSelectionDecoration(decoration);
|
|
13908
|
+
} catch (e) {
|
|
13909
|
+
console.warn(`Invalid decoration: ${decoration}`);
|
|
13543
13910
|
}
|
|
13544
13911
|
}
|
|
13545
13912
|
}
|
|
@@ -13551,9 +13918,41 @@ __decorateClass([
|
|
|
13551
13918
|
], RichTextEditor.prototype, "selectionEnd");
|
|
13552
13919
|
|
|
13553
13920
|
const getClasses = (_) => classNames.classNames("control");
|
|
13921
|
+
const VALID_MENU_ELEMEMENT_SUFFIX = "menubar";
|
|
13922
|
+
function textSizeSelectedHandler(event) {
|
|
13923
|
+
this.setTextSize(event.detail);
|
|
13924
|
+
}
|
|
13925
|
+
function selectionDecorationSelectedHandler(event) {
|
|
13926
|
+
this.setSelectionDecoration(event.detail);
|
|
13927
|
+
}
|
|
13928
|
+
function handleMenuBarSlotChange(richTextEditor, { event }) {
|
|
13929
|
+
const slot = event.target;
|
|
13930
|
+
const assignedElements = slot.assignedElements({ flatten: true });
|
|
13931
|
+
const menuBar = assignedElements.find(
|
|
13932
|
+
(element) => element.tagName.toLowerCase().endsWith(VALID_MENU_ELEMEMENT_SUFFIX)
|
|
13933
|
+
);
|
|
13934
|
+
assignedElements.forEach((element) => {
|
|
13935
|
+
if (element === menuBar) {
|
|
13936
|
+
element.style.removeProperty("display");
|
|
13937
|
+
} else {
|
|
13938
|
+
element.style.display = "none";
|
|
13939
|
+
}
|
|
13940
|
+
});
|
|
13941
|
+
if (menuBar) {
|
|
13942
|
+
menuBar.addEventListener(
|
|
13943
|
+
"text-size-selected",
|
|
13944
|
+
textSizeSelectedHandler.bind(richTextEditor)
|
|
13945
|
+
);
|
|
13946
|
+
menuBar.addEventListener(
|
|
13947
|
+
"text-decoration-selected",
|
|
13948
|
+
selectionDecorationSelectedHandler.bind(richTextEditor)
|
|
13949
|
+
);
|
|
13950
|
+
}
|
|
13951
|
+
}
|
|
13554
13952
|
const RichTextEditorTemplate = (_) => {
|
|
13555
13953
|
return vividElement.html`<template class="${getClasses}">
|
|
13556
|
-
<div id="editor"></div>
|
|
13954
|
+
<div id="editor" class="editor"></div>
|
|
13955
|
+
<slot name="menu-bar" @slotchange="${handleMenuBarSlotChange}"></slot>
|
|
13557
13956
|
</template>`;
|
|
13558
13957
|
};
|
|
13559
13958
|
|
|
@@ -13561,9 +13960,9 @@ const richTextEditorDefinition = vividElement.defineVividComponent(
|
|
|
13561
13960
|
"rich-text-editor",
|
|
13562
13961
|
RichTextEditor,
|
|
13563
13962
|
RichTextEditorTemplate,
|
|
13564
|
-
[],
|
|
13963
|
+
[menuBarDefinition],
|
|
13565
13964
|
{
|
|
13566
|
-
styles,
|
|
13965
|
+
styles: styles$1,
|
|
13567
13966
|
shadowOptions: {
|
|
13568
13967
|
delegatesFocus: true
|
|
13569
13968
|
}
|
|
@@ -13573,5 +13972,6 @@ const registerRichTextEditor = vividElement.createRegisterFunction(
|
|
|
13573
13972
|
richTextEditorDefinition
|
|
13574
13973
|
);
|
|
13575
13974
|
|
|
13975
|
+
exports.RichTextEditor = RichTextEditor;
|
|
13576
13976
|
exports.registerRichTextEditor = registerRichTextEditor;
|
|
13577
13977
|
exports.richTextEditorDefinition = richTextEditorDefinition;
|