@onereach/ui-components 10.2.1-beta.4275.0 → 10.2.1-beta.4277.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.
Files changed (63) hide show
  1. package/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.js +11 -9
  2. package/dist/bundled/v2/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +2 -0
  3. package/dist/bundled/v2/components/OrCardCollectionV3/styles.d.ts +1 -0
  4. package/dist/bundled/v2/components/OrCardCollectionV3/styles.js +5 -2
  5. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +252 -382
  6. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +68 -21
  7. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +0 -1
  8. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +4 -5
  9. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  10. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  11. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +2 -2
  12. package/dist/bundled/v2/{index-0e9c2b43.js → index-02a897ac.js} +1 -1
  13. package/dist/bundled/v2/{index-f379c836.js → index-7516cf60.js} +173 -258
  14. package/dist/bundled/v2/{markdown-2d22cf16.js → markdown-fe3bfb01.js} +113 -66
  15. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +1 -1
  16. package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.vue.d.ts +1 -0
  17. package/dist/bundled/v3/components/OrCardCollectionV3/index.js +1 -1
  18. package/dist/bundled/v3/components/OrCardCollectionV3/props.js +1 -1
  19. package/dist/bundled/v3/components/OrCardCollectionV3/styles.d.ts +1 -0
  20. package/dist/bundled/v3/components/OrCardCollectionV3/styles.js +1 -1
  21. package/dist/bundled/v3/components/{OrCardCollectionV3-8ddb17cf.js → OrCardCollectionV3-b9d360ef.js} +16 -10
  22. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  23. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +18 -14
  24. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  25. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
  26. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +0 -1
  27. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
  28. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  29. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  30. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  31. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
  32. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  33. package/dist/bundled/v3/components/{OrRichTextEditorV3-45e64a85.js → OrRichTextEditorV3-358d7df2.js} +532 -674
  34. package/dist/bundled/v3/components/index.js +2 -2
  35. package/dist/bundled/v3/index.js +2 -2
  36. package/dist/esm/v2/{OrCardCollection-e14978d3.js → OrCardCollection-2a2c0b31.js} +14 -9
  37. package/dist/esm/v2/{OrRichTextEditor-fbcc33fd.js → OrRichTextEditor-734b8b27.js} +244 -353
  38. package/dist/esm/v2/components/index.js +2 -2
  39. package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +2 -0
  40. package/dist/esm/v2/components/or-card-collection-v3/index.js +1 -1
  41. package/dist/esm/v2/components/or-card-collection-v3/styles.d.ts +1 -0
  42. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +68 -21
  43. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +7 -7
  44. package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +0 -1
  45. package/dist/esm/v2/index.js +2 -2
  46. package/dist/esm/v3/{OrCardCollection-65c9e771.js → OrCardCollection-a39155b7.js} +15 -9
  47. package/dist/esm/v3/{OrRichTextEditor-cdd9e3e4.js → OrRichTextEditor-b5684aab.js} +242 -325
  48. package/dist/esm/v3/components/index.js +2 -2
  49. package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +1 -0
  50. package/dist/esm/v3/components/or-card-collection-v3/index.js +1 -1
  51. package/dist/esm/v3/components/or-card-collection-v3/styles.d.ts +1 -0
  52. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +18 -14
  53. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +6 -6
  54. package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +0 -1
  55. package/dist/esm/v3/index.js +2 -2
  56. package/package.json +18 -18
  57. package/src/components/or-card-collection-v3/OrCardCollection.vue +25 -14
  58. package/src/components/or-card-collection-v3/styles.ts +6 -1
  59. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +203 -48
  60. package/src/components/or-rich-text-editor-v3/styles.ts +10 -13
  61. package/dist/esm/v2/components/or-rich-text-editor-v3/partials/EditorToolbar.vue.d.ts +0 -160
  62. package/dist/esm/v3/components/or-rich-text-editor-v3/partials/EditorToolbar.vue.d.ts +0 -89
  63. package/src/components/or-rich-text-editor-v3/partials/EditorToolbar.vue +0 -238
@@ -1,311 +1,25 @@
1
1
  import { g as useResizeObserver, o as onClickOutside } from '../../index-13c63b4c.js';
2
2
  import { u as useFocusTrap } from '../../useFocusTrap-c1b303f8.js';
