@onereach/ui-components 10.2.0 → 10.2.1-beta.4272.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 (42) hide show
  1. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +382 -252
  2. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +21 -68
  3. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.d.ts +1 -0
  4. package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +5 -4
  5. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  6. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  7. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +2 -2
  8. package/dist/bundled/v2/{index-02a897ac.js → index-0e9c2b43.js} +1 -1
  9. package/dist/bundled/v2/{index-7516cf60.js → index-f379c836.js} +258 -173
  10. package/dist/bundled/v2/{markdown-fe3bfb01.js → markdown-2d22cf16.js} +66 -113
  11. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  12. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +14 -18
  13. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  14. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
  15. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.d.ts +1 -0
  16. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
  17. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  18. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  19. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  20. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
  21. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  22. package/dist/bundled/v3/components/{OrRichTextEditorV3-358d7df2.js → OrRichTextEditorV3-45e64a85.js} +673 -531
  23. package/dist/bundled/v3/components/index.js +1 -1
  24. package/dist/bundled/v3/index.js +1 -1
  25. package/dist/esm/v2/{OrRichTextEditor-734b8b27.js → OrRichTextEditor-fbcc33fd.js} +353 -244
  26. package/dist/esm/v2/components/index.js +1 -1
  27. package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +21 -68
  28. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +7 -7
  29. package/dist/esm/v2/components/or-rich-text-editor-v3/partials/EditorToolbar.vue.d.ts +160 -0
  30. package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +1 -0
  31. package/dist/esm/v2/index.js +1 -1
  32. package/dist/esm/v3/{OrRichTextEditor-b5684aab.js → OrRichTextEditor-cdd9e3e4.js} +325 -242
  33. package/dist/esm/v3/components/index.js +1 -1
  34. package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +14 -18
  35. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +6 -6
  36. package/dist/esm/v3/components/or-rich-text-editor-v3/partials/EditorToolbar.vue.d.ts +89 -0
  37. package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +1 -0
  38. package/dist/esm/v3/index.js +1 -1
  39. package/package.json +19 -20
  40. package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +48 -203
  41. package/src/components/or-rich-text-editor-v3/partials/EditorToolbar.vue +238 -0
  42. package/src/components/or-rich-text-editor-v3/styles.ts +13 -10
@@ -1,20 +1,20 @@
1
- import { resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, Fragment as Fragment$1, renderList, withDirectives, vShow, vModelText, createVNode } from 'vue';
1
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment as Fragment$1, renderList, createBlock, createCommentVNode, withCtx, createElementVNode, createTextVNode, toDisplayString, createVNode, renderSlot, withDirectives, vShow, vModelText } from 'vue';
2
2
  import { s as styleInject } from './OrAvatar-86b41eb9.js';
3
3
  import { l as useResizeObserver, m as useDebounceFn, o as onClickOutside } from './OrBottomSheetV3-a6bcf245.js';
4
4
  import { u as useFocusTrap } from './OrModal-ca7146cc.js';
5
- import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue-demi';
5
+ import { defineComponent, ref, computed, onMounted, onBeforeUnmount, watch, nextTick } from 'vue-demi';
6
6
  import { j as commonjsGlobal, k as getDefaultExportFromCjs } from './OrDateTimePicker-0a55e490.js';
7
7
  import { f as keyName, g as base, E as EditorView$1, H as HighlightStyle, t as tags, s as syntaxHighlighting, a as EditorState$1, m as highlightActiveLine, n as highlightActiveLineGutter, o as lineNumbers, k as keymap$1, p as minimalSetup, j as javascript } from './OrCode-d9b43205.js';
8
- import { s as script$1 } from './OrIconButtonV3-1226bc94.js';
9
- import { s as script$2 } from './OrLabelV3-23a42d9d.js';
8
+ import { s as script$2 } from './OrIconButtonV3-1226bc94.js';
10
9
  import { s as script$3 } from './OrMenuItemV3-97def528.js';
11
10
  import { s as script$4 } from './OrMenuV3-a6e4003d.js';
12
- import { s as script$5 } from './OrModalV3-d10e039e.js';
13
- import { s as script$6 } from './OrInputV3-ce85efcb.js';
14
- import { s as script$7 } from './OrButtonV3-9bd422c8.js';
15
- import { s as script$8 } from './OrPopoverV3-dd93694c.js';
11
+ import { s as script$5 } from './OrPopoverV3-dd93694c.js';
12
+ import { s as script$6 } from './OrModalV3-d10e039e.js';
13
+ import { s as script$7 } from './OrInputV3-ce85efcb.js';
14
+ import { s as script$8 } from './OrButtonV3-9bd422c8.js';
16
15
  import { s as script$9 } from './OrHintV3-c8ac5975.js';
17
16
  import { s as script$a } from './OrErrorV3-b04d76aa.js';
17
+ import { s as script$b } from './OrLabelV3-23a42d9d.js';
18
18
  import { useTheme } from '../hooks/useTheme.js';
19
19
 
20
20
  // ::- Persistent data structure representing an ordered mapping from
