@onereach/ui-components 10.2.1-beta.4275.0 → 10.2.1-beta.4276.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,6 +1,6 @@
1
1
  import { useResizeObserver, useDebounceFn, onClickOutside } from '@vueuse/core';
2
2
  import { useFocusTrap } from '@vueuse/integrations/useFocusTrap';
3
- import { defineComponent, ref, computed, onMounted, onBeforeUnmount, watch, nextTick } from 'vue-demi';
3
+ import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
4
4
  import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
5
5
  import { DOMParser as DOMParser$1 } from 'prosemirror-model';
6
6
  import Paragraph from '@tiptap/extension-paragraph';
@@ -16,19 +16,18 @@ import Blockquote from '@tiptap/extension-blockquote';
16
16
  import Link from '@tiptap/extension-link';
17
17
  import Highlight from '@tiptap/extension-highlight';
18
18
  import Underline from '@tiptap/extension-underline';
19
- import { _ as __vue_component__$2 } from './OrIconButton-5a905423.js';
19
+ import { _ as __vue_component__$7 } from './OrButton-e4e85817.js';
20
+ import './OrButton.vue_rollup-plugin-vue_script-199bb600.js';
21
+ import { _ as __vue_component__$1 } from './OrIconButton-5a905423.js';
22
+ import { _ as __vue_component__$6 } from './OrInput-a32b517e.js';
23
+ import { _ as __vue_component__$2 } from './OrLabel-b0805497.js';
20
24
  import { _ as __vue_component__$3 } from './OrMenuItem-9ccf816f.js';
21
25
  import { _ as __vue_component__$4 } from './OrMenu-b3a9fcfb.js';
22
- import { _ as __vue_component__$5 } from './OrPopover-f624356f.js';
26
+ import { _ as __vue_component__$5 } from './OrModal-d3f7a508.js';
27
+ import { _ as __vue_component__$8 } from './OrPopover-f624356f.js';
23
28
  import './dom-53c9635b.js';
24
- import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
25
- import { _ as __vue_component__$8 } from './OrButton-e4e85817.js';
26
- import './OrButton.vue_rollup-plugin-vue_script-199bb600.js';
27
- import { _ as __vue_component__$7 } from './OrInput-a32b517e.js';
28
- import { _ as __vue_component__$6 } from './OrModal-d3f7a508.js';
29
29
  import { _ as __vue_component__$9 } from './OrHint-2fe1157b.js';
30
30
  import { _ as __vue_component__$a } from './OrError-b25d782d.js';
31
- import { _ as __vue_component__$b } from './OrLabel-b0805497.js';
32
31
  import { Node, Editor, mergeAttributes } from '@tiptap/core';
33
32
  import Heading from '@tiptap/extension-heading';
34
33
  import Placeholder from '@tiptap/extension-placeholder';
@@ -37,6 +36,7 @@ import { C as CodeMirrorView } from './codemirrorView-020fe885.js';
37
36
  import { minimalSetup } from 'codemirror';
38
37
  import { javascript } from '@codemirror/lang-javascript';
39
38
  import { s as styleInject } from './style-inject.es-4c6f2515.js';
39
+ import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
40
40
 
41
41
  const serializerNodes = {
42
42
  ...defaultMarkdownSerializer.nodes,
@@ -163,17 +163,16 @@ const OrRichTextEditor = [
163
163
  // Spacing
164
164
  'gap-xs',
165
165
  // Box
166
- 'max-h-full', 'w-full'];
166
+ 'max-h-full'];
167
167
  const EditorContainer = [
168
168
  // Layout
169
169
  'layout-column',
170
+ // Theme (focus)
171
+ 'focus-within:theme-background-primary-translucent-1', 'dark:focus-within:theme-background-primary-translucent-1-dark', 'focus-within:theme-border-1-primary', 'dark:focus-within:theme-border-1-primary-dark', 'focus-within:theme-outline-2-primary', 'dark:focus-within:theme-outline-2-primary-dark',
170
172
  // Theme (invalid)
171
173
  'invalid:theme-background-error-translucent-1', 'dark:invalid:theme-background-error-translucent-1-dark', 'invalid:theme-foreground-default', 'dark:invalid:theme-foreground-default-dark', 'invalid:theme-border-1-error', 'dark:invalid:theme-border-1-error-dark', 'invalid:theme-outline-2-transparent', 'dark:invalid:theme-outline-2-transparent',
172
174
  // Box
173
175
  'border-1', 'rounded-md', 'w-full', 'overflow-hidden', 'grow'];