3
- import { defineComponent, ref, computed, onMounted, onBeforeUnmount, watch, nextTick } from 'vue-demi';
4
- import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from '../../markdown-2d22cf16.js';
5
- import { ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, OrRichTextEditor, EditorContainer, EditorContainerFocus, EditorInput } from './styles.js';
6
- import __vue_component__$2 from '../OrIconButtonV3/OrIconButton.js';
7
- import __vue_component__$3 from '../OrMenuItemV3/OrMenuItem.js';
8
- import __vue_component__$4 from '../OrMenuV3/OrMenu.js';
9
- import __vue_component__$5 from '../OrPopoverV3/OrPopover.js';
10
- import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
3
+ import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
4
+ import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from '../../markdown-fe3bfb01.js';
5
+ import { OrRichTextEditor, EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './styles.js';
11
6
  import { Formats } from './props.js';
12
- import { N as Node, m as mergeAttributes, t as textblockTypeInputRule, E as Extension, D as Decoration, a as DecorationSet, M as Mark, b as markInputRule, c as markPasteRule, k as keydownHandler, d as callOrReturn, g as getExtensionField, n as nodeInputRule, e as Editor } from '../../index-f379c836.js';
13
- import { P as Plugin, a as PluginKey, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, b as Slice, T as TextSelection, M as Mapping } from '../../index-0e9c2b43.js';
7
+ import { N as Node, m as mergeAttributes, t as textblockTypeInputRule, E as Extension, D as Decoration, a as DecorationSet, M as Mark, b as markInputRule, c as markPasteRule, k as keydownHandler, d as callOrReturn, g as getExtensionField, n as nodeInputRule, e as Editor } from '../../index-7516cf60.js';
8
+ import { P as Plugin, a as PluginKey, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, b as Slice, T as TextSelection, M as Mapping } from '../../index-02a897ac.js';
14
9
  import codemirrorNode from './utils/codemirror/codemirrorNode.js';
15
- import __vue_component__$6 from '../OrModalV3/OrModal.js';
16
- import { _ as __vue_component__$7 } from '../../OrInput-b477f1d1.js';
17
- import __vue_component__$8 from '../OrButtonV3/OrButton.js';
10
+ import __vue_component__$1 from '../OrIconButtonV3/OrIconButton.js';
11
+ import __vue_component__$2 from '../OrLabelV3/OrLabel.js';
12
+ import __vue_component__$3 from '../OrMenuItemV3/OrMenuItem.js';
13
+ import __vue_component__$4 from '../OrMenuV3/OrMenu.js';
14
+ import __vue_component__$5 from '../OrModalV3/OrModal.js';
15
+ import { _ as __vue_component__$6 } from '../../OrInput-b477f1d1.js';
16
+ import __vue_component__$7 from '../OrButtonV3/OrButton.js';
17
+ import __vue_component__$8 from '../OrPopoverV3/OrPopover.js';
18
18
  import __vue_component__$9 from '../OrHintV3/OrHint.js';
19
19
  import __vue_component__$a from '../OrErrorV3/OrError.js';
20
- import __vue_component__$b from '../OrLabelV3/OrLabel.js';
21
20
  import { a as useDebounceFn } from '../../index-279e78b9.js';
22
21
  import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
23
-
24
- var script$1 = defineComponent({
25
- components: {
26
- OrIconButton: __vue_component__$2,
27
- OrMenuItem: __vue_component__$3,
28
- OrMenu: __vue_component__$4,
29
- OrPopover: __vue_component__$5
30
- },
31
- props: {
32
- toolbar: {
33
- type: Array,
34
- default: () => []
35
- },
36
- isFocused: {
37
- type: Boolean,
38
- default: false
39
- },
40
- countOfNotVisibleTools: {
41
- type: Number,
42
- default: 0
43
- },
44
- activeHeadingLevel: {
45
- type: Number,
46
- default: 0
47
- },
48
- isActive: {
49
- type: Object,
50
- default: () => ({})
51
- },
52
- headingLevels: {
53
- type: Array,
54
- default: () => [1, 2, 3, 4]
55
- }
56
- },
57
- emits: ['click-tool'],
58
- setup(props, _ref) {
59
- let {
60
- emit
61
- } = _ref;
62
- const toolbarRef = ref();
63
- const moreButtonRef = ref();
64
- const moreRef = ref();
65
- const toolbarButtonRef = ref();
66
- const menuRef = ref();
67
- const iconsEnum = ref({
68
- bold: 'format_bold',
69
- italic: 'format_italic',
70
- underline: 'format_underlined',
71
- strike: 'format_strikethrough',
72
- bulletList: 'format_list_bulleted',
73
- orderedList: 'format_list_numbered',
74
- link: 'link',
75
- highlight: 'highlight',
76
- redo: 'redo',
77
- undo: 'undo',
78
- codeBlock: 'code_blocks',
79
- blockquote: 'format_quote',
80
- file: 'attach_file',
81
- source: 'source_notes'
82
- });
83
- const iconTooltipsEnum = ref({
84
- bold: 'Bold',
85
- italic: 'Italic',
86
- underline: 'Underline',
87
- strike: 'Strike',
88
- bulletList: 'Bulleted List',
89
- orderedList: 'Numbered List',
90
- link: 'Link',
91
- highlight: 'Highlight',
92
- redo: 'Redo',
93
- undo: 'Undo',
94
- codeBlock: 'Code Block',
95
- blockquote: 'Quote',
96
- file: 'File',
97
- source: 'Source'
98
- });
99
- const notVisibleTools = computed(() => {
100
- const count = props.countOfNotVisibleTools;
101
- const toolbar = props.toolbar.flat();
102
- let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
103
- props.toolbar.forEach(tools => {
104
- if (tools.some(item => notVisible.has(item))) {
105
- tools.forEach(item => notVisible.add(item));
106
- }
107
- });
108
- return notVisible;
109
- });
110
- const toolbarContainerStyles = computed(() => [...ToolbarContainer]);
111
- const toolbarStyles = computed(() => [...Toolbar, ...(props.isFocused ? ToolbarButtonFocused : ToolbarButton)]);
112
- const getIndexOfHeading = computed(() => {
113
- return props.toolbar.flat().indexOf('heading');
114
- });
115
- const headingIcon = computed(() => {
116
- if (props.activeHeadingLevel && props.isActive.heading) {
117
- return `format_h${props.activeHeadingLevel}`;
118
- }
119
- return 'format_paragraph';
120
- });
121
- const isVisible = value => {
122
- if (Array.isArray(value)) {
123
- const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
124
- return isHaveNotVisibleTools;
125
- }
126
- return !notVisibleTools.value.has(value);
127
- };
128
- const handleClick = (item, level) => {
129
- emit('click-tool', {
130
- item,
131
- level
132
- });
133
- };
134
- return {
135
- toolbarRef,
136
- moreButtonRef,
137
- moreRef,
138
- toolbarButtonRef,
139
- menuRef,
140
- toolbarContainerStyles,
141
- toolbarStyles,
142
- isVisible,
143
- handleClick,
144
- headingIcon,
145
- getIndexOfHeading,
146
- notVisibleTools,
147
- iconsEnum,
148
- iconTooltipsEnum
149
- };
150
- }
151
- });
152
-
153
- /* script */
154
- const __vue_script__$1 = script$1;
155
-
156
- /* template */
157
- var __vue_render__$1 = function () {
158
- var _vm = this;
159
- var _h = _vm.$createElement;
160
- var _c = _vm._self._c || _h;
161
- return _c('div', {
162
- ref: "toolbarRef",
163
- class: _vm.toolbarContainerStyles
164
- }, [_vm._l(_vm.toolbar, function (tools, index) {
165
- return _c('div', {
166
- key: index,
167
- class: _vm.toolbarStyles.concat([{
168
- 'hidden': _vm.isVisible(tools)
169
- }])
170
- }, _vm._l(tools, function (item) {
171
- return _c('div', {
172
- key: item,
173
- class: ['flex gap-md', {
174
- 'hidden': !_vm.isVisible(item)
175
- }]
176
- }, [item === 'heading' ? _c('or-icon-button', {
177
- ref: "toolbarButtonRef",
178
- refInFor: true,
179
- attrs: {
180
- "selected": _vm.isActive[item],
181
- "disabled": !_vm.isFocused,
182
- "tooltip": {
183
- content: item,
184
- placement: 'top'
185
- },
186
- "icon": {
187
- icon: _vm.headingIcon,
188
- variant: 'inherit'
189
- }
190
- },
191
- on: {
192
- "click": function ($event) {
193
- _vm.menuRef && _vm.menuRef.toggle();
194
- }
195
- }
196
- }) : _vm.isVisible(item) ? _c('or-icon-button', {
197
- attrs: {
198
- "tooltip": {
199
- content: _vm.iconTooltipsEnum[item],
200
- placement: 'top'
201
- },
202
- "selected": _vm.isActive[item],
203
- "disabled": !_vm.isFocused,
204
- "icon": {
205
- icon: _vm.iconsEnum[item],
206
- variant: 'inherit'
207
- }
208
- },
209
- on: {
210
- "click": function ($event) {
211
- return _vm.handleClick(item);
212
- }
213
- }
214
- }) : _vm._e()], 1);
215
- }), 0);
216
- }), _vm._v(" "), _vm.countOfNotVisibleTools > 0 ? _c('or-icon-button', {
217
- ref: "moreButtonRef",
218
- staticClass: "px-sm",
219
- attrs: {
220
- "disabled": !_vm.isFocused,
221
- "icon": {
222
- icon: 'more_horiz',
223
- variant: 'inherit'
224
- }
225
- },
226
- on: {
227
- "click": function ($event) {
228
- _vm.moreRef && _vm.moreRef.open();
229
- }
230
- }
231
- }) : _vm._e(), _vm._v(" "), _vm.moreButtonRef ? _c('or-popover', {
232
- ref: "moreRef",
233
- attrs: {
234
- "trigger": _vm.moreButtonRef && _vm.moreButtonRef.root,
235
- "placement": "top-end"
236
- }
237
- }, [_c('div', {
238
- staticClass: "flex p-sm gap-md"
239
- }, _vm._l(_vm.notVisibleTools, function (item) {
240
- return _c('or-icon-button', {
241
- key: item,
242
- attrs: {
243
- "tooltip": {
244
- content: _vm.iconTooltipsEnum[item],
245
- placement: 'top'
246
- },
247
- "selected": _vm.isActive[item],
248
- "icon": {
249
- icon: _vm.iconsEnum[item],
250
- variant: 'inherit'
251
- }
252
- },
253
- on: {
254
- "click": function ($event) {
255
- return _vm.handleClick(item);
256
- }
257
- }
258
- });
259
- }), 1)]) : _vm._e(), _vm._v(" "), _vm.toolbarButtonRef ? _c('or-menu', {
260
- ref: "menuRef",
261
- attrs: {
262
- "trigger": _vm.toolbarButtonRef[_vm.getIndexOfHeading] && _vm.toolbarButtonRef[_vm.getIndexOfHeading].root,
263
- "placement": "bottom-start"
264
- }
265
- }, [_vm._l(_vm.headingLevels, function (heading) {
266
- return _c('or-menu-item', {
267
- key: heading,
268
- attrs: {
269
- "selected": _vm.activeHeadingLevel === heading
270
- },
271
- on: {
272
- "click": function ($event) {
273
- return _vm.handleClick('heading', heading);
274
- }
275
- }
276
- }, [_vm._v("\n Heading " + _vm._s(heading) + "\n ")]);
277
- }), _vm._v(" "), _c('or-menu-item', {
278
- attrs: {
279
- "selected": !_vm.activeHeadingLevel
280
- },
281
- on: {
282
- "click": function ($event) {
283
- return _vm.handleClick('heading');
284
- }
285
- }
286
- }, [_vm._v("\n None\n ")])], 2) : _vm._e()], 2);
287
- };
288
- var __vue_staticRenderFns__$1 = [];
289
-
290
- /* style */
291
- const __vue_inject_styles__$1 = undefined;
292
- /* scoped */
293
- const __vue_scope_id__$1 = undefined;
294
- /* module identifier */
295
- const __vue_module_identifier__$1 = undefined;
296
- /* functional template */
297
- const __vue_is_functional_template__$1 = false;
298
- /* style inject */
299
-
300
- /* style inject SSR */
301
-
302
- /* style inject shadow dom */
303
-
304
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent({
305
- render: __vue_render__$1,
306
- staticRenderFns: __vue_staticRenderFns__$1
307
- }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
308
- var EditorToolbar = __vue_component__$1;
22
+ import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
309
23
 
310
24
  const Heading = Node.create({
311
25
  name: 'heading',
@@ -1568,11 +1282,8 @@ const History = Extension.create({
1568
1282
  addKeyboardShortcuts() {
1569
1283
  return {
1570
1284
  'Mod-z': () => this.editor.commands.undo(),
1571
- 'Mod-Z': () => this.editor.commands.undo(),
1572
1285
  'Mod-y': () => this.editor.commands.redo(),
1573
- 'Mod-Y': () => this.editor.commands.redo(),
1574
1286
  'Shift-Mod-z': () => this.editor.commands.redo(),
1575
- 'Shift-Mod-Z': () => this.editor.commands.redo(),
1576
1287
  // Russian keyboard layouts
1577
1288
  'Mod-я': () => this.editor.commands.undo(),
1578
1289
  'Shift-Mod-я': () => this.editor.commands.redo()
@@ -1603,23 +1314,11 @@ const HorizontalRule = Node.create({
1603
1314
  return {
1604
1315
  setHorizontalRule: () => _ref2 => {
1605
1316
  let {
1606
- chain,
1607
- state
1317
+ chain
1608
1318
  } = _ref2;
1609
- const {
1610
- $to: $originTo
1611
- } = state.selection;
1612
- const currentChain = chain();
1613
- if ($originTo.parentOffset === 0) {
1614
- currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), {
1615
- type: this.name
1616
- });
1617
- } else {
1618
- currentChain.insertContent({
1619
- type: this.name
1620
- });
1621
- }
1622
- return currentChain
1319
+ return chain().insertContent({
1320
+ type: this.name
1321
+ })
1623
1322
  // set cursor after horizontal rule
1624
1323
  .command(_ref3 => {
1625
1324
  let {
@@ -1633,19 +1332,13 @@ const HorizontalRule = Node.create({
1633
1332
  } = tr.selection;
1634
1333
  const posAfter = $to.end();
1635
1334
  if ($to.nodeAfter) {
1636
- if ($to.nodeAfter.isTextblock) {
1637
- tr.setSelection(TextSelection.create(tr.doc, $to.pos + 1));
1638
- } else if ($to.nodeAfter.isBlock) {
1639
- tr.setSelection(NodeSelection.create(tr.doc, $to.pos));
1640
- } else {
1641
- tr.setSelection(TextSelection.create(tr.doc, $to.pos));
1642
- }
1335
+ tr.setSelection(TextSelection.create(tr.doc, $to.pos));
1643
1336
  } else {
1644
1337
  // add node after horizontal rule if it’s the end of the document
1645
1338
  const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create();
1646
1339
  if (node) {
1647
1340
  tr.insert(posAfter, node);
1648
- tr.setSelection(TextSelection.create(tr.doc, posAfter + 1));
1341
+ tr.setSelection(TextSelection.create(tr.doc, posAfter));
1649
1342
  }
1650
1343
  }
1651
1344
  tr.scrollIntoView();
@@ -1734,13 +1427,16 @@ const StarterKit = Extension.create({
1734
1427
  var script = defineComponent({
1735
1428
  name: 'OrRichTextEditor',
1736
1429
  components: {
1737
- OrModal: __vue_component__$6,
1738
- OrInput: __vue_component__$7,
1739
- OrButton: __vue_component__$8,
1430
+ OrIconButton: __vue_component__$1,
1431
+ OrLabel: __vue_component__$2,
1432
+ OrMenuItem: __vue_component__$3,
1433
+ OrMenu: __vue_component__$4,
1434
+ OrModal: __vue_component__$5,
1435
+ OrInput: __vue_component__$6,
1436
+ OrButton: __vue_component__$7,
1437
+ OrPopover: __vue_component__$8,
1740
1438
  OrHint: __vue_component__$9,
1741
- OrError: __vue_component__$a,
1742
- OrLabel: __vue_component__$b,
1743
- EditorToolbar
1439
+ OrError: __vue_component__$a
1744
1440
  },
1745
1441
  model: {
1746
1442
  prop: 'modelValue',
@@ -1786,10 +1482,6 @@ var script = defineComponent({
1786
1482
  error: {
1787
1483
  type: [String, Boolean],
1788
1484
  default: undefined
1789
- },
1790
- readonly: {
1791
- type: Boolean,
1792
- default: false
1793
1485
  }
1794
1486
  },
1795
1487
  emits: ['update:modelValue', 'input', 'file-upload'],
@@ -1801,7 +1493,11 @@ var script = defineComponent({
1801
1493
  const editorRef = ref();
1802
1494
  const textareaRef = ref();
1803
1495
  const containerRef = ref();
1804
- const toolbarContainerRef = ref();
1496
+ const toolbarRef = ref();
1497
+ const moreButtonRef = ref();
1498
+ const moreRef = ref();
1499
+ const toolbarButtonRef = ref();
1500
+ const menuRef = ref();
1805
1501
  // isActive should be set with default values for all toolbar buttons, otherwise it will not work in vue2
1806
1502
  const isActive = ref({
1807
1503
  bold: false,
@@ -1819,7 +1515,7 @@ var script = defineComponent({
1819
1515
  file: false,
1820
1516
  source: false
1821
1517
  });
1822
- const isFocused = ref(!props.readonly ? props.autofocus : false);
1518
+ const isFocused = ref(props.autofocus);
1823
1519
  const headingLevels = [1, 2, 3, 4];
1824
1520
  const activeHeadingLevel = ref(0);
1825
1521
  const markdownOutput = ref('');
@@ -1834,19 +1530,49 @@ var script = defineComponent({
1834
1530
  fallbackFocus: '.container',
1835
1531
  allowOutsideClick: true
1836
1532
  });
1533
+ const iconsEnum = ref({
1534
+ bold: 'format_bold',
1535
+ italic: 'format_italic',
1536
+ underline: 'format_underlined',
1537
+ strike: 'format_strikethrough',
1538
+ bulletList: 'format_list_bulleted',
1539
+ orderedList: 'format_list_numbered',
1540
+ link: 'link',
1541
+ highlight: 'highlight',
1542
+ redo: 'redo',
1543
+ undo: 'undo',
1544
+ codeBlock: 'code_blocks',
1545
+ blockquote: 'format_quote',
1546
+ file: 'attach_file',
1547
+ source: 'source_notes'
1548
+ });
1549
+ const iconTooltipsEnum = ref({
1550
+ bold: 'Bold',
1551
+ italic: 'Italic',
1552
+ underline: 'Underline',
1553
+ strike: 'Strike',
1554
+ bulletList: 'Bulleted List',
1555
+ orderedList: 'Numbered List',
1556
+ link: 'Link',
1557
+ highlight: 'Highlight',
1558
+ redo: 'Redo',
1559
+ undo: 'Undo',
1560
+ codeBlock: 'Code Block',
1561
+ blockquote: 'Quote',
1562
+ file: 'File',
1563
+ source: 'Source'
1564
+ });
1837
1565
  useResizeObserver(root, useDebounceFn(entries => {
1838
1566
  var _a, _b;
1839
1567
  const entry = entries[0];
1840
1568
  const {
1841
1569
  width
1842
1570
  } = entry.contentRect;
1843
- const toolbarLength = props.toolbar.flat().length;
1844
- if (containerRef.value && toolbarContainerRef.value && toolbarLength) {
1571
+ if (containerRef.value && toolbarRef.value && toolbarLength.value) {
1845
1572
  let lengthOfItem = 0;
1846
- const toolbarRef = toolbarContainerRef.value.$refs.toolbarRef;
1847
- lengthOfItem = ((_b = (_a = toolbarRef === null || toolbarRef === void 0 ? void 0 : toolbarRef.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.offsetWidth) + 16;
1573
+ lengthOfItem = ((_b = (_a = toolbarRef.value.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.offsetWidth) + 16;
1848
1574
  const count = width / lengthOfItem - 2;
1849
- countOfNotVisibleTools.value = Math.round(toolbarLength - count);
1575
+ countOfNotVisibleTools.value = Math.round(toolbarLength.value - count);
1850
1576
  }
1851
1577
  }, 10));
1852
1578
  onMounted(() => {
@@ -1878,8 +1604,7 @@ var script = defineComponent({
1878
1604
  }
1879
1605
  },
1880
1606
  element: editorRef.value,
1881
- autofocus: !props.readonly ? props.autofocus : false,
1882
- editable: !props.readonly,
1607
+ autofocus: props.autofocus,
1883
1608
  enableInputRules: true,
1884
1609
  enablePasteRules: true,
1885
1610
  extensions: [codemirrorNode, StarterKit.configure({
@@ -1960,16 +1685,44 @@ var script = defineComponent({
1960
1685
  context.emit('update:modelValue', value);
1961
1686
  }
1962
1687
  });
1688
+ const getIndexOfHeading = computed(() => {
1689
+ return props.toolbar.flat().indexOf('heading');
1690
+ });
1691
+ const headingIcon = computed(() => {
1692
+ if (activeHeadingLevel.value && isActive.value.heading) {
1693
+ return `format_h${activeHeadingLevel.value}`;
1694
+ }
1695
+ return 'format_paragraph';
1696
+ });
1697
+ const toolbarLength = computed(() => {
1698
+ return props.toolbar.flat().length;
1699
+ });
1700
+ const notVisibleTools = computed(() => {
1701
+ const count = countOfNotVisibleTools.value;
1702
+ const toolbar = props.toolbar.flat();
1703
+ let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
1704
+ props.toolbar.forEach(tools => {
1705
+ if (tools.some(item => notVisible.has(item))) {
1706
+ tools.forEach(item => notVisible.add(item));
1707
+ }
1708
+ });
1709
+ return notVisible;
1710
+ });
1963
1711
  //Methods
1964
1712
  const handleEditorClick = () => {
1965
1713
  var _a;
1966
1714
  setActiveFormats();
1967
- if (!props.readonly) {
1968
- isFocused.value = true;
1969
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
1970
- }
1715
+ isFocused.value = true;
1716
+ editor === null || editor === void 0 ? void 0 : editor.commands.focus();
1971
1717
  activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
1972
1718
  };
1719
+ const isVisible = value => {
1720
+ if (Array.isArray(value)) {
1721
+ const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
1722
+ return isHaveNotVisibleTools;
1723
+ }
1724
+ return !notVisibleTools.value.has(value);
1725
+ };
1973
1726
  const handleInput = event => {
1974
1727
  const target = event.target;
1975
1728
  const value = target.value;
@@ -1977,11 +1730,7 @@ var script = defineComponent({
1977
1730
  markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
1978
1731
  proxyModelValue.value = markdownOutput.value;
1979
1732
  };
1980
- const handleToolbarClick = _ref4 => {
1981
- let {
1982
- item,
1983
- level
1984
- } = _ref4;
1733
+ const handleToolbarClick = (item, level) => {
1985
1734
  var _a, _b, _c, _d;
1986
1735
  switch (item) {
1987
1736
  case 'source':
@@ -2061,10 +1810,10 @@ var script = defineComponent({
2061
1810
  editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
2062
1811
  href: link.value,
2063
1812
  target: '__blank'
2064
- }).command(_ref5 => {
1813
+ }).command(_ref4 => {
2065
1814
  let {
2066
1815
  tr
2067
- } = _ref5;
1816
+ } = _ref4;
2068
1817
  const preparedValue = text.value[text.value.length - 1] === ' ' ? text.value : `${text.value} `;
2069
1818
  tr.insertText(preparedValue);
2070
1819
  return true;
@@ -2100,7 +1849,11 @@ var script = defineComponent({
2100
1849
  };
2101
1850
  // Styles
2102
1851
  const rootStyles = computed(() => ['or-rich-text-editor-v3', ...OrRichTextEditor]);
2103
- const containerStyles = computed(() => [...EditorContainer, ...(isFocused.value ? EditorContainerFocus : [])]);
1852
+ const containerStyles = computed(() => [...EditorContainer]);
1853
+ const toolbarContainerStyles = computed(() => [...ToolbarContainer]);
1854
+ const toolbarStyles = computed(() => [...Toolbar,
1855
+ // 'overflow-x-hidden',
1856
+ ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)]);
2104
1857
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
2105
1858
  //Effects
2106
1859
  watch(proxyModelValue, value => {
@@ -2108,38 +1861,43 @@ var script = defineComponent({
2108
1861
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
2109
1862
  }
2110
1863
  if (props.format === 'markdown' && value !== markdownOutput.value) {
2111
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
2112
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
1864
+ //TODO: const deserialized = deserialize(editor?.schema, value);
1865
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
2113
1866
  }
2114
1867
  });
2115
- watch(props, _ref6 => {
2116
- let {
2117
- readonly
2118
- } = _ref6;
2119
- isFocused.value = !readonly;
2120
- editor === null || editor === void 0 ? void 0 : editor.setEditable(!readonly);
2121
- });
2122
1868
  return {
2123
1869
  editor,
2124
1870
  editorRef,
2125
- toolbarContainerRef,
1871
+ toolbarRef,
2126
1872
  containerRef,
1873
+ toolbarButtonRef,
1874
+ moreButtonRef,
2127
1875
  textareaRef,
1876
+ moreRef,
1877
+ menuRef,
1878
+ iconsEnum,
2128
1879
  handleToolbarClick,
2129
1880
  handleEditorClick,
2130
1881
  isActive,
1882
+ iconTooltipsEnum,
2131
1883
  containerStyles,
1884
+ toolbarContainerStyles,
1885
+ toolbarStyles,
2132
1886
  rootStyles,
2133
1887
  root,
2134
1888
  editorInputStyles,
1889
+ getIndexOfHeading,
2135
1890
  headingLevels,
1891
+ headingIcon,
2136
1892
  attachLink,
2137
1893
  discardLink,
2138
1894
  isOpenLinkModal,
2139
1895
  text,
2140
1896
  link,
2141
1897
  isFocused,
1898
+ isVisible,
2142
1899
  countOfNotVisibleTools,
1900
+ notVisibleTools,
2143
1901
  handleInput,
2144
1902
  proxyModelValue,
2145
1903
  disableMarkdown,
@@ -2176,7 +1934,7 @@ var __vue_render__ = function () {
2176
1934
  }, [_vm._t("label", function () {
2177
1935
  return [_vm._v("\n " + _vm._s(_vm.label) + "\n ")];
2178
1936
  })], 2)] : _vm._e(), _vm._v(" "), _c('div', {
2179
- ref: "containerRef",
1937
+ ref: 'containerRef',
2180
1938
  class: _vm.containerStyles,
2181
1939
  attrs: {
2182
1940
  "invalid": !!_vm.error
@@ -2186,20 +1944,77 @@ var __vue_render__ = function () {
2186
1944
  return _vm.handleEditorClick();
2187
1945
  }
2188
1946
  }
2189
- }, [!_vm.readonly ? _c('editor-toolbar', {
2190
- ref: "toolbarContainerRef",
1947
+ }, [_c('div', {
1948
+ ref: 'toolbarRef',
1949
+ class: _vm.toolbarContainerStyles
1950
+ }, [_vm._l(_vm.toolbar, function (tools, index) {
1951
+ return _c('div', {
1952
+ key: index,
1953
+ class: _vm.toolbarStyles.concat([{
1954
+ 'hidden': _vm.isVisible(tools)
1955
+ }])
1956
+ }, _vm._l(tools, function (item) {
1957
+ return _c('div', {
1958
+ key: item,
1959
+ class: ['flex gap-md', {
1960
+ 'hidden': !_vm.isVisible(item)
1961
+ }]
1962
+ }, [item === 'heading' ? _c('or-icon-button', {
1963
+ ref: 'toolbarButtonRef',
1964
+ refInFor: true,
1965
+ attrs: {
1966
+ "selected": _vm.isActive[item],
1967
+ "disabled": !_vm.isFocused,
1968
+ "tooltip": {
1969
+ content: item,
1970
+ placement: 'top'
1971
+ },
1972
+ "icon": {
1973
+ icon: _vm.headingIcon,
1974
+ variant: 'inherit'
1975
+ }
1976
+ },
1977
+ on: {
1978
+ "click": function ($event) {
1979
+ _vm.menuRef && _vm.menuRef.toggle();
1980
+ }
1981
+ }
1982
+ }) : _vm.isVisible(item) ? _c('or-icon-button', {
1983
+ attrs: {
1984
+ "tooltip": {
1985
+ content: _vm.iconTooltipsEnum[item],
1986
+ placement: 'top'
1987
+ },
1988
+ "selected": _vm.isActive[item],
1989
+ "disabled": !_vm.isFocused,
1990
+ "icon": {
1991
+ icon: _vm.iconsEnum[item],
1992
+ variant: 'inherit'
1993
+ }
1994
+ },
1995
+ on: {
1996
+ "click": function ($event) {
1997
+ return _vm.handleToolbarClick(item);
1998
+ }
1999
+ }
2000
+ }) : _vm._e()], 1);
2001
+ }), 0);
2002
+ }), _vm._v(" "), _vm.countOfNotVisibleTools > 0 ? _c('or-icon-button', {
2003
+ ref: 'moreButtonRef',
2004
+ staticClass: "px-sm",
2191
2005
  attrs: {
2192
- "count-of-not-visible-tools": _vm.countOfNotVisibleTools,
2193
- "toolbar": _vm.toolbar,
2194
- "is-focused": _vm.isFocused,
2195
- "active-heading-level": _vm.activeHeadingLevel,
2196
- "is-active": _vm.isActive,
2197
- "heading-levels": _vm.headingLevels
2006
+ "disabled": !_vm.isFocused,
2007
+ "icon": {
2008
+ icon: 'more_horiz',
2009
+ variant: 'inherit'
2010
+ }
2198
2011
  },
2199
2012
  on: {
2200
- "click-tool": _vm.handleToolbarClick
2013
+ "click": function ($event) {
2014
+ _vm.moreRef && _vm.moreRef.open();
2015
+ }
2201
2016
  }
2202
- }) : _vm._e(), _vm._v(" "), _c('div', {
2017
+ }) : _vm._e()], 2), _vm._v(" "), _c('div', {
2203
2018
  class: ['p-sm', 'overflow-auto', 'min-h-[88px]']
2204
2019
  }, [_c('textarea', {
2205
2020
  directives: [{
@@ -2236,9 +2051,9 @@ var __vue_render__ = function () {
2236
2051
  value: !_vm.disableMarkdown,
2237
2052
  expression: "!disableMarkdown"
2238
2053
  }],
2239
- ref: "editorRef",
2054
+ ref: 'editorRef',
2240
2055
  class: _vm.editorInputStyles
2241
- }), _vm._v(" "), _vm._t("files")], 2)], 1), _vm._v(" "), !_vm.error ? [_vm.$slots.hint || _vm.hint ? [_c('OrHint', {
2056
+ }), _vm._v(" "), _vm._t("files")], 2)]), _vm._v(" "), !_vm.error ? [_vm.$slots.hint || _vm.hint ? [_c('OrHint', {
2242
2057
  attrs: {
2243
2058
  "disabled": _vm.disabled
2244
2059
  }
@@ -2248,7 +2063,62 @@ var __vue_render__ = function () {
2248
2063
  attrs: {
2249
2064
  "disabled": _vm.disabled
2250
2065
  }
2251
- }, [_vm._v("\n " + _vm._s(_vm.error) + "\n ")])] : _vm._e(), _vm._v(" "), _c('or-modal', {
2066
+ }, [_vm._v("\n " + _vm._s(_vm.error) + "\n ")])] : _vm._e(), _vm._v(" "), _vm.moreButtonRef ? _c('or-popover', {
2067
+ ref: 'moreRef',
2068
+ attrs: {
2069
+ "trigger": _vm.moreButtonRef && _vm.moreButtonRef.root,
2070
+ "placement": "top-end"
2071
+ }
2072
+ }, [_c('div', {
2073
+ staticClass: "flex p-sm gap-md"
2074
+ }, _vm._l(_vm.notVisibleTools, function (item) {
2075
+ return _c('or-icon-button', {
2076
+ key: item,
2077
+ attrs: {
2078
+ "tooltip": {
2079
+ content: _vm.iconTooltipsEnum[item],
2080
+ placement: 'top'
2081
+ },
2082
+ "selected": _vm.isActive[item],
2083
+ "icon": {
2084
+ icon: _vm.iconsEnum[item],
2085
+ variant: 'inherit'
2086
+ }
2087
+ },
2088
+ on: {
2089
+ "click": function ($event) {
2090
+ return _vm.handleToolbarClick(item);
2091
+ }
2092
+ }
2093
+ });
2094
+ }), 1)]) : _vm._e(), _vm._v(" "), _vm.toolbarButtonRef ? _c('or-menu', {
2095
+ ref: 'menuRef',
2096
+ attrs: {
2097
+ "trigger": _vm.toolbarButtonRef[_vm.getIndexOfHeading] && _vm.toolbarButtonRef[_vm.getIndexOfHeading].root,
2098
+ "placement": "bottom-start"
2099
+ }
2100
+ }, [_vm._l(_vm.headingLevels, function (heading) {
2101
+ return _c('or-menu-item', {
2102
+ key: heading,
2103
+ attrs: {
2104
+ "selected": _vm.activeHeadingLevel === heading
2105
+ },
2106
+ on: {
2107
+ "click": function ($event) {
2108
+ return _vm.handleToolbarClick('heading', heading);
2109
+ }
2110
+ }
2111
+ }, [_vm._v("\n Heading " + _vm._s(heading) + "\n ")]);
2112
+ }), _vm._v(" "), _c('or-menu-item', {
2113
+ attrs: {
2114
+ "selected": !_vm.activeHeadingLevel
2115
+ },
2116
+ on: {
2117
+ "click": function ($event) {
2118
+ return _vm.handleToolbarClick('heading');
2119
+ }
2120
+ }
2121
+ }, [_vm._v("\n None\n ")])], 2) : _vm._e(), _vm._v(" "), _c('or-modal', {
2252
2122
  attrs: {
2253
2123
  "is-open": _vm.isOpenLinkModal,
2254
2124
  "size": "s"