@@ -17763,9 +17763,6 @@ class CommandManager {
17763
17763
  const {
17764
17764
  view
17765
17765
  } = editor;
17766
- if (state.storedMarks) {
17767
- tr.setStoredMarks(state.storedMarks);
17768
- }
17769
17766
  const props = {
17770
17767
  tr,
17771
17768
  editor,
@@ -17775,7 +17772,7 @@ class CommandManager {
17775
17772
  transaction: tr
17776
17773
  }),
17777
17774
  dispatch: shouldDispatch ? () => undefined : undefined,
17778
- chain: () => this.createChain(tr),
17775
+ chain: () => this.createChain(tr, shouldDispatch),
17779
17776
  can: () => this.createCan(tr),
17780
17777
  get commands() {
17781
17778
  return Object.fromEntries(Object.entries(rawCommands).map(_ref4 => {
@@ -17954,7 +17951,10 @@ function mergeAttributes() {
17954
17951
  return;
17955
17952
  }
17956
17953
  if (key === 'class') {
17957
- mergedAttributes[key] = [mergedAttributes[key], value].join(' ');
17954
+ const valueClasses = value ? value.split(' ') : [];
17955
+ const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(' ') : [];
17956
+ const insertClasses = valueClasses.filter(valueClass => !existingClasses.includes(valueClass));
17957
+ mergedAttributes[key] = [...existingClasses, ...insertClasses].join(' ');
17958
17958
  } else if (key === 'style') {
17959
17959
  mergedAttributes[key] = [mergedAttributes[key], value].join('; ');
17960
17960
  } else {
@@ -18421,7 +18421,9 @@ function run$2(config) {
18421
18421
  state,
18422
18422
  from,
18423
18423
  to,
18424
- rule
18424
+ rule,
18425
+ pasteEvent,
18426
+ dropEvent
18425
18427
  } = config;
18426
18428
  const {
18427
18429
  commands,
@@ -18456,7 +18458,9 @@ function run$2(config) {
18456
18458
  match,
18457
18459
  commands,
18458
18460
  chain,
18459
- can
18461
+ can,
18462
+ pasteEvent,
18463
+ dropEvent
18460
18464
  });
18461
18465
  handlers.push(handler);
18462
18466
  });
@@ -18477,6 +18481,8 @@ function pasteRulesPlugin(props) {
18477
18481
  let dragSourceElement = null;
18478
18482
  let isPastedFromProseMirror = false;
18479
18483
  let isDroppedFromProseMirror = false;
18484
+ let pasteEvent = new ClipboardEvent('paste');
18485
+ let dropEvent = new DragEvent('drop');
18480
18486
  const plugins = rules.map(rule => {
18481
18487
  return new Plugin({
18482
18488
  // we register a global drag handler to track the current drag source element
@@ -18494,13 +18500,15 @@ function pasteRulesPlugin(props) {
18494
18500
  },
18495
18501
  props: {
18496
18502
  handleDOMEvents: {
18497
- drop: view => {
18503
+ drop: (view, event) => {
18498
18504
  isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
18505
+ dropEvent = event;
18499
18506
  return false;
18500
18507
  },
18501
- paste: (view, event) => {
18508
+ paste: (_view, event) => {
18502
18509
  var _a;
18503
18510
  const html = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/html');
18511
+ pasteEvent = event;
18504
18512
  isPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes('data-pm-slice'));
18505
18513
  return false;
18506
18514
  }
@@ -18531,12 +18539,16 @@ function pasteRulesPlugin(props) {
18531
18539
  state: chainableState,
18532
18540
  from: Math.max(from - 1, 0),
18533
18541
  to: to.b - 1,
18534
- rule
18542
+ rule,
18543
+ pasteEvent,
18544
+ dropEvent
18535
18545
  });
18536
18546
  // stop if there are no changes
18537
18547
  if (!handler || !tr.steps.length) {
18538
18548
  return;
18539
18549
  }
18550
+ dropEvent = new DragEvent('drop');
18551
+ pasteEvent = new ClipboardEvent('paste');
18540
18552
  return tr;
18541
18553
  }
18542
18554
  });
@@ -19032,11 +19044,26 @@ const createParagraphNear = () => _ref16 => {
19032
19044
  } = _ref16;
19033
19045
  return createParagraphNear$1(state, dispatch);
19034
19046
  };
19035
- const deleteCurrentNode = () => _ref17 => {
19047
+ const cut = (originRange, targetPos) => _ref17 => {
19048
+ let {
19049
+ editor,
19050
+ tr
19051
+ } = _ref17;
19052
+ const {
19053
+ state
19054
+ } = editor;
19055
+ const contentSlice = state.doc.slice(originRange.from, originRange.to);
19056
+ tr.deleteRange(originRange.from, originRange.to);
19057
+ const newPos = tr.mapping.map(targetPos);
19058
+ tr.insert(newPos, contentSlice.content);
19059
+ tr.setSelection(new TextSelection(tr.doc.resolve(newPos - 1)));
19060
+ return true;
19061
+ };
19062
+ const deleteCurrentNode = () => _ref18 => {
19036
19063
  let {
19037
19064
  tr,
19038
19065
  dispatch
19039
- } = _ref17;
19066
+ } = _ref18;
19040
19067
  const {
19041
19068
  selection
19042
19069
  } = tr;
@@ -19059,12 +19086,12 @@ const deleteCurrentNode = () => _ref17 => {
19059
19086
  }
19060
19087
  return false;
19061
19088
  };
19062
- const deleteNode = typeOrName => _ref18 => {
19089
+ const deleteNode = typeOrName => _ref19 => {
19063
19090
  let {
19064
19091
  tr,
19065
19092
  state,
19066
19093
  dispatch
19067
- } = _ref18;
19094
+ } = _ref19;
19068
19095
  const type = getNodeType(typeOrName, state.schema);
19069
19096
  const $pos = tr.selection.$anchor;
19070
19097
  for (let depth = $pos.depth; depth > 0; depth -= 1) {
@@ -19080,11 +19107,11 @@ const deleteNode = typeOrName => _ref18 => {
19080
19107
  }
19081
19108
  return false;
19082
19109
  };
19083
- const deleteRange = range => _ref19 => {
19110
+ const deleteRange = range => _ref20 => {
19084
19111
  let {
19085
19112
  tr,
19086
19113
  dispatch
19087
- } = _ref19;
19114
+ } = _ref20;
19088
19115
  const {
19089
19116
  from,
19090
19117
  to
@@ -19094,24 +19121,24 @@ const deleteRange = range => _ref19 => {
19094
19121
  }
19095
19122
  return true;
19096
19123
  };
19097
- const deleteSelection = () => _ref20 => {
19124
+ const deleteSelection = () => _ref21 => {
19098
19125
  let {
19099
19126
  state,
19100
19127
  dispatch
19101
- } = _ref20;
19128
+ } = _ref21;
19102
19129
  return deleteSelection$1(state, dispatch);
19103
19130
  };
19104
- const enter = () => _ref21 => {
19131
+ const enter = () => _ref22 => {
19105
19132
  let {
19106
19133
  commands
19107
- } = _ref21;
19134
+ } = _ref22;
19108
19135
  return commands.keyboardShortcut('Enter');
19109
19136
  };
19110
- const exitCode = () => _ref22 => {
19137
+ const exitCode = () => _ref23 => {
19111
19138
  let {
19112
19139
  state,
19113
19140
  dispatch
19114
- } = _ref22;
19141
+ } = _ref23;
19115
19142
  return exitCode$1(state, dispatch);
19116
19143
  };
19117
19144
 
@@ -19193,12 +19220,12 @@ function getMarkType(nameOrType, schema) {
19193
19220
  }
19194
19221
  const extendMarkRange = function (typeOrName) {
19195
19222
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19196
- return _ref23 => {
19223
+ return _ref24 => {
19197
19224
  let {
19198
19225
  tr,
19199
19226
  state,
19200
19227
  dispatch
19201
- } = _ref23;
19228
+ } = _ref24;
19202
19229
  const type = getMarkType(typeOrName, state.schema);
19203
19230
  const {
19204
19231
  doc,
@@ -19265,13 +19292,13 @@ function isiOS() {
19265
19292
  const focus = function () {
19266
19293
  let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
19267
19294
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19268
- return _ref24 => {
19295
+ return _ref25 => {
19269
19296
  let {
19270
19297
  editor,
19271
19298
  view,
19272
19299
  tr,
19273
19300
  dispatch
19274
- } = _ref24;
19301
+ } = _ref25;
19275
19302
  options = {
19276
19303
  scrollIntoView: true,
19277
19304
  ...options
@@ -19325,11 +19352,11 @@ const forEach = (items, fn) => props => {
19325
19352
  index
19326
19353
  }));
19327
19354
  };
19328
- const insertContent = (value, options) => _ref25 => {
19355
+ const insertContent = (value, options) => _ref26 => {
19329
19356
  let {
19330
19357
  tr,
19331
19358
  commands
19332
- } = _ref25;
19359
+ } = _ref26;
19333
19360
  return commands.insertContentAt({
19334
19361
  from: tr.selection.from,
19335
19362
  to: tr.selection.to
@@ -19386,12 +19413,12 @@ function selectionToInsertionEnd(tr, startLen, bias) {
19386
19413
  const isFragment = nodeOrFragment => {
19387
19414
  return nodeOrFragment.toString().startsWith('<');
19388
19415
  };
19389
- const insertContentAt = (position, value, options) => _ref26 => {
19416
+ const insertContentAt = (position, value, options) => _ref27 => {
19390
19417
  let {
19391
19418
  tr,
19392
19419
  dispatch,
19393
19420
  editor
19394
- } = _ref26;
19421
+ } = _ref27;
19395
19422
  if (dispatch) {
19396
19423
  options = {
19397
19424
  parseOptions: {},
@@ -19414,7 +19441,10 @@ const insertContentAt = (position, value, options) => _ref26 => {
19414
19441
  } = typeof position === 'number' ? {
19415
19442
  from: position,
19416
19443
  to: position
19417
- } : position;
19444
+ } : {
19445
+ from: position.from,
19446
+ to: position.to
19447
+ };
19418
19448
  let isOnlyTextContent = true;
19419
19449
  let isOnlyBlockContent = true;
19420
19450
  const nodes = isFragment(content) ? content : [content];
@@ -19461,34 +19491,74 @@ const insertContentAt = (position, value, options) => _ref26 => {
19461
19491
  }
19462
19492
  return true;
19463
19493
  };
19464
- const joinUp = () => _ref27 => {
19494
+ const joinUp = () => _ref28 => {
19465
19495
  let {
19466
19496
  state,
19467
19497
  dispatch
19468
- } = _ref27;
19498
+ } = _ref28;
19469
19499
  return joinUp$1(state, dispatch);
19470
19500
  };
19471
- const joinDown = () => _ref28 => {
19501
+ const joinDown = () => _ref29 => {
19472
19502
  let {
19473
19503
  state,
19474
19504
  dispatch
19475
- } = _ref28;
19505
+ } = _ref29;
19476
19506
  return joinDown$1(state, dispatch);
19477
19507
  };
19478
- const joinBackward = () => _ref29 => {
19508
+ const joinBackward = () => _ref30 => {
19479
19509
  let {
19480
19510
  state,
19481
19511
  dispatch
19482
- } = _ref29;
19512
+ } = _ref30;
19483
19513
  return joinBackward$1(state, dispatch);
19484
19514
  };
19485
- const joinForward = () => _ref30 => {
19515
+ const joinForward = () => _ref31 => {
19486
19516
  let {
19487
19517
  state,
19488
19518
  dispatch
19489
- } = _ref30;
19519
+ } = _ref31;
19490
19520
  return joinForward$1(state, dispatch);
19491
19521
  };
19522
+ const joinItemBackward = () => _ref32 => {
19523
+ let {
19524
+ tr,
19525
+ state,
19526
+ dispatch
19527
+ } = _ref32;
19528
+ try {
19529
+ const point = joinPoint(state.doc, state.selection.$from.pos, -1);
19530
+ if (point === null || point === undefined) {
19531
+ return false;
19532
+ }
19533
+ tr.join(point, 2);
19534
+ if (dispatch) {
19535
+ dispatch(tr);
19536
+ }
19537
+ return true;
19538
+ } catch {
19539
+ return false;
19540
+ }
19541
+ };
19542
+ const joinItemForward = () => _ref33 => {
19543
+ let {
19544
+ state,
19545
+ dispatch,
19546
+ tr
19547
+ } = _ref33;
19548
+ try {
19549
+ const point = joinPoint(state.doc, state.selection.$from.pos, +1);
19550
+ if (point === null || point === undefined) {
19551
+ return false;
19552
+ }
19553
+ tr.join(point, 2);
19554
+ if (dispatch) {
19555
+ dispatch(tr);
19556
+ }
19557
+ return true;
19558
+ } catch (e) {
19559
+ return false;
19560
+ }
19561
+ };
19492
19562
  function isMacOS() {
19493
19563
  return typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
19494
19564
  }
@@ -19536,13 +19606,13 @@ function normalizeKeyName(name) {
19536
19606
  }
19537
19607
  return result;
19538
19608
  }
19539
- const keyboardShortcut = name => _ref31 => {
19609
+ const keyboardShortcut = name => _ref34 => {
19540
19610
  let {
19541
19611
  editor,
19542
19612
  view,
19543
19613
  tr,
19544
19614
  dispatch
19545
- } = _ref31;
19615
+ } = _ref34;
19546
19616
  const keys = normalizeKeyName(name).split(/-(?!$)/);
19547
19617
  const key = keys.find(item => !['Alt', 'Ctrl', 'Meta', 'Shift'].includes(item));
19548
19618
  const event = new KeyboardEvent('keydown', {
@@ -19603,11 +19673,11 @@ function isNodeActive(state, typeOrName) {
19603
19673
  }
19604
19674
  const lift = function (typeOrName) {
19605
19675
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19606
- return _ref32 => {
19676
+ return _ref35 => {
19607
19677
  let {
19608
19678
  state,
19609
19679
  dispatch
19610
- } = _ref32;
19680
+ } = _ref35;
19611
19681
  const type = getNodeType(typeOrName, state.schema);
19612
19682
  const isActive = isNodeActive(state, type, attributes);
19613
19683
  if (!isActive) {
@@ -19616,26 +19686,26 @@ const lift = function (typeOrName) {
19616
19686
  return lift$1(state, dispatch);
19617
19687
  };
19618
19688
  };
19619
- const liftEmptyBlock = () => _ref33 => {
19689
+ const liftEmptyBlock = () => _ref36 => {
19620
19690
  let {
19621
19691
  state,
19622
19692
  dispatch
19623
- } = _ref33;
19693
+ } = _ref36;
19624
19694
  return liftEmptyBlock$1(state, dispatch);
19625
19695
  };
19626
- const liftListItem = typeOrName => _ref34 => {
19696
+ const liftListItem = typeOrName => _ref37 => {
19627
19697
  let {
19628
19698
  state,
19629
19699
  dispatch
19630
- } = _ref34;
19700
+ } = _ref37;
19631
19701
  const type = getNodeType(typeOrName, state.schema);
19632
19702
  return liftListItem$1(type)(state, dispatch);
19633
19703
  };
19634
- const newlineInCode = () => _ref35 => {
19704
+ const newlineInCode = () => _ref38 => {
19635
19705
  let {
19636
19706
  state,
19637
19707
  dispatch
19638
- } = _ref35;
19708
+ } = _ref38;
19639
19709
  return newlineInCode$1(state, dispatch);
19640
19710
  };
19641
19711
  function getSchemaTypeNameByName(name, schema) {
@@ -19662,12 +19732,12 @@ function deleteProps(obj, propOrProps) {
19662
19732
  return newObj;
19663
19733
  }, {});
19664
19734
  }
19665
- const resetAttributes = (typeOrName, attributes) => _ref36 => {
19735
+ const resetAttributes = (typeOrName, attributes) => _ref39 => {
19666
19736
  let {
19667
19737
  tr,
19668
19738
  state,
19669
19739
  dispatch
19670
- } = _ref36;
19740
+ } = _ref39;
19671
19741
  let nodeType = null;
19672
19742
  let markType = null;
19673
19743
  const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);
@@ -19698,63 +19768,63 @@ const resetAttributes = (typeOrName, attributes) => _ref36 => {
19698
19768
  }
19699
19769
  return true;
19700
19770
  };
19701
- const scrollIntoView = () => _ref37 => {
19771
+ const scrollIntoView = () => _ref40 => {
19702
19772
  let {
19703
19773
  tr,
19704
19774
  dispatch
19705
- } = _ref37;
19775
+ } = _ref40;
19706
19776
  if (dispatch) {
19707
19777
  tr.scrollIntoView();
19708
19778
  }
19709
19779
  return true;
19710
19780
  };
19711
- const selectAll = () => _ref38 => {
19781
+ const selectAll = () => _ref41 => {
19712
19782
  let {
19713
19783
  tr,
19714
19784
  commands
19715
- } = _ref38;
19785
+ } = _ref41;
19716
19786
  return commands.setTextSelection({
19717
19787
  from: 0,
19718
19788
  to: tr.doc.content.size
19719
19789
  });
19720
19790
  };
19721
- const selectNodeBackward = () => _ref39 => {
19791
+ const selectNodeBackward = () => _ref42 => {
19722
19792
  let {
19723
19793
  state,
19724
19794
  dispatch
19725
- } = _ref39;
19795
+ } = _ref42;
19726
19796
  return selectNodeBackward$1(state, dispatch);
19727
19797
  };
19728
- const selectNodeForward = () => _ref40 => {
19798
+ const selectNodeForward = () => _ref43 => {
19729
19799
  let {
19730
19800
  state,
19731
19801
  dispatch
19732
- } = _ref40;
19802
+ } = _ref43;
19733
19803
  return selectNodeForward$1(state, dispatch);
19734
19804
  };
19735
- const selectParentNode = () => _ref41 => {
19805
+ const selectParentNode = () => _ref44 => {
19736
19806
  let {
19737
19807
  state,
19738
19808
  dispatch
19739
- } = _ref41;
19809
+ } = _ref44;
19740
19810
  return selectParentNode$1(state, dispatch);
19741
19811
  };
19742
19812
 
19743
19813
  // @ts-ignore
19744
- const selectTextblockEnd = () => _ref42 => {
19814
+ const selectTextblockEnd = () => _ref45 => {
19745
19815
  let {
19746
19816
  state,
19747
19817
  dispatch
19748
- } = _ref42;
19818
+ } = _ref45;
19749
19819
  return selectTextblockEnd$1(state, dispatch);
19750
19820
  };
19751
19821
 
19752
19822
  // @ts-ignore
19753
- const selectTextblockStart = () => _ref43 => {
19823
+ const selectTextblockStart = () => _ref46 => {
19754
19824
  let {
19755
19825
  state,
19756
19826
  dispatch
19757
- } = _ref43;
19827
+ } = _ref46;
19758
19828
  return selectTextblockStart$1(state, dispatch);
19759
19829
  };
19760
19830
  function createDocument(content, schema) {
@@ -19767,12 +19837,12 @@ function createDocument(content, schema) {
19767
19837
  const setContent = function (content) {
19768
19838
  let emitUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
19769
19839
  let parseOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
19770
- return _ref44 => {
19840
+ return _ref47 => {
19771
19841
  let {
19772
19842
  tr,
19773
19843
  editor,
19774
19844
  dispatch
19775
- } = _ref44;
19845
+ } = _ref47;
19776
19846
  const {
19777
19847
  doc
19778
19848
  } = tr;
@@ -19783,6 +19853,32 @@ const setContent = function (content) {
19783
19853
  return true;
19784
19854
  };
19785
19855
  };
19856
+ function getMarkAttributes(state, typeOrName) {
19857
+ const type = getMarkType(typeOrName, state.schema);
19858
+ const {
19859
+ from,
19860
+ to,
19861
+ empty
19862
+ } = state.selection;
19863
+ const marks = [];
19864
+ if (empty) {
19865
+ if (state.storedMarks) {
19866
+ marks.push(...state.storedMarks);
19867
+ }
19868
+ marks.push(...state.selection.$head.marks());
19869
+ } else {
19870
+ state.doc.nodesBetween(from, to, node => {
19871
+ marks.push(...node.marks);
19872
+ });
19873
+ }
19874
+ const mark = marks.find(markItem => markItem.type.name === type.name);
19875
+ if (!mark) {
19876
+ return {};
19877
+ }
19878
+ return {
19879
+ ...mark.attrs
19880
+ };
19881
+ }
19786
19882
 
19787
19883
  /**
19788
19884
  * Returns a new `Transform` based on all steps of the passed transactions.
@@ -19862,32 +19958,6 @@ function getText(node, options) {
19862
19958
  };
19863
19959
  return getTextBetween(node, range, options);
19864
19960
  }
19865
- function getMarkAttributes(state, typeOrName) {
19866
- const type = getMarkType(typeOrName, state.schema);
19867
- const {
19868
- from,
19869
- to,
19870
- empty
19871
- } = state.selection;
19872
- const marks = [];
19873
- if (empty) {
19874
- if (state.storedMarks) {
19875
- marks.push(...state.storedMarks);
19876
- }
19877
- marks.push(...state.selection.$head.marks());
19878
- } else {
19879
- state.doc.nodesBetween(from, to, node => {
19880
- marks.push(...node.marks);
19881
- });
19882
- }
19883
- const mark = marks.find(markItem => markItem.type.name === type.name);
19884
- if (!mark) {
19885
- return {};
19886
- }
19887
- return {
19888
- ...mark.attrs
19889
- };
19890
- }
19891
19961
  function getNodeAttributes(state, typeOrName) {
19892
19962
  const type = getNodeType(typeOrName, state.schema);
19893
19963
  const {
@@ -19978,11 +20048,11 @@ function getChangedRanges(transform) {
19978
20048
  });
19979
20049
  });
19980
20050
  }
19981
- ranges.forEach(_ref45 => {
20051
+ ranges.forEach(_ref48 => {
19982
20052
  let {
19983
20053
  from,
19984
20054
  to
19985
- } = _ref45;
20055
+ } = _ref48;
19986
20056
  const newStart = mapping.slice(index).map(from, -1);
19987
20057
  const newEnd = mapping.slice(index).map(to);
19988
20058
  const oldStart = mapping.invert().map(newStart, -1);
@@ -20028,8 +20098,8 @@ function getMarksBetween(from, to, doc) {
20028
20098
  return marks;
20029
20099
  }
20030
20100
  function getSplittedAttributes(extensionAttributes, typeName, attributes) {
20031
- return Object.fromEntries(Object.entries(attributes).filter(_ref46 => {
20032
- let [name] = _ref46;
20101
+ return Object.fromEntries(Object.entries(attributes).filter(_ref49 => {
20102
+ let [name] = _ref49;
20033
20103
  const extensionAttribute = extensionAttributes.find(item => {
20034
20104
  return item.type === typeName && item.name === name;
20035
20105
  });
@@ -20058,11 +20128,11 @@ function isMarkActive(state, typeOrName) {
20058
20128
  }
20059
20129
  let selectionRange = 0;
20060
20130
  const markRanges = [];
20061
- ranges.forEach(_ref47 => {
20131
+ ranges.forEach(_ref50 => {
20062
20132
  let {
20063
20133
  $from,
20064
20134
  $to
20065
- } = _ref47;
20135
+ } = _ref50;
20066
20136
  const from = $from.pos;
20067
20137
  const to = $to.pos;
20068
20138
  state.doc.nodesBetween(from, to, (node, pos) => {
@@ -20161,11 +20231,11 @@ function canSetMark(state, tr, newMarkType) {
20161
20231
  const {
20162
20232
  ranges
20163
20233
  } = selection;
20164
- return ranges.some(_ref48 => {
20234
+ return ranges.some(_ref51 => {
20165
20235
  let {
20166
20236
  $from,
20167
20237
  $to
20168
- } = _ref48;
20238
+ } = _ref51;
20169
20239
  let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
20170
20240
  state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
20171
20241
  // If we already found a mark that we can enable, return false to bypass the remaining search
@@ -20184,12 +20254,12 @@ function canSetMark(state, tr, newMarkType) {
20184
20254
  }
20185
20255
  const setMark = function (typeOrName) {
20186
20256
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20187
- return _ref49 => {
20257
+ return _ref52 => {
20188
20258
  let {
20189
20259
  tr,
20190
20260
  state,
20191
20261
  dispatch
20192
- } = _ref49;
20262
+ } = _ref52;
20193
20263
  const {
20194
20264
  selection
20195
20265
  } = tr;
@@ -20235,21 +20305,21 @@ const setMark = function (typeOrName) {
20235
20305
  return canSetMark(state, tr, type);
20236
20306
  };
20237
20307
  };
20238
- const setMeta = (key, value) => _ref50 => {
20308
+ const setMeta = (key, value) => _ref53 => {
20239
20309
  let {
20240
20310
  tr
20241
- } = _ref50;
20311
+ } = _ref53;
20242
20312
  tr.setMeta(key, value);
20243
20313
  return true;
20244
20314
  };
20245
20315
  const setNode = function (typeOrName) {
20246
20316
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20247
- return _ref51 => {
20317
+ return _ref54 => {
20248
20318
  let {
20249
20319
  state,
20250
20320
  dispatch,
20251
20321
  chain
20252
- } = _ref51;
20322
+ } = _ref54;
20253
20323
  const type = getNodeType(typeOrName, state.schema);
20254
20324
  // TODO: use a fallback like insertContent?
20255
20325
  if (!type.isTextblock) {
@@ -20258,28 +20328,28 @@ const setNode = function (typeOrName) {
20258
20328
  }
20259
20329
  return chain()
20260
20330
  // try to convert node to default node if needed
20261
- .command(_ref52 => {
20331
+ .command(_ref55 => {
20262
20332
  let {
20263
20333
  commands
20264
- } = _ref52;
20334
+ } = _ref55;
20265
20335
  const canSetBlock = setBlockType(type, attributes)(state);
20266
20336
  if (canSetBlock) {
20267
20337
  return true;
20268
20338
  }
20269
20339
  return commands.clearNodes();
20270
- }).command(_ref53 => {
20340
+ }).command(_ref56 => {
20271
20341
  let {
20272
20342
  state: updatedState
20273
- } = _ref53;
20343
+ } = _ref56;
20274
20344
  return setBlockType(type, attributes)(updatedState, dispatch);
20275
20345
  }).run();
20276
20346
  };
20277
20347
  };
20278
- const setNodeSelection = position => _ref54 => {
20348
+ const setNodeSelection = position => _ref57 => {
20279
20349
  let {
20280
20350
  tr,
20281
20351
  dispatch
20282
- } = _ref54;
20352
+ } = _ref57;
20283
20353
  if (dispatch) {
20284
20354
  const {
20285
20355
  doc
@@ -20290,11 +20360,11 @@ const setNodeSelection = position => _ref54 => {
20290
20360
  }
20291
20361
  return true;
20292
20362
  };
20293
- const setTextSelection = position => _ref55 => {
20363
+ const setTextSelection = position => _ref58 => {
20294
20364
  let {
20295
20365
  tr,
20296
20366
  dispatch
20297
- } = _ref55;
20367
+ } = _ref58;
20298
20368
  if (dispatch) {
20299
20369
  const {
20300
20370
  doc
@@ -20315,11 +20385,11 @@ const setTextSelection = position => _ref55 => {
20315
20385
  }
20316
20386
  return true;
20317
20387
  };
20318
- const sinkListItem = typeOrName => _ref56 => {
20388
+ const sinkListItem = typeOrName => _ref59 => {
20319
20389
  let {
20320
20390
  state,
20321
20391
  dispatch
20322
- } = _ref56;
20392
+ } = _ref59;
20323
20393
  const type = getNodeType(typeOrName, state.schema);
20324
20394
  return sinkListItem$1(type)(state, dispatch);
20325
20395
  };
@@ -20334,13 +20404,13 @@ const splitBlock = function () {
20334
20404
  let {
20335
20405
  keepMarks = true
20336
20406
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20337
- return _ref57 => {
20407
+ return _ref60 => {
20338
20408
  let {
20339
20409
  tr,
20340
20410
  state,
20341
20411
  dispatch,
20342
20412
  editor
20343
- } = _ref57;
20413
+ } = _ref60;
20344
20414
  const {
20345
20415
  selection,
20346
20416
  doc
@@ -20404,13 +20474,13 @@ const splitBlock = function () {
20404
20474
  return true;
20405
20475
  };
20406
20476
  };
20407
- const splitListItem = typeOrName => _ref58 => {
20477
+ const splitListItem = typeOrName => _ref61 => {
20408
20478
  let {
20409
20479
  tr,
20410
20480
  state,
20411
20481
  dispatch,
20412
20482
  editor
20413
- } = _ref58;
20483
+ } = _ref61;
20414
20484
  var _a;
20415
20485
  const type = getNodeType(typeOrName, state.schema);
20416
20486
  const {
@@ -20539,7 +20609,7 @@ const joinListForwards = (tr, listType) => {
20539
20609
  };
20540
20610
  const toggleList = function (listTypeOrName, itemTypeOrName, keepMarks) {
20541
20611
  let attributes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
20542
- return _ref59 => {
20612
+ return _ref62 => {
20543
20613
  let {
20544
20614
  editor,
20545
20615
  tr,
@@ -20548,7 +20618,7 @@ const toggleList = function (listTypeOrName, itemTypeOrName, keepMarks) {
20548
20618
  chain,
20549
20619
  commands,
20550
20620
  can
20551
- } = _ref59;
20621
+ } = _ref62;
20552
20622
  const {
20553
20623
  extensions,
20554
20624
  splittableMarks
@@ -20609,11 +20679,11 @@ const toggleList = function (listTypeOrName, itemTypeOrName, keepMarks) {
20609
20679
  const toggleMark = function (typeOrName) {
20610
20680
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20611
20681
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
20612
- return _ref60 => {
20682
+ return _ref63 => {
20613
20683
  let {
20614
20684
  state,
20615
20685
  commands
20616
- } = _ref60;
20686
+ } = _ref63;
20617
20687
  const {
20618
20688
  extendEmptyMarkRange = false
20619
20689
  } = options;
@@ -20629,11 +20699,11 @@ const toggleMark = function (typeOrName) {
20629
20699
  };
20630
20700
  const toggleNode = function (typeOrName, toggleTypeOrName) {
20631
20701
  let attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
20632
- return _ref61 => {
20702
+ return _ref64 => {
20633
20703
  let {
20634
20704
  state,
20635
20705
  commands
20636
- } = _ref61;
20706
+ } = _ref64;
20637
20707
  const type = getNodeType(typeOrName, state.schema);
20638
20708
  const toggleType = getNodeType(toggleTypeOrName, state.schema);
20639
20709
  const isActive = isNodeActive(state, type, attributes);
@@ -20645,11 +20715,11 @@ const toggleNode = function (typeOrName, toggleTypeOrName) {
20645
20715
  };
20646
20716
  const toggleWrap = function (typeOrName) {
20647
20717
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20648
- return _ref62 => {
20718
+ return _ref65 => {
20649
20719
  let {
20650
20720
  state,
20651
20721
  commands
20652
- } = _ref62;
20722
+ } = _ref65;
20653
20723
  const type = getNodeType(typeOrName, state.schema);
20654
20724
  const isActive = isNodeActive(state, type, attributes);
20655
20725
  if (isActive) {
@@ -20658,11 +20728,11 @@ const toggleWrap = function (typeOrName) {
20658
20728
  return commands.wrapIn(type, attributes);
20659
20729
  };
20660
20730
  };
20661
- const undoInputRule = () => _ref63 => {
20731
+ const undoInputRule = () => _ref66 => {
20662
20732
  let {
20663
20733
  state,
20664
20734
  dispatch
20665
- } = _ref63;
20735
+ } = _ref66;
20666
20736
  const plugins = state.plugins;
20667
20737
  for (let i = 0; i < plugins.length; i += 1) {
20668
20738
  const plugin = plugins[i];
@@ -20688,11 +20758,11 @@ const undoInputRule = () => _ref63 => {
20688
20758
  }
20689
20759
  return false;
20690
20760
  };
20691
- const unsetAllMarks = () => _ref64 => {
20761
+ const unsetAllMarks = () => _ref67 => {
20692
20762
  let {
20693
20763
  tr,
20694
20764
  dispatch
20695
- } = _ref64;
20765
+ } = _ref67;
20696
20766
  const {
20697
20767
  selection
20698
20768
  } = tr;
@@ -20712,12 +20782,12 @@ const unsetAllMarks = () => _ref64 => {
20712
20782
  };
20713
20783
  const unsetMark = function (typeOrName) {
20714
20784
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20715
- return _ref65 => {
20785
+ return _ref68 => {
20716
20786
  let {
20717
20787
  tr,
20718
20788
  state,
20719
20789
  dispatch
20720
- } = _ref65;
20790
+ } = _ref68;
20721
20791
  var _a;
20722
20792
  const {
20723
20793
  extendEmptyMarkRange = false
@@ -20757,12 +20827,12 @@ const unsetMark = function (typeOrName) {
20757
20827
  };
20758
20828
  const updateAttributes = function (typeOrName) {
20759
20829
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20760
- return _ref66 => {
20830
+ return _ref69 => {
20761
20831
  let {
20762
20832
  tr,
20763
20833
  state,
20764
20834
  dispatch
20765
- } = _ref66;
20835
+ } = _ref69;
20766
20836
  let nodeType = null;
20767
20837
  let markType = null;
20768
20838
  const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);
@@ -20806,22 +20876,22 @@ const updateAttributes = function (typeOrName) {
20806
20876
  };
20807
20877
  const wrapIn = function (typeOrName) {
20808
20878
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20809
- return _ref67 => {
20879
+ return _ref70 => {
20810
20880
  let {
20811
20881
  state,
20812
20882
  dispatch
20813
- } = _ref67;
20883
+ } = _ref70;
20814
20884
  const type = getNodeType(typeOrName, state.schema);
20815
20885
  return wrapIn$1(type, attributes)(state, dispatch);
20816
20886
  };
20817
20887
  };
20818
20888
  const wrapInList = function (typeOrName) {
20819
20889
  let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20820
- return _ref68 => {
20890
+ return _ref71 => {
20821
20891
  let {
20822
20892
  state,
20823
20893
  dispatch
20824
- } = _ref68;
20894
+ } = _ref71;
20825
20895
  const type = getNodeType(typeOrName, state.schema);
20826
20896
  return wrapInList$1(type, attributes)(state, dispatch);
20827
20897
  };
@@ -20833,6 +20903,7 @@ var commands = /*#__PURE__*/Object.freeze({
20833
20903
  clearNodes: clearNodes,
20834
20904
  command: command,
20835
20905
  createParagraphNear: createParagraphNear,
20906
+ cut: cut,
20836
20907
  deleteCurrentNode: deleteCurrentNode,
20837
20908
  deleteNode: deleteNode,
20838
20909
  deleteRange: deleteRange,
@@ -20849,6 +20920,8 @@ var commands = /*#__PURE__*/Object.freeze({
20849
20920
  joinDown: joinDown,
20850
20921
  joinBackward: joinBackward,
20851
20922
  joinForward: joinForward,
20923
+ joinItemBackward: joinItemBackward,
20924
+ joinItemForward: joinItemForward,
20852
20925
  keyboardShortcut: keyboardShortcut,
20853
20926
  lift: lift,
20854
20927
  liftEmptyBlock: liftEmptyBlock,
@@ -20935,16 +21008,16 @@ const FocusEvents = Extension.create({
20935
21008
  const Keymap = Extension.create({
20936
21009
  name: 'keymap',
20937
21010
  addKeyboardShortcuts() {
20938
- const handleBackspace = () => this.editor.commands.first(_ref69 => {
21011
+ const handleBackspace = () => this.editor.commands.first(_ref72 => {
20939
21012
  let {
20940
21013
  commands
20941
- } = _ref69;
21014
+ } = _ref72;
20942
21015
  return [() => commands.undoInputRule(),
20943
21016
  // maybe convert first text block node to default node
20944
- () => commands.command(_ref70 => {
21017
+ () => commands.command(_ref73 => {
20945
21018
  let {
20946
21019
  tr
20947
- } = _ref70;
21020
+ } = _ref73;
20948
21021
  const {
20949
21022
  selection,
20950
21023
  doc
@@ -20957,23 +21030,26 @@ const Keymap = Extension.create({
20957
21030
  pos,
20958
21031
  parent
20959
21032
  } = $anchor;
20960
- const isAtStart = Selection.atStart(doc).from === pos;
21033
+ const $parentPos = $anchor.parent.isTextblock ? tr.doc.resolve(pos - 1) : $anchor;
21034
+ const parentIsIsolating = $parentPos.parent.type.spec.isolating;
21035
+ const parentPos = $anchor.pos - $anchor.parentOffset;
21036
+ const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
20961
21037
  if (!empty || !isAtStart || !parent.type.isTextblock || parent.textContent.length) {
20962
21038
  return false;
20963
21039
  }
20964
21040
  return commands.clearNodes();
20965
21041
  }), () => commands.deleteSelection(), () => commands.joinBackward(), () => commands.selectNodeBackward()];
20966
21042
  });
20967
- const handleDelete = () => this.editor.commands.first(_ref71 => {
21043
+ const handleDelete = () => this.editor.commands.first(_ref74 => {
20968
21044
  let {
20969
21045
  commands
20970
- } = _ref71;
21046
+ } = _ref74;
20971
21047
  return [() => commands.deleteSelection(), () => commands.deleteCurrentNode(), () => commands.joinForward(), () => commands.selectNodeForward()];
20972
21048
  });
20973
- const handleEnter = () => this.editor.commands.first(_ref72 => {
21049
+ const handleEnter = () => this.editor.commands.first(_ref75 => {
20974
21050
  let {
20975
21051
  commands
20976
- } = _ref72;
21052
+ } = _ref75;
20977
21053
  return [() => commands.newlineInCode(), () => commands.createParagraphNear(), () => commands.liftEmptyBlock(), () => commands.splitBlock()];
20978
21054
  });
20979
21055
  const baseKeymap = {
@@ -21151,8 +21227,8 @@ img.ProseMirror-separator {
21151
21227
  .tippy-box[data-animation=fade][data-state=hidden] {
21152
21228
  opacity: 0
21153
21229
  }`;
21154
- function createStyleTag(style, nonce) {
21155
- const tiptapStyleTag = document.querySelector('style[data-tiptap-style]');
21230
+ function createStyleTag(style, nonce, suffix) {
21231
+ const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ''}]`);
21156
21232
  if (tiptapStyleTag !== null) {
21157
21233
  return tiptapStyleTag;
21158
21234
  }
@@ -21160,7 +21236,7 @@ function createStyleTag(style, nonce) {
21160
21236
  if (nonce) {
21161
21237
  styleNode.setAttribute('nonce', nonce);
21162
21238
  }
21163
- styleNode.setAttribute('data-tiptap-style', '');
21239
+ styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ''}`, '');
21164
21240
  styleNode.innerHTML = style;
21165
21241
  document.getElementsByTagName('head')[0].appendChild(styleNode);
21166
21242
  return styleNode;
@@ -21378,6 +21454,7 @@ class Editor extends EventEmitter {
21378
21454
  });
21379
21455
  this.view.updateState(newState);
21380
21456
  this.createNodeViews();
21457
+ this.prependClass();
21381
21458
  // Let’s store the editor instance in the DOM element.
21382
21459
  // So we’ll have access to it for tests.
21383
21460
  const dom = this.view.dom;
@@ -21391,6 +21468,12 @@ class Editor extends EventEmitter {
21391
21468
  nodeViews: this.extensionManager.nodeViews
21392
21469
  });
21393
21470
  }
21471
+ /**
21472
+ * Prepend class name to element.
21473
+ */
21474
+ prependClass() {
21475
+ this.view.dom.className = `tiptap ${this.view.dom.className}`;
21476
+ }
21394
21477
  captureTransaction(fn) {
21395
21478
  this.isCapturingTransaction = true;
21396
21479
  fn();
@@ -21539,12 +21622,12 @@ class Editor extends EventEmitter {
21539
21622
  function markInputRule(config) {
21540
21623
  return new InputRule({
21541
21624
  find: config.find,
21542
- handler: _ref73 => {
21625
+ handler: _ref76 => {
21543
21626
  let {
21544
21627
  state,
21545
21628
  range,
21546
21629
  match
21547
- } = _ref73;
21630
+ } = _ref76;
21548
21631
  const attributes = callOrReturn(config.getAttributes, undefined, match);
21549
21632
  if (attributes === false || attributes === null) {
21550
21633
  return null;
@@ -21554,7 +21637,6 @@ function markInputRule(config) {
21554
21637
  } = state;
21555
21638
  const captureGroup = match[match.length - 1];
21556
21639
  const fullMatch = match[0];
21557
- let markEnd = range.to;
21558
21640
  if (captureGroup) {
21559
21641
  const startSpaces = fullMatch.search(/\S/);
21560
21642
  const textStart = range.from + fullMatch.indexOf(captureGroup);
@@ -21573,7 +21655,7 @@ function markInputRule(config) {
21573
21655
  if (textStart > range.from) {
21574
21656
  tr.delete(range.from + startSpaces, textStart);
21575
21657
  }
21576
- markEnd = range.from + startSpaces + captureGroup.length;
21658
+ const markEnd = range.from + startSpaces + captureGroup.length;
21577
21659
  tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
21578
21660
  tr.removeStoredMark(config.type);
21579
21661
  }
@@ -21588,18 +21670,19 @@ function markInputRule(config) {
21588
21670
  function nodeInputRule(config) {
21589
21671
  return new InputRule({
21590
21672
  find: config.find,
21591
- handler: _ref74 => {
21673
+ handler: _ref77 => {
21592
21674
  let {
21593
21675
  state,
21594
21676
  range,
21595
21677
  match
21596
- } = _ref74;
21678
+ } = _ref77;
21597
21679
  const attributes = callOrReturn(config.getAttributes, undefined, match) || {};
21598
21680
  const {
21599
21681
  tr
21600
21682
  } = state;
21601
21683
  const start = range.from;
21602
21684
  let end = range.to;
21685
+ const newNode = config.type.create(attributes);
21603
21686
  if (match[1]) {
21604
21687
  const offset = match[0].lastIndexOf(match[1]);
21605
21688
  let matchStart = start + offset;
@@ -21612,10 +21695,11 @@ function nodeInputRule(config) {
21612
21695
  const lastChar = match[0][match[0].length - 1];
21613
21696
  tr.insertText(lastChar, start + match[0].length - 1);
21614
21697
  // insert node from input rule
21615
- tr.replaceWith(matchStart, end, config.type.create(attributes));
21698
+ tr.replaceWith(matchStart, end, newNode);
21616
21699
  } else if (match[0]) {
21617
- tr.replaceWith(start, end, config.type.create(attributes));
21700
+ tr.insert(start - 1, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));
21618
21701
  }
21702
+ tr.scrollIntoView();
21619
21703
  }
21620
21704
  });
21621
21705
  }
@@ -21629,12 +21713,12 @@ function nodeInputRule(config) {
21629
21713
  function textblockTypeInputRule(config) {
21630
21714
  return new InputRule({
21631
21715
  find: config.find,
21632
- handler: _ref75 => {
21716
+ handler: _ref78 => {
21633
21717
  let {
21634
21718
  state,
21635
21719
  range,
21636
21720
  match
21637
- } = _ref75;
21721
+ } = _ref78;
21638
21722
  const $start = state.doc.resolve(range.from);
21639
21723
  const attributes = callOrReturn(config.getAttributes, undefined, match) || {};
21640
21724
  if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {
@@ -21662,13 +21746,13 @@ function textblockTypeInputRule(config) {
21662
21746
  function wrappingInputRule(config) {
21663
21747
  return new InputRule({
21664
21748
  find: config.find,
21665
- handler: _ref77 => {
21749
+ handler: _ref80 => {
21666
21750
  let {
21667
21751
  state,
21668
21752
  range,
21669
21753
  match,
21670
21754
  chain
21671
- } = _ref77;
21755
+ } = _ref80;
21672
21756
  const attributes = callOrReturn(config.getAttributes, undefined, match) || {};
21673
21757
  const tr = state.tr.delete(range.from, range.to);
21674
21758
  const $start = tr.doc.resolve(range.from);
@@ -21769,11 +21853,11 @@ class Mark {
21769
21853
  }));
21770
21854
  return extension;
21771
21855
  }
21772
- static handleExit(_ref78) {
21856
+ static handleExit(_ref81) {
21773
21857
  let {
21774
21858
  editor,
21775
21859
  mark
21776
- } = _ref78;
21860
+ } = _ref81;
21777
21861
  const {
21778
21862
  tr
21779
21863
  } = editor.state;
@@ -21870,13 +21954,14 @@ class Node {
21870
21954
  function markPasteRule(config) {
21871
21955
  return new PasteRule({
21872
21956
  find: config.find,
21873
- handler: _ref80 => {
21957
+ handler: _ref83 => {
21874
21958
  let {
21875
21959
  state,
21876
21960
  range,
21877
- match
21878
- } = _ref80;
21879
- const attributes = callOrReturn(config.getAttributes, undefined, match);
21961
+ match,
21962
+ pasteEvent
21963
+ } = _ref83;
21964
+ const attributes = callOrReturn(config.getAttributes, undefined, match, pasteEvent);
21880
21965
  if (attributes === false || attributes === null) {
21881
21966
  return null;
21882
21967
  }
@@ -21954,7 +22039,9 @@ const ListItem$2 = Node.create({
21954
22039
  name: 'listItem',
21955
22040
  addOptions() {
21956
22041
  return {
21957
- HTMLAttributes: {}
22042
+ HTMLAttributes: {},
22043
+ bulletListTypeName: 'bulletList',
22044
+ orderedListTypeName: 'orderedList'
21958
22045
  };
21959
22046
  },
21960
22047
  content: 'paragraph block*',
@@ -22093,7 +22180,9 @@ const ListItem$1 = Node.create({
22093
22180
  name: 'listItem',
22094
22181
  addOptions() {
22095
22182
  return {
22096
- HTMLAttributes: {}
22183
+ HTMLAttributes: {},
22184
+ bulletListTypeName: 'bulletList',
22185
+ orderedListTypeName: 'orderedList'
22097
22186
  };
22098
22187
  },
22099
22188
  content: 'paragraph block*',
@@ -22122,7 +22211,9 @@ const ListItem = Node.create({
22122
22211
  name: 'listItem',
22123
22212
  addOptions() {
22124
22213
  return {
22125
- HTMLAttributes: {}
22214
+ HTMLAttributes: {},
22215
+ bulletListTypeName: 'bulletList',
22216
+ orderedListTypeName: 'orderedList'
22126
22217
  };
22127
22218
  },
22128
22219
  content: 'paragraph block*',
@@ -22328,9 +22419,13 @@ const Strike = Mark.create({
22328
22419
  };
22329
22420
  },
22330
22421
  addKeyboardShortcuts() {
22331
- return {
22332
- 'Mod-Shift-x': () => this.editor.commands.toggleStrike()
22333
- };
22422
+ const shortcuts = {};
22423
+ if (isMacOS()) {
22424
+ shortcuts['Mod-Shift-s'] = () => this.editor.commands.toggleStrike();
22425
+ } else {
22426
+ shortcuts['Ctrl-Shift-s'] = () => this.editor.commands.toggleStrike();
22427
+ }
22428
+ return shortcuts;
22334
22429
  },
22335
22430
  addInputRules() {
22336
22431
  return [markInputRule({
@@ -24585,30 +24680,6 @@ function find(str, type, opts) {
24585
24680
  return filtered;
24586
24681
  }
24587
24682
 
24588
- /**
24589
- * Is the given string valid linkable text of some sort. Note that this does not
24590
- * trim the text for you.
24591
- *
24592
- * Optionally pass in a second `type` param, which is the type of link to test
24593
- * for.
24594
- *
24595
- * For example,
24596
- *
24597
- * linkify.test(str, 'email');
24598
- *
24599
- * Returns `true` if str is a valid email.
24600
- * @param {string} str string to test for links
24601
- * @param {string} [type] optional specific link type to look for
24602
- * @returns boolean true/false
24603
- */
24604
- function test(str, type) {
24605
- if (type === void 0) {
24606
- type = null;
24607
- }
24608
- const tokens = tokenize(str);
24609
- return tokens.length === 1 && tokens[0].isLink && (!type || tokens[0].t === type);
24610
- }
24611
-
24612
24683
  function autolink(options) {
24613
24684
  return new Plugin({
24614
24685
  key: new PluginKey('autolink'),
@@ -24622,44 +24693,21 @@ function autolink(options) {
24622
24693
  tr
24623
24694
  } = newState;
24624
24695
  const transform = combineTransactionSteps(oldState.doc, [...transactions]);
24625
- const {
24626
- mapping
24627
- } = transform;
24628
24696
  const changes = getChangedRanges(transform);
24629
24697
  changes.forEach(_ref => {
24630
24698
  let {
24631
- oldRange,
24632
24699
  newRange
24633
24700
  } = _ref;
24634
- // at first we check if we have to remove links
24635
- getMarksBetween(oldRange.from, oldRange.to, oldState.doc).filter(item => item.mark.type === options.type).forEach(oldMark => {
24636
- const newFrom = mapping.map(oldMark.from);
24637
- const newTo = mapping.map(oldMark.to);
24638
- const newMarks = getMarksBetween(newFrom, newTo, newState.doc).filter(item => item.mark.type === options.type);
24639
- if (!newMarks.length) {
24640
- return;
24641
- }
24642
- const newMark = newMarks[0];
24643
- const oldLinkText = oldState.doc.textBetween(oldMark.from, oldMark.to, undefined, ' ');
24644
- const newLinkText = newState.doc.textBetween(newMark.from, newMark.to, undefined, ' ');
24645
- const wasLink = test(oldLinkText);
24646
- const isLink = test(newLinkText);
24647
- // remove only the link, if it was a link before too
24648
- // because we don’t want to remove links that were set manually
24649
- if (wasLink && !isLink) {
24650
- tr.removeMark(newMark.from, newMark.to, options.type);
24651
- }
24652
- });
24653
- // now let’s see if we can add new links
24701
+ // Now let’s see if we can add new links.
24654
24702
  const nodesInChangedRanges = findChildrenInRange(newState.doc, newRange, node => node.isTextblock);
24655
24703
  let textBlock;
24656
24704
  let textBeforeWhitespace;
24657
24705
  if (nodesInChangedRanges.length > 1) {
24658
- // Grab the first node within the changed ranges (ex. the first of two paragraphs when hitting enter)
24706
+ // Grab the first node within the changed ranges (ex. the first of two paragraphs when hitting enter).
24659
24707
  textBlock = nodesInChangedRanges[0];
24660
24708
  textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, textBlock.pos + textBlock.node.nodeSize, undefined, ' ');
24661
24709
  } else if (nodesInChangedRanges.length
24662
- // We want to make sure to include the block seperator argument to treat hard breaks like spaces
24710
+ // We want to make sure to include the block seperator argument to treat hard breaks like spaces.
24663
24711
  && newState.doc.textBetween(newRange.from, newRange.to, ' ', ' ').endsWith(' ')) {
24664
24712
  textBlock = nodesInChangedRanges[0];
24665
24713
  textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, newRange.to, undefined, ' ');
@@ -24674,20 +24722,32 @@ function autolink(options) {
24674
24722
  if (!lastWordBeforeSpace) {
24675
24723
  return false;
24676
24724
  }
24677
- find(lastWordBeforeSpace).filter(link => link.isLink).filter(link => {
24678
- if (options.validate) {
24679
- return options.validate(link.value);
24680
- }
24681
- return true;
24682
- })
24683
- // calculate link position
24725
+ find(lastWordBeforeSpace).filter(link => link.isLink)
24726
+ // Calculate link position.
24684
24727
  .map(link => ({
24685
24728
  ...link,
24686
24729
  from: lastWordAndBlockOffset + link.start + 1,
24687
24730
  to: lastWordAndBlockOffset + link.end + 1
24688
24731
  }))
24689
- // add link mark
24732
+ // ignore link inside code mark
24733
+ .filter(link => {
24734
+ if (!newState.schema.marks.code) {
24735
+ return true;
24736
+ }
24737
+ return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
24738
+ })
24739
+ // validate link
24740
+ .filter(link => {
24741
+ if (options.validate) {
24742
+ return options.validate(link.value);
24743
+ }
24744
+ return true;
24745
+ })
24746
+ // Add link mark.
24690
24747
  .forEach(link => {
24748
+ if (getMarksBetween(link.from, link.to, newState.doc).some(item => item.mark.type === options.type)) {
24749
+ return;
24750
+ }
24691
24751
  tr.addMark(link.from, link.to, options.type.create({
24692
24752
  href: link.href
24693
24753
  }));
@@ -24706,16 +24766,22 @@ function clickHandler(options) {
24706
24766
  key: new PluginKey('handleClickLink'),
24707
24767
  props: {
24708
24768
  handleClick: (view, pos, event) => {
24709
- var _a, _b, _c;
24769
+ var _a, _b;
24710
24770
  if (event.button !== 0) {
24711
24771
  return false;
24712
24772
  }
24773
+ const eventTarget = event.target;
24774
+ if (eventTarget.nodeName !== 'A') {
24775
+ return false;
24776
+ }
24713
24777
  const attrs = getAttributes(view.state, options.type.name);
24714
- const link = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('a');
24715
- const href = (_b = link === null || link === void 0 ? void 0 : link.href) !== null && _b !== void 0 ? _b : attrs.href;
24716
- const target = (_c = link === null || link === void 0 ? void 0 : link.target) !== null && _c !== void 0 ? _c : attrs.target;
24778
+ const link = event.target;
24779
+ const href = (_a = link === null || link === void 0 ? void 0 : link.href) !== null && _a !== void 0 ? _a : attrs.href;
24780
+ const target = (_b = link === null || link === void 0 ? void 0 : link.target) !== null && _b !== void 0 ? _b : attrs.target;
24717
24781
  if (link && href) {
24718
- window.open(href, target);
24782
+ if (view.editable) {
24783
+ window.open(href, target);
24784
+ }
24719
24785
  return true;
24720
24786
  }
24721
24787
  return false;
@@ -24723,39 +24789,6 @@ function clickHandler(options) {
24723
24789
  }
24724
24790
  });
24725
24791
  }
24726
- function pasteHandler(options) {
24727
- return new Plugin({
24728
- key: new PluginKey('handlePasteLink'),
24729
- props: {
24730
- handlePaste: (view, event, slice) => {
24731
- const {
24732
- state
24733
- } = view;
24734
- const {
24735
- selection
24736
- } = state;
24737
- const {
24738
- empty
24739
- } = selection;
24740
- if (empty) {
24741
- return false;
24742
- }
24743
- let textContent = '';
24744
- slice.content.forEach(node => {
24745
- textContent += node.textContent;
24746
- });
24747
- const link = find(textContent).find(item => item.isLink && item.value === textContent);
24748
- if (!textContent || !link) {
24749
- return false;
24750
- }
24751
- options.editor.commands.setMark(options.type, {
24752
- href: link.href
24753
- });
24754
- return true;
24755
- }
24756
- }
24757
- });
24758
- }
24759
24792
  const Link = Mark.create({
24760
24793
  name: 'link',
24761
24794
  priority: 1000,
@@ -24797,6 +24830,9 @@ const Link = Mark.create({
24797
24830
  target: {
24798
24831
  default: this.options.HTMLAttributes.target
24799
24832
  },
24833
+ rel: {
24834
+ default: this.options.HTMLAttributes.rel
24835
+ },
24800
24836
  class: {
24801
24837
  default: this.options.HTMLAttributes.class
24802
24838
  }
@@ -24852,10 +24888,18 @@ const Link = Mark.create({
24852
24888
  data: link
24853
24889
  })),
24854
24890
  type: this.type,
24855
- getAttributes: match => {
24856
- var _a;
24891
+ getAttributes: (match, pasteEvent) => {
24892
+ var _a, _b;
24893
+ const html = (_a = pasteEvent.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/html');
24894
+ const hrefRegex = /href="([^"]*)"/;
24895
+ const existingLink = html === null || html === void 0 ? void 0 : html.match(hrefRegex);
24896
+ if (existingLink) {
24897
+ return {
24898
+ href: existingLink[1]
24899
+ };
24900
+ }
24857
24901
  return {
24858
- href: (_a = match.data) === null || _a === void 0 ? void 0 : _a.href
24902
+ href: (_b = match.data) === null || _b === void 0 ? void 0 : _b.href
24859
24903
  };
24860
24904
  }
24861
24905
  })];
@@ -24873,12 +24917,6 @@ const Link = Mark.create({
24873
24917
  type: this.type
24874
24918
  }));
24875
24919
  }
24876
- if (this.options.linkOnPaste) {
24877
- plugins.push(pasteHandler({
24878
- editor: this.editor,
24879
- type: this.type
24880
- }));
24881
- }
24882
24920
  return plugins;
24883
24921
  }
24884
24922
  });
@@ -25142,16 +25180,17 @@ const OrRichTextEditor = [
25142
25180
  // Spacing
25143
25181
  'gap-xs',
25144
25182
  // Box
25145
- 'max-h-full'];
25183
+ 'max-h-full', 'w-full'];
25146
25184
  const EditorContainer = [
25147
25185
  // Layout
25148
25186
  'layout-column',
25149
- // Theme (focus)
25150
- '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',
25151
25187
  // Theme (invalid)
25152
25188
  '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',
25153
25189
  // Box
25154
25190
  'border-1', 'rounded-md', 'w-full', 'overflow-hidden', 'grow'];
25191
+ const EditorContainerFocus = [
25192
+ // Theme (focus)
25193
+ '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'];
25155
25194
  const ToolbarContainer = [
25156
25195
  // Layout
25157
25196
  'layout-row',
@@ -25182,6 +25221,251 @@ const EditorInput = [
25182
25221
  // Typography
25183
25222
  'typography-body-2-regular'];
25184
25223
 
25224
+ var script$1 = defineComponent({
25225
+ components: {
25226
+ OrIconButton: script$2,
25227
+ OrMenuItem: script$3,
25228
+ OrMenu: script$4,
25229
+ OrPopover: script$5
25230
+ },
25231
+ props: {
25232
+ toolbar: {
25233
+ type: Array,
25234
+ default: () => []
25235
+ },
25236
+ isFocused: {
25237
+ type: Boolean,
25238
+ default: false
25239
+ },
25240
+ countOfNotVisibleTools: {
25241
+ type: Number,
25242
+ default: 0
25243
+ },
25244
+ activeHeadingLevel: {
25245
+ type: Number,
25246
+ default: 0
25247
+ },
25248
+ isActive: {
25249
+ type: Object,
25250
+ default: () => ({})
25251
+ },
25252
+ headingLevels: {
25253
+ type: Array,
25254
+ default: () => [1, 2, 3, 4]
25255
+ }
25256
+ },
25257
+ emits: ['click-tool'],
25258
+ setup(props, _ref) {
25259
+ let {
25260
+ emit
25261
+ } = _ref;
25262
+ const toolbarRef = ref();
25263
+ const moreButtonRef = ref();
25264
+ const moreRef = ref();
25265
+ const toolbarButtonRef = ref();
25266
+ const menuRef = ref();
25267
+ const iconsEnum = ref({
25268
+ bold: 'format_bold',
25269
+ italic: 'format_italic',
25270
+ underline: 'format_underlined',
25271
+ strike: 'format_strikethrough',
25272
+ bulletList: 'format_list_bulleted',
25273
+ orderedList: 'format_list_numbered',
25274
+ link: 'link',
25275
+ highlight: 'highlight',
25276
+ redo: 'redo',
25277
+ undo: 'undo',
25278
+ codeBlock: 'code_blocks',
25279
+ blockquote: 'format_quote',
25280
+ file: 'attach_file',
25281
+ source: 'source_notes'
25282
+ });
25283
+ const iconTooltipsEnum = ref({
25284
+ bold: 'Bold',
25285
+ italic: 'Italic',
25286
+ underline: 'Underline',
25287
+ strike: 'Strike',
25288
+ bulletList: 'Bulleted List',
25289
+ orderedList: 'Numbered List',
25290
+ link: 'Link',
25291
+ highlight: 'Highlight',
25292
+ redo: 'Redo',
25293
+ undo: 'Undo',
25294
+ codeBlock: 'Code Block',
25295
+ blockquote: 'Quote',
25296
+ file: 'File',
25297
+ source: 'Source'
25298
+ });
25299
+ const notVisibleTools = computed(() => {
25300
+ const count = props.countOfNotVisibleTools;
25301
+ const toolbar = props.toolbar.flat();
25302
+ let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
25303
+ props.toolbar.forEach(tools => {
25304
+ if (tools.some(item => notVisible.has(item))) {
25305
+ tools.forEach(item => notVisible.add(item));
25306
+ }
25307
+ });
25308
+ return notVisible;
25309
+ });
25310
+ const toolbarContainerStyles = computed(() => [...ToolbarContainer]);
25311
+ const toolbarStyles = computed(() => [...Toolbar, ...(props.isFocused ? ToolbarButtonFocused : ToolbarButton)]);
25312
+ const getIndexOfHeading = computed(() => {
25313
+ return props.toolbar.flat().indexOf('heading');
25314
+ });
25315
+ const headingIcon = computed(() => {
25316
+ if (props.activeHeadingLevel && props.isActive.heading) {
25317
+ return `format_h${props.activeHeadingLevel}`;
25318
+ }
25319
+ return 'format_paragraph';
25320
+ });
25321
+ const isVisible = value => {
25322
+ if (Array.isArray(value)) {
25323
+ const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
25324
+ return isHaveNotVisibleTools;
25325
+ }
25326
+ return !notVisibleTools.value.has(value);
25327
+ };
25328
+ const handleClick = (item, level) => {
25329
+ emit('click-tool', {
25330
+ item,
25331
+ level
25332
+ });
25333
+ };
25334
+ return {
25335
+ toolbarRef,
25336
+ moreButtonRef,
25337
+ moreRef,
25338
+ toolbarButtonRef,
25339
+ menuRef,
25340
+ toolbarContainerStyles,
25341
+ toolbarStyles,
25342
+ isVisible,
25343
+ handleClick,
25344
+ headingIcon,
25345
+ getIndexOfHeading,
25346
+ notVisibleTools,
25347
+ iconsEnum,
25348
+ iconTooltipsEnum
25349
+ };
25350
+ }
25351
+ });
25352
+
25353
+ const _hoisted_1$1 = {
25354
+ class: "flex p-sm gap-md"
25355
+ };
25356
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
25357
+ const _component_or_icon_button = resolveComponent("or-icon-button");
25358
+ const _component_or_popover = resolveComponent("or-popover");
25359
+ const _component_or_menu_item = resolveComponent("or-menu-item");
25360
+ const _component_or_menu = resolveComponent("or-menu");
25361
+ return openBlock(), createElementBlock("div", {
25362
+ ref: "toolbarRef",
25363
+ class: normalizeClass(_ctx.toolbarContainerStyles)
25364
+ }, [(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.toolbar, (tools, index) => {
25365
+ return openBlock(), createElementBlock("div", {
25366
+ key: index,
25367
+ class: normalizeClass([..._ctx.toolbarStyles, {
25368
+ 'hidden': _ctx.isVisible(tools)
25369
+ }])
25370
+ }, [(openBlock(true), createElementBlock(Fragment$1, null, renderList(tools, item => {
25371
+ return openBlock(), createElementBlock("div", {
25372
+ key: item,
25373
+ class: normalizeClass(['flex gap-md', {
25374
+ 'hidden': !_ctx.isVisible(item)
25375
+ }])
25376
+ }, [item === 'heading' ? (openBlock(), createBlock(_component_or_icon_button, {
25377
+ key: 0,
25378
+ ref_for: true,
25379
+ ref: "toolbarButtonRef",
25380
+ selected: _ctx.isActive[item],
25381
+ disabled: !_ctx.isFocused,
25382
+ tooltip: {
25383
+ content: item,
25384
+ placement: 'top'
25385
+ },
25386
+ icon: {
25387
+ icon: _ctx.headingIcon,
25388
+ variant: 'inherit'
25389
+ },
25390
+ onClick: _cache[0] || (_cache[0] = $event => _ctx.menuRef && _ctx.menuRef.toggle())
25391
+ }, null, 8 /* PROPS */, ["selected", "disabled", "tooltip", "icon"])) : _ctx.isVisible(item) ? (openBlock(), createBlock(_component_or_icon_button, {
25392
+ key: 1,
25393
+ tooltip: {
25394
+ content: _ctx.iconTooltipsEnum[item],
25395
+ placement: 'top'
25396
+ },
25397
+ selected: _ctx.isActive[item],
25398
+ disabled: !_ctx.isFocused,
25399
+ icon: {
25400
+ icon: _ctx.iconsEnum[item],
25401
+ variant: 'inherit'
25402
+ },
25403
+ onClick: $event => _ctx.handleClick(item)
25404
+ }, null, 8 /* PROPS */, ["tooltip", "selected", "disabled", "icon", "onClick"])) : createCommentVNode("v-if", true)], 2 /* CLASS */);
25405
+ }), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */);
25406
+ }), 128 /* KEYED_FRAGMENT */)), _ctx.countOfNotVisibleTools > 0 ? (openBlock(), createBlock(_component_or_icon_button, {
25407
+ key: 0,
25408
+ ref: "moreButtonRef",
25409
+ disabled: !_ctx.isFocused,
25410
+ icon: {
25411
+ icon: 'more_horiz',
25412
+ variant: 'inherit'
25413
+ },
25414
+ class: "px-sm",
25415
+ onClick: _cache[1] || (_cache[1] = $event => _ctx.moreRef && _ctx.moreRef.open())
25416
+ }, null, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true), _ctx.moreButtonRef ? (openBlock(), createBlock(_component_or_popover, {
25417
+ key: 1,
25418
+ ref: "moreRef",
25419
+ trigger: _ctx.moreButtonRef && _ctx.moreButtonRef.root,
25420
+ placement: "top-end"
25421
+ }, {
25422
+ default: withCtx(() => [createElementVNode("div", _hoisted_1$1, [(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.notVisibleTools, item => {
25423
+ return openBlock(), createBlock(_component_or_icon_button, {
25424
+ key: item,
25425
+ tooltip: {
25426
+ content: _ctx.iconTooltipsEnum[item],
25427
+ placement: 'top'
25428
+ },
25429
+ selected: _ctx.isActive[item],
25430
+ icon: {
25431
+ icon: _ctx.iconsEnum[item],
25432
+ variant: 'inherit'
25433
+ },
25434
+ onClick: $event => _ctx.handleClick(item)
25435
+ }, null, 8 /* PROPS */, ["tooltip", "selected", "icon", "onClick"]);
25436
+ }), 128 /* KEYED_FRAGMENT */))])]),
25437
+
25438
+ _: 1 /* STABLE */
25439
+ }, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true), _ctx.toolbarButtonRef ? (openBlock(), createBlock(_component_or_menu, {
25440
+ key: 2,
25441
+ ref: "menuRef",
25442
+ trigger: _ctx.toolbarButtonRef[_ctx.getIndexOfHeading] && _ctx.toolbarButtonRef[_ctx.getIndexOfHeading].root,
25443
+ placement: "bottom-start"
25444
+ }, {
25445
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.headingLevels, heading => {
25446
+ return openBlock(), createBlock(_component_or_menu_item, {
25447
+ key: heading,
25448
+ selected: _ctx.activeHeadingLevel === heading,
25449
+ onClick: $event => _ctx.handleClick('heading', heading)
25450
+ }, {
25451
+ default: withCtx(() => [createTextVNode(" Heading " + toDisplayString(heading), 1 /* TEXT */)]),
25452
+
25453
+ _: 2 /* DYNAMIC */
25454
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["selected", "onClick"]);
25455
+ }), 128 /* KEYED_FRAGMENT */)), createVNode(_component_or_menu_item, {
25456
+ selected: !_ctx.activeHeadingLevel,
25457
+ onClick: _cache[2] || (_cache[2] = $event => _ctx.handleClick('heading'))
25458
+ }, {
25459
+ default: withCtx(() => [createTextVNode(" None ")]),
25460
+ _: 1 /* STABLE */
25461
+ }, 8 /* PROPS */, ["selected"])]),
25462
+ _: 1 /* STABLE */
25463
+ }, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true)], 2 /* CLASS */);
25464
+ }
25465
+
25466
+ script$1.render = render$1;
25467
+ script$1.__file = "src/components/or-rich-text-editor-v3/partials/EditorToolbar.vue";
25468
+
25185
25469
  var Formats;
25186
25470
  (function (Formats) {
25187
25471
  Formats["Markdown"] = "markdown";
@@ -26449,8 +26733,11 @@ const History = Extension.create({
26449
26733
  addKeyboardShortcuts() {
26450
26734
  return {
26451
26735
  'Mod-z': () => this.editor.commands.undo(),
26736
+ 'Mod-Z': () => this.editor.commands.undo(),
26452
26737
  'Mod-y': () => this.editor.commands.redo(),
26738
+ 'Mod-Y': () => this.editor.commands.redo(),
26453
26739
  'Shift-Mod-z': () => this.editor.commands.redo(),
26740
+ 'Shift-Mod-Z': () => this.editor.commands.redo(),
26454
26741
  // Russian keyboard layouts
26455
26742
  'Mod-я': () => this.editor.commands.undo(),
26456
26743
  'Shift-Mod-я': () => this.editor.commands.redo()
@@ -26481,11 +26768,23 @@ const HorizontalRule = Node.create({
26481
26768
  return {
26482
26769
  setHorizontalRule: () => _ref2 => {
26483
26770
  let {
26484
- chain
26771
+ chain,
26772
+ state
26485
26773
  } = _ref2;
26486
- return chain().insertContent({
26487
- type: this.name
26488
- })
26774
+ const {
26775
+ $to: $originTo
26776
+ } = state.selection;
26777
+ const currentChain = chain();
26778
+ if ($originTo.parentOffset === 0) {
26779
+ currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), {
26780
+ type: this.name
26781
+ });
26782
+ } else {
26783
+ currentChain.insertContent({
26784
+ type: this.name
26785
+ });
26786
+ }
26787
+ return currentChain
26489
26788
  // set cursor after horizontal rule
26490
26789
  .command(_ref3 => {
26491
26790
  let {
@@ -26499,13 +26798,19 @@ const HorizontalRule = Node.create({
26499
26798
  } = tr.selection;
26500
26799
  const posAfter = $to.end();
26501
26800
  if ($to.nodeAfter) {
26502
- tr.setSelection(TextSelection.create(tr.doc, $to.pos));
26801
+ if ($to.nodeAfter.isTextblock) {
26802
+ tr.setSelection(TextSelection.create(tr.doc, $to.pos + 1));
26803
+ } else if ($to.nodeAfter.isBlock) {
26804
+ tr.setSelection(NodeSelection.create(tr.doc, $to.pos));
26805
+ } else {
26806
+ tr.setSelection(TextSelection.create(tr.doc, $to.pos));
26807
+ }
26503
26808
  } else {
26504
26809
  // add node after horizontal rule if it’s the end of the document
26505
26810
  const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create();
26506
26811
  if (node) {
26507
26812
  tr.insert(posAfter, node);
26508
- tr.setSelection(TextSelection.create(tr.doc, posAfter));
26813
+ tr.setSelection(TextSelection.create(tr.doc, posAfter + 1));
26509
26814
  }
26510
26815
  }
26511
26816
  tr.scrollIntoView();
@@ -27003,16 +27308,13 @@ var codemirrorNode = Node.create({
27003
27308
  var script = defineComponent({
27004
27309
  name: 'OrRichTextEditor',
27005
27310
  components: {
27006
- OrIconButton: script$1,
27007
- OrLabel: script$2,
27008
- OrMenuItem: script$3,
27009
- OrMenu: script$4,
27010
- OrModal: script$5,
27011
- OrInput: script$6,
27012
- OrButton: script$7,
27013
- OrPopover: script$8,
27311
+ OrModal: script$6,
27312
+ OrInput: script$7,
27313
+ OrButton: script$8,
27014
27314
  OrHint: script$9,
27015
- OrError: script$a
27315
+ OrError: script$a,
27316
+ OrLabel: script$b,
27317
+ EditorToolbar: script$1
27016
27318
  },
27017
27319
  model: {
27018
27320
  prop: 'modelValue',
@@ -27058,6 +27360,10 @@ var script = defineComponent({
27058
27360
  error: {
27059
27361
  type: [String, Boolean],
27060
27362
  default: undefined
27363
+ },
27364
+ readonly: {
27365
+ type: Boolean,
27366
+ default: false
27061
27367
  }
27062
27368
  },
27063
27369
  emits: ['update:modelValue', 'input', 'file-upload'],
@@ -27069,11 +27375,7 @@ var script = defineComponent({
27069
27375
  const editorRef = ref();
27070
27376
  const textareaRef = ref();
27071
27377
  const containerRef = ref();
27072
- const toolbarRef = ref();
27073
- const moreButtonRef = ref();
27074
- const moreRef = ref();
27075
- const toolbarButtonRef = ref();
27076
- const menuRef = ref();
27378
+ const toolbarContainerRef = ref();
27077
27379
  // isActive should be set with default values for all toolbar buttons, otherwise it will not work in vue2
27078
27380
  const isActive = ref({
27079
27381
  bold: false,
@@ -27091,7 +27393,7 @@ var script = defineComponent({
27091
27393
  file: false,
27092
27394
  source: false
27093
27395
  });
27094
- const isFocused = ref(props.autofocus);
27396
+ const isFocused = ref(!props.readonly ? props.autofocus : false);
27095
27397
  const headingLevels = [1, 2, 3, 4];
27096
27398
  const activeHeadingLevel = ref(0);
27097
27399
  const markdownOutput = ref('');
@@ -27106,49 +27408,19 @@ var script = defineComponent({
27106
27408
  fallbackFocus: '.container',
27107
27409
  allowOutsideClick: true
27108
27410
  });
27109
- const iconsEnum = ref({
27110
- bold: 'format_bold',
27111
- italic: 'format_italic',
27112
- underline: 'format_underlined',
27113
- strike: 'format_strikethrough',
27114
- bulletList: 'format_list_bulleted',
27115
- orderedList: 'format_list_numbered',
27116
- link: 'link',
27117
- highlight: 'highlight',
27118
- redo: 'redo',
27119
- undo: 'undo',
27120
- codeBlock: 'code_blocks',
27121
- blockquote: 'format_quote',
27122
- file: 'attach_file',
27123
- source: 'source_notes'
27124
- });
27125
- const iconTooltipsEnum = ref({
27126
- bold: 'Bold',
27127
- italic: 'Italic',
27128
- underline: 'Underline',
27129
- strike: 'Strike',
27130
- bulletList: 'Bulleted List',
27131
- orderedList: 'Numbered List',
27132
- link: 'Link',
27133
- highlight: 'Highlight',
27134
- redo: 'Redo',
27135
- undo: 'Undo',
27136
- codeBlock: 'Code Block',
27137
- blockquote: 'Quote',
27138
- file: 'File',
27139
- source: 'Source'
27140
- });
27141
27411
  useResizeObserver(root, useDebounceFn(entries => {
27142
27412
  var _a, _b;
27143
27413
  const entry = entries[0];
27144
27414
  const {
27145
27415
  width
27146
27416
  } = entry.contentRect;
27147
- if (containerRef.value && toolbarRef.value && toolbarLength.value) {
27417
+ const toolbarLength = props.toolbar.flat().length;
27418
+ if (containerRef.value && toolbarContainerRef.value && toolbarLength) {
27148
27419
  let lengthOfItem = 0;
27149
- lengthOfItem = ((_b = (_a = toolbarRef.value.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.offsetWidth) + 16;
27420
+ const toolbarRef = toolbarContainerRef.value.$refs.toolbarRef;
27421
+ 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;
27150
27422
  const count = width / lengthOfItem - 2;
27151
- countOfNotVisibleTools.value = Math.round(toolbarLength.value - count);
27423
+ countOfNotVisibleTools.value = Math.round(toolbarLength - count);
27152
27424
  }
27153
27425
  }, 10));
27154
27426
  onMounted(() => {
@@ -27180,7 +27452,8 @@ var script = defineComponent({
27180
27452
  }
27181
27453
  },
27182
27454
  element: editorRef.value,
27183
- autofocus: props.autofocus,
27455
+ autofocus: !props.readonly ? props.autofocus : false,
27456
+ editable: !props.readonly,
27184
27457
  enableInputRules: true,
27185
27458
  enablePasteRules: true,
27186
27459
  extensions: [codemirrorNode, StarterKit.configure({
@@ -27261,43 +27534,15 @@ var script = defineComponent({
27261
27534
  context.emit('update:modelValue', value);
27262
27535
  }
27263
27536
  });
27264
- const getIndexOfHeading = computed(() => {
27265
- return props.toolbar.flat().indexOf('heading');
27266
- });
27267
- const headingIcon = computed(() => {
27268
- if (activeHeadingLevel.value && isActive.value.heading) {
27269
- return `format_h${activeHeadingLevel.value}`;
27270
- }
27271
- return 'format_paragraph';
27272
- });
27273
- const toolbarLength = computed(() => {
27274
- return props.toolbar.flat().length;
27275
- });
27276
- const notVisibleTools = computed(() => {
27277
- const count = countOfNotVisibleTools.value;
27278
- const toolbar = props.toolbar.flat();
27279
- let notVisible = new Set(toolbar.slice(toolbar.length - count, toolbar.length));
27280
- props.toolbar.forEach(tools => {
27281
- if (tools.some(item => notVisible.has(item))) {
27282
- tools.forEach(item => notVisible.add(item));
27283
- }
27284
- });
27285
- return notVisible;
27286
- });
27287
27537
  //Methods
27288
27538
  const handleEditorClick = () => {
27289
27539
  var _a;
27290
27540
  setActiveFormats();
27291
- isFocused.value = true;
27292
- editor === null || editor === void 0 ? void 0 : editor.commands.focus();
27293
- activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
27294
- };
27295
- const isVisible = value => {
27296
- if (Array.isArray(value)) {
27297
- const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.has(item));
27298
- return isHaveNotVisibleTools;
27541
+ if (!props.readonly) {
27542
+ isFocused.value = true;
27543
+ editor === null || editor === void 0 ? void 0 : editor.commands.focus();
27299
27544
  }
27300
- return !notVisibleTools.value.has(value);
27545
+ activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
27301
27546
  };
27302
27547
  const handleInput = event => {
27303
27548
  const target = event.target;
@@ -27306,7 +27551,11 @@ var script = defineComponent({
27306
27551
  markdownOutput.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
27307
27552
  proxyModelValue.value = markdownOutput.value;
27308
27553
  };
27309
- const handleToolbarClick = (item, level) => {
27554
+ const handleToolbarClick = _ref4 => {
27555
+ let {
27556
+ item,
27557
+ level
27558
+ } = _ref4;
27310
27559
  var _a, _b, _c, _d;
27311
27560
  switch (item) {
27312
27561
  case 'source':
@@ -27386,10 +27635,10 @@ var script = defineComponent({
27386
27635
  editor === null || editor === void 0 ? void 0 : editor.chain().focus().setMark('link', {
27387
27636
  href: link.value,
27388
27637
  target: '__blank'
27389
- }).command(_ref4 => {
27638
+ }).command(_ref5 => {
27390
27639
  let {
27391
27640
  tr
27392
- } = _ref4;
27641
+ } = _ref5;
27393
27642
  const preparedValue = text.value[text.value.length - 1] === ' ' ? text.value : `${text.value} `;
27394
27643
  tr.insertText(preparedValue);
27395
27644
  return true;
@@ -27425,11 +27674,7 @@ var script = defineComponent({
27425
27674
  };
27426
27675
  // Styles
27427
27676
  const rootStyles = computed(() => ['or-rich-text-editor-v3', ...OrRichTextEditor]);
27428
- const containerStyles = computed(() => [...EditorContainer]);
27429
- const toolbarContainerStyles = computed(() => [...ToolbarContainer]);
27430
- const toolbarStyles = computed(() => [...Toolbar,
27431
- // 'overflow-x-hidden',
27432
- ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)]);
27677
+ const containerStyles = computed(() => [...EditorContainer, ...(isFocused.value ? EditorContainerFocus : [])]);
27433
27678
  const editorInputStyles = computed(() => ['tiptap-editor-v3', ...EditorInput]);
27434
27679
  //Effects
27435
27680
  watch(proxyModelValue, value => {
@@ -27437,43 +27682,38 @@ var script = defineComponent({
27437
27682
  editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
27438
27683
  }
27439
27684
  if (props.format === 'markdown' && value !== markdownOutput.value) {
27440
- //TODO: const deserialized = deserialize(editor?.schema, value);
27441
- editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
27685
+ const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
27686
+ editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
27442
27687
  }
27443
27688
  });
27689
+ watch(props, _ref6 => {
27690
+ let {
27691
+ readonly
27692
+ } = _ref6;
27693
+ isFocused.value = !readonly;
27694
+ editor === null || editor === void 0 ? void 0 : editor.setEditable(!readonly);
27695
+ });
27444
27696
  return {
27445
27697
  editor,
27446
27698
  editorRef,
27447
- toolbarRef,
27699
+ toolbarContainerRef,
27448
27700
  containerRef,
27449
- toolbarButtonRef,
27450
- moreButtonRef,
27451
27701
  textareaRef,
27452
- moreRef,
27453
- menuRef,
27454
- iconsEnum,
27455
27702
  handleToolbarClick,
27456
27703
  handleEditorClick,
27457
27704
  isActive,
27458
- iconTooltipsEnum,
27459
27705
  containerStyles,
27460
- toolbarContainerStyles,
27461
- toolbarStyles,
27462
27706
  rootStyles,
27463
27707
  root,
27464
27708
  editorInputStyles,
27465
- getIndexOfHeading,
27466
27709
  headingLevels,
27467
- headingIcon,
27468
27710
  attachLink,
27469
27711
  discardLink,
27470
27712
  isOpenLinkModal,
27471
27713
  text,
27472
27714
  link,
27473
27715
  isFocused,
27474
- isVisible,
27475
27716
  countOfNotVisibleTools,
27476
- notVisibleTools,
27477
27717
  handleInput,
27478
27718
  proxyModelValue,
27479
27719
  disableMarkdown,
@@ -27488,26 +27728,20 @@ const _hoisted_2 = {
27488
27728
  class: /*#__PURE__*/normalizeClass(['p-sm', 'overflow-auto', 'min-h-[88px]'])
27489
27729
  };
27490
27730
  const _hoisted_3 = ["activated"];
27491
- const _hoisted_4 = {
27492
- class: "flex p-sm gap-md"
27493
- };
27494
- const _hoisted_5 = /*#__PURE__*/createElementVNode("p", {
27731
+ const _hoisted_4 = /*#__PURE__*/createElementVNode("p", {
27495
27732
  class: "text-headline-2"
27496
27733
  }, " Add Link ", -1 /* HOISTED */);
27497
- const _hoisted_6 = {
27734
+ const _hoisted_5 = {
27498
27735
  class: "flex ml-auto gap-md"
27499
27736
  };
27500
- const _hoisted_7 = /*#__PURE__*/createElementVNode("p", null, "Cancel", -1 /* HOISTED */);
27501
- const _hoisted_8 = /*#__PURE__*/createElementVNode("p", null, "Save", -1 /* HOISTED */);
27737
+ const _hoisted_6 = /*#__PURE__*/createElementVNode("p", null, "Cancel", -1 /* HOISTED */);
27738
+ const _hoisted_7 = /*#__PURE__*/createElementVNode("p", null, "Save", -1 /* HOISTED */);
27502
27739
 
27503
27740
  function render(_ctx, _cache, $props, $setup, $data, $options) {
27504
27741
  const _component_OrLabel = resolveComponent("OrLabel");
27505
- const _component_or_icon_button = resolveComponent("or-icon-button");
27742
+ const _component_editor_toolbar = resolveComponent("editor-toolbar");
27506
27743
  const _component_OrHint = resolveComponent("OrHint");
27507
27744
  const _component_OrError = resolveComponent("OrError");
27508
- const _component_or_popover = resolveComponent("or-popover");
27509
- const _component_or_menu_item = resolveComponent("or-menu-item");
27510
- const _component_or_menu = resolveComponent("or-menu");
27511
27745
  const _component_or_label = resolveComponent("or-label");
27512
27746
  const _component_or_input = resolveComponent("or-input");
27513
27747
  const _component_or_button = resolveComponent("or-button");
@@ -27524,75 +27758,30 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
27524
27758
 
27525
27759
  _: 3 /* FORWARDED */
27526
27760
  })) : createCommentVNode("v-if", true), createElementVNode("div", {
27527
- ref: 'containerRef',
27761
+ ref: "containerRef",
27528
27762
  class: normalizeClass(_ctx.containerStyles),
27529
27763
  invalid: !!_ctx.error,
27530
- onClick: _cache[4] || (_cache[4] = $event => _ctx.handleEditorClick())
27531
- }, [createElementVNode("div", {
27532
- ref: 'toolbarRef',
27533
- class: normalizeClass(_ctx.toolbarContainerStyles)
27534
- }, [(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.toolbar, (tools, index) => {
27535
- return openBlock(), createElementBlock("div", {
27536
- key: index,
27537
- class: normalizeClass([..._ctx.toolbarStyles, {
27538
- 'hidden': _ctx.isVisible(tools)
27539
- }])
27540
- }, [(openBlock(true), createElementBlock(Fragment$1, null, renderList(tools, item => {
27541
- return openBlock(), createElementBlock("div", {
27542
- key: item,
27543
- class: normalizeClass(['flex gap-md', {
27544
- 'hidden': !_ctx.isVisible(item)
27545
- }])
27546
- }, [item === 'heading' ? (openBlock(), createBlock(_component_or_icon_button, {
27547
- key: 0,
27548
- ref_for: true,
27549
- ref: 'toolbarButtonRef',
27550
- selected: _ctx.isActive[item],
27551
- disabled: !_ctx.isFocused,
27552
- tooltip: {
27553
- content: item,
27554
- placement: 'top'
27555
- },
27556
- icon: {
27557
- icon: _ctx.headingIcon,
27558
- variant: 'inherit'
27559
- },
27560
- onClick: _cache[0] || (_cache[0] = $event => _ctx.menuRef && _ctx.menuRef.toggle())
27561
- }, null, 8 /* PROPS */, ["selected", "disabled", "tooltip", "icon"])) : _ctx.isVisible(item) ? (openBlock(), createBlock(_component_or_icon_button, {
27562
- key: 1,
27563
- tooltip: {
27564
- content: _ctx.iconTooltipsEnum[item],
27565
- placement: 'top'
27566
- },
27567
- selected: _ctx.isActive[item],
27568
- disabled: !_ctx.isFocused,
27569
- icon: {
27570
- icon: _ctx.iconsEnum[item],
27571
- variant: 'inherit'
27572
- },
27573
- onClick: $event => _ctx.handleToolbarClick(item)
27574
- }, null, 8 /* PROPS */, ["tooltip", "selected", "disabled", "icon", "onClick"])) : createCommentVNode("v-if", true)], 2 /* CLASS */);
27575
- }), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */);
27576
- }), 128 /* KEYED_FRAGMENT */)), _ctx.countOfNotVisibleTools > 0 ? (openBlock(), createBlock(_component_or_icon_button, {
27764
+ onClick: _cache[2] || (_cache[2] = $event => _ctx.handleEditorClick())
27765
+ }, [!_ctx.readonly ? (openBlock(), createBlock(_component_editor_toolbar, {
27577
27766
  key: 0,
27578
- ref: 'moreButtonRef',
27579
- disabled: !_ctx.isFocused,
27580
- icon: {
27581
- icon: 'more_horiz',
27582
- variant: 'inherit'
27583
- },
27584
- class: "px-sm",
27585
- onClick: _cache[1] || (_cache[1] = $event => _ctx.moreRef && _ctx.moreRef.open())
27586
- }, null, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true)], 2 /* CLASS */), createElementVNode("div", _hoisted_2, [withDirectives(createElementVNode("textarea", {
27767
+ ref: "toolbarContainerRef",
27768
+ "count-of-not-visible-tools": _ctx.countOfNotVisibleTools,
27769
+ toolbar: _ctx.toolbar,
27770
+ "is-focused": _ctx.isFocused,
27771
+ "active-heading-level": _ctx.activeHeadingLevel,
27772
+ "is-active": _ctx.isActive,
27773
+ "heading-levels": _ctx.headingLevels,
27774
+ onClickTool: _ctx.handleToolbarClick
27775
+ }, null, 8 /* PROPS */, ["count-of-not-visible-tools", "toolbar", "is-focused", "active-heading-level", "is-active", "heading-levels", "onClickTool"])) : createCommentVNode("v-if", true), createElementVNode("div", _hoisted_2, [withDirectives(createElementVNode("textarea", {
27587
27776
  ref: 'textareaRef',
27588
- "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.sourceValue = $event),
27777
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.sourceValue = $event),
27589
27778
  activated: _ctx.disableMarkdown,
27590
27779
  class: "block w-full h-full resize-none border-none outline-none bg-transparent typography-body-2-regular",
27591
- onInput: _cache[3] || (_cache[3] = function () {
27780
+ onInput: _cache[1] || (_cache[1] = function () {
27592
27781
  return _ctx.handleInput && _ctx.handleInput(...arguments);
27593
27782
  })
27594
27783
  }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_3), [[vShow, _ctx.disableMarkdown], [vModelText, _ctx.sourceValue]]), withDirectives(createElementVNode("div", {
27595
- ref: 'editorRef',
27784
+ ref: "editorRef",
27596
27785
  class: normalizeClass(_ctx.editorInputStyles)
27597
27786
  }, null, 2 /* CLASS */), [[vShow, !_ctx.disableMarkdown]]), renderSlot(_ctx.$slots, "files")])], 10 /* CLASS, PROPS */, _hoisted_1), !_ctx.error ? (openBlock(), createElementBlock(Fragment$1, {
27598
27787
  key: 1
@@ -27610,68 +27799,21 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
27610
27799
  default: withCtx(() => [createTextVNode(toDisplayString(_ctx.error), 1 /* TEXT */)]),
27611
27800
 
27612
27801
  _: 1 /* STABLE */
27613
- }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true), _ctx.moreButtonRef ? (openBlock(), createBlock(_component_or_popover, {
27614
- key: 3,
27615
- ref: 'moreRef',
27616
- trigger: _ctx.moreButtonRef && _ctx.moreButtonRef.root,
27617
- placement: "top-end"
27618
- }, {
27619
- default: withCtx(() => [createElementVNode("div", _hoisted_4, [(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.notVisibleTools, item => {
27620
- return openBlock(), createBlock(_component_or_icon_button, {
27621
- key: item,
27622
- tooltip: {
27623
- content: _ctx.iconTooltipsEnum[item],
27624
- placement: 'top'
27625
- },
27626
- selected: _ctx.isActive[item],
27627
- icon: {
27628
- icon: _ctx.iconsEnum[item],
27629
- variant: 'inherit'
27630
- },
27631
- onClick: $event => _ctx.handleToolbarClick(item)
27632
- }, null, 8 /* PROPS */, ["tooltip", "selected", "icon", "onClick"]);
27633
- }), 128 /* KEYED_FRAGMENT */))])]),
27634
-
27635
- _: 1 /* STABLE */
27636
- }, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true), _ctx.toolbarButtonRef ? (openBlock(), createBlock(_component_or_menu, {
27637
- key: 4,
27638
- ref: 'menuRef',
27639
- trigger: _ctx.toolbarButtonRef[_ctx.getIndexOfHeading] && _ctx.toolbarButtonRef[_ctx.getIndexOfHeading].root,
27640
- placement: "bottom-start"
27641
- }, {
27642
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment$1, null, renderList(_ctx.headingLevels, heading => {
27643
- return openBlock(), createBlock(_component_or_menu_item, {
27644
- key: heading,
27645
- selected: _ctx.activeHeadingLevel === heading,
27646
- onClick: $event => _ctx.handleToolbarClick('heading', heading)
27647
- }, {
27648
- default: withCtx(() => [createTextVNode(" Heading " + toDisplayString(heading), 1 /* TEXT */)]),
27649
-
27650
- _: 2 /* DYNAMIC */
27651
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["selected", "onClick"]);
27652
- }), 128 /* KEYED_FRAGMENT */)), createVNode(_component_or_menu_item, {
27653
- selected: !_ctx.activeHeadingLevel,
27654
- onClick: _cache[5] || (_cache[5] = $event => _ctx.handleToolbarClick('heading'))
27655
- }, {
27656
- default: withCtx(() => [createTextVNode(" None ")]),
27657
- _: 1 /* STABLE */
27658
- }, 8 /* PROPS */, ["selected"])]),
27659
- _: 1 /* STABLE */
27660
- }, 8 /* PROPS */, ["trigger"])) : createCommentVNode("v-if", true), createVNode(_component_or_modal, {
27802
+ }, 8 /* PROPS */, ["disabled"])) : createCommentVNode("v-if", true), createVNode(_component_or_modal, {
27661
27803
  "is-open": _ctx.isOpenLinkModal,
27662
27804
  size: "s"
27663
27805
  }, {
27664
- header: withCtx(() => [_hoisted_5]),
27665
- footer: withCtx(() => [createElementVNode("div", _hoisted_6, [createVNode(_component_or_button, {
27806
+ header: withCtx(() => [_hoisted_4]),
27807
+ footer: withCtx(() => [createElementVNode("div", _hoisted_5, [createVNode(_component_or_button, {
27666
27808
  variant: "outlined",
27667
27809
  onClick: _ctx.discardLink
27668
27810
  }, {
27669
- default: withCtx(() => [_hoisted_7]),
27811
+ default: withCtx(() => [_hoisted_6]),
27670
27812
  _: 1 /* STABLE */
27671
27813
  }, 8 /* PROPS */, ["onClick"]), createVNode(_component_or_button, {
27672
27814
  onClick: _ctx.attachLink
27673
27815
  }, {
27674
- default: withCtx(() => [_hoisted_8]),
27816
+ default: withCtx(() => [_hoisted_7]),
27675
27817
  _: 1 /* STABLE */
27676
27818
  }, 8 /* PROPS */, ["onClick"])])]),
27677
27819
  default: withCtx(() => [createElementVNode("div", null, [createVNode(_component_or_label, null, {
@@ -27679,7 +27821,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
27679
27821
  _: 1 /* STABLE */
27680
27822
  }), createVNode(_component_or_input, {
27681
27823
  modelValue: _ctx.text,
27682
- "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => _ctx.text = $event),
27824
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => _ctx.text = $event),
27683
27825
  placeholder: "Placeholder",
27684
27826
  class: "pb-md"
27685
27827
  }, null, 8 /* PROPS */, ["modelValue"]), createVNode(_component_or_label, null, {
@@ -27687,7 +27829,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
27687
27829
  _: 1 /* STABLE */
27688
27830
  }), createVNode(_component_or_input, {
27689
27831
  modelValue: _ctx.link,
27690
- "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => _ctx.link = $event),
27832
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => _ctx.link = $event),
27691
27833
  placeholder: "Placeholder"
27692
27834
  }, null, 8 /* PROPS */, ["modelValue"])])]),
27693
27835
  _: 1 /* STABLE */
@@ -27700,4 +27842,4 @@ styleInject(css_248z);
27700
27842
  script.render = render;
27701
27843
  script.__file = "src/components/or-rich-text-editor-v3/OrRichTextEditor.vue";
27702
27844
 
27703
- export { CodeMirrorView as C, EditorContainer as E, Formats as F, OrRichTextEditor as O, ToolbarContainer as T, serialize as a, Toolbar as b, ToolbarButton as c, deserialize as d, ToolbarButtonFocused as e, EditorInput as f, color as g, orCodeHighlightStyle as h, codemirrorNode as i, orCodeTheme as o, script as s, theme as t };
27845
+ export { CodeMirrorView as C, EditorContainer as E, Formats as F, OrRichTextEditor as O, ToolbarContainer as T, serialize as a, EditorContainerFocus as b, Toolbar as c, deserialize as d, ToolbarButton as e, ToolbarButtonFocused as f, EditorInput as g, color as h, orCodeHighlightStyle as i, codemirrorNode as j, orCodeTheme as o, script as s, theme as t };