174
- const EditorContainerFocus = [
175
- // Theme (focus)
176
- 'focus-within:theme-background-primary-translucent-1', 'dark:focus-within:theme-background-primary-translucent-1-dark', 'focus-within:theme-border-1-primary', 'dark:focus-within:theme-border-1-primary-dark', 'focus-within:theme-outline-2-primary', 'dark:focus-within:theme-outline-2-primary-dark'];
177
176
  const ToolbarContainer = [
178
177
  // Layout
179
178
  'layout-row',
@@ -204,291 +203,6 @@ const EditorInput = [
204
203
  // Typography
205
204
  'typography-body-2-regular'];
206
205
 
207
- var script$1 = defineComponent({
208
- components: {
209
- OrIconButton: __vue_component__$2,
210
- OrMenuItem: __vue_component__$3,
211
- OrMenu: __vue_component__$4,
212
- OrPopover: __vue_component__$5
213
- },
214
- props: {
215
- toolbar: {
216
- type: Array,
217
- default: () => []
218
- },
219
- isFocused: {
220
- type: Boolean,
221
- default: false
222
- },
223
- countOfNotVisibleTools: {
224
- type: Number,
225
- default: 0
226
- },
227
- activeHeadingLevel: {
228
- type: Number,
229
- default: 0
230
- },
231
- isActive: {
232
- type: Object,
233
- default: () => ({})
234
- },
235
- headingLevels: {
236
- type: Array,
237
- default: () => [1, 2, 3, 4]
238
- }
239
- },
240
- emits: ['click-tool'],
241
- setup(props, _ref) {
242
- let {
243
- emit
244
- } = _ref;
245
- const toolbarRef = ref();
246
- const moreButtonRef = ref();
247
- const moreRef = ref();
248
- const toolbarButtonRef = ref();
249
- const menuRef = ref();
250
- const iconsEnum = ref({
251
- bold: 'format_bold',
252
- italic: 'format_italic',
253
- underline: 'format_underlined',
254
- strike: 'format_strikethrough',
255
- bulletList: 'format_list_bulleted',
256
- orderedList: 'format_list_numbered',
257
- link: 'link',
258
- highlight: 'highlight',
259
- redo: 'redo',
260
- undo: 'undo',
261
- codeBlock: 'code_blocks',
262
- blockquote: 'format_quote',
263
- file: 'attach_file',
264
- source: 'source_notes'
265
- });
266
- const iconTooltipsEnum = ref({
267
- bold: 'Bold',
268
- italic: 'Italic',
269
- underline: 'Underline',
270
- strike: 'Strike',
271
- bulletList: 'Bulleted List',
272
- orderedList: 'Numbered List',
273
- link: 'Link',
274
- highlight: 'Highlight',
275
- redo: 'Redo',
276
- undo: 'Undo',
277
- codeBlock: 'Code Block',
278
- blockquote: 'Quote',
279
- file: 'File',
280
- source: 'Source'
281
- });
282
- const notVisibleTools = computed(() => {
283
- const count = props.countOfNotVisibleTools;
284
- const toolbar = props.toolbar.flat();
285
- let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
286
- props.toolbar.forEach(tools => {
287
- if (tools.some(item => notVisible.has(item))) {
288
- tools.forEach(item => notVisible.add(item));
289
- }
290
- });
291
- return notVisible;
292
- });
293
- const toolbarContainerStyles = computed(() => [...ToolbarContainer]);
294
- const toolbarStyles = computed(() => [...Toolbar, ...(props.isFocused ? ToolbarButtonFocused : ToolbarButton)]);
295
- const getIndexOfHeading = computed(() => {
296
- return props.toolbar.flat().indexOf('heading');
297
- });
298
- const headingIcon = computed(() => {
299
- if (props.activeHeadingLevel && props.isActive.heading) {
300
- return `format_h${props.activeHeadingLevel}`;
301
- }
302
- return 'format_paragraph';
303
- });
304
- const isVisible = value => {
305
- if (Array.isArray(value)) {
306
- const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
307
- return isHaveNotVisibleTools;
308
- }
309
- return !notVisibleTools.value.has(value);
310
- };
311
- const handleClick = (item, level) => {
312
- emit('click-tool', {
313
- item,
314
- level
315
- });
316
- };
317
- return {
318
- toolbarRef,
319
- moreButtonRef,
320
- moreRef,
321
- toolbarButtonRef,
322
- menuRef,
323
- toolbarContainerStyles,
324
- toolbarStyles,
325
- isVisible,
326
- handleClick,
327
- headingIcon,
328
- getIndexOfHeading,
329
- notVisibleTools,
330
- iconsEnum,
331
- iconTooltipsEnum
332
- };
333
- }
334
- });
335
-
336
- /* script */
337
- const __vue_script__$1 = script$1;
338
-
339
- /* template */
340
- var __vue_render__$1 = function () {
341
- var _vm = this;
342
- var _h = _vm.$createElement;
343
- var _c = _vm._self._c || _h;
344
- return _c('div', {
345
- ref: "toolbarRef",
346
- class: _vm.toolbarContainerStyles
347
- }, [_vm._l(_vm.toolbar, function (tools, index) {
348
- return _c('div', {
349
- key: index,
350
- class: _vm.toolbarStyles.concat([{
351
- 'hidden': _vm.isVisible(tools)
352
- }])
353
- }, _vm._l(tools, function (item) {
354
- return _c('div', {
355
- key: item,
356
- class: ['flex gap-md', {
357
- 'hidden': !_vm.isVisible(item)
358
- }]
359
- }, [item === 'heading' ? _c('or-icon-button', {
360
- ref: "toolbarButtonRef",
361
- refInFor: true,
362
- attrs: {
363
- "selected": _vm.isActive[item],
364
- "disabled": !_vm.isFocused,
365
- "tooltip": {
366
- content: item,
367
- placement: 'top'
368
- },
369
- "icon": {
370
- icon: _vm.headingIcon,
371
- variant: 'inherit'
372
- }
373
- },
374
- on: {
375
- "click": function ($event) {
376
- _vm.menuRef && _vm.menuRef.toggle();
377
- }
378
- }
379
- }) : _vm.isVisible(item) ? _c('or-icon-button', {
380
- attrs: {
381
- "tooltip": {
382
- content: _vm.iconTooltipsEnum[item],
383
- placement: 'top'
384
- },
385
- "selected": _vm.isActive[item],
386
- "disabled": !_vm.isFocused,
387
- "icon": {
388
- icon: _vm.iconsEnum[item],
389
- variant: 'inherit'
390
- }
391
- },
392
- on: {
393
- "click": function ($event) {
394
- return _vm.handleClick(item);
395
- }
396
- }
397
- }) : _vm._e()], 1);
398
- }), 0);
399
- }), _vm._v(" "), _vm.countOfNotVisibleTools > 0 ? _c('or-icon-button', {
400
- ref: "moreButtonRef",
401
- staticClass: "px-sm",
402
- attrs: {
403
- "disabled": !_vm.isFocused,
404
- "icon": {
405
- icon: 'more_horiz',
406
- variant: 'inherit'
407
- }
408
- },
409
- on: {
410
- "click": function ($event) {
411
- _vm.moreRef && _vm.moreRef.open();
412
- }
413
- }
414
- }) : _vm._e(), _vm._v(" "), _vm.moreButtonRef ? _c('or-popover', {
415
- ref: "moreRef",
416
- attrs: {
417
- "trigger": _vm.moreButtonRef && _vm.moreButtonRef.root,
418
- "placement": "top-end"
419
- }
420
- }, [_c('div', {
421
- staticClass: "flex p-sm gap-md"
422
- }, _vm._l(_vm.notVisibleTools, function (item) {
423
- return _c('or-icon-button', {
424
- key: item,
425
- attrs: {
426
- "tooltip": {
427
- content: _vm.iconTooltipsEnum[item],
428
- placement: 'top'
429
- },
430
- "selected": _vm.isActive[item],
431
- "icon": {
432
- icon: _vm.iconsEnum[item],
433
- variant: 'inherit'
434
- }
435
- },
436
- on: {
437
- "click": function ($event) {
438
- return _vm.handleClick(item);
439
- }
440
- }
441
- });
442
- }), 1)]) : _vm._e(), _vm._v(" "), _vm.toolbarButtonRef ? _c('or-menu', {
443
- ref: "menuRef",
444
- attrs: {
445
- "trigger": _vm.toolbarButtonRef[_vm.getIndexOfHeading] && _vm.toolbarButtonRef[_vm.getIndexOfHeading].root,
446
- "placement": "bottom-start"
447
- }
448
- }, [_vm._l(_vm.headingLevels, function (heading) {
449
- return _c('or-menu-item', {
450
- key: heading,
451
- attrs: {
452
- "selected": _vm.activeHeadingLevel === heading
453
- },
454
- on: {
455
- "click": function ($event) {
456
- return _vm.handleClick('heading', heading);
457
- }
458
- }
459
- }, [_vm._v("\n Heading " + _vm._s(heading) + "\n ")]);
460
- }), _vm._v(" "), _c('or-menu-item', {
461
- attrs: {
462
- "selected": !_vm.activeHeadingLevel
463
- },
464
- on: {
465
- "click": function ($event) {
466
- return _vm.handleClick('heading');
467
- }
468
- }
469
- }, [_vm._v("\n None\n ")])], 2) : _vm._e()], 2);
470
- };
471
- var __vue_staticRenderFns__$1 = [];
472
-
473
- /* style */
474
- const __vue_inject_styles__$1 = undefined;
475
- /* scoped */
476
- const __vue_scope_id__$1 = undefined;
477
- /* module identifier */
478
- const __vue_module_identifier__$1 = undefined;
479
- /* functional template */
480
- const __vue_is_functional_template__$1 = false;
481
- /* style inject */
482
-
483
- /* style inject SSR */
484
-
485
- /* style inject shadow dom */
486
-
487
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent({
488
- render: __vue_render__$1,
489
- staticRenderFns: __vue_staticRenderFns__$1
490
- }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
491
-
492
206
  var Formats;
493
207
  (function (Formats) {
494
208
  Formats["Markdown"] = "markdown";
@@ -534,13 +248,16 @@ var codemirrorNode = Node.create({
534
248
  var script = defineComponent({
535
249
  name: 'OrRichTextEditor',
536
250
  components: {
537
- OrModal: __vue_component__$6,
538
- OrInput: __vue_component__$7,
539
- OrButton: __vue_component__$8,
251
+ OrIconButton: __vue_component__$1,
252
+ OrLabel: __vue_component__$2,
253
+ OrMenuItem: __vue_component__$3,
254
+ OrMenu: __vue_component__$4,
255
+ OrModal: __vue_component__$5,
256
+ OrInput: __vue_component__$6,
257
+ OrButton: __vue_component__$7,
258
+ OrPopover: __vue_component__$8,
540
259
  OrHint: __vue_component__$9,
541
- OrError: __vue_component__$a,
542
- OrLabel: __vue_component__$b,
543
- EditorToolbar: __vue_component__$1
260
+ OrError: __vue_component__$a
544
261
  },
545
262
  model: {
546
263
  prop: 'modelValue',
@@ -586,10 +303,6 @@ var script = defineComponent({
586
303
  error: {
587
304
  type: [String, Boolean],
588
305
  default: undefined
589
- },
590
- readonly: {
591
- type: Boolean,
592
- default: false
593
306
  }
594
307
  },
595
308
  emits: ['update:modelValue', 'input', 'file-upload'],
@@ -601,7 +314,11 @@ var script = defineComponent({
601
314
  const editorRef = ref();
602
315
  const textareaRef = ref();
603
316
  const containerRef = ref();
604
- const toolbarContainerRef = ref();
317
+ const toolbarRef = ref();
318
+ const moreButtonRef = ref();
319
+ const moreRef = ref();
320
+ const toolbarButtonRef = ref();
321
+ const menuRef = ref();
605
322
  // isActive should be set with default values for all toolbar buttons, otherwise it will not work in vue2
606
323
  const isActive = ref({
607
324
  bold: false,
@@ -619,7 +336,7 @@ var script = defineComponent({
619
336
  file: false,
620
337
  source: false
621
338
  });
622
- const isFocused = ref(!props.readonly ? props.autofocus : false);
339
+ const isFocused = ref(props.autofocus);
623
340
  const headingLevels = [1, 2, 3, 4];
624
341
  const activeHeadingLevel = ref(0);
625
342
  const markdownOutput = ref('');
@@ -634,19 +351,49 @@ var script = defineComponent({
634
351
  fallbackFocus: '.container',
635
352
  allowOutsideClick: true
636
353
  });
354
+ const iconsEnum = ref({
355
+ bold: 'format_bold',
356
+ italic: 'format_italic',
357
+ underline: 'format_underlined',
358
+ strike: 'format_strikethrough',
359
+ bulletList: 'format_list_bulleted',
360
+ orderedList: 'format_list_numbered',
361
+ link: 'link',
362
+ highlight: 'highlight',
363
+ redo: 'redo',
364
+ undo: 'undo',
365
+ codeBlock: 'code_blocks',
366
+ blockquote: 'format_quote',
367
+ file: 'attach_file',
368
+ source: 'source_notes'
369
+ });
370
+ const iconTooltipsEnum = ref({
371
+ bold: 'Bold',
372
+ italic: 'Italic',
373
+ underline: 'Underline',
374
+ strike: 'Strike',
375
+ bulletList: 'Bulleted List',
376
+ orderedList: 'Numbered List',
377
+ link: 'Link',
378
+ highlight: 'Highlight',
379
+ redo: 'Redo',
380
+ undo: 'Undo',
381
+ codeBlock: 'Code Block',
382
+ blockquote: 'Quote',
383
+ file: 'File',
384
+ source: 'Source'
385
+ });
637
386
  useResizeObserver(root, useDebounceFn(entries => {
638
387
  var _a, _b;
639
388
  const entry = entries[0];
640
389
  const {
641
390
  width
642
391
  } = entry.contentRect;
643
- const toolbarLength = props.toolbar.flat().length;
644
- if (containerRef.value && toolbarContainerRef.value && toolbarLength) {
392
+ if (containerRef.value && toolbarRef.value && toolbarLength.value) {
645
393
  let lengthOfItem = 0;
646
- const toolbarRef = toolbarContainerRef.value.$refs.toolbarRef;
647
- 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;
394
+ lengthOfItem = ((_b = (_a = toolbarRef.value.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.offsetWidth) + 16;
648
395
  const count = width / lengthOfItem - 2;
649
- countOfNotVisibleTools.value = Math.round(toolbarLength - count);
396
+ countOfNotVisibleTools.value = Math.round(toolbarLength.value - count);
650
397
  }
651
398
  }, 10));
652
399
  onMounted(() => {
@@ -678,8 +425,7 @@ var script = defineComponent({
678
425
  }
679
426
  },
680
427
  element: editorRef.value,
681
- autofocus: !props.readonly ? props.autofocus : false,
682
- editable: !props.readonly,
428
+ autofocus: props.autofocus,
683
429
  enableInputRules: true,
684
430
  enablePasteRules: true,
685
431
  extensions: [codemirrorNode, StarterKit.configure({
@@ -760,16 +506,44 @@ var script = defineComponent({
760
506
  context.emit('update:modelValue', value);
761
507
  }
762
508
  });
509
+ const getIndexOfHeading = computed(() => {
510
+ return props.toolbar.flat().indexOf('heading');
511
+ });
512
+ const headingIcon = computed(() => {
513
+ if (activeHeadingLevel.value && isActive.value.heading) {
514
+ return `format_h${activeHeadingLevel.value}`;
515
+ }
516
+ return 'format_paragraph';
517
+ });
518
+ const toolbarLength = computed(() => {
519
+ return props.toolbar.flat().length;
520
+ });
521
+ const notVisibleTools = computed(() => {
522
+ const count = countOfNotVisibleTools.value;
523
+ const toolbar = props.toolbar.flat();
524
+ let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
525
+ props.toolbar.forEach(tools => {
526
+ if (tools.some(item => notVisible.has(item))) {
527
+ tools.forEach(item => notVisible.add(item));
528
+ }
529
+ });
530
+ return notVisible;
531
+ });
763
532
  //Methods
764
533
  const handleEditorClick = () => {
765
534
  var _a;
766
535
  setActiveFormats();
767
- if (!props.readonly) {
768
- isFocused.value = true;
769
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
770
- }
536
+ isFocused.value = true;
537
+ editor === null || editor === void 0 ? void 0 : editor.commands.focus();
771
538
  activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
772
539
  };
540
+ const isVisible = value => {
541
+ if (Array.isArray(value)) {
542
+ const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
543
+ return isHaveNotVisibleTools;
544
+ }
545
+ return !notVisibleTools.value.has(value);
546
+ };
773
547
  const handleInput = event => {
774
548
  const target = event.target;
775
549
  const value = target.value;
@@ -777,11 +551,7 @@ var script = defineComponent({
777
551
  markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
778
552
  proxyModelValue.value = markdownOutput.value;
779
553
  };
780
- const handleToolbarClick = _ref4 => {
781
- let {
782
- item,
783
- level
784
- } = _ref4;
554
+ const handleToolbarClick = (item, level) => {
785
555
  var _a, _b, _c, _d;
786
556
  switch (item) {
787
557
  case 'source':
@@ -861,10 +631,10 @@ var script = defineComponent({
861
631
  editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
862
632
  href: link.value,
863
633
  target: '__blank'
864
- }).command(_ref5 => {
634
+ }).command(_ref4 => {
865
635
  let {
866
636
  tr
867
- } = _ref5;
637
+ } = _ref4;
868
638
  const preparedValue = text.value[text.value.length - 1] === ' ' ? text.value : `${text.value} `;
869
639
  tr.insertText(preparedValue);
870
640
  return true;
@@ -900,7 +670,11 @@ var script = defineComponent({
900
670
  };
901
671
  // Styles
902
672
  const rootStyles = computed(() => ['or-rich-text-editor-v3', ...OrRichTextEditor]);
903
- const containerStyles = computed(() => [...EditorContainer, ...(isFocused.value ? EditorContainerFocus : [])]);
673
+ const containerStyles = computed(() => [...EditorContainer]);
674
+ const toolbarContainerStyles = computed(() => [...ToolbarContainer]);
675
+ const toolbarStyles = computed(() => [...Toolbar,
676
+ // 'overflow-x-hidden',
677
+ ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)]);
904
678
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
905
679
  //Effects
906
680
  watch(proxyModelValue, value => {
@@ -908,38 +682,43 @@ var script = defineComponent({
908
682
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
909
683
  }
910
684
  if (props.format === 'markdown' && value !== markdownOutput.value) {
911
- const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
912
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
685
+ //TODO: const deserialized = deserialize(editor?.schema, value);
686
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
913
687
  }
914
688
  });
915
- watch(props, _ref6 => {
916
- let {
917
- readonly
918
- } = _ref6;
919
- isFocused.value = !readonly;
920
- editor === null || editor === void 0 ? void 0 : editor.setEditable(!readonly);
921
- });
922
689
  return {
923
690
  editor,
924
691
  editorRef,
925
- toolbarContainerRef,
692
+ toolbarRef,
926
693
  containerRef,
694
+ toolbarButtonRef,
695
+ moreButtonRef,
927
696
  textareaRef,
697
+ moreRef,
698
+ menuRef,
699
+ iconsEnum,
928
700
  handleToolbarClick,
929
701
  handleEditorClick,
930
702
  isActive,
703
+ iconTooltipsEnum,
931
704
  containerStyles,
705
+ toolbarContainerStyles,
706
+ toolbarStyles,
932
707
  rootStyles,
933
708
  root,
934
709
  editorInputStyles,
710
+ getIndexOfHeading,
935
711
  headingLevels,
712
+ headingIcon,
936
713
  attachLink,
937
714
  discardLink,
938
715
  isOpenLinkModal,
939
716
  text,
940
717
  link,
941
718
  isFocused,
719
+ isVisible,
942
720
  countOfNotVisibleTools,
721
+ notVisibleTools,
943
722
  handleInput,
944
723
  proxyModelValue,
945
724
  disableMarkdown,
@@ -976,7 +755,7 @@ var __vue_render__ = function () {
976
755
  }, [_vm._t("label", function () {
977
756
  return [_vm._v("\n " + _vm._s(_vm.label) + "\n ")];
978
757
  })], 2)] : _vm._e(), _vm._v(" "), _c('div', {
979
- ref: "containerRef",
758
+ ref: 'containerRef',
980
759
  class: _vm.containerStyles,
981
760
  attrs: {
982
761
  "invalid": !!_vm.error
@@ -986,20 +765,77 @@ var __vue_render__ = function () {
986
765
  return _vm.handleEditorClick();
987
766
  }
988
767
  }
989
- }, [!_vm.readonly ? _c('editor-toolbar', {
990
- ref: "toolbarContainerRef",
768
+ }, [_c('div', {
769
+ ref: 'toolbarRef',
770
+ class: _vm.toolbarContainerStyles
771
+ }, [_vm._l(_vm.toolbar, function (tools, index) {
772
+ return _c('div', {
773
+ key: index,
774
+ class: _vm.toolbarStyles.concat([{
775
+ 'hidden': _vm.isVisible(tools)
776
+ }])
777
+ }, _vm._l(tools, function (item) {
778
+ return _c('div', {
779
+ key: item,
780
+ class: ['flex gap-md', {
781
+ 'hidden': !_vm.isVisible(item)
782
+ }]
783
+ }, [item === 'heading' ? _c('or-icon-button', {
784
+ ref: 'toolbarButtonRef',
785
+ refInFor: true,
786
+ attrs: {
787
+ "selected": _vm.isActive[item],
788
+ "disabled": !_vm.isFocused,
789
+ "tooltip": {
790
+ content: item,
791
+ placement: 'top'
792
+ },
793
+ "icon": {
794
+ icon: _vm.headingIcon,
795
+ variant: 'inherit'
796
+ }
797
+ },
798
+ on: {
799
+ "click": function ($event) {
800
+ _vm.menuRef && _vm.menuRef.toggle();
801
+ }
802
+ }
803
+ }) : _vm.isVisible(item) ? _c('or-icon-button', {
804
+ attrs: {
805
+ "tooltip": {
806
+ content: _vm.iconTooltipsEnum[item],
807
+ placement: 'top'
808
+ },
809
+ "selected": _vm.isActive[item],
810
+ "disabled": !_vm.isFocused,
811
+ "icon": {
812
+ icon: _vm.iconsEnum[item],
813
+ variant: 'inherit'
814
+ }
815
+ },
816
+ on: {
817
+ "click": function ($event) {
818
+ return _vm.handleToolbarClick(item);
819
+ }
820
+ }
821
+ }) : _vm._e()], 1);
822
+ }), 0);
823
+ }), _vm._v(" "), _vm.countOfNotVisibleTools > 0 ? _c('or-icon-button', {
824
+ ref: 'moreButtonRef',
825
+ staticClass: "px-sm",
991
826
  attrs: {
992
- "count-of-not-visible-tools": _vm.countOfNotVisibleTools,
993
- "toolbar": _vm.toolbar,
994
- "is-focused": _vm.isFocused,
995
- "active-heading-level": _vm.activeHeadingLevel,
996
- "is-active": _vm.isActive,
997
- "heading-levels": _vm.headingLevels
827
+ "disabled": !_vm.isFocused,
828
+ "icon": {
829
+ icon: 'more_horiz',
830
+ variant: 'inherit'
831
+ }
998
832
  },
999
833
  on: {
1000
- "click-tool": _vm.handleToolbarClick
834
+ "click": function ($event) {
835
+ _vm.moreRef && _vm.moreRef.open();
836
+ }
1001
837
  }
1002
- }) : _vm._e(), _vm._v(" "), _c('div', {
838
+ }) : _vm._e()], 2), _vm._v(" "), _c('div', {
1003
839
  class: ['p-sm', 'overflow-auto', 'min-h-[88px]']
1004
840
  }, [_c('textarea', {
1005
841
  directives: [{
@@ -1036,9 +872,9 @@ var __vue_render__ = function () {
1036
872
  value: !_vm.disableMarkdown,
1037
873
  expression: "!disableMarkdown"
1038
874
  }],
1039
- ref: "editorRef",
875
+ ref: 'editorRef',
1040
876
  class: _vm.editorInputStyles
1041
- }), _vm._v(" "), _vm._t("files")], 2)], 1), _vm._v(" "), !_vm.error ? [_vm.$slots.hint || _vm.hint ? [_c('OrHint', {
877
+ }), _vm._v(" "), _vm._t("files")], 2)]), _vm._v(" "), !_vm.error ? [_vm.$slots.hint || _vm.hint ? [_c('OrHint', {
1042
878
  attrs: {
1043
879
  "disabled": _vm.disabled
1044
880
  }
@@ -1048,7 +884,62 @@ var __vue_render__ = function () {
1048
884
  attrs: {
1049
885
  "disabled": _vm.disabled
1050
886
  }
1051
- }, [_vm._v("\n " + _vm._s(_vm.error) + "\n ")])] : _vm._e(), _vm._v(" "), _c('or-modal', {
887
+ }, [_vm._v("\n " + _vm._s(_vm.error) + "\n ")])] : _vm._e(), _vm._v(" "), _vm.moreButtonRef ? _c('or-popover', {
888
+ ref: 'moreRef',
889
+ attrs: {
890
+ "trigger": _vm.moreButtonRef && _vm.moreButtonRef.root,
891
+ "placement": "top-end"
892
+ }
893
+ }, [_c('div', {
894
+ staticClass: "flex p-sm gap-md"
895
+ }, _vm._l(_vm.notVisibleTools, function (item) {
896
+ return _c('or-icon-button', {
897
+ key: item,
898
+ attrs: {
899
+ "tooltip": {
900
+ content: _vm.iconTooltipsEnum[item],
901
+ placement: 'top'
902
+ },
903
+ "selected": _vm.isActive[item],
904
+ "icon": {
905
+ icon: _vm.iconsEnum[item],
906
+ variant: 'inherit'
907
+ }
908
+ },
909
+ on: {
910
+ "click": function ($event) {
911
+ return _vm.handleToolbarClick(item);
912
+ }
913
+ }
914
+ });
915
+ }), 1)]) : _vm._e(), _vm._v(" "), _vm.toolbarButtonRef ? _c('or-menu', {
916
+ ref: 'menuRef',
917
+ attrs: {
918
+ "trigger": _vm.toolbarButtonRef[_vm.getIndexOfHeading] && _vm.toolbarButtonRef[_vm.getIndexOfHeading].root,
919
+ "placement": "bottom-start"
920
+ }
921
+ }, [_vm._l(_vm.headingLevels, function (heading) {
922
+ return _c('or-menu-item', {
923
+ key: heading,
924
+ attrs: {
925
+ "selected": _vm.activeHeadingLevel === heading
926
+ },
927
+ on: {
928
+ "click": function ($event) {
929
+ return _vm.handleToolbarClick('heading', heading);
930
+ }
931
+ }
932
+ }, [_vm._v("\n Heading " + _vm._s(heading) + "\n ")]);
933
+ }), _vm._v(" "), _c('or-menu-item', {
934
+ attrs: {
935
+ "selected": !_vm.activeHeadingLevel
936
+ },
937
+ on: {
938
+ "click": function ($event) {
939
+ return _vm.handleToolbarClick('heading');
940
+ }
941
+ }
942
+ }, [_vm._v("\n None\n ")])], 2) : _vm._e(), _vm._v(" "), _c('or-modal', {
1052
943
  attrs: {
1053
944
  "is-open": _vm.isOpenLinkModal,
1054
945
  "size": "s"