@zipify/wysiwyg 4.1.0-0 → 4.1.0-2

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 (32) hide show
  1. package/config/build/settings.js +1 -1
  2. package/config/jest/setupTests.js +3 -0
  3. package/dist/cli.js +2 -3
  4. package/dist/wysiwyg.css +37 -37
  5. package/dist/wysiwyg.mjs +920 -846
  6. package/example/ai-component/AiComponent.vue +16 -50
  7. package/lib/Wysiwyg.vue +9 -17
  8. package/lib/components/base/Modal.vue +19 -18
  9. package/lib/components/base/ModalFloating.vue +32 -0
  10. package/lib/components/base/__tests__/Modal.test.js +2 -19
  11. package/lib/components/base/composables/useModalToggler.js +3 -34
  12. package/lib/components/base/dropdown/Dropdown.vue +7 -6
  13. package/lib/components/base/dropdown/DropdownActivator.vue +4 -5
  14. package/lib/components/base/dropdown/__tests__/DropdownActivator.test.js +1 -1
  15. package/lib/components/base/dropdown/__tests__/DropdownOption.test.js +1 -1
  16. package/lib/components/toolbar/Toolbar.vue +29 -13
  17. package/lib/components/toolbar/ToolbarFloating.vue +42 -0
  18. package/lib/components/toolbar/__tests__/Toolbar.test.js +4 -6
  19. package/lib/components/toolbar/controls/LineHeightControl.vue +9 -7
  20. package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +2 -4
  21. package/lib/components/toolbar/controls/link/LinkControl.vue +13 -14
  22. package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +1 -1
  23. package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
  24. package/lib/composables/__tests__/useEditor.test.js +26 -5
  25. package/lib/composables/index.js +0 -1
  26. package/lib/composables/useEditor.js +7 -2
  27. package/lib/styles/content.css +0 -1
  28. package/package.json +50 -51
  29. package/lib/components/base/composables/__tests__/useModalToggler.test.js +0 -59
  30. package/lib/composables/useToolbar.js +0 -36
  31. /package/config/build/{example.config.js → example.config.mjs} +0 -0
  32. /package/config/build/{lib.config.js → lib.config.mjs} +0 -0
package/dist/wysiwyg.mjs CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { defineComponent, ref, onMounted, onBeforeUnmount, h, getCurrentInstance, watchEffect, nextTick, unref, Teleport, reactive, markRaw, customRef, openBlock, createElementBlock, renderSlot, computed, normalizeClass, toRef, watch, Fragment as Fragment$1, renderList, normalizeStyle, inject, onUnmounted, provide, createElementVNode, createVNode, toDisplayString, createCommentVNode, createBlock, Transition, withCtx, withDirectives, pushScopeId, popScopeId, createTextVNode, normalizeProps, guardReactiveProps, withModifiers, resolveComponent, resolveDynamicComponent, useCssVars, KeepAlive } from "vue";
7
+ import { defineComponent, ref, onMounted, onBeforeUnmount, h, getCurrentInstance, watchEffect, nextTick, unref, Teleport, reactive, markRaw, customRef, openBlock, createElementBlock, renderSlot, computed, normalizeClass, toRef, watch, Fragment as Fragment$1, renderList, normalizeStyle, inject, onUnmounted, provide, createElementVNode, createVNode, toDisplayString, createCommentVNode, shallowRef, getCurrentScope, onScopeDispose, shallowReadonly, useCssVars, createBlock, Transition, withCtx, withDirectives, pushScopeId, popScopeId, createTextVNode, normalizeProps, guardReactiveProps, withModifiers, resolveComponent, resolveDynamicComponent, KeepAlive } from "vue";
8
8
  import { ColorModel, ColorPicker } from "@zipify/colorpicker";
9
9
  function OrderedMap(content) {
10
10
  this.content = content;
@@ -8766,7 +8766,7 @@ function captureCopy(view, dom) {
8766
8766
  const brokenClipboardAPI = ie$1 && ie_version < 15 || ios && webkit_version < 604;
8767
8767
  handlers.copy = editHandlers.cut = (view, _event) => {
8768
8768
  let event = _event;
8769
- let sel = view.state.selection, cut = event.type == "cut";
8769
+ let sel = view.state.selection, cut2 = event.type == "cut";
8770
8770
  if (sel.empty)
8771
8771
  return;
8772
8772
  let data = brokenClipboardAPI ? null : event.clipboardData;
@@ -8779,7 +8779,7 @@ handlers.copy = editHandlers.cut = (view, _event) => {
8779
8779
  } else {
8780
8780
  captureCopy(view, dom);
8781
8781
  }
8782
- if (cut)
8782
+ if (cut2)
8783
8783
  view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
8784
8784
  };
8785
8785
  function sliceSingleNode(slice2) {
@@ -11364,9 +11364,6 @@ class CommandManager {
11364
11364
  buildProps(tr2, shouldDispatch = true) {
11365
11365
  const { rawCommands, editor, state } = this;
11366
11366
  const { view } = editor;
11367
- if (state.storedMarks) {
11368
- tr2.setStoredMarks(state.storedMarks);
11369
- }
11370
11367
  const props = {
11371
11368
  tr: tr2,
11372
11369
  editor,
@@ -11376,7 +11373,7 @@ class CommandManager {
11376
11373
  transaction: tr2
11377
11374
  }),
11378
11375
  dispatch: shouldDispatch ? () => void 0 : void 0,
11379
- chain: () => this.createChain(tr2),
11376
+ chain: () => this.createChain(tr2, shouldDispatch),
11380
11377
  can: () => this.createCan(tr2),
11381
11378
  get commands() {
11382
11379
  return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
@@ -11531,7 +11528,10 @@ function mergeAttributes(...objects) {
11531
11528
  return;
11532
11529
  }
11533
11530
  if (key === "class") {
11534
- mergedAttributes[key] = [mergedAttributes[key], value].join(" ");
11531
+ const valueClasses = value ? value.split(" ") : [];
11532
+ const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
11533
+ const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
11534
+ mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
11535
11535
  } else if (key === "style") {
11536
11536
  mergedAttributes[key] = [mergedAttributes[key], value].join("; ");
11537
11537
  } else {
@@ -11933,7 +11933,7 @@ const pasteRuleMatcherHandler = (text, find2) => {
11933
11933
  });
11934
11934
  };
11935
11935
  function run$2(config) {
11936
- const { editor, state, from: from2, to, rule } = config;
11936
+ const { editor, state, from: from2, to, rule, pasteEvent, dropEvent } = config;
11937
11937
  const { commands: commands2, chain, can } = new CommandManager({
11938
11938
  editor,
11939
11939
  state
@@ -11963,7 +11963,9 @@ function run$2(config) {
11963
11963
  match,
11964
11964
  commands: commands2,
11965
11965
  chain,
11966
- can
11966
+ can,
11967
+ pasteEvent,
11968
+ dropEvent
11967
11969
  });
11968
11970
  handlers2.push(handler);
11969
11971
  });
@@ -11976,6 +11978,8 @@ function pasteRulesPlugin(props) {
11976
11978
  let dragSourceElement = null;
11977
11979
  let isPastedFromProseMirror = false;
11978
11980
  let isDroppedFromProseMirror = false;
11981
+ let pasteEvent = new ClipboardEvent("paste");
11982
+ let dropEvent = new DragEvent("drop");
11979
11983
  const plugins = rules.map((rule) => {
11980
11984
  return new Plugin({
11981
11985
  // we register a global drag handler to track the current drag source element
@@ -11993,13 +11997,15 @@ function pasteRulesPlugin(props) {
11993
11997
  },
11994
11998
  props: {
11995
11999
  handleDOMEvents: {
11996
- drop: (view) => {
12000
+ drop: (view, event) => {
11997
12001
  isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
12002
+ dropEvent = event;
11998
12003
  return false;
11999
12004
  },
12000
- paste: (view, event) => {
12005
+ paste: (_view, event) => {
12001
12006
  var _a2;
12002
12007
  const html = (_a2 = event.clipboardData) === null || _a2 === void 0 ? void 0 : _a2.getData("text/html");
12008
+ pasteEvent = event;
12003
12009
  isPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes("data-pm-slice"));
12004
12010
  return false;
12005
12011
  }
@@ -12027,11 +12033,15 @@ function pasteRulesPlugin(props) {
12027
12033
  state: chainableState,
12028
12034
  from: Math.max(from2 - 1, 0),
12029
12035
  to: to.b - 1,
12030
- rule
12036
+ rule,
12037
+ pasteEvent,
12038
+ dropEvent
12031
12039
  });
12032
12040
  if (!handler || !tr2.steps.length) {
12033
12041
  return;
12034
12042
  }
12043
+ dropEvent = new DragEvent("drop");
12044
+ pasteEvent = new ClipboardEvent("paste");
12035
12045
  return tr2;
12036
12046
  }
12037
12047
  });
@@ -12435,6 +12445,15 @@ const command = (fn2) => (props) => {
12435
12445
  const createParagraphNear = () => ({ state, dispatch }) => {
12436
12446
  return createParagraphNear$1(state, dispatch);
12437
12447
  };
12448
+ const cut = (originRange, targetPos) => ({ editor, tr: tr2 }) => {
12449
+ const { state } = editor;
12450
+ const contentSlice = state.doc.slice(originRange.from, originRange.to);
12451
+ tr2.deleteRange(originRange.from, originRange.to);
12452
+ const newPos = tr2.mapping.map(targetPos);
12453
+ tr2.insert(newPos, contentSlice.content);
12454
+ tr2.setSelection(new TextSelection(tr2.doc.resolve(newPos - 1)));
12455
+ return true;
12456
+ };
12438
12457
  const deleteCurrentNode = () => ({ tr: tr2, dispatch }) => {
12439
12458
  const { selection } = tr2;
12440
12459
  const currentNode = selection.$anchor.node();
@@ -12717,7 +12736,7 @@ const insertContentAt = (position, value, options) => ({ tr: tr2, dispatch, edit
12717
12736
  if (content.toString() === "<>") {
12718
12737
  return true;
12719
12738
  }
12720
- let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : position;
12739
+ let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
12721
12740
  let isOnlyTextContent = true;
12722
12741
  let isOnlyBlockContent = true;
12723
12742
  const nodes = isFragment(content) ? content : [content];
@@ -12763,6 +12782,36 @@ const joinBackward = () => ({ state, dispatch }) => {
12763
12782
  const joinForward = () => ({ state, dispatch }) => {
12764
12783
  return joinForward$1(state, dispatch);
12765
12784
  };
12785
+ const joinItemBackward = () => ({ tr: tr2, state, dispatch }) => {
12786
+ try {
12787
+ const point = joinPoint(state.doc, state.selection.$from.pos, -1);
12788
+ if (point === null || point === void 0) {
12789
+ return false;
12790
+ }
12791
+ tr2.join(point, 2);
12792
+ if (dispatch) {
12793
+ dispatch(tr2);
12794
+ }
12795
+ return true;
12796
+ } catch {
12797
+ return false;
12798
+ }
12799
+ };
12800
+ const joinItemForward = () => ({ state, dispatch, tr: tr2 }) => {
12801
+ try {
12802
+ const point = joinPoint(state.doc, state.selection.$from.pos, 1);
12803
+ if (point === null || point === void 0) {
12804
+ return false;
12805
+ }
12806
+ tr2.join(point, 2);
12807
+ if (dispatch) {
12808
+ dispatch(tr2);
12809
+ }
12810
+ return true;
12811
+ } catch (e) {
12812
+ return false;
12813
+ }
12814
+ };
12766
12815
  function isMacOS() {
12767
12816
  return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
12768
12817
  }
@@ -12967,6 +13016,26 @@ const setContent$1 = (content, emitUpdate = false, parseOptions = {}) => ({ tr:
12967
13016
  }
12968
13017
  return true;
12969
13018
  };
13019
+ function getMarkAttributes(state, typeOrName) {
13020
+ const type = getMarkType(typeOrName, state.schema);
13021
+ const { from: from2, to, empty: empty2 } = state.selection;
13022
+ const marks = [];
13023
+ if (empty2) {
13024
+ if (state.storedMarks) {
13025
+ marks.push(...state.storedMarks);
13026
+ }
13027
+ marks.push(...state.selection.$head.marks());
13028
+ } else {
13029
+ state.doc.nodesBetween(from2, to, (node) => {
13030
+ marks.push(...node.marks);
13031
+ });
13032
+ }
13033
+ const mark = marks.find((markItem) => markItem.type.name === type.name);
13034
+ if (!mark) {
13035
+ return {};
13036
+ }
13037
+ return { ...mark.attrs };
13038
+ }
12970
13039
  function combineTransactionSteps(oldDoc, transactions) {
12971
13040
  const transform = new Transform(oldDoc);
12972
13041
  transactions.forEach((transaction) => {
@@ -13031,26 +13100,6 @@ function getText(node, options) {
13031
13100
  };
13032
13101
  return getTextBetween(node, range, options);
13033
13102
  }
13034
- function getMarkAttributes(state, typeOrName) {
13035
- const type = getMarkType(typeOrName, state.schema);
13036
- const { from: from2, to, empty: empty2 } = state.selection;
13037
- const marks = [];
13038
- if (empty2) {
13039
- if (state.storedMarks) {
13040
- marks.push(...state.storedMarks);
13041
- }
13042
- marks.push(...state.selection.$head.marks());
13043
- } else {
13044
- state.doc.nodesBetween(from2, to, (node) => {
13045
- marks.push(...node.marks);
13046
- });
13047
- }
13048
- const mark = marks.find((markItem) => markItem.type.name === type.name);
13049
- if (!mark) {
13050
- return {};
13051
- }
13052
- return { ...mark.attrs };
13053
- }
13054
13103
  function getNodeAttributes(state, typeOrName) {
13055
13104
  const type = getNodeType(typeOrName, state.schema);
13056
13105
  const { from: from2, to } = state.selection;
@@ -13746,6 +13795,7 @@ var commands = /* @__PURE__ */ Object.freeze({
13746
13795
  clearNodes,
13747
13796
  command,
13748
13797
  createParagraphNear,
13798
+ cut,
13749
13799
  deleteCurrentNode,
13750
13800
  deleteNode,
13751
13801
  deleteRange,
@@ -13762,6 +13812,8 @@ var commands = /* @__PURE__ */ Object.freeze({
13762
13812
  joinDown,
13763
13813
  joinBackward,
13764
13814
  joinForward,
13815
+ joinItemBackward,
13816
+ joinItemForward,
13765
13817
  keyboardShortcut,
13766
13818
  lift,
13767
13819
  liftEmptyBlock,
@@ -13853,7 +13905,10 @@ const Keymap = Extension.create({
13853
13905
  const { selection, doc: doc2 } = tr2;
13854
13906
  const { empty: empty2, $anchor } = selection;
13855
13907
  const { pos, parent } = $anchor;
13856
- const isAtStart = Selection.atStart(doc2).from === pos;
13908
+ const $parentPos = $anchor.parent.isTextblock ? tr2.doc.resolve(pos - 1) : $anchor;
13909
+ const parentIsIsolating = $parentPos.parent.type.spec.isolating;
13910
+ const parentPos = $anchor.pos - $anchor.parentOffset;
13911
+ const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc2).from === pos;
13857
13912
  if (!empty2 || !isAtStart || !parent.type.isTextblock || parent.textContent.length) {
13858
13913
  return false;
13859
13914
  }
@@ -14045,8 +14100,8 @@ img.ProseMirror-separator {
14045
14100
  .tippy-box[data-animation=fade][data-state=hidden] {
14046
14101
  opacity: 0
14047
14102
  }`;
14048
- function createStyleTag(style2, nonce) {
14049
- const tiptapStyleTag = document.querySelector("style[data-tiptap-style]");
14103
+ function createStyleTag(style2, nonce, suffix) {
14104
+ const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
14050
14105
  if (tiptapStyleTag !== null) {
14051
14106
  return tiptapStyleTag;
14052
14107
  }
@@ -14054,7 +14109,7 @@ function createStyleTag(style2, nonce) {
14054
14109
  if (nonce) {
14055
14110
  styleNode.setAttribute("nonce", nonce);
14056
14111
  }
14057
- styleNode.setAttribute("data-tiptap-style", "");
14112
+ styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
14058
14113
  styleNode.innerHTML = style2;
14059
14114
  document.getElementsByTagName("head")[0].appendChild(styleNode);
14060
14115
  return styleNode;
@@ -14252,6 +14307,7 @@ let Editor$1 = class Editor extends EventEmitter {
14252
14307
  });
14253
14308
  this.view.updateState(newState);
14254
14309
  this.createNodeViews();
14310
+ this.prependClass();
14255
14311
  const dom = this.view.dom;
14256
14312
  dom.editor = this;
14257
14313
  }
@@ -14263,6 +14319,12 @@ let Editor$1 = class Editor extends EventEmitter {
14263
14319
  nodeViews: this.extensionManager.nodeViews
14264
14320
  });
14265
14321
  }
14322
+ /**
14323
+ * Prepend class name to element.
14324
+ */
14325
+ prependClass() {
14326
+ this.view.dom.className = `tiptap ${this.view.dom.className}`;
14327
+ }
14266
14328
  captureTransaction(fn2) {
14267
14329
  this.isCapturingTransaction = true;
14268
14330
  fn2();
@@ -14584,8 +14646,8 @@ let Node$1 = class Node3 {
14584
14646
  function markPasteRule(config) {
14585
14647
  return new PasteRule({
14586
14648
  find: config.find,
14587
- handler: ({ state, range, match }) => {
14588
- const attributes = callOrReturn(config.getAttributes, void 0, match);
14649
+ handler: ({ state, range, match, pasteEvent }) => {
14650
+ const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);
14589
14651
  if (attributes === false || attributes === null) {
14590
14652
  return null;
14591
14653
  }
@@ -14961,15 +15023,7 @@ function effect$1(_ref2) {
14961
15023
  return;
14962
15024
  }
14963
15025
  }
14964
- if (process.env.NODE_ENV !== "production") {
14965
- if (!isHTMLElement$1(arrowElement)) {
14966
- console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
14967
- }
14968
- }
14969
15026
  if (!contains(state.elements.popper, arrowElement)) {
14970
- if (process.env.NODE_ENV !== "production") {
14971
- console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
14972
- }
14973
15027
  return;
14974
15028
  }
14975
15029
  state.elements.arrow = arrowElement;
@@ -15070,14 +15124,6 @@ function mapToStyles(_ref2) {
15070
15124
  function computeStyles(_ref5) {
15071
15125
  var state = _ref5.state, options = _ref5.options;
15072
15126
  var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
15073
- if (process.env.NODE_ENV !== "production") {
15074
- var transitionProperty = getComputedStyle$2(state.elements.popper).transitionProperty || "";
15075
- if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
15076
- return transitionProperty.indexOf(property) >= 0;
15077
- })) {
15078
- console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
15079
- }
15080
- }
15081
15127
  var commonStyles = {
15082
15128
  placement: getBasePlacement$1(state.placement),
15083
15129
  variation: getVariation(state.placement),
@@ -15406,9 +15452,6 @@ function computeAutoPlacement(state, options) {
15406
15452
  });
15407
15453
  if (allowedPlacements.length === 0) {
15408
15454
  allowedPlacements = placements$1;
15409
- if (process.env.NODE_ENV !== "production") {
15410
- console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
15411
- }
15412
15455
  }
15413
15456
  var overflows = allowedPlacements.reduce(function(acc, placement2) {
15414
15457
  acc[placement2] = detectOverflow$1(state, {
@@ -15830,86 +15873,6 @@ function debounce$2(fn2) {
15830
15873
  return pending;
15831
15874
  };
15832
15875
  }
15833
- function format(str) {
15834
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
15835
- args[_key - 1] = arguments[_key];
15836
- }
15837
- return [].concat(args).reduce(function(p, c) {
15838
- return p.replace(/%s/, c);
15839
- }, str);
15840
- }
15841
- var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
15842
- var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
15843
- var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
15844
- function validateModifiers(modifiers2) {
15845
- modifiers2.forEach(function(modifier) {
15846
- [].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self2) {
15847
- return self2.indexOf(value) === index;
15848
- }).forEach(function(key) {
15849
- switch (key) {
15850
- case "name":
15851
- if (typeof modifier.name !== "string") {
15852
- console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
15853
- }
15854
- break;
15855
- case "enabled":
15856
- if (typeof modifier.enabled !== "boolean") {
15857
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
15858
- }
15859
- break;
15860
- case "phase":
15861
- if (modifierPhases.indexOf(modifier.phase) < 0) {
15862
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
15863
- }
15864
- break;
15865
- case "fn":
15866
- if (typeof modifier.fn !== "function") {
15867
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
15868
- }
15869
- break;
15870
- case "effect":
15871
- if (modifier.effect != null && typeof modifier.effect !== "function") {
15872
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
15873
- }
15874
- break;
15875
- case "requires":
15876
- if (modifier.requires != null && !Array.isArray(modifier.requires)) {
15877
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
15878
- }
15879
- break;
15880
- case "requiresIfExists":
15881
- if (!Array.isArray(modifier.requiresIfExists)) {
15882
- console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
15883
- }
15884
- break;
15885
- case "options":
15886
- case "data":
15887
- break;
15888
- default:
15889
- console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
15890
- return '"' + s + '"';
15891
- }).join(", ") + '; but "' + key + '" was provided.');
15892
- }
15893
- modifier.requires && modifier.requires.forEach(function(requirement) {
15894
- if (modifiers2.find(function(mod) {
15895
- return mod.name === requirement;
15896
- }) == null) {
15897
- console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
15898
- }
15899
- });
15900
- });
15901
- });
15902
- }
15903
- function uniqueBy(arr, fn2) {
15904
- var identifiers = /* @__PURE__ */ new Set();
15905
- return arr.filter(function(item) {
15906
- var identifier = fn2(item);
15907
- if (!identifiers.has(identifier)) {
15908
- identifiers.add(identifier);
15909
- return true;
15910
- }
15911
- });
15912
- }
15913
15876
  function mergeByName(modifiers2) {
15914
15877
  var merged = modifiers2.reduce(function(merged2, current) {
15915
15878
  var existing = merged2[current.name];
@@ -15923,8 +15886,6 @@ function mergeByName(modifiers2) {
15923
15886
  return merged[key];
15924
15887
  });
15925
15888
  }
15926
- var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
15927
- var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
15928
15889
  var DEFAULT_OPTIONS = {
15929
15890
  placement: "bottom",
15930
15891
  modifiers: [],
@@ -15975,28 +15936,6 @@ function popperGenerator(generatorOptions) {
15975
15936
  state.orderedModifiers = orderedModifiers.filter(function(m) {
15976
15937
  return m.enabled;
15977
15938
  });
15978
- if (process.env.NODE_ENV !== "production") {
15979
- var modifiers2 = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
15980
- var name = _ref.name;
15981
- return name;
15982
- });
15983
- validateModifiers(modifiers2);
15984
- if (getBasePlacement$1(state.options.placement) === auto) {
15985
- var flipModifier = state.orderedModifiers.find(function(_ref2) {
15986
- var name = _ref2.name;
15987
- return name === "flip";
15988
- });
15989
- if (!flipModifier) {
15990
- console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
15991
- }
15992
- }
15993
- var _getComputedStyle = getComputedStyle$2(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
15994
- if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
15995
- return parseFloat(margin);
15996
- })) {
15997
- console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
15998
- }
15999
- }
16000
15939
  runModifierEffects();
16001
15940
  return instance.update();
16002
15941
  },
@@ -16011,9 +15950,6 @@ function popperGenerator(generatorOptions) {
16011
15950
  }
16012
15951
  var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
16013
15952
  if (!areValidElements(reference3, popper3)) {
16014
- if (process.env.NODE_ENV !== "production") {
16015
- console.error(INVALID_ELEMENT_ERROR);
16016
- }
16017
15953
  return;
16018
15954
  }
16019
15955
  state.rects = {
@@ -16025,15 +15961,7 @@ function popperGenerator(generatorOptions) {
16025
15961
  state.orderedModifiers.forEach(function(modifier) {
16026
15962
  return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
16027
15963
  });
16028
- var __debug_loops__ = 0;
16029
15964
  for (var index = 0; index < state.orderedModifiers.length; index++) {
16030
- if (process.env.NODE_ENV !== "production") {
16031
- __debug_loops__ += 1;
16032
- if (__debug_loops__ > 100) {
16033
- console.error(INFINITE_LOOP_ERROR);
16034
- break;
16035
- }
16036
- }
16037
15965
  if (state.reset === true) {
16038
15966
  state.reset = false;
16039
15967
  index = -1;
@@ -16064,9 +15992,6 @@ function popperGenerator(generatorOptions) {
16064
15992
  }
16065
15993
  };
16066
15994
  if (!areValidElements(reference2, popper2)) {
16067
- if (process.env.NODE_ENV !== "production") {
16068
- console.error(INVALID_ELEMENT_ERROR);
16069
- }
16070
15995
  return instance;
16071
15996
  }
16072
15997
  instance.setOptions(options).then(function(state2) {
@@ -16075,8 +16000,8 @@ function popperGenerator(generatorOptions) {
16075
16000
  }
16076
16001
  });
16077
16002
  function runModifierEffects() {
16078
- state.orderedModifiers.forEach(function(_ref3) {
16079
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect3 = _ref3.effect;
16003
+ state.orderedModifiers.forEach(function(_ref) {
16004
+ var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
16080
16005
  if (typeof effect3 === "function") {
16081
16006
  var cleanupFn = effect3({
16082
16007
  state,
@@ -17927,6 +17852,7 @@ defineComponent({
17927
17852
  }
17928
17853
  });
17929
17854
  defineComponent({
17855
+ name: "NodeViewContent",
17930
17856
  props: {
17931
17857
  as: {
17932
17858
  type: String,
@@ -17943,6 +17869,7 @@ defineComponent({
17943
17869
  }
17944
17870
  });
17945
17871
  defineComponent({
17872
+ name: "NodeViewWrapper",
17946
17873
  props: {
17947
17874
  as: {
17948
17875
  type: String,
@@ -18077,7 +18004,6 @@ const LinkDestinations = Object.freeze({
18077
18004
  URL: "url",
18078
18005
  BLOCK: "block"
18079
18006
  });
18080
- const ToolbarGroup_vue_vue_type_style_index_0_scoped_8467d9b8_lang = "";
18081
18007
  const _export_sfc = (sfc, props) => {
18082
18008
  const target = sfc.__vccOpts || sfc;
18083
18009
  for (const [key, val] of props) {
@@ -18085,7 +18011,7 @@ const _export_sfc = (sfc, props) => {
18085
18011
  }
18086
18012
  return target;
18087
18013
  };
18088
- const _sfc_main$J = {
18014
+ const _sfc_main$L = {
18089
18015
  name: "ToolbarGroup"
18090
18016
  };
18091
18017
  const _hoisted_1$p = { class: "zw-toolbar__group" };
@@ -18094,9 +18020,8 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
18094
18020
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
18095
18021
  ]);
18096
18022
  }
18097
- const ToolbarGroup = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$4], ["__scopeId", "data-v-8467d9b8"]]);
18098
- const ToolbarDivider_vue_vue_type_style_index_0_scoped_1a453fb5_lang = "";
18099
- const _sfc_main$I = {
18023
+ const ToolbarGroup = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$4], ["__scopeId", "data-v-8467d9b8"]]);
18024
+ const _sfc_main$K = {
18100
18025
  name: "ToolbarDivider",
18101
18026
  props: {
18102
18027
  vertical: {
@@ -18123,9 +18048,8 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
18123
18048
  class: normalizeClass(["zw-toolbar__divider", $setup.classes])
18124
18049
  }, null, 2);
18125
18050
  }
18126
- const ToolbarDivider = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$3], ["__scopeId", "data-v-1a453fb5"]]);
18127
- const ToolbarRow_vue_vue_type_style_index_0_scoped_14a4e361_lang = "";
18128
- const _sfc_main$H = {
18051
+ const ToolbarDivider = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$3], ["__scopeId", "data-v-1a453fb5"]]);
18052
+ const _sfc_main$J = {
18129
18053
  name: "ToolbarRow"
18130
18054
  };
18131
18055
  const _hoisted_1$o = { class: "zw-toolbar__row" };
@@ -18134,7 +18058,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
18134
18058
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
18135
18059
  ]);
18136
18060
  }
18137
- const ToolbarRow = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render", _sfc_render$2], ["__scopeId", "data-v-14a4e361"]]);
18061
+ const ToolbarRow = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$2], ["__scopeId", "data-v-14a4e361"]]);
18138
18062
  const InjectionTokens$1 = Object.freeze({
18139
18063
  FONTS: Symbol("fonts"),
18140
18064
  FONT_SIZES: Symbol("fontSizes"),
@@ -18721,8 +18645,11 @@ const History = Extension.create({
18721
18645
  addKeyboardShortcuts() {
18722
18646
  return {
18723
18647
  "Mod-z": () => this.editor.commands.undo(),
18648
+ "Mod-Z": () => this.editor.commands.undo(),
18724
18649
  "Mod-y": () => this.editor.commands.redo(),
18650
+ "Mod-Y": () => this.editor.commands.redo(),
18725
18651
  "Shift-Mod-z": () => this.editor.commands.redo(),
18652
+ "Shift-Mod-Z": () => this.editor.commands.redo(),
18726
18653
  // Russian keyboard layouts
18727
18654
  "Mod-я": () => this.editor.commands.undo(),
18728
18655
  "Shift-Mod-я": () => this.editor.commands.redo()
@@ -19149,8 +19076,8 @@ var tk = /* @__PURE__ */ Object.freeze({
19149
19076
  SYM
19150
19077
  });
19151
19078
  const ASCII_LETTER = /[a-z]/;
19152
- const LETTER = /\p{L}/u;
19153
- const EMOJI = /\p{Emoji}/u;
19079
+ const LETTER = new RegExp("\\p{L}", "u");
19080
+ const EMOJI = new RegExp("\\p{Emoji}", "u");
19154
19081
  const DIGIT = /\d/;
19155
19082
  const SPACE = /\s/;
19156
19083
  const NL = "\n";
@@ -20115,6 +20042,9 @@ function findMarkByType(list, typeOrName) {
20115
20042
  return list.find((mark) => mark.type.name === name);
20116
20043
  }
20117
20044
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
20045
+ function getDefaultExportFromCjs(x) {
20046
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
20047
+ }
20118
20048
  function listCacheClear$1() {
20119
20049
  this.__data__ = [];
20120
20050
  this.size = 0;
@@ -20568,7 +20498,7 @@ var baseIsArguments = _baseIsArguments, isObjectLike$5 = isObjectLike_1;
20568
20498
  var objectProto$a = Object.prototype;
20569
20499
  var hasOwnProperty$7 = objectProto$a.hasOwnProperty;
20570
20500
  var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
20571
- var isArguments$1 = baseIsArguments(function() {
20501
+ var isArguments$1 = baseIsArguments(/* @__PURE__ */ function() {
20572
20502
  return arguments;
20573
20503
  }()) ? baseIsArguments : function(value) {
20574
20504
  return isObjectLike$5(value) && hasOwnProperty$7.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
@@ -20576,19 +20506,12 @@ var isArguments$1 = baseIsArguments(function() {
20576
20506
  var isArguments_1 = isArguments$1;
20577
20507
  var isArray$4 = Array.isArray;
20578
20508
  var isArray_1 = isArray$4;
20579
- var isBufferExports = {};
20580
- var isBuffer$3 = {
20581
- get exports() {
20582
- return isBufferExports;
20583
- },
20584
- set exports(v) {
20585
- isBufferExports = v;
20586
- }
20587
- };
20509
+ var isBuffer$3 = { exports: {} };
20588
20510
  function stubFalse() {
20589
20511
  return false;
20590
20512
  }
20591
20513
  var stubFalse_1 = stubFalse;
20514
+ isBuffer$3.exports;
20592
20515
  (function(module, exports) {
20593
20516
  var root2 = _root, stubFalse2 = stubFalse_1;
20594
20517
  var freeExports = exports && !exports.nodeType && exports;
@@ -20598,7 +20521,8 @@ var stubFalse_1 = stubFalse;
20598
20521
  var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
20599
20522
  var isBuffer2 = nativeIsBuffer || stubFalse2;
20600
20523
  module.exports = isBuffer2;
20601
- })(isBuffer$3, isBufferExports);
20524
+ })(isBuffer$3, isBuffer$3.exports);
20525
+ var isBufferExports = isBuffer$3.exports;
20602
20526
  var MAX_SAFE_INTEGER$1 = 9007199254740991;
20603
20527
  var reIsUint = /^(?:0|[1-9]\d*)$/;
20604
20528
  function isIndex$1(value, length) {
@@ -20628,15 +20552,8 @@ function baseUnary$3(func) {
20628
20552
  };
20629
20553
  }
20630
20554
  var _baseUnary = baseUnary$3;
20631
- var _nodeUtilExports = {};
20632
- var _nodeUtil = {
20633
- get exports() {
20634
- return _nodeUtilExports;
20635
- },
20636
- set exports(v) {
20637
- _nodeUtilExports = v;
20638
- }
20639
- };
20555
+ var _nodeUtil = { exports: {} };
20556
+ _nodeUtil.exports;
20640
20557
  (function(module, exports) {
20641
20558
  var freeGlobal2 = _freeGlobal;
20642
20559
  var freeExports = exports && !exports.nodeType && exports;
@@ -20654,7 +20571,8 @@ var _nodeUtil = {
20654
20571
  }
20655
20572
  }();
20656
20573
  module.exports = nodeUtil2;
20657
- })(_nodeUtil, _nodeUtilExports);
20574
+ })(_nodeUtil, _nodeUtil.exports);
20575
+ var _nodeUtilExports = _nodeUtil.exports;
20658
20576
  var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
20659
20577
  var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
20660
20578
  var isTypedArray$2 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
@@ -20758,15 +20676,8 @@ function baseAssignIn$1(object, source) {
20758
20676
  return object && copyObject$2(source, keysIn$2(source), object);
20759
20677
  }
20760
20678
  var _baseAssignIn = baseAssignIn$1;
20761
- var _cloneBufferExports = {};
20762
- var _cloneBuffer = {
20763
- get exports() {
20764
- return _cloneBufferExports;
20765
- },
20766
- set exports(v) {
20767
- _cloneBufferExports = v;
20768
- }
20769
- };
20679
+ var _cloneBuffer = { exports: {} };
20680
+ _cloneBuffer.exports;
20770
20681
  (function(module, exports) {
20771
20682
  var root2 = _root;
20772
20683
  var freeExports = exports && !exports.nodeType && exports;
@@ -20782,7 +20693,8 @@ var _cloneBuffer = {
20782
20693
  return result;
20783
20694
  }
20784
20695
  module.exports = cloneBuffer2;
20785
- })(_cloneBuffer, _cloneBufferExports);
20696
+ })(_cloneBuffer, _cloneBuffer.exports);
20697
+ var _cloneBufferExports = _cloneBuffer.exports;
20786
20698
  function copyArray$1(source, array) {
20787
20699
  var index = -1, length = source.length;
20788
20700
  array || (array = Array(length));
@@ -20992,7 +20904,7 @@ function initCloneByTag$1(object, tag, isDeep) {
20992
20904
  var _initCloneByTag = initCloneByTag$1;
20993
20905
  var isObject$2 = isObject_1;
20994
20906
  var objectCreate = Object.create;
20995
- var baseCreate$1 = function() {
20907
+ var baseCreate$1 = /* @__PURE__ */ function() {
20996
20908
  function object() {
20997
20909
  }
20998
20910
  return function(proto) {
@@ -21108,8 +21020,9 @@ function cloneDeep(value) {
21108
21020
  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
21109
21021
  }
21110
21022
  var cloneDeep_1 = cloneDeep;
21023
+ const cloneDeep$1 = /* @__PURE__ */ getDefaultExportFromCjs(cloneDeep_1);
21111
21024
  function copyMark(mark) {
21112
- return mark.type.create(cloneDeep_1(mark.attrs));
21025
+ return mark.type.create(cloneDeep$1(mark.attrs));
21113
21026
  }
21114
21027
  const NodeProcessor = Extension.create({
21115
21028
  name: "node_processor",
@@ -22291,7 +22204,9 @@ const ListItem$1 = Node$1.create({
22291
22204
  name: "listItem",
22292
22205
  addOptions() {
22293
22206
  return {
22294
- HTMLAttributes: {}
22207
+ HTMLAttributes: {},
22208
+ bulletListTypeName: "bulletList",
22209
+ orderedListTypeName: "orderedList"
22295
22210
  };
22296
22211
  },
22297
22212
  content: "paragraph block*",
@@ -22507,25 +22422,8 @@ function autolink(options) {
22507
22422
  }
22508
22423
  const { tr: tr2 } = newState;
22509
22424
  const transform = combineTransactionSteps(oldState.doc, [...transactions]);
22510
- const { mapping } = transform;
22511
22425
  const changes = getChangedRanges(transform);
22512
- changes.forEach(({ oldRange, newRange }) => {
22513
- getMarksBetween(oldRange.from, oldRange.to, oldState.doc).filter((item) => item.mark.type === options.type).forEach((oldMark) => {
22514
- const newFrom = mapping.map(oldMark.from);
22515
- const newTo = mapping.map(oldMark.to);
22516
- const newMarks = getMarksBetween(newFrom, newTo, newState.doc).filter((item) => item.mark.type === options.type);
22517
- if (!newMarks.length) {
22518
- return;
22519
- }
22520
- const newMark = newMarks[0];
22521
- const oldLinkText = oldState.doc.textBetween(oldMark.from, oldMark.to, void 0, " ");
22522
- const newLinkText = newState.doc.textBetween(newMark.from, newMark.to, void 0, " ");
22523
- const wasLink = test(oldLinkText);
22524
- const isLink = test(newLinkText);
22525
- if (wasLink && !isLink) {
22526
- tr2.removeMark(newMark.from, newMark.to, options.type);
22527
- }
22528
- });
22426
+ changes.forEach(({ newRange }) => {
22529
22427
  const nodesInChangedRanges = findChildrenInRange(newState.doc, newRange, (node) => node.isTextblock);
22530
22428
  let textBlock;
22531
22429
  let textBeforeWhitespace;
@@ -22546,16 +22444,24 @@ function autolink(options) {
22546
22444
  if (!lastWordBeforeSpace) {
22547
22445
  return false;
22548
22446
  }
22549
- find(lastWordBeforeSpace).filter((link) => link.isLink).filter((link) => {
22447
+ find(lastWordBeforeSpace).filter((link) => link.isLink).map((link) => ({
22448
+ ...link,
22449
+ from: lastWordAndBlockOffset + link.start + 1,
22450
+ to: lastWordAndBlockOffset + link.end + 1
22451
+ })).filter((link) => {
22452
+ if (!newState.schema.marks.code) {
22453
+ return true;
22454
+ }
22455
+ return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
22456
+ }).filter((link) => {
22550
22457
  if (options.validate) {
22551
22458
  return options.validate(link.value);
22552
22459
  }
22553
22460
  return true;
22554
- }).map((link) => ({
22555
- ...link,
22556
- from: lastWordAndBlockOffset + link.start + 1,
22557
- to: lastWordAndBlockOffset + link.end + 1
22558
- })).forEach((link) => {
22461
+ }).forEach((link) => {
22462
+ if (getMarksBetween(link.from, link.to, newState.doc).some((item) => item.mark.type === options.type)) {
22463
+ return;
22464
+ }
22559
22465
  tr2.addMark(link.from, link.to, options.type.create({
22560
22466
  href: link.href
22561
22467
  }));
@@ -22574,16 +22480,22 @@ function clickHandler(options) {
22574
22480
  key: new PluginKey("handleClickLink"),
22575
22481
  props: {
22576
22482
  handleClick: (view, pos, event) => {
22577
- var _a2, _b, _c;
22578
- if (event.button !== 1) {
22483
+ var _a2, _b;
22484
+ if (event.button !== 0) {
22485
+ return false;
22486
+ }
22487
+ const eventTarget = event.target;
22488
+ if (eventTarget.nodeName !== "A") {
22579
22489
  return false;
22580
22490
  }
22581
22491
  const attrs = getAttributes(view.state, options.type.name);
22582
- const link = (_a2 = event.target) === null || _a2 === void 0 ? void 0 : _a2.closest("a");
22583
- const href = (_b = link === null || link === void 0 ? void 0 : link.href) !== null && _b !== void 0 ? _b : attrs.href;
22584
- const target = (_c = link === null || link === void 0 ? void 0 : link.target) !== null && _c !== void 0 ? _c : attrs.target;
22492
+ const link = event.target;
22493
+ const href = (_a2 = link === null || link === void 0 ? void 0 : link.href) !== null && _a2 !== void 0 ? _a2 : attrs.href;
22494
+ const target = (_b = link === null || link === void 0 ? void 0 : link.target) !== null && _b !== void 0 ? _b : attrs.target;
22585
22495
  if (link && href) {
22586
- window.open(href, target);
22496
+ if (view.editable) {
22497
+ window.open(href, target);
22498
+ }
22587
22499
  return true;
22588
22500
  }
22589
22501
  return false;
@@ -22596,6 +22508,7 @@ function pasteHandler(options) {
22596
22508
  key: new PluginKey("handlePasteLink"),
22597
22509
  props: {
22598
22510
  handlePaste: (view, event, slice2) => {
22511
+ var _a2;
22599
22512
  const { state } = view;
22600
22513
  const { selection } = state;
22601
22514
  const { empty: empty2 } = selection;
@@ -22610,8 +22523,12 @@ function pasteHandler(options) {
22610
22523
  if (!textContent || !link) {
22611
22524
  return false;
22612
22525
  }
22526
+ const html = (_a2 = event.clipboardData) === null || _a2 === void 0 ? void 0 : _a2.getData("text/html");
22527
+ const hrefRegex = /href="([^"]*)"/;
22528
+ const existingLink = html === null || html === void 0 ? void 0 : html.match(hrefRegex);
22529
+ const url = existingLink ? existingLink[1] : link.href;
22613
22530
  options.editor.commands.setMark(options.type, {
22614
- href: link.href
22531
+ href: url
22615
22532
  });
22616
22533
  return true;
22617
22534
  }
@@ -22659,6 +22576,9 @@ const Link$1 = Mark2.create({
22659
22576
  target: {
22660
22577
  default: this.options.HTMLAttributes.target
22661
22578
  },
22579
+ rel: {
22580
+ default: this.options.HTMLAttributes.rel
22581
+ },
22662
22582
  class: {
22663
22583
  default: this.options.HTMLAttributes.class
22664
22584
  }
@@ -22668,6 +22588,10 @@ const Link$1 = Mark2.create({
22668
22588
  return [{ tag: 'a[href]:not([href *= "javascript:" i])' }];
22669
22589
  },
22670
22590
  renderHTML({ HTMLAttributes }) {
22591
+ var _a2;
22592
+ if ((_a2 = HTMLAttributes.href) === null || _a2 === void 0 ? void 0 : _a2.startsWith("javascript:")) {
22593
+ return ["a", mergeAttributes(this.options.HTMLAttributes, { ...HTMLAttributes, href: "" }), 0];
22594
+ }
22671
22595
  return ["a", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
22672
22596
  },
22673
22597
  addCommands() {
@@ -22697,10 +22621,18 @@ const Link$1 = Mark2.create({
22697
22621
  data: link
22698
22622
  })),
22699
22623
  type: this.type,
22700
- getAttributes: (match) => {
22701
- var _a2;
22624
+ getAttributes: (match, pasteEvent) => {
22625
+ var _a2, _b;
22626
+ const html = (_a2 = pasteEvent === null || pasteEvent === void 0 ? void 0 : pasteEvent.clipboardData) === null || _a2 === void 0 ? void 0 : _a2.getData("text/html");
22627
+ const hrefRegex = /href="([^"]*)"/;
22628
+ const existingLink = html === null || html === void 0 ? void 0 : html.match(hrefRegex);
22629
+ if (existingLink) {
22630
+ return {
22631
+ href: existingLink[1]
22632
+ };
22633
+ }
22702
22634
  return {
22703
- href: (_a2 = match.data) === null || _a2 === void 0 ? void 0 : _a2.href
22635
+ href: (_b = match.data) === null || _b === void 0 ? void 0 : _b.href
22704
22636
  };
22705
22637
  }
22706
22638
  })
@@ -22937,7 +22869,7 @@ class BaseNormalizer {
22937
22869
  throw new Error("Implement abstract method");
22938
22870
  }
22939
22871
  }
22940
- const _HtmlNormalizer = class extends BaseNormalizer {
22872
+ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
22941
22873
  constructor({ content, parser }) {
22942
22874
  super({ content });
22943
22875
  __publicField(this, "_parser");
@@ -23163,10 +23095,9 @@ const _HtmlNormalizer = class extends BaseNormalizer {
23163
23095
  return span;
23164
23096
  }
23165
23097
  };
23166
- let HtmlNormalizer = _HtmlNormalizer;
23167
- __publicField(HtmlNormalizer, "BLOCK_NODE_NAMES", ["P", "H1", "H2", "H3", "H4"]);
23168
- __publicField(HtmlNormalizer, "ROOT_NODE_NAMES", _HtmlNormalizer.BLOCK_NODE_NAMES.concat("UL", "OL"));
23169
- __publicField(HtmlNormalizer, "BLOCK_STYLES", [
23098
+ __publicField(_HtmlNormalizer, "BLOCK_NODE_NAMES", ["P", "H1", "H2", "H3", "H4"]);
23099
+ __publicField(_HtmlNormalizer, "ROOT_NODE_NAMES", _HtmlNormalizer.BLOCK_NODE_NAMES.concat("UL", "OL"));
23100
+ __publicField(_HtmlNormalizer, "BLOCK_STYLES", [
23170
23101
  "text-align",
23171
23102
  "line-height",
23172
23103
  "margin",
@@ -23175,6 +23106,7 @@ __publicField(HtmlNormalizer, "BLOCK_STYLES", [
23175
23106
  "margin-left",
23176
23107
  "margin-right"
23177
23108
  ]);
23109
+ let HtmlNormalizer = _HtmlNormalizer;
23178
23110
  var HASH_UNDEFINED = "__lodash_hash_undefined__";
23179
23111
  function setCacheAdd$1(value) {
23180
23112
  this.__data__.set(value, HASH_UNDEFINED);
@@ -23424,6 +23356,7 @@ function isEqual(value, other) {
23424
23356
  return baseIsEqual(value, other);
23425
23357
  }
23426
23358
  var isEqual_1 = isEqual;
23359
+ const isEqual$1 = /* @__PURE__ */ getDefaultExportFromCjs(isEqual_1);
23427
23360
  class JsonNormalizer extends BaseNormalizer {
23428
23361
  normalize() {
23429
23362
  this._iterateNodes(this._bubbleMarks);
@@ -23477,7 +23410,7 @@ class JsonNormalizer extends BaseNormalizer {
23477
23410
  }
23478
23411
  _includesMark(node, checkingMark) {
23479
23412
  var _a2;
23480
- return ((_a2 = node.marks) == null ? void 0 : _a2.some((mark) => isEqual_1(mark, checkingMark))) ?? false;
23413
+ return ((_a2 = node.marks) == null ? void 0 : _a2.some((mark) => isEqual$1(mark, checkingMark))) ?? false;
23481
23414
  }
23482
23415
  _includesMarkType(node, type) {
23483
23416
  var _a2;
@@ -23805,7 +23738,7 @@ class StylePresetRenderer {
23805
23738
  return this.makePresetHtmlClass(preset).split(" ").map((part) => `.${part}`).join("");
23806
23739
  }
23807
23740
  }
23808
- const _NodeSelector = class {
23741
+ const _NodeSelector = class _NodeSelector {
23809
23742
  static get instance() {
23810
23743
  this._instance ?? (this._instance = new _NodeSelector());
23811
23744
  return this._instance;
@@ -23845,8 +23778,8 @@ const _NodeSelector = class {
23845
23778
  return mark.type.name === selector.typeName;
23846
23779
  }
23847
23780
  };
23781
+ __publicField(_NodeSelector, "_instance");
23848
23782
  let NodeSelector = _NodeSelector;
23849
- __publicField(NodeSelector, "_instance");
23850
23783
  const dataStorage = /* @__PURE__ */ new WeakMap();
23851
23784
  function toggleListener(toEnable, onClick) {
23852
23785
  const args = ["click", onClick, { capture: true }];
@@ -23895,9 +23828,8 @@ function tooltip(el, { value, modifiers: modifiers2 }) {
23895
23828
  if (modifiers2.lg)
23896
23829
  el.dataset.tooltipSize = "lg";
23897
23830
  }
23898
- const Button_vue_vue_type_style_index_0_scoped_b2d5d74a_lang = "";
23899
23831
  const _hoisted_1$n = ["disabled"];
23900
- const _sfc_main$G = {
23832
+ const _sfc_main$I = {
23901
23833
  __name: "Button",
23902
23834
  props: {
23903
23835
  skin: {
@@ -23942,10 +23874,9 @@ const _sfc_main$G = {
23942
23874
  };
23943
23875
  }
23944
23876
  };
23945
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-b2d5d74a"]]);
23946
- const ButtonToggle_vue_vue_type_style_index_0_scoped_bbdc7b20_lang = "";
23877
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-b2d5d74a"]]);
23947
23878
  const _hoisted_1$m = { class: "zw-button-toggle" };
23948
- const _sfc_main$F = {
23879
+ const _sfc_main$H = {
23949
23880
  __name: "ButtonToggle",
23950
23881
  props: {
23951
23882
  value: {
@@ -23972,10 +23903,9 @@ const _sfc_main$F = {
23972
23903
  };
23973
23904
  }
23974
23905
  };
23975
- const ButtonToggle = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-bbdc7b20"]]);
23976
- const Icon_vue_vue_type_style_index_0_scoped_09bee8af_lang = "";
23906
+ const ButtonToggle = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-bbdc7b20"]]);
23977
23907
  const _hoisted_1$l = ["innerHTML"];
23978
- const _sfc_main$E = {
23908
+ const _sfc_main$G = {
23979
23909
  __name: "Icon",
23980
23910
  props: {
23981
23911
  name: {
@@ -24021,9 +23951,10 @@ const _sfc_main$E = {
24021
23951
  };
24022
23952
  }
24023
23953
  };
24024
- const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-09bee8af"]]);
23954
+ const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-09bee8af"]]);
24025
23955
  var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
24026
23956
  var canUseDom = canUseDOM;
23957
+ const canUseDOM$1 = /* @__PURE__ */ getDefaultExportFromCjs(canUseDom);
24027
23958
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
24028
23959
  const freeGlobal$1 = freeGlobal;
24029
23960
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
@@ -24227,7 +24158,7 @@ var __assign = function() {
24227
24158
  };
24228
24159
  var cachedScrollbarWidth = null;
24229
24160
  var cachedDevicePixelRatio = null;
24230
- if (canUseDom) {
24161
+ if (canUseDOM$1) {
24231
24162
  window.addEventListener("resize", function() {
24232
24163
  if (cachedDevicePixelRatio !== window.devicePixelRatio) {
24233
24164
  cachedDevicePixelRatio = window.devicePixelRatio;
@@ -24486,7 +24417,7 @@ var SimpleBarCore = (
24486
24417
  eventOffset = e.pageX;
24487
24418
  }
24488
24419
  var dragPos = eventOffset - ((_h = (_g = track.rect) === null || _g === void 0 ? void 0 : _g[_this.axis[_this.draggedAxis].offsetAttr]) !== null && _h !== void 0 ? _h : 0) - _this.axis[_this.draggedAxis].dragOffset;
24489
- dragPos = _this.isRtl ? ((_k = (_j = track.rect) === null || _j === void 0 ? void 0 : _j[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _k !== void 0 ? _k : 0) - scrollbar.size - dragPos : dragPos;
24420
+ dragPos = _this.draggedAxis === "x" && _this.isRtl ? ((_k = (_j = track.rect) === null || _j === void 0 ? void 0 : _j[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _k !== void 0 ? _k : 0) - scrollbar.size - dragPos : dragPos;
24490
24421
  var dragPerc = dragPos / (trackSize - scrollbar.size);
24491
24422
  var scrollPos = dragPerc * (contentSize - hostSize);
24492
24423
  if (_this.draggedAxis === "x" && _this.isRtl) {
@@ -24598,7 +24529,7 @@ var SimpleBarCore = (
24598
24529
  };
24599
24530
  };
24600
24531
  SimpleBarCore2.prototype.init = function() {
24601
- if (canUseDom) {
24532
+ if (canUseDOM$1) {
24602
24533
  this.initDOM();
24603
24534
  this.rtlHelpers = SimpleBarCore2.getRtlHelpers();
24604
24535
  this.scrollbarWidth = this.getScrollbarWidth();
@@ -25110,7 +25041,7 @@ var SimpleBar = (
25110
25041
  return SimpleBar2;
25111
25042
  }(SimpleBarCore)
25112
25043
  );
25113
- if (canUseDom) {
25044
+ if (canUseDOM$1) {
25114
25045
  SimpleBar.initHtmlApi();
25115
25046
  }
25116
25047
  function useValidator({ validations }) {
@@ -25130,9 +25061,9 @@ function useValidator({ validations }) {
25130
25061
  return { error, validate, reset: reset2 };
25131
25062
  }
25132
25063
  const noFormatter = (value) => value;
25133
- function useTempValue({ valueRef, format: format2 = noFormatter }) {
25134
- const tempValue = ref(format2(valueRef.value));
25135
- watch(valueRef, () => tempValue.value = format2(valueRef.value));
25064
+ function useTempValue({ valueRef, format = noFormatter }) {
25065
+ const tempValue = ref(format(valueRef.value));
25066
+ watch(valueRef, () => tempValue.value = format(valueRef.value));
25136
25067
  return tempValue;
25137
25068
  }
25138
25069
  function useElementRef(ref2) {
@@ -25142,10 +25073,10 @@ function useElementRef(ref2) {
25142
25073
  });
25143
25074
  }
25144
25075
  function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
25145
- function format2(number) {
25076
+ function format(number) {
25146
25077
  return Number(parseFloat(number).toFixed(digits));
25147
25078
  }
25148
- const temp = useTempValue({ valueRef, format: format2 });
25079
+ const temp = useTempValue({ valueRef, format });
25149
25080
  function validateNumber(number) {
25150
25081
  if (min2 !== null && number < min2)
25151
25082
  return min2;
@@ -25160,19 +25091,19 @@ function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
25160
25091
  }
25161
25092
  const numericValue = Number.parseFloat(temp.value);
25162
25093
  const validatedNumber = validateNumber(numericValue);
25163
- temp.value = format2(validatedNumber);
25094
+ temp.value = format(validatedNumber);
25164
25095
  onChange(temp.value);
25165
25096
  }
25166
25097
  function increment(step) {
25167
25098
  const newValue = temp.value + Number(step);
25168
25099
  const validatedNumber = validateNumber(newValue);
25169
- temp.value = format2(validatedNumber);
25100
+ temp.value = format(validatedNumber);
25170
25101
  onChange(temp.value);
25171
25102
  }
25172
25103
  function decrement(step) {
25173
25104
  const newValue = temp.value - Number(step);
25174
25105
  const validatedNumber = validateNumber(newValue);
25175
- temp.value = format2(validatedNumber);
25106
+ temp.value = format(validatedNumber);
25176
25107
  onChange(temp.value);
25177
25108
  }
25178
25109
  return {
@@ -25182,31 +25113,320 @@ function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
25182
25113
  decrement
25183
25114
  };
25184
25115
  }
25185
- const min = Math.min;
25186
- const max = Math.max;
25187
- const round = Math.round;
25188
- const floor = Math.floor;
25189
- const createCoords = (v) => ({
25190
- x: v,
25191
- y: v
25192
- });
25193
- function clamp(start2, value, end2) {
25194
- return max(start2, min(value, end2));
25195
- }
25196
- function evaluate(value, param) {
25197
- return typeof value === "function" ? value(param) : value;
25116
+ function useModalToggler({ onBeforeOpened, onClosed } = {}) {
25117
+ const editor = inject(InjectionTokens$1.EDITOR);
25118
+ const isOpened = ref(false);
25119
+ async function open() {
25120
+ if (isOpened.value)
25121
+ return;
25122
+ onBeforeOpened == null ? void 0 : onBeforeOpened();
25123
+ editor.commands.storeSelection();
25124
+ isOpened.value = true;
25125
+ }
25126
+ function close2() {
25127
+ isOpened.value = false;
25128
+ editor.commands.restoreSelection();
25129
+ onClosed == null ? void 0 : onClosed();
25130
+ }
25131
+ const toggle = (toOpen) => toOpen ? open() : close2();
25132
+ return reactive({ isOpened, open, close: close2, toggle });
25198
25133
  }
25199
- function getSide(placement) {
25200
- return placement.split("-")[0];
25134
+ function useActivatedListener({ targetRef, isActiveRef, event, onEvent, options }) {
25135
+ function addListener() {
25136
+ targetRef.value.addEventListener(event, onEvent, options);
25137
+ }
25138
+ function removeListener() {
25139
+ var _a2;
25140
+ (_a2 = targetRef.value) == null ? void 0 : _a2.removeEventListener(event, onEvent, options);
25141
+ }
25142
+ function updateListener() {
25143
+ if (!targetRef.value)
25144
+ return;
25145
+ isActiveRef.value ? addListener() : removeListener();
25146
+ }
25147
+ watch(isActiveRef, updateListener);
25148
+ watch(targetRef, updateListener);
25149
+ onUnmounted(removeListener);
25150
+ updateListener();
25201
25151
  }
25202
- function getAlignment(placement) {
25203
- return placement.split("-")[1];
25152
+ const INTERACTIVE_TAGS = [
25153
+ "BUTTON",
25154
+ "INPUT",
25155
+ "LABEL",
25156
+ "A"
25157
+ ];
25158
+ function useDeselectionLock({ hostRef, isActiveRef }) {
25159
+ const editor = inject(InjectionTokens$1.EDITOR);
25160
+ const targetRef = useElementRef(hostRef);
25161
+ function onEvent(event) {
25162
+ if (INTERACTIVE_TAGS.includes(event.target.tagName))
25163
+ return;
25164
+ if (editor.isFocused) {
25165
+ event.stopPropagation();
25166
+ event.preventDefault();
25167
+ }
25168
+ editor.chain().restoreSelection().run();
25169
+ }
25170
+ useActivatedListener({
25171
+ event: "mousedown",
25172
+ targetRef,
25173
+ isActiveRef,
25174
+ onEvent
25175
+ });
25204
25176
  }
25205
- function getOppositeAxis(axis) {
25206
- return axis === "x" ? "y" : "x";
25177
+ const SCROLL_VIEW = Symbol("scrollView");
25178
+ function useScrollView() {
25179
+ const scrollerRef = inject(SCROLL_VIEW);
25180
+ function scrollToElement(element, { offset: offset2 } = {}) {
25181
+ if (!scrollerRef.value)
25182
+ return;
25183
+ const rootRect = scrollerRef.value.getBoundingClientRect();
25184
+ const elementRect = element.getBoundingClientRect();
25185
+ const position = elementRect.top - rootRect.top;
25186
+ scrollerRef.value.scrollTo({
25187
+ top: position - (offset2 || 0)
25188
+ });
25189
+ }
25190
+ return { scrollToElement };
25207
25191
  }
25208
- function getAxisLength(axis) {
25209
- return axis === "y" ? "height" : "width";
25192
+ const _sfc_main$F = {
25193
+ __name: "ScrollView",
25194
+ setup(__props) {
25195
+ const hostRef = ref(null);
25196
+ const scrollerRef = ref(null);
25197
+ provide(SCROLL_VIEW, scrollerRef);
25198
+ onMounted(() => {
25199
+ const options = SimpleBar.getOptions(hostRef.value.attributes);
25200
+ const simpleBar = new SimpleBar(hostRef.value, options);
25201
+ scrollerRef.value = simpleBar.getScrollElement();
25202
+ });
25203
+ return (_ctx, _cache) => {
25204
+ return openBlock(), createElementBlock("div", {
25205
+ class: "zw-scroll-view",
25206
+ "data-simplebar-auto-hide": "false",
25207
+ ref_key: "hostRef",
25208
+ ref: hostRef
25209
+ }, [
25210
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
25211
+ ], 512);
25212
+ };
25213
+ }
25214
+ };
25215
+ const ScrollView = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-07fd5408"]]);
25216
+ const _hoisted_1$k = ["for"];
25217
+ const _sfc_main$E = {
25218
+ __name: "FieldLabel",
25219
+ props: {
25220
+ fieldId: {
25221
+ type: String,
25222
+ required: false,
25223
+ default: null
25224
+ }
25225
+ },
25226
+ setup(__props) {
25227
+ return (_ctx, _cache) => {
25228
+ return openBlock(), createElementBlock("label", {
25229
+ class: "zw-field-label",
25230
+ for: __props.fieldId
25231
+ }, [
25232
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
25233
+ ], 8, _hoisted_1$k);
25234
+ };
25235
+ }
25236
+ };
25237
+ const FieldLabel = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-7ab8105c"]]);
25238
+ const _hoisted_1$j = ["id", "min", "max", "step", "value"];
25239
+ const _sfc_main$D = {
25240
+ __name: "Range",
25241
+ props: {
25242
+ min: {
25243
+ type: [String, Number],
25244
+ required: true
25245
+ },
25246
+ max: {
25247
+ type: [String, Number],
25248
+ required: true
25249
+ },
25250
+ step: {
25251
+ type: [String, Number],
25252
+ required: true
25253
+ },
25254
+ value: {
25255
+ type: [String, Number],
25256
+ required: true
25257
+ },
25258
+ fieldId: {
25259
+ type: String,
25260
+ required: false,
25261
+ default: ""
25262
+ }
25263
+ },
25264
+ emits: ["input"],
25265
+ setup(__props, { emit: __emit }) {
25266
+ const props = __props;
25267
+ const emit = __emit;
25268
+ const tempValue = useTempValue({
25269
+ valueRef: toRef(props, "value"),
25270
+ format: Number
25271
+ });
25272
+ const inputStyles = computed(() => {
25273
+ const min2 = Number(props.min);
25274
+ const max2 = Number(props.max);
25275
+ const step = Number(props.step);
25276
+ const value = Math.ceil(tempValue.value / step) * step;
25277
+ const progress = (value - min2) / (max2 - min2);
25278
+ return { "--zw-range-progress": `${progress * 100}%` };
25279
+ });
25280
+ function update(event) {
25281
+ tempValue.value = Number(event.target.value);
25282
+ emit("input", tempValue.value);
25283
+ }
25284
+ return (_ctx, _cache) => {
25285
+ return openBlock(), createElementBlock("input", {
25286
+ class: "zw-range",
25287
+ type: "range",
25288
+ id: __props.fieldId,
25289
+ min: __props.min,
25290
+ max: __props.max,
25291
+ step: __props.step,
25292
+ value: unref(tempValue),
25293
+ style: normalizeStyle(inputStyles.value),
25294
+ onInput: _cache[0] || (_cache[0] = ($event) => update($event))
25295
+ }, null, 44, _hoisted_1$j);
25296
+ };
25297
+ }
25298
+ };
25299
+ const Range = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-c0059745"]]);
25300
+ const _hoisted_1$i = ["id", "disabled", "value"];
25301
+ const _hoisted_2$7 = { class: "zw-number-field__controls" };
25302
+ const _hoisted_3$3 = { class: "zw-number-field__buttons" };
25303
+ const _hoisted_4$2 = {
25304
+ key: 0,
25305
+ class: "zw-number-field__units"
25306
+ };
25307
+ const _sfc_main$C = {
25308
+ __name: "NumberField",
25309
+ props: {
25310
+ value: {
25311
+ required: true,
25312
+ type: [Number, String]
25313
+ },
25314
+ min: {
25315
+ type: [Number, String],
25316
+ required: false,
25317
+ default: null
25318
+ },
25319
+ max: {
25320
+ type: [Number, String],
25321
+ required: false,
25322
+ default: null
25323
+ },
25324
+ digits: {
25325
+ type: [Number, String],
25326
+ required: false,
25327
+ default: 2
25328
+ },
25329
+ step: {
25330
+ type: [Number, String],
25331
+ required: false,
25332
+ default: 1
25333
+ },
25334
+ units: {
25335
+ type: String,
25336
+ required: false,
25337
+ default: ""
25338
+ },
25339
+ disabled: {
25340
+ type: Boolean,
25341
+ required: false,
25342
+ default: false
25343
+ },
25344
+ fieldId: {
25345
+ type: String,
25346
+ required: false,
25347
+ default: ""
25348
+ }
25349
+ },
25350
+ emits: ["input"],
25351
+ setup(__props, { emit: __emit }) {
25352
+ const props = __props;
25353
+ const emit = __emit;
25354
+ const toOptionalNumber = (number) => number === null ? null : Number(number);
25355
+ const numberValue = useNumberValue({
25356
+ valueRef: toRef(props, "value"),
25357
+ onChange: (value) => emit("input", value),
25358
+ digits: Number(props.digits),
25359
+ min: toOptionalNumber(props.min),
25360
+ max: toOptionalNumber(props.max)
25361
+ });
25362
+ const onChange = (event) => numberValue.change(event.target.value);
25363
+ const incrementValue = () => numberValue.increment(Number(props.step));
25364
+ const decrementValue = () => numberValue.decrement(Number(props.step));
25365
+ const tempValue = computed(() => unref(numberValue.temp.value));
25366
+ const elementClasses = computed(() => ({
25367
+ "zw-number-field--disabled": props.disabled
25368
+ }));
25369
+ return (_ctx, _cache) => {
25370
+ return openBlock(), createElementBlock("label", {
25371
+ class: normalizeClass([elementClasses.value, "zw-number-field"])
25372
+ }, [
25373
+ createElementVNode("input", {
25374
+ type: "number",
25375
+ class: "zw-number-field__input",
25376
+ id: __props.fieldId,
25377
+ disabled: __props.disabled,
25378
+ value: tempValue.value,
25379
+ onChange
25380
+ }, null, 40, _hoisted_1$i),
25381
+ createElementVNode("div", _hoisted_2$7, [
25382
+ createElementVNode("div", _hoisted_3$3, [
25383
+ createVNode(unref(Button), {
25384
+ class: "zw-number-field__increment-button",
25385
+ onClick: incrementValue,
25386
+ disabled: __props.disabled,
25387
+ "data-test-selector": "increment-button",
25388
+ type: "button"
25389
+ }, null, 8, ["disabled"]),
25390
+ createVNode(unref(Button), {
25391
+ class: "zw-number-field__decrement-button",
25392
+ onClick: decrementValue,
25393
+ disabled: __props.disabled,
25394
+ "data-test-selector": "decrement-button",
25395
+ type: "button"
25396
+ }, null, 8, ["disabled"])
25397
+ ]),
25398
+ __props.units ? (openBlock(), createElementBlock("p", _hoisted_4$2, toDisplayString(__props.units), 1)) : createCommentVNode("", true)
25399
+ ])
25400
+ ], 2);
25401
+ };
25402
+ }
25403
+ };
25404
+ const NumberField = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-e462abc1"]]);
25405
+ const min = Math.min;
25406
+ const max = Math.max;
25407
+ const round = Math.round;
25408
+ const floor = Math.floor;
25409
+ const createCoords = (v) => ({
25410
+ x: v,
25411
+ y: v
25412
+ });
25413
+ function clamp(start2, value, end2) {
25414
+ return max(start2, min(value, end2));
25415
+ }
25416
+ function evaluate(value, param) {
25417
+ return typeof value === "function" ? value(param) : value;
25418
+ }
25419
+ function getSide(placement) {
25420
+ return placement.split("-")[0];
25421
+ }
25422
+ function getAlignment(placement) {
25423
+ return placement.split("-")[1];
25424
+ }
25425
+ function getOppositeAxis(axis) {
25426
+ return axis === "x" ? "y" : "x";
25427
+ }
25428
+ function getAxisLength(axis) {
25429
+ return axis === "y" ? "height" : "width";
25210
25430
  }
25211
25431
  function getSideAxis(placement) {
25212
25432
  return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
@@ -25762,11 +25982,11 @@ function getCssDimensions(element) {
25762
25982
  $: shouldFallback
25763
25983
  };
25764
25984
  }
25765
- function unwrapElement(element) {
25985
+ function unwrapElement$1(element) {
25766
25986
  return !isElement(element) ? element.contextElement : element;
25767
25987
  }
25768
25988
  function getScale(element) {
25769
- const domElement = unwrapElement(element);
25989
+ const domElement = unwrapElement$1(element);
25770
25990
  if (!isHTMLElement(domElement)) {
25771
25991
  return createCoords(1);
25772
25992
  }
@@ -25817,7 +26037,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
25817
26037
  isFixedStrategy = false;
25818
26038
  }
25819
26039
  const clientRect2 = element.getBoundingClientRect();
25820
- const domElement = unwrapElement(element);
26040
+ const domElement = unwrapElement$1(element);
25821
26041
  let scale = createCoords(1);
25822
26042
  if (includeScale) {
25823
26043
  if (offsetParent) {
@@ -26201,7 +26421,7 @@ function autoUpdate(reference2, floating, update, options) {
26201
26421
  layoutShift = typeof IntersectionObserver === "function",
26202
26422
  animationFrame = false
26203
26423
  } = options;
26204
- const referenceEl = unwrapElement(reference2);
26424
+ const referenceEl = unwrapElement$1(reference2);
26205
26425
  const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
26206
26426
  ancestors.forEach((ancestor) => {
26207
26427
  ancestorScroll && ancestor.addEventListener("scroll", update, {
@@ -26271,324 +26491,180 @@ const computePosition = (reference2, floating, options) => {
26271
26491
  platform: platformWithCache
26272
26492
  });
26273
26493
  };
26274
- function useModalToggler({ onBeforeOpened, onClosed, wrapperRef, modalRef } = {}) {
26275
- const editor = inject(InjectionTokens$1.EDITOR);
26276
- const isOpened = ref(false);
26277
- let floatingInstance;
26278
- function initModal() {
26279
- const wrapperEl = useElementRef(wrapperRef);
26280
- const modalEl = useElementRef(modalRef);
26281
- floatingInstance = autoUpdate(wrapperEl.value, modalEl.value, async () => {
26282
- const positioning = await computePosition(wrapperEl.value, modalEl.value, {
26283
- placement: "bottom",
26284
- strategy: "fixed",
26285
- middleware: [
26286
- shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
26287
- offset({ mainAxis: 4 })
26288
- ]
26289
- });
26290
- const { x, y } = positioning;
26291
- Object.assign(modalEl.value, {
26292
- left: `${x}px`,
26293
- top: `${y}px`
26294
- });
26295
- });
26296
- }
26297
- async function open() {
26298
- if (isOpened.value)
26299
- return;
26300
- onBeforeOpened == null ? void 0 : onBeforeOpened();
26301
- editor.commands.storeSelection();
26302
- isOpened.value = true;
26303
- await nextTick();
26304
- initModal();
26305
- }
26306
- function close2() {
26307
- isOpened.value = false;
26308
- floatingInstance == null ? void 0 : floatingInstance();
26309
- editor.commands.restoreSelection();
26310
- onClosed == null ? void 0 : onClosed();
26311
- }
26312
- const toggle = (toOpen) => toOpen ? open() : close2();
26313
- return { isOpened, open, close: close2, toggle };
26494
+ function unwrapElement(element) {
26495
+ var _$el;
26496
+ return (_$el = element == null ? void 0 : element.$el) != null ? _$el : element;
26314
26497
  }
26315
- function useActivatedListener({ targetRef, isActiveRef, event, onEvent, options }) {
26316
- function addListener() {
26317
- targetRef.value.addEventListener(event, onEvent, options);
26318
- }
26319
- function removeListener() {
26320
- var _a2;
26321
- (_a2 = targetRef.value) == null ? void 0 : _a2.removeEventListener(event, onEvent, options);
26322
- }
26323
- function updateListener() {
26324
- if (!targetRef.value)
26325
- return;
26326
- isActiveRef.value ? addListener() : removeListener();
26498
+ function getDPR(element) {
26499
+ if (typeof window === "undefined") {
26500
+ return 1;
26327
26501
  }
26328
- watch(isActiveRef, updateListener);
26329
- watch(targetRef, updateListener);
26330
- onUnmounted(removeListener);
26331
- updateListener();
26502
+ const win = element.ownerDocument.defaultView || window;
26503
+ return win.devicePixelRatio || 1;
26332
26504
  }
26333
- const INTERACTIVE_TAGS = [
26334
- "BUTTON",
26335
- "INPUT",
26336
- "LABEL",
26337
- "A"
26338
- ];
26339
- function useDeselectionLock({ hostRef, isActiveRef }) {
26340
- const editor = inject(InjectionTokens$1.EDITOR);
26341
- const targetRef = useElementRef(hostRef);
26342
- function onEvent(event) {
26343
- if (INTERACTIVE_TAGS.includes(event.target.tagName))
26344
- return;
26345
- if (editor.isFocused) {
26346
- event.stopPropagation();
26347
- event.preventDefault();
26348
- }
26349
- editor.chain().restoreSelection().run();
26350
- }
26351
- useActivatedListener({
26352
- event: "mousedown",
26353
- targetRef,
26354
- isActiveRef,
26355
- onEvent
26356
- });
26505
+ function roundByDPR(element, value) {
26506
+ const dpr = getDPR(element);
26507
+ return Math.round(value * dpr) / dpr;
26357
26508
  }
26358
- const SCROLL_VIEW = Symbol("scrollView");
26359
- function useScrollView() {
26360
- const scrollerRef = inject(SCROLL_VIEW);
26361
- function scrollToElement(element, { offset: offset2 } = {}) {
26362
- if (!scrollerRef.value)
26363
- return;
26364
- const rootRect = scrollerRef.value.getBoundingClientRect();
26365
- const elementRect = element.getBoundingClientRect();
26366
- const position = elementRect.top - rootRect.top;
26367
- scrollerRef.value.scrollTo({
26368
- top: position - (offset2 || 0)
26369
- });
26509
+ function useFloating(reference2, floating, options) {
26510
+ if (options === void 0) {
26511
+ options = {};
26370
26512
  }
26371
- return { scrollToElement };
26372
- }
26373
- const ScrollView_vue_vue_type_style_index_0_scoped_07fd5408_lang = "";
26374
- const _sfc_main$D = {
26375
- __name: "ScrollView",
26376
- setup(__props) {
26377
- const hostRef = ref(null);
26378
- const scrollerRef = ref(null);
26379
- provide(SCROLL_VIEW, scrollerRef);
26380
- onMounted(() => {
26381
- const options = SimpleBar.getOptions(hostRef.value.attributes);
26382
- const simpleBar = new SimpleBar(hostRef.value, options);
26383
- scrollerRef.value = simpleBar.getScrollElement();
26384
- });
26385
- return (_ctx, _cache) => {
26386
- return openBlock(), createElementBlock("div", {
26387
- class: "zw-scroll-view",
26388
- "data-simplebar-auto-hide": "false",
26389
- ref_key: "hostRef",
26390
- ref: hostRef
26391
- }, [
26392
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
26393
- ], 512);
26513
+ const whileElementsMountedOption = options.whileElementsMounted;
26514
+ const openOption = computed(() => {
26515
+ var _unref;
26516
+ return (_unref = unref(options.open)) != null ? _unref : true;
26517
+ });
26518
+ const middlewareOption = computed(() => unref(options.middleware));
26519
+ const placementOption = computed(() => {
26520
+ var _unref2;
26521
+ return (_unref2 = unref(options.placement)) != null ? _unref2 : "bottom";
26522
+ });
26523
+ const strategyOption = computed(() => {
26524
+ var _unref3;
26525
+ return (_unref3 = unref(options.strategy)) != null ? _unref3 : "absolute";
26526
+ });
26527
+ const transformOption = computed(() => {
26528
+ var _unref4;
26529
+ return (_unref4 = unref(options.transform)) != null ? _unref4 : true;
26530
+ });
26531
+ const referenceElement = computed(() => unwrapElement(reference2.value));
26532
+ const floatingElement = computed(() => unwrapElement(floating.value));
26533
+ const x = ref(0);
26534
+ const y = ref(0);
26535
+ const strategy = ref(strategyOption.value);
26536
+ const placement = ref(placementOption.value);
26537
+ const middlewareData = shallowRef({});
26538
+ const isPositioned = ref(false);
26539
+ const floatingStyles = computed(() => {
26540
+ const initialStyles = {
26541
+ position: strategy.value,
26542
+ left: "0",
26543
+ top: "0"
26394
26544
  };
26395
- }
26396
- };
26397
- const ScrollView = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-07fd5408"]]);
26398
- const FieldLabel_vue_vue_type_style_index_0_scoped_7ab8105c_lang = "";
26399
- const _hoisted_1$k = ["for"];
26400
- const _sfc_main$C = {
26401
- __name: "FieldLabel",
26402
- props: {
26403
- fieldId: {
26404
- type: String,
26405
- required: false,
26406
- default: null
26545
+ if (!floatingElement.value) {
26546
+ return initialStyles;
26407
26547
  }
26408
- },
26409
- setup(__props) {
26410
- return (_ctx, _cache) => {
26411
- return openBlock(), createElementBlock("label", {
26412
- class: "zw-field-label",
26413
- for: __props.fieldId
26414
- }, [
26415
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
26416
- ], 8, _hoisted_1$k);
26548
+ const xVal = roundByDPR(floatingElement.value, x.value);
26549
+ const yVal = roundByDPR(floatingElement.value, y.value);
26550
+ if (transformOption.value) {
26551
+ return {
26552
+ ...initialStyles,
26553
+ transform: "translate(" + xVal + "px, " + yVal + "px)",
26554
+ ...getDPR(floatingElement.value) >= 1.5 && {
26555
+ willChange: "transform"
26556
+ }
26557
+ };
26558
+ }
26559
+ return {
26560
+ position: strategy.value,
26561
+ left: xVal + "px",
26562
+ top: yVal + "px"
26417
26563
  };
26418
- }
26419
- };
26420
- const FieldLabel = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-7ab8105c"]]);
26421
- const Range_vue_vue_type_style_index_0_scoped_c0059745_lang = "";
26422
- const _hoisted_1$j = ["id", "min", "max", "step", "value"];
26423
- const _sfc_main$B = {
26424
- __name: "Range",
26425
- props: {
26426
- min: {
26427
- type: [String, Number],
26428
- required: true
26429
- },
26430
- max: {
26431
- type: [String, Number],
26432
- required: true
26433
- },
26434
- step: {
26435
- type: [String, Number],
26436
- required: true
26437
- },
26438
- value: {
26439
- type: [String, Number],
26440
- required: true
26441
- },
26442
- fieldId: {
26443
- type: String,
26444
- required: false,
26445
- default: ""
26564
+ });
26565
+ let whileElementsMountedCleanup;
26566
+ function update() {
26567
+ if (referenceElement.value == null || floatingElement.value == null) {
26568
+ return;
26446
26569
  }
26447
- },
26448
- emits: ["input"],
26449
- setup(__props, { emit }) {
26450
- const props = __props;
26451
- const tempValue = useTempValue({
26452
- valueRef: toRef(props, "value"),
26453
- format: Number
26570
+ computePosition(referenceElement.value, floatingElement.value, {
26571
+ middleware: middlewareOption.value,
26572
+ placement: placementOption.value,
26573
+ strategy: strategyOption.value
26574
+ }).then((position) => {
26575
+ x.value = position.x;
26576
+ y.value = position.y;
26577
+ strategy.value = position.strategy;
26578
+ placement.value = position.placement;
26579
+ middlewareData.value = position.middlewareData;
26580
+ isPositioned.value = true;
26454
26581
  });
26455
- const inputStyles = computed(() => {
26456
- const min2 = Number(props.min);
26457
- const max2 = Number(props.max);
26458
- const step = Number(props.step);
26459
- const value = Math.ceil(tempValue.value / step) * step;
26460
- const progress = (value - min2) / (max2 - min2);
26461
- return { "--zw-range-progress": `${progress * 100}%` };
26462
- });
26463
- function update(event) {
26464
- tempValue.value = Number(event.target.value);
26465
- emit("input", tempValue.value);
26466
- }
26467
- return (_ctx, _cache) => {
26468
- return openBlock(), createElementBlock("input", {
26469
- class: "zw-range",
26470
- type: "range",
26471
- id: __props.fieldId,
26472
- min: __props.min,
26473
- max: __props.max,
26474
- step: __props.step,
26475
- value: unref(tempValue),
26476
- style: normalizeStyle(inputStyles.value),
26477
- onInput: _cache[0] || (_cache[0] = ($event) => update($event))
26478
- }, null, 44, _hoisted_1$j);
26479
- };
26480
26582
  }
26481
- };
26482
- const Range = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-c0059745"]]);
26483
- const NumberField_vue_vue_type_style_index_0_scoped_e462abc1_lang = "";
26484
- const _hoisted_1$i = ["id", "disabled", "value"];
26485
- const _hoisted_2$8 = { class: "zw-number-field__controls" };
26486
- const _hoisted_3$3 = { class: "zw-number-field__buttons" };
26487
- const _hoisted_4$2 = {
26488
- key: 0,
26489
- class: "zw-number-field__units"
26490
- };
26491
- const _sfc_main$A = {
26492
- __name: "NumberField",
26583
+ function cleanup() {
26584
+ if (typeof whileElementsMountedCleanup === "function") {
26585
+ whileElementsMountedCleanup();
26586
+ whileElementsMountedCleanup = void 0;
26587
+ }
26588
+ }
26589
+ function attach() {
26590
+ cleanup();
26591
+ if (whileElementsMountedOption === void 0) {
26592
+ update();
26593
+ return;
26594
+ }
26595
+ if (referenceElement.value != null && floatingElement.value != null) {
26596
+ whileElementsMountedCleanup = whileElementsMountedOption(referenceElement.value, floatingElement.value, update);
26597
+ return;
26598
+ }
26599
+ }
26600
+ function reset2() {
26601
+ if (!openOption.value) {
26602
+ isPositioned.value = false;
26603
+ }
26604
+ }
26605
+ watch([middlewareOption, placementOption, strategyOption], update, {
26606
+ flush: "sync"
26607
+ });
26608
+ watch([referenceElement, floatingElement], attach, {
26609
+ flush: "sync"
26610
+ });
26611
+ watch(openOption, reset2, {
26612
+ flush: "sync"
26613
+ });
26614
+ if (getCurrentScope()) {
26615
+ onScopeDispose(cleanup);
26616
+ }
26617
+ return {
26618
+ x: shallowReadonly(x),
26619
+ y: shallowReadonly(y),
26620
+ strategy: shallowReadonly(strategy),
26621
+ placement: shallowReadonly(placement),
26622
+ middlewareData: shallowReadonly(middlewareData),
26623
+ isPositioned: shallowReadonly(isPositioned),
26624
+ floatingStyles,
26625
+ update
26626
+ };
26627
+ }
26628
+ const _sfc_main$B = {
26629
+ __name: "ModalFloating",
26493
26630
  props: {
26494
- value: {
26495
- required: true,
26496
- type: [Number, String]
26497
- },
26498
- min: {
26499
- type: [Number, String],
26500
- required: false,
26501
- default: null
26502
- },
26503
- max: {
26504
- type: [Number, String],
26505
- required: false,
26506
- default: null
26507
- },
26508
- digits: {
26509
- type: [Number, String],
26510
- required: false,
26511
- default: 2
26512
- },
26513
- step: {
26514
- type: [Number, String],
26515
- required: false,
26516
- default: 1
26517
- },
26518
- units: {
26519
- type: String,
26520
- required: false,
26521
- default: ""
26522
- },
26523
- disabled: {
26524
- type: Boolean,
26525
- required: false,
26526
- default: false
26527
- },
26528
- fieldId: {
26529
- type: String,
26530
- required: false,
26531
- default: ""
26631
+ referenceRef: {
26632
+ type: Object,
26633
+ required: true
26532
26634
  }
26533
26635
  },
26534
- emits: ["input"],
26535
- setup(__props, { emit }) {
26636
+ setup(__props) {
26536
26637
  const props = __props;
26537
- const toOptionalNumber = (number) => number === null ? null : Number(number);
26538
- const numberValue = useNumberValue({
26539
- valueRef: toRef(props, "value"),
26540
- onChange: (value) => emit("input", value),
26541
- digits: Number(props.digits),
26542
- min: toOptionalNumber(props.min),
26543
- max: toOptionalNumber(props.max)
26638
+ const floatingRef = ref(null);
26639
+ const referenceRef = toRef(props, "referenceRef");
26640
+ const { floatingStyles } = useFloating(referenceRef, floatingRef, {
26641
+ placement: "bottom",
26642
+ strategy: "fixed",
26643
+ middleware: [
26644
+ shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
26645
+ offset({ mainAxis: 4 })
26646
+ ],
26647
+ whileElementsMounted: autoUpdate
26544
26648
  });
26545
- const onChange = (event) => numberValue.change(event.target.value);
26546
- const incrementValue = () => numberValue.increment(Number(props.step));
26547
- const decrementValue = () => numberValue.decrement(Number(props.step));
26548
- const tempValue = computed(() => unref(numberValue.temp.value));
26549
- const elementClasses = computed(() => ({
26550
- "zw-number-field--disabled": props.disabled
26551
- }));
26552
26649
  return (_ctx, _cache) => {
26553
- return openBlock(), createElementBlock("label", {
26554
- class: normalizeClass([elementClasses.value, "zw-number-field"])
26650
+ return openBlock(), createElementBlock("div", {
26651
+ ref_key: "floatingRef",
26652
+ ref: floatingRef,
26653
+ style: normalizeStyle(unref(floatingStyles))
26555
26654
  }, [
26556
- createElementVNode("input", {
26557
- type: "number",
26558
- class: "zw-number-field__input",
26559
- id: __props.fieldId,
26560
- disabled: __props.disabled,
26561
- value: tempValue.value,
26562
- onChange
26563
- }, null, 40, _hoisted_1$i),
26564
- createElementVNode("div", _hoisted_2$8, [
26565
- createElementVNode("div", _hoisted_3$3, [
26566
- createVNode(unref(Button), {
26567
- class: "zw-number-field__increment-button",
26568
- onClick: incrementValue,
26569
- disabled: __props.disabled,
26570
- "data-test-selector": "increment-button",
26571
- type: "button"
26572
- }, null, 8, ["disabled"]),
26573
- createVNode(unref(Button), {
26574
- class: "zw-number-field__decrement-button",
26575
- onClick: decrementValue,
26576
- disabled: __props.disabled,
26577
- "data-test-selector": "decrement-button",
26578
- type: "button"
26579
- }, null, 8, ["disabled"])
26580
- ]),
26581
- __props.units ? (openBlock(), createElementBlock("p", _hoisted_4$2, toDisplayString(__props.units), 1)) : createCommentVNode("", true)
26582
- ])
26583
- ], 2);
26655
+ renderSlot(_ctx.$slots, "default")
26656
+ ], 4);
26584
26657
  };
26585
26658
  }
26586
26659
  };
26587
- const NumberField = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-e462abc1"]]);
26588
- const Modal_vue_vue_type_style_index_0_scoped_5be0e050_lang = "";
26589
- const _sfc_main$z = {
26660
+ const _sfc_main$A = {
26590
26661
  __name: "Modal",
26591
26662
  props: {
26663
+ referenceRef: {
26664
+ type: Object,
26665
+ required: false,
26666
+ default: null
26667
+ },
26592
26668
  toggler: {
26593
26669
  type: Object,
26594
26670
  required: false,
@@ -26611,25 +26687,24 @@ const _sfc_main$z = {
26611
26687
  }
26612
26688
  },
26613
26689
  setup(__props) {
26690
+ useCssVars((_ctx) => ({
26691
+ "3cdf9de8": __props.maxHeight + "px",
26692
+ "8ae6b87e": __props.maxWidth + "px"
26693
+ }));
26614
26694
  const props = __props;
26615
- const transition = {
26695
+ const transitionDuration = {
26616
26696
  enter: 200,
26617
26697
  leave: 100
26618
26698
  };
26619
26699
  const toggler = props.toggler || useModalToggler();
26620
- const isOpened = computed(() => unref(toggler.isOpened));
26621
26700
  const hostRef = ref(null);
26622
26701
  const hostEl = useElementRef(hostRef);
26623
- const modalStyles = computed(() => ({
26624
- "--zw-modal-max-height": `${props.maxHeight}px`,
26625
- "--zw-modal-max-width": `${props.maxWidth}px`
26626
- }));
26627
26702
  useDeselectionLock({
26628
- isActiveRef: toggler.isOpened,
26703
+ isActiveRef: toRef(toggler, "isOpened"),
26629
26704
  hostRef
26630
26705
  });
26631
26706
  if (props.focusFirstControl) {
26632
- watch(toggler.isOpened, async (_, wasOpened) => {
26707
+ watch(toRef(toggler, "isOpened"), async (_, wasOpened) => {
26633
26708
  if (wasOpened)
26634
26709
  return;
26635
26710
  await nextTick();
@@ -26640,20 +26715,23 @@ const _sfc_main$z = {
26640
26715
  return (_ctx, _cache) => {
26641
26716
  return openBlock(), createBlock(Transition, {
26642
26717
  name: "zw-modal-",
26643
- duration: transition
26718
+ duration: transitionDuration
26644
26719
  }, {
26645
26720
  default: withCtx(() => [
26646
- isOpened.value ? withDirectives((openBlock(), createElementBlock("div", {
26721
+ unref(toggler).isOpened && __props.referenceRef ? withDirectives((openBlock(), createBlock(unref(_sfc_main$B), {
26647
26722
  key: 0,
26648
26723
  class: "zw-modal",
26649
26724
  ref_key: "hostRef",
26650
26725
  ref: hostRef,
26651
26726
  tabindex: "-1",
26652
- style: normalizeStyle(modalStyles.value),
26727
+ "reference-ref": __props.referenceRef,
26653
26728
  "data-test-selector": "modal"
26654
- }, [
26655
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
26656
- ], 4)), [
26729
+ }, {
26730
+ default: withCtx(() => [
26731
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
26732
+ ], void 0, true),
26733
+ _: 3
26734
+ }, 8, ["reference-ref"])), [
26657
26735
  [unref(outClick), unref(toggler).close]
26658
26736
  ]) : createCommentVNode("", true)
26659
26737
  ], void 0, true),
@@ -26662,17 +26740,16 @@ const _sfc_main$z = {
26662
26740
  };
26663
26741
  }
26664
26742
  };
26665
- const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-5be0e050"]]);
26666
- const TextField_vue_vue_type_style_index_0_scoped_dfa0d6f0_lang = "";
26743
+ const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-078bbe11"]]);
26667
26744
  const _hoisted_1$h = { class: "zw-field" };
26668
- const _hoisted_2$7 = ["for"];
26745
+ const _hoisted_2$6 = ["for"];
26669
26746
  const _hoisted_3$2 = ["value", "id", "placeholder"];
26670
26747
  const _hoisted_4$1 = {
26671
26748
  key: 0,
26672
26749
  class: "zw-field__label--error",
26673
26750
  "data-test-selector": "error"
26674
26751
  };
26675
- const _sfc_main$y = {
26752
+ const _sfc_main$z = {
26676
26753
  __name: "TextField",
26677
26754
  props: {
26678
26755
  value: {
@@ -26695,8 +26772,9 @@ const _sfc_main$y = {
26695
26772
  }
26696
26773
  },
26697
26774
  emits: ["input"],
26698
- setup(__props, { emit }) {
26775
+ setup(__props, { emit: __emit }) {
26699
26776
  const props = __props;
26777
+ const emit = __emit;
26700
26778
  const onInput = (event) => emit("input", event.target.value);
26701
26779
  const fieldId = computed(() => {
26702
26780
  return props.label.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase());
@@ -26707,7 +26785,7 @@ const _sfc_main$y = {
26707
26785
  class: "zw-field__label",
26708
26786
  for: fieldId.value,
26709
26787
  "data-test-selector": "label"
26710
- }, toDisplayString(__props.label), 9, _hoisted_2$7),
26788
+ }, toDisplayString(__props.label), 9, _hoisted_2$6),
26711
26789
  createElementVNode("input", {
26712
26790
  class: "zw-field__input",
26713
26791
  type: "text",
@@ -26722,14 +26800,13 @@ const _sfc_main$y = {
26722
26800
  };
26723
26801
  }
26724
26802
  };
26725
- const TextField = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-dfa0d6f0"]]);
26726
- const Checkbox_vue_vue_type_style_index_0_scoped_6e170d87_lang = "";
26803
+ const TextField = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-dfa0d6f0"]]);
26727
26804
  const _withScopeId$2 = (n) => (pushScopeId("data-v-6e170d87"), n = n(), popScopeId(), n);
26728
26805
  const _hoisted_1$g = { class: "zw-checkbox" };
26729
- const _hoisted_2$6 = ["checked"];
26806
+ const _hoisted_2$5 = ["checked"];
26730
26807
  const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "zw-checkbox__indicator zw-margin-right--xs" }, null, -1));
26731
26808
  const _hoisted_4 = { class: "zw-checkbox__label" };
26732
- const _sfc_main$x = {
26809
+ const _sfc_main$y = {
26733
26810
  __name: "Checkbox",
26734
26811
  props: {
26735
26812
  value: {
@@ -26743,8 +26820,9 @@ const _sfc_main$x = {
26743
26820
  }
26744
26821
  },
26745
26822
  emits: ["input"],
26746
- setup(__props, { emit }) {
26823
+ setup(__props, { emit: __emit }) {
26747
26824
  const props = __props;
26825
+ const emit = __emit;
26748
26826
  const onCheckedChanged = () => emit("input", !props.value);
26749
26827
  return (_ctx, _cache) => {
26750
26828
  return openBlock(), createElementBlock("label", _hoisted_1$g, [
@@ -26753,14 +26831,14 @@ const _sfc_main$x = {
26753
26831
  type: "checkbox",
26754
26832
  checked: __props.value,
26755
26833
  onClick: onCheckedChanged
26756
- }, null, 8, _hoisted_2$6),
26834
+ }, null, 8, _hoisted_2$5),
26757
26835
  _hoisted_3$1,
26758
26836
  createElementVNode("span", _hoisted_4, toDisplayString(__props.label), 1)
26759
26837
  ]);
26760
26838
  };
26761
26839
  }
26762
26840
  };
26763
- const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-6e170d87"]]);
26841
+ const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-6e170d87"]]);
26764
26842
  const InjectionTokens = Object.freeze({
26765
26843
  ACTIVE_MANAGER: Symbol("dropdownActiveManager"),
26766
26844
  TOGGLER: Symbol("dropdownToggler"),
@@ -26789,14 +26867,13 @@ function useDropdownEntityTitle(entityRef) {
26789
26867
  return ((_a2 = entityRef.value) == null ? void 0 : _a2.title) || ((_b = entityRef.value) == null ? void 0 : _b.id) || "";
26790
26868
  });
26791
26869
  }
26792
- const DropdownActivator_vue_vue_type_style_index_0_scoped_c73e0119_lang = "";
26793
26870
  const _hoisted_1$f = { class: "zw-dropdown__activator-title zw-text--truncate" };
26794
- const _hoisted_2$5 = {
26871
+ const _hoisted_2$4 = {
26795
26872
  key: 0,
26796
26873
  class: "zw-dropdown__customized-indicator",
26797
26874
  "data-test-selector": "customizedIndicator"
26798
26875
  };
26799
- const _sfc_main$w = {
26876
+ const _sfc_main$x = {
26800
26877
  __name: "DropdownActivator",
26801
26878
  props: {
26802
26879
  color: {
@@ -26814,27 +26891,26 @@ const _sfc_main$w = {
26814
26891
  const props = __props;
26815
26892
  const activeOptionManager = inject(InjectionTokens.ACTIVE_MANAGER);
26816
26893
  const dropdownToggler = inject(InjectionTokens.TOGGLER);
26817
- const isOpened = computed(() => unref(dropdownToggler.isOpened));
26818
26894
  const color = toRef(props, "color");
26819
26895
  const activeOptionTitle = useDropdownEntityTitle(activeOptionManager.activeOption);
26820
26896
  const dropdownClasses = computed(() => ({
26821
- "zw-dropdown__activator--active": dropdownToggler.isOpened.value,
26897
+ "zw-dropdown__activator--active": dropdownToggler.isOpened,
26822
26898
  "zw-dropdown__activator--gray": color.value === "gray"
26823
26899
  }));
26824
26900
  return (_ctx, _cache) => {
26825
26901
  return renderSlot(_ctx.$slots, "default", {
26826
26902
  open: unref(dropdownToggler).open,
26827
- isOpened: isOpened.value
26903
+ isOpened: unref(dropdownToggler).isOpened
26828
26904
  }, () => [
26829
26905
  createVNode(unref(Button), {
26830
26906
  skin: "toolbar",
26831
26907
  class: normalizeClass(["zw-dropdown__activator", dropdownClasses.value]),
26832
- active: isOpened.value,
26908
+ active: unref(dropdownToggler).isOpened,
26833
26909
  onClick: unref(dropdownToggler).open
26834
26910
  }, {
26835
26911
  default: withCtx(() => [
26836
26912
  createElementVNode("span", _hoisted_1$f, toDisplayString(unref(activeOptionTitle)), 1),
26837
- __props.isCustomized ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$5, null, 512)), [
26913
+ __props.isCustomized ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$4, null, 512)), [
26838
26914
  [
26839
26915
  unref(tooltip),
26840
26916
  "Style differs from Page Styles",
@@ -26855,9 +26931,8 @@ const _sfc_main$w = {
26855
26931
  };
26856
26932
  }
26857
26933
  };
26858
- const DropdownActivator = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-c73e0119"]]);
26859
- const DropdownOption_vue_vue_type_style_index_0_scoped_2e8320d2_lang = "";
26860
- const _sfc_main$v = {
26934
+ const DropdownActivator = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-678de368"]]);
26935
+ const _sfc_main$w = {
26861
26936
  __name: "DropdownOption",
26862
26937
  props: {
26863
26938
  option: {
@@ -26908,11 +26983,10 @@ const _sfc_main$v = {
26908
26983
  };
26909
26984
  }
26910
26985
  };
26911
- const DropdownOption = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-2e8320d2"]]);
26912
- const DropdownGroup_vue_vue_type_style_index_0_scoped_2239aa7b_lang = "";
26986
+ const DropdownOption = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-2e8320d2"]]);
26913
26987
  const _hoisted_1$e = { class: "zw-dropdown__group" };
26914
- const _hoisted_2$4 = { class: "zw-dropdown__group-title" };
26915
- const _sfc_main$u = {
26988
+ const _hoisted_2$3 = { class: "zw-dropdown__group-title" };
26989
+ const _sfc_main$v = {
26916
26990
  __name: "DropdownGroup",
26917
26991
  props: {
26918
26992
  group: {
@@ -26925,7 +26999,7 @@ const _sfc_main$u = {
26925
26999
  const groupTitle = useDropdownEntityTitle(toRef(props, "group"));
26926
27000
  return (_ctx, _cache) => {
26927
27001
  return openBlock(), createElementBlock("div", _hoisted_1$e, [
26928
- createElementVNode("p", _hoisted_2$4, toDisplayString(unref(groupTitle)), 1),
27002
+ createElementVNode("p", _hoisted_2$3, toDisplayString(unref(groupTitle)), 1),
26929
27003
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(__props.group.options, (option) => {
26930
27004
  return renderSlot(_ctx.$slots, "option", { option }, () => [
26931
27005
  createVNode(unref(DropdownOption), { option }, null, 8, ["option"])
@@ -26935,20 +27009,18 @@ const _sfc_main$u = {
26935
27009
  };
26936
27010
  }
26937
27011
  };
26938
- const DropdownGroup = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-2239aa7b"]]);
26939
- const DropdownDivider_vue_vue_type_style_index_0_scoped_91a22273_lang = "";
26940
- const _sfc_main$t = {};
27012
+ const DropdownGroup = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-2239aa7b"]]);
27013
+ const _sfc_main$u = {};
26941
27014
  const _hoisted_1$d = { class: "zw-dropdown__divider" };
26942
27015
  function _sfc_render$1(_ctx, _cache) {
26943
27016
  return openBlock(), createElementBlock("div", _hoisted_1$d);
26944
27017
  }
26945
- const DropdownDivider = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$1], ["__scopeId", "data-v-91a22273"]]);
26946
- const DropdownMenu_vue_vue_type_style_index_0_lang = "";
27018
+ const DropdownDivider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$1], ["__scopeId", "data-v-91a22273"]]);
26947
27019
  const _hoisted_1$c = {
26948
27020
  class: "zw-dropdown__menu",
26949
27021
  "data-test-selector": "dropdownMenu"
26950
27022
  };
26951
- const _sfc_main$s = {
27023
+ const _sfc_main$t = {
26952
27024
  __name: "DropdownMenu",
26953
27025
  props: {
26954
27026
  options: {
@@ -26992,8 +27064,7 @@ const _sfc_main$s = {
26992
27064
  };
26993
27065
  }
26994
27066
  };
26995
- const Dropdown_vue_vue_type_style_index_0_scoped_c59753d1_lang = "";
26996
- const _sfc_main$r = {
27067
+ const _sfc_main$s = {
26997
27068
  __name: "Dropdown",
26998
27069
  props: {
26999
27070
  value: {
@@ -27022,20 +27093,17 @@ const _sfc_main$r = {
27022
27093
  }
27023
27094
  },
27024
27095
  emits: ["change"],
27025
- setup(__props, { emit }) {
27096
+ setup(__props, { emit: __emit }) {
27026
27097
  const props = __props;
27098
+ const emit = __emit;
27027
27099
  const dropdownRef = ref(null);
27028
- const modalRef = ref(null);
27029
27100
  const activeOptionManager = useActiveOptionManager({
27030
27101
  optionsRef: toRef(props, "options"),
27031
27102
  inputRef: toRef(props, "value"),
27032
27103
  stateless: props.value === null,
27033
27104
  onChange: (value) => emit("change", value.id)
27034
27105
  });
27035
- const toggler = useModalToggler({
27036
- wrapperRef: dropdownRef,
27037
- modalRef
27038
- });
27106
+ const toggler = useModalToggler();
27039
27107
  provide(InjectionTokens.ACTIVE_MANAGER, activeOptionManager);
27040
27108
  provide(InjectionTokens.TOGGLER, toggler);
27041
27109
  return (_ctx, _cache) => {
@@ -27057,11 +27125,10 @@ const _sfc_main$r = {
27057
27125
  "max-height": "300",
27058
27126
  "max-width": __props.maxWidth,
27059
27127
  toggler: unref(toggler),
27060
- ref_key: "modalRef",
27061
- ref: modalRef
27128
+ "reference-ref": dropdownRef.value
27062
27129
  }, {
27063
27130
  default: withCtx(() => [
27064
- createVNode(unref(_sfc_main$s), { options: __props.options }, {
27131
+ createVNode(unref(_sfc_main$t), { options: __props.options }, {
27065
27132
  option: withCtx((attrs) => [
27066
27133
  renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(attrs)), void 0, true)
27067
27134
  ]),
@@ -27069,12 +27136,12 @@ const _sfc_main$r = {
27069
27136
  }, 8, ["options"])
27070
27137
  ], void 0, true),
27071
27138
  _: 3
27072
- }, 8, ["max-width", "toggler"])
27139
+ }, 8, ["max-width", "toggler", "reference-ref"])
27073
27140
  ], 512);
27074
27141
  };
27075
27142
  }
27076
27143
  };
27077
- const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-c59753d1"]]);
27144
+ const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-0d65726d"]]);
27078
27145
  function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened }) {
27079
27146
  const isOpened = computed(() => {
27080
27147
  var _a2;
@@ -27141,7 +27208,7 @@ function usePickerHotkeys({ isOpenedRef, onCancel, onApply }) {
27141
27208
  options: { capture: true }
27142
27209
  });
27143
27210
  }
27144
- const _sfc_main$q = {
27211
+ const _sfc_main$r = {
27145
27212
  __name: "ColorPicker",
27146
27213
  props: {
27147
27214
  value: {
@@ -27150,8 +27217,9 @@ const _sfc_main$q = {
27150
27217
  }
27151
27218
  },
27152
27219
  emits: ["change"],
27153
- setup(__props, { emit }) {
27220
+ setup(__props, { emit: __emit }) {
27154
27221
  const props = __props;
27222
+ const emit = __emit;
27155
27223
  const favoriteColorsService = inject(InjectionTokens$1.FAVORITE_COLORS);
27156
27224
  const editor = inject(InjectionTokens$1.EDITOR);
27157
27225
  const pickerRef = ref(null);
@@ -27211,12 +27279,11 @@ function useRecentFonts({ limit }) {
27211
27279
  const isEmpty = computed(() => !fonts.value.length);
27212
27280
  return { fonts, isEmpty, add };
27213
27281
  }
27214
- const FontFamilyControl_vue_vue_type_style_index_0_scoped_3931975f_lang = "";
27215
27282
  const _hoisted_1$b = {
27216
27283
  key: 0,
27217
27284
  class: "zw-dropdown__default-option"
27218
27285
  };
27219
- const _sfc_main$p = {
27286
+ const _sfc_main$q = {
27220
27287
  __name: "FontFamilyControl",
27221
27288
  setup(__props) {
27222
27289
  const fonts = inject(InjectionTokens$1.FONTS);
@@ -27285,13 +27352,12 @@ const _sfc_main$p = {
27285
27352
  };
27286
27353
  }
27287
27354
  };
27288
- const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-3931975f"]]);
27289
- const FontWeightControl_vue_vue_type_style_index_0_scoped_54f744a9_lang = "";
27355
+ const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-3931975f"]]);
27290
27356
  const _hoisted_1$a = {
27291
27357
  key: 0,
27292
27358
  class: "zw-dropdown__default-option"
27293
27359
  };
27294
- const _sfc_main$o = {
27360
+ const _sfc_main$p = {
27295
27361
  __name: "FontWeightControl",
27296
27362
  setup(__props) {
27297
27363
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27335,13 +27401,12 @@ const _sfc_main$o = {
27335
27401
  };
27336
27402
  }
27337
27403
  };
27338
- const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-54f744a9"]]);
27339
- const FontSizeControl_vue_vue_type_style_index_0_scoped_9452b945_lang = "";
27404
+ const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-54f744a9"]]);
27340
27405
  const _hoisted_1$9 = {
27341
27406
  key: 0,
27342
27407
  class: "zw-dropdown__default-option"
27343
27408
  };
27344
- const _sfc_main$n = {
27409
+ const _sfc_main$o = {
27345
27410
  __name: "FontSizeControl",
27346
27411
  setup(__props) {
27347
27412
  const fontSizes = inject(InjectionTokens$1.FONT_SIZES);
@@ -27386,13 +27451,13 @@ const _sfc_main$n = {
27386
27451
  };
27387
27452
  }
27388
27453
  };
27389
- const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-9452b945"]]);
27454
+ const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-9452b945"]]);
27390
27455
  const _hoisted_1$8 = {
27391
27456
  key: 0,
27392
27457
  class: "zw-button__customized-indicator",
27393
27458
  "data-test-selector": "customizedIndicator"
27394
27459
  };
27395
- const _sfc_main$m = {
27460
+ const _sfc_main$n = {
27396
27461
  __name: "FontColorControl",
27397
27462
  setup(__props) {
27398
27463
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27400,7 +27465,7 @@ const _sfc_main$m = {
27400
27465
  const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_COLOR);
27401
27466
  const apply2 = (color) => editor.chain().applyFontColor(color).run();
27402
27467
  return (_ctx, _cache) => {
27403
- return openBlock(), createBlock(unref(_sfc_main$q), {
27468
+ return openBlock(), createBlock(unref(_sfc_main$r), {
27404
27469
  value: unref(currentValue),
27405
27470
  onChange: apply2
27406
27471
  }, {
@@ -27437,14 +27502,14 @@ const _sfc_main$m = {
27437
27502
  };
27438
27503
  }
27439
27504
  };
27440
- const _sfc_main$l = {
27505
+ const _sfc_main$m = {
27441
27506
  __name: "BackgroundColorControl",
27442
27507
  setup(__props) {
27443
27508
  const editor = inject(InjectionTokens$1.EDITOR);
27444
27509
  const currentValue = editor.commands.getBackgroundColor();
27445
27510
  const apply2 = (color) => editor.chain().applyBackgroundColor(color).run();
27446
27511
  return (_ctx, _cache) => {
27447
- return openBlock(), createBlock(unref(_sfc_main$q), {
27512
+ return openBlock(), createBlock(unref(_sfc_main$r), {
27448
27513
  value: unref(currentValue),
27449
27514
  onChange: apply2
27450
27515
  }, {
@@ -27477,7 +27542,7 @@ const _hoisted_1$7 = {
27477
27542
  class: "zw-button__customized-indicator",
27478
27543
  "data-test-selector": "customizedIndicator"
27479
27544
  };
27480
- const _sfc_main$k = {
27545
+ const _sfc_main$l = {
27481
27546
  __name: "ItalicControl",
27482
27547
  setup(__props) {
27483
27548
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27521,7 +27586,7 @@ const _hoisted_1$6 = {
27521
27586
  class: "zw-button__customized-indicator",
27522
27587
  "data-test-selector": "customizedIndicator"
27523
27588
  };
27524
- const _sfc_main$j = {
27589
+ const _sfc_main$k = {
27525
27590
  __name: "UnderlineControl",
27526
27591
  setup(__props) {
27527
27592
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27558,7 +27623,7 @@ const _sfc_main$j = {
27558
27623
  };
27559
27624
  }
27560
27625
  };
27561
- const _sfc_main$i = {
27626
+ const _sfc_main$j = {
27562
27627
  __name: "StrikeThroughControl",
27563
27628
  setup(__props) {
27564
27629
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27585,7 +27650,7 @@ const _sfc_main$i = {
27585
27650
  };
27586
27651
  }
27587
27652
  };
27588
- const _sfc_main$h = {
27653
+ const _sfc_main$i = {
27589
27654
  __name: "SuperscriptControl",
27590
27655
  setup(__props) {
27591
27656
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27612,7 +27677,7 @@ const _sfc_main$h = {
27612
27677
  };
27613
27678
  }
27614
27679
  };
27615
- const _sfc_main$g = {
27680
+ const _sfc_main$h = {
27616
27681
  __name: "CaseStyleControl",
27617
27682
  setup(__props) {
27618
27683
  const styles = [
@@ -27651,10 +27716,11 @@ const _sfc_main$g = {
27651
27716
  };
27652
27717
  }
27653
27718
  };
27654
- const _sfc_main$f = {
27719
+ const _sfc_main$g = {
27655
27720
  __name: "AlignmentControl",
27656
27721
  emits: ["applied"],
27657
- setup(__props, { emit }) {
27722
+ setup(__props, { emit: __emit }) {
27723
+ const emit = __emit;
27658
27724
  const alignments = [
27659
27725
  {
27660
27726
  id: Alignments.LEFT,
@@ -27725,24 +27791,21 @@ const _sfc_main$f = {
27725
27791
  };
27726
27792
  }
27727
27793
  };
27728
- const LineHeightControl_vue_vue_type_style_index_0_scoped_74a13b9d_lang = "";
27729
27794
  const _hoisted_1$5 = {
27730
27795
  key: 0,
27731
27796
  class: "zw-button__customized-indicator",
27732
27797
  "data-test-selector": "customizedIndicator"
27733
27798
  };
27734
- const _hoisted_2$3 = { class: "zw-line-height-control__row" };
27735
- const _sfc_main$e = {
27799
+ const _hoisted_2$2 = { class: "zw-line-height-control__row" };
27800
+ const _sfc_main$f = {
27736
27801
  __name: "LineHeightControl",
27737
27802
  setup(__props) {
27738
- const wrapperRef = ref(null);
27739
- const modalRef = ref(null);
27740
27803
  const editor = inject(InjectionTokens$1.EDITOR);
27741
- const toggler = useModalToggler({ wrapperRef, modalRef });
27804
+ const wrapperRef = ref(null);
27805
+ const toggler = useModalToggler();
27742
27806
  const currentValue = editor.commands.getLineHeight();
27743
27807
  const isCustomized = editor.commands.isSettingCustomized(TextSettings.LINE_HEIGHT);
27744
27808
  const apply2 = (value) => editor.commands.applyLineHeight(String(value));
27745
- const isOpened = computed(() => unref(toggler.isOpened));
27746
27809
  return (_ctx, _cache) => {
27747
27810
  return openBlock(), createElementBlock("div", {
27748
27811
  class: "zw-position--relative",
@@ -27753,7 +27816,7 @@ const _sfc_main$e = {
27753
27816
  class: "zw-position--relative",
27754
27817
  icon: "",
27755
27818
  skin: "toolbar",
27756
- active: isOpened.value,
27819
+ active: unref(toggler).isOpened,
27757
27820
  onClick: unref(toggler).open
27758
27821
  }, {
27759
27822
  default: withCtx(() => [
@@ -27777,9 +27840,8 @@ const _sfc_main$e = {
27777
27840
  ]),
27778
27841
  createVNode(unref(Modal), {
27779
27842
  class: "zw-line-height-control__modal",
27780
- ref_key: "modalRef",
27781
- ref: modalRef,
27782
- toggler: unref(toggler)
27843
+ toggler: unref(toggler),
27844
+ "reference-ref": wrapperRef.value
27783
27845
  }, {
27784
27846
  default: withCtx(() => [
27785
27847
  createVNode(unref(FieldLabel), {
@@ -27791,7 +27853,7 @@ const _sfc_main$e = {
27791
27853
  ], void 0, true),
27792
27854
  _: 1
27793
27855
  }),
27794
- createElementVNode("div", _hoisted_2$3, [
27856
+ createElementVNode("div", _hoisted_2$2, [
27795
27857
  createVNode(unref(Range), {
27796
27858
  class: "zw-line-height-control__range",
27797
27859
  step: "0.1",
@@ -27812,15 +27874,14 @@ const _sfc_main$e = {
27812
27874
  ])
27813
27875
  ], void 0, true),
27814
27876
  _: 1
27815
- }, 8, ["toggler"])
27877
+ }, 8, ["toggler", "reference-ref"])
27816
27878
  ], 512);
27817
27879
  };
27818
27880
  }
27819
27881
  };
27820
- const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-74a13b9d"]]);
27821
- const ListControl_vue_vue_type_style_index_0_scoped_923a86d6_lang = "";
27882
+ const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-8eb86211"]]);
27822
27883
  const _hoisted_1$4 = { class: "zpa-list-control" };
27823
- const _sfc_main$d = {
27884
+ const _sfc_main$e = {
27824
27885
  __name: "ListControl",
27825
27886
  setup(__props) {
27826
27887
  const listTypes = ListTypes.values.map((type) => ({
@@ -27903,8 +27964,8 @@ const _sfc_main$d = {
27903
27964
  };
27904
27965
  }
27905
27966
  };
27906
- const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-923a86d6"]]);
27907
- const _sfc_main$c = {
27967
+ const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-923a86d6"]]);
27968
+ const _sfc_main$d = {
27908
27969
  __name: "RemoveFormatControl",
27909
27970
  setup(__props) {
27910
27971
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27935,20 +27996,20 @@ const RegExps = {
27935
27996
  MAILTO_PROTOCOL: /^mailto:.+$/,
27936
27997
  TEL_PROTOCOL: /^tel:.+$/
27937
27998
  };
27938
- const LinkControlHeader_vue_vue_type_style_index_0_scoped_64870ac2_lang = "";
27939
27999
  const _withScopeId$1 = (n) => (pushScopeId("data-v-64870ac2"), n = n(), popScopeId(), n);
27940
28000
  const _hoisted_1$3 = { class: "zw-link-modal-header" };
27941
- const _hoisted_2$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "zw-link-modal-header__title" }, " Link ", -1));
27942
- const _sfc_main$b = {
28001
+ const _hoisted_2$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "zw-link-modal-header__title" }, " Link ", -1));
28002
+ const _sfc_main$c = {
27943
28003
  __name: "LinkControlHeader",
27944
28004
  emits: ["remove-link"],
27945
- setup(__props, { emit }) {
28005
+ setup(__props, { emit: __emit }) {
28006
+ const emit = __emit;
27946
28007
  const editor = inject(InjectionTokens$1.EDITOR);
27947
28008
  const isLink = editor.commands.isLink();
27948
28009
  const removeLink = () => emit("remove-link");
27949
28010
  return (_ctx, _cache) => {
27950
28011
  return openBlock(), createElementBlock("div", _hoisted_1$3, [
27951
- _hoisted_2$2,
28012
+ _hoisted_2$1,
27952
28013
  createVNode(unref(Button), {
27953
28014
  class: "zw-link-modal-header__unlink-button",
27954
28015
  disabled: !unref(isLink),
@@ -27970,7 +28031,7 @@ const _sfc_main$b = {
27970
28031
  };
27971
28032
  }
27972
28033
  };
27973
- const LinkControlHeader = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-64870ac2"]]);
28034
+ const LinkControlHeader = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-64870ac2"]]);
27974
28035
  function useLink() {
27975
28036
  const editor = inject(InjectionTokens$1.EDITOR);
27976
28037
  const pageBlocks = inject(InjectionTokens$1.PAGE_BLOCKS);
@@ -28038,7 +28099,7 @@ function useLink() {
28038
28099
  updateText
28039
28100
  };
28040
28101
  }
28041
- const _sfc_main$a = {
28102
+ const _sfc_main$b = {
28042
28103
  __name: "LinkControlPageBlock",
28043
28104
  props: {
28044
28105
  value: {
@@ -28047,7 +28108,8 @@ const _sfc_main$a = {
28047
28108
  }
28048
28109
  },
28049
28110
  emits: ["update"],
28050
- setup(__props, { emit }) {
28111
+ setup(__props, { emit: __emit }) {
28112
+ const emit = __emit;
28051
28113
  const pageBlocks = inject(InjectionTokens$1.PAGE_BLOCKS);
28052
28114
  const applyBlock = (id) => {
28053
28115
  const block = pageBlocks.value.find((block2) => block2.id === id);
@@ -28060,7 +28122,7 @@ const _sfc_main$a = {
28060
28122
  "field-id": "link-destination"
28061
28123
  }, {
28062
28124
  default: withCtx(() => [
28063
- createTextVNode(" Select block ")
28125
+ createTextVNode(" Select section ")
28064
28126
  ], void 0, true),
28065
28127
  _: 1
28066
28128
  }),
@@ -28083,7 +28145,7 @@ const _sfc_main$a = {
28083
28145
  };
28084
28146
  }
28085
28147
  };
28086
- const _sfc_main$9 = {
28148
+ const _sfc_main$a = {
28087
28149
  __name: "LinkControlUrl",
28088
28150
  props: {
28089
28151
  href: {
@@ -28100,7 +28162,8 @@ const _sfc_main$9 = {
28100
28162
  }
28101
28163
  },
28102
28164
  emits: ["update-link", "update-target"],
28103
- setup(__props, { emit }) {
28165
+ setup(__props, { emit: __emit }) {
28166
+ const emit = __emit;
28104
28167
  const updateLink = (value) => emit("update-link", value);
28105
28168
  const updateTarget = (value) => emit("update-target", value);
28106
28169
  return (_ctx, _cache) => {
@@ -28122,7 +28185,7 @@ const _sfc_main$9 = {
28122
28185
  };
28123
28186
  }
28124
28187
  };
28125
- const _sfc_main$8 = {
28188
+ const _sfc_main$9 = {
28126
28189
  __name: "LinkControlDestination",
28127
28190
  props: {
28128
28191
  link: {
@@ -28135,11 +28198,12 @@ const _sfc_main$8 = {
28135
28198
  }
28136
28199
  },
28137
28200
  emits: ["reset-errors"],
28138
- setup(__props, { emit }) {
28201
+ setup(__props, { emit: __emit }) {
28139
28202
  const props = __props;
28203
+ const emit = __emit;
28140
28204
  const destinationTypes = [
28141
28205
  { id: LinkDestinations.URL, title: "URL" },
28142
- { id: LinkDestinations.BLOCK, title: "Page Block" }
28206
+ { id: LinkDestinations.BLOCK, title: "Page Section" }
28143
28207
  ];
28144
28208
  const link = toRef(props, "link");
28145
28209
  const isURLDestination = computed(() => link.value.currentDestination.value.id === LinkDestinations.URL);
@@ -28179,7 +28243,7 @@ const _sfc_main$8 = {
28179
28243
  ]),
28180
28244
  _: 1
28181
28245
  }, 8, ["value"]),
28182
- isURLDestination.value ? (openBlock(), createBlock(unref(_sfc_main$9), {
28246
+ isURLDestination.value ? (openBlock(), createBlock(unref(_sfc_main$a), {
28183
28247
  key: 0,
28184
28248
  class: "zw-margin-bottom--md",
28185
28249
  href: link.value.destinationHrefs.value.url,
@@ -28187,7 +28251,7 @@ const _sfc_main$8 = {
28187
28251
  validator: __props.validator,
28188
28252
  onUpdateLink: updateLink,
28189
28253
  onUpdateTarget: link.value.updateTarget
28190
- }, null, 8, ["href", "isTargetBlank", "validator", "onUpdateTarget"])) : (openBlock(), createBlock(unref(_sfc_main$a), {
28254
+ }, null, 8, ["href", "isTargetBlank", "validator", "onUpdateTarget"])) : (openBlock(), createBlock(unref(_sfc_main$b), {
28191
28255
  key: 1,
28192
28256
  value: link.value.destinationHrefs.value.block,
28193
28257
  onUpdate: updateLink
@@ -28196,15 +28260,12 @@ const _sfc_main$8 = {
28196
28260
  };
28197
28261
  }
28198
28262
  };
28199
- const LinkControl_vue_vue_type_style_index_0_scoped_c3983e26_lang = "";
28200
- const _hoisted_1$2 = ["onSubmit"];
28201
- const _hoisted_2$1 = { class: "zw-link-modal__actions" };
28202
- const _sfc_main$7 = {
28263
+ const _hoisted_1$2 = { class: "zw-link-modal__actions" };
28264
+ const _sfc_main$8 = {
28203
28265
  __name: "LinkControl",
28204
28266
  setup(__props) {
28205
- const wrapperRef = ref(null);
28206
- const modalRef = ref(null);
28207
28267
  const editor = inject(InjectionTokens$1.EDITOR);
28268
+ const wrapperRef = ref(null);
28208
28269
  const link = useLink();
28209
28270
  const isEmpty = () => {
28210
28271
  return link.linkData.value.text ? false : "Can't be empty";
@@ -28231,18 +28292,15 @@ const _sfc_main$7 = {
28231
28292
  nameValidator.reset();
28232
28293
  urlValidator.reset();
28233
28294
  };
28234
- const onBeforeOpened = () => {
28235
- editor.commands.extendMarkRange(TextSettings.LINK);
28236
- resetErrors();
28237
- link.prepareInitialFields();
28238
- };
28239
28295
  const toggler = useModalToggler({
28240
- onBeforeOpened: () => onBeforeOpened(),
28241
- wrapperRef,
28242
- modalRef
28296
+ onBeforeOpened: () => {
28297
+ editor.commands.extendMarkRange(TextSettings.LINK);
28298
+ resetErrors();
28299
+ link.prepareInitialFields();
28300
+ }
28243
28301
  });
28244
28302
  const isLink = editor.commands.isLink();
28245
- const isActive2 = computed(() => unref(toggler.isOpened) || unref(isLink));
28303
+ const isActive2 = computed(() => toggler.isOpened || unref(isLink));
28246
28304
  const updateLinkText = (value) => {
28247
28305
  resetErrors();
28248
28306
  link.updateText(value);
@@ -28286,8 +28344,7 @@ const _sfc_main$7 = {
28286
28344
  createVNode(unref(Modal), {
28287
28345
  class: "zw-link-modal",
28288
28346
  toggler: unref(toggler),
28289
- ref_key: "modalRef",
28290
- ref: modalRef,
28347
+ "reference-ref": wrapperRef.value,
28291
28348
  "focus-first-control": ""
28292
28349
  }, {
28293
28350
  default: withCtx(() => [
@@ -28305,13 +28362,13 @@ const _sfc_main$7 = {
28305
28362
  error: unref(nameValidator).error.value,
28306
28363
  onInput: updateLinkText
28307
28364
  }, null, 8, ["value", "error"]),
28308
- createVNode(unref(_sfc_main$8), {
28365
+ createVNode(unref(_sfc_main$9), {
28309
28366
  class: "zw-margin-bottom--md",
28310
28367
  link: unref(link),
28311
28368
  validator: unref(urlValidator),
28312
28369
  onResetErrors: resetErrors
28313
28370
  }, null, 8, ["link", "validator"]),
28314
- createElementVNode("div", _hoisted_2$1, [
28371
+ createElementVNode("div", _hoisted_1$2, [
28315
28372
  createVNode(unref(Button), {
28316
28373
  class: "zw-margin-right--xs",
28317
28374
  skin: "secondary",
@@ -28332,17 +28389,16 @@ const _sfc_main$7 = {
28332
28389
  _: 1
28333
28390
  })
28334
28391
  ])
28335
- ], 40, _hoisted_1$2)
28392
+ ], 32)
28336
28393
  ], void 0, true),
28337
28394
  _: 1
28338
- }, 8, ["toggler"])
28395
+ }, 8, ["toggler", "reference-ref"])
28339
28396
  ], 512);
28340
28397
  };
28341
28398
  }
28342
28399
  };
28343
- const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-c3983e26"]]);
28344
- const StylePresetOption_vue_vue_type_style_index_0_scoped_c80fcebf_lang = "";
28345
- const _sfc_main$6 = {
28400
+ const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-5d6cf980"]]);
28401
+ const _sfc_main$7 = {
28346
28402
  name: "StylePresetOption",
28347
28403
  components: {
28348
28404
  DropdownOption
@@ -28389,10 +28445,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
28389
28445
  _: 1
28390
28446
  }, 8, ["style", "option"]);
28391
28447
  }
28392
- const StylePresetOption = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render], ["__scopeId", "data-v-c80fcebf"]]);
28393
- const StylePresetControl_vue_vue_type_style_index_0_scoped_a8aff4db_lang = "";
28448
+ const StylePresetOption = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render], ["__scopeId", "data-v-c80fcebf"]]);
28394
28449
  const _hoisted_1 = { class: "zw-style-preset-control" };
28395
- const _sfc_main$5 = {
28450
+ const _sfc_main$6 = {
28396
28451
  __name: "StylePresetControl",
28397
28452
  setup(__props) {
28398
28453
  const CLEAR_MARKS = [TextSettings.FONT_SIZE, TextSettings.FONT_WEIGHT];
@@ -28460,8 +28515,8 @@ const _sfc_main$5 = {
28460
28515
  };
28461
28516
  }
28462
28517
  };
28463
- const StylePresetControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-a8aff4db"]]);
28464
- const _sfc_main$4 = {
28518
+ const StylePresetControl = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-a8aff4db"]]);
28519
+ const _sfc_main$5 = {
28465
28520
  __name: "ToolbarDesktop",
28466
28521
  props: {
28467
28522
  aiComponent: {
@@ -28489,8 +28544,8 @@ const _sfc_main$4 = {
28489
28544
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28490
28545
  createVNode(unref(ToolbarGroup), null, {
28491
28546
  default: withCtx(() => [
28492
- createVNode(unref(_sfc_main$m)),
28493
- createVNode(unref(_sfc_main$l))
28547
+ createVNode(unref(_sfc_main$n)),
28548
+ createVNode(unref(_sfc_main$m))
28494
28549
  ], void 0, true),
28495
28550
  _: 1
28496
28551
  })
@@ -28502,16 +28557,16 @@ const _sfc_main$4 = {
28502
28557
  default: withCtx(() => [
28503
28558
  createVNode(unref(ToolbarGroup), null, {
28504
28559
  default: withCtx(() => [
28560
+ createVNode(unref(_sfc_main$l)),
28505
28561
  createVNode(unref(_sfc_main$k)),
28506
28562
  createVNode(unref(_sfc_main$j)),
28507
28563
  createVNode(unref(_sfc_main$i)),
28508
- createVNode(unref(_sfc_main$h)),
28509
- createVNode(unref(_sfc_main$g))
28564
+ createVNode(unref(_sfc_main$h))
28510
28565
  ], void 0, true),
28511
28566
  _: 1
28512
28567
  }),
28513
28568
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28514
- createVNode(unref(_sfc_main$f)),
28569
+ createVNode(unref(_sfc_main$g)),
28515
28570
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28516
28571
  createVNode(unref(LineHeightControl)),
28517
28572
  createVNode(unref(ToolbarDivider), { vertical: "" }),
@@ -28520,7 +28575,7 @@ const _sfc_main$4 = {
28520
28575
  createVNode(unref(ToolbarGroup), null, {
28521
28576
  default: withCtx(() => [
28522
28577
  createVNode(unref(LinkControl)),
28523
- createVNode(unref(_sfc_main$c))
28578
+ createVNode(unref(_sfc_main$d))
28524
28579
  ], void 0, true),
28525
28580
  _: 1
28526
28581
  })
@@ -28531,7 +28586,7 @@ const _sfc_main$4 = {
28531
28586
  };
28532
28587
  }
28533
28588
  };
28534
- const _sfc_main$3 = {
28589
+ const _sfc_main$4 = {
28535
28590
  __name: "ToolbarMobile",
28536
28591
  setup(__props) {
28537
28592
  return (_ctx, _cache) => {
@@ -28553,19 +28608,19 @@ const _sfc_main$3 = {
28553
28608
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28554
28609
  createVNode(unref(ToolbarGroup), null, {
28555
28610
  default: withCtx(() => [
28556
- createVNode(unref(_sfc_main$m)),
28557
- createVNode(unref(_sfc_main$l))
28611
+ createVNode(unref(_sfc_main$n)),
28612
+ createVNode(unref(_sfc_main$m))
28558
28613
  ], void 0, true),
28559
28614
  _: 1
28560
28615
  }),
28561
28616
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28562
28617
  createVNode(unref(ToolbarGroup), null, {
28563
28618
  default: withCtx(() => [
28619
+ createVNode(unref(_sfc_main$l)),
28564
28620
  createVNode(unref(_sfc_main$k)),
28565
28621
  createVNode(unref(_sfc_main$j)),
28566
28622
  createVNode(unref(_sfc_main$i)),
28567
- createVNode(unref(_sfc_main$h)),
28568
- createVNode(unref(_sfc_main$g))
28623
+ createVNode(unref(_sfc_main$h))
28569
28624
  ], void 0, true),
28570
28625
  _: 1
28571
28626
  })
@@ -28575,7 +28630,7 @@ const _sfc_main$3 = {
28575
28630
  createVNode(unref(ToolbarDivider), { horizontal: "" }),
28576
28631
  createVNode(unref(ToolbarRow), null, {
28577
28632
  default: withCtx(() => [
28578
- createVNode(unref(_sfc_main$f)),
28633
+ createVNode(unref(_sfc_main$g)),
28579
28634
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28580
28635
  createVNode(unref(LineHeightControl)),
28581
28636
  createVNode(unref(ToolbarDivider), { vertical: "" }),
@@ -28584,7 +28639,7 @@ const _sfc_main$3 = {
28584
28639
  createVNode(unref(ToolbarGroup), null, {
28585
28640
  default: withCtx(() => [
28586
28641
  createVNode(unref(LinkControl)),
28587
- createVNode(unref(_sfc_main$c))
28642
+ createVNode(unref(_sfc_main$d))
28588
28643
  ], void 0, true),
28589
28644
  _: 1
28590
28645
  })
@@ -28595,7 +28650,7 @@ const _sfc_main$3 = {
28595
28650
  };
28596
28651
  }
28597
28652
  };
28598
- const _sfc_main$2 = {
28653
+ const _sfc_main$3 = {
28599
28654
  __name: "ToolbarPopup",
28600
28655
  props: {
28601
28656
  aiComponent: {
@@ -28623,19 +28678,19 @@ const _sfc_main$2 = {
28623
28678
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28624
28679
  createVNode(unref(ToolbarGroup), null, {
28625
28680
  default: withCtx(() => [
28626
- createVNode(unref(_sfc_main$m)),
28627
- createVNode(unref(_sfc_main$l))
28681
+ createVNode(unref(_sfc_main$n)),
28682
+ createVNode(unref(_sfc_main$m))
28628
28683
  ], void 0, true),
28629
28684
  _: 1
28630
28685
  }),
28631
28686
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28632
28687
  createVNode(unref(ToolbarGroup), null, {
28633
28688
  default: withCtx(() => [
28689
+ createVNode(unref(_sfc_main$l)),
28634
28690
  createVNode(unref(_sfc_main$k)),
28635
28691
  createVNode(unref(_sfc_main$j)),
28636
28692
  createVNode(unref(_sfc_main$i)),
28637
- createVNode(unref(_sfc_main$h)),
28638
- createVNode(unref(_sfc_main$g))
28693
+ createVNode(unref(_sfc_main$h))
28639
28694
  ], void 0, true),
28640
28695
  _: 1
28641
28696
  })
@@ -28645,7 +28700,7 @@ const _sfc_main$2 = {
28645
28700
  createVNode(unref(ToolbarDivider), { horizontal: "" }),
28646
28701
  createVNode(unref(ToolbarRow), null, {
28647
28702
  default: withCtx(() => [
28648
- createVNode(unref(_sfc_main$f)),
28703
+ createVNode(unref(_sfc_main$g)),
28649
28704
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28650
28705
  createVNode(unref(LineHeightControl)),
28651
28706
  createVNode(unref(ToolbarDivider), { vertical: "" }),
@@ -28654,7 +28709,7 @@ const _sfc_main$2 = {
28654
28709
  createVNode(unref(ToolbarGroup), null, {
28655
28710
  default: withCtx(() => [
28656
28711
  createVNode(unref(LinkControl)),
28657
- createVNode(unref(_sfc_main$c))
28712
+ createVNode(unref(_sfc_main$d))
28658
28713
  ], void 0, true),
28659
28714
  _: 1
28660
28715
  })
@@ -28665,7 +28720,47 @@ const _sfc_main$2 = {
28665
28720
  };
28666
28721
  }
28667
28722
  };
28668
- const Toolbar_vue_vue_type_style_index_0_scoped_d3e5d777_lang = "";
28723
+ const _sfc_main$2 = {
28724
+ __name: "ToolbarFloating",
28725
+ props: {
28726
+ referenceRef: {
28727
+ type: Object,
28728
+ required: true
28729
+ },
28730
+ placement: {
28731
+ type: String,
28732
+ required: true
28733
+ },
28734
+ offsets: {
28735
+ type: Array,
28736
+ required: true
28737
+ }
28738
+ },
28739
+ setup(__props) {
28740
+ const props = __props;
28741
+ const floatingRef = ref(null);
28742
+ const referenceRef = toRef(props, "referenceRef");
28743
+ const middlewares = computed(() => [
28744
+ shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
28745
+ offset({ crossAxis: props.offsets[0], mainAxis: props.offsets[1] })
28746
+ ]);
28747
+ const { floatingStyles } = useFloating(referenceRef, floatingRef, {
28748
+ placement: toRef(props, "placement"),
28749
+ strategy: "fixed",
28750
+ middleware: middlewares,
28751
+ whileElementsMounted: autoUpdate
28752
+ });
28753
+ return (_ctx, _cache) => {
28754
+ return openBlock(), createElementBlock("div", {
28755
+ ref_key: "floatingRef",
28756
+ ref: floatingRef,
28757
+ style: normalizeStyle(unref(floatingStyles))
28758
+ }, [
28759
+ renderSlot(_ctx.$slots, "default")
28760
+ ], 4);
28761
+ };
28762
+ }
28763
+ };
28669
28764
  const _sfc_main$1 = {
28670
28765
  __name: "Toolbar",
28671
28766
  props: {
@@ -28673,14 +28768,27 @@ const _sfc_main$1 = {
28673
28768
  type: String,
28674
28769
  required: true
28675
28770
  },
28676
- toolbar: {
28677
- type: Object,
28771
+ visible: {
28772
+ type: Boolean,
28678
28773
  required: true
28679
28774
  },
28680
28775
  popupMode: {
28681
28776
  type: Boolean,
28682
28777
  required: true
28683
28778
  },
28779
+ referenceRef: {
28780
+ type: Object,
28781
+ required: false,
28782
+ default: null
28783
+ },
28784
+ placement: {
28785
+ type: String,
28786
+ required: true
28787
+ },
28788
+ offsets: {
28789
+ type: Array,
28790
+ required: true
28791
+ },
28684
28792
  aiComponent: {
28685
28793
  type: Object,
28686
28794
  required: false,
@@ -28688,19 +28796,14 @@ const _sfc_main$1 = {
28688
28796
  }
28689
28797
  },
28690
28798
  setup(__props) {
28691
- const props = __props;
28692
28799
  useCssVars((_ctx) => ({
28693
- "c6eda43c": __props.toolbar.offsets[1]
28800
+ "0f007386": __props.offsets[1]
28694
28801
  }));
28802
+ const props = __props;
28695
28803
  const layoutComponent = computed(() => {
28696
28804
  if (props.popupMode)
28697
- return _sfc_main$2;
28698
- return props.device === Devices.MOBILE ? _sfc_main$3 : _sfc_main$4;
28699
- });
28700
- const isVisible = computed(() => props.toolbar.isActiveRef.value);
28701
- const toolbarRef = ref(null);
28702
- watch(toolbarRef, (toolbarEl) => {
28703
- toolbarEl && props.toolbar.mount(toolbarEl);
28805
+ return _sfc_main$3;
28806
+ return props.device === Devices.MOBILE ? _sfc_main$4 : _sfc_main$5;
28704
28807
  });
28705
28808
  return (_ctx, _cache) => {
28706
28809
  return openBlock(), createBlock(KeepAlive, null, [
@@ -28709,14 +28812,18 @@ const _sfc_main$1 = {
28709
28812
  duration: "150"
28710
28813
  }, {
28711
28814
  default: withCtx(() => [
28712
- isVisible.value ? (openBlock(), createElementBlock("div", {
28815
+ __props.visible && __props.referenceRef ? (openBlock(), createBlock(unref(_sfc_main$2), {
28713
28816
  key: 0,
28714
28817
  class: "zw-toolbar",
28715
- ref_key: "toolbarRef",
28716
- ref: toolbarRef
28717
- }, [
28718
- (openBlock(), createBlock(resolveDynamicComponent(layoutComponent.value), { "ai-component": __props.aiComponent }, null, 8, ["ai-component"]))
28719
- ], 512)) : createCommentVNode("", true)
28818
+ "reference-ref": __props.referenceRef,
28819
+ placement: __props.placement,
28820
+ offsets: __props.offsets
28821
+ }, {
28822
+ default: withCtx(() => [
28823
+ (openBlock(), createBlock(resolveDynamicComponent(layoutComponent.value), { "ai-component": __props.aiComponent }, null, 8, ["ai-component"]))
28824
+ ], void 0, true),
28825
+ _: 1
28826
+ }, 8, ["reference-ref", "placement", "offsets"])) : createCommentVNode("", true)
28720
28827
  ], void 0, true),
28721
28828
  _: 1
28722
28829
  })
@@ -28724,7 +28831,7 @@ const _sfc_main$1 = {
28724
28831
  };
28725
28832
  }
28726
28833
  };
28727
- const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d3e5d777"]]);
28834
+ const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-39370f99"]]);
28728
28835
  function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
28729
28836
  let editor;
28730
28837
  const getContent = () => markWysiwygContent(editor.getJSON());
@@ -28733,7 +28840,12 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
28733
28840
  onUpdate: () => onChange(getContent()),
28734
28841
  extensions: extensions2,
28735
28842
  injectCSS: false,
28736
- editable: !unref(isReadonlyRef)
28843
+ editable: !unref(isReadonlyRef),
28844
+ editorProps: {
28845
+ attributes: {
28846
+ class: "zw-wysiwyg__content"
28847
+ }
28848
+ }
28737
28849
  }));
28738
28850
  onUnmounted(() => editor.destroy());
28739
28851
  watch(content, (value) => {
@@ -28742,36 +28854,9 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
28742
28854
  editor.commands.setContent(content2, false);
28743
28855
  }
28744
28856
  });
28745
- watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly));
28857
+ watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly, false));
28746
28858
  return { editor, getContent };
28747
28859
  }
28748
- function useToolbar({ wrapperRef, offsets, isActiveRef, placementRef }) {
28749
- const wrapperEl = useElementRef(wrapperRef);
28750
- let floatingInstance;
28751
- function mount(element) {
28752
- floatingInstance = autoUpdate(wrapperEl.value, element, async () => {
28753
- const positioning = await computePosition(wrapperEl.value, element, {
28754
- placement: placementRef.value,
28755
- strategy: "fixed",
28756
- middleware: [
28757
- shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
28758
- offset({ crossAxis: offsets[0], mainAxis: offsets[1] })
28759
- ]
28760
- });
28761
- const { x, y } = positioning;
28762
- Object.assign(element.style, {
28763
- left: `${x}px`,
28764
- top: `${y}px`
28765
- });
28766
- });
28767
- }
28768
- onUnmounted(() => floatingInstance == null ? void 0 : floatingInstance());
28769
- return {
28770
- mount,
28771
- isActiveRef,
28772
- offsets
28773
- };
28774
- }
28775
28860
  class Font {
28776
28861
  constructor({ name, category, styles }) {
28777
28862
  this.name = name;
@@ -28806,7 +28891,6 @@ class Font {
28806
28891
  return String(closestWeight);
28807
28892
  }
28808
28893
  }
28809
- const main_css_vue_type_style_index_0_src_true_lang = "";
28810
28894
  const MIN_FONT_SIZE = 5;
28811
28895
  const MAX_FONT_SIZE = 112;
28812
28896
  const _sfc_main = {
@@ -28900,30 +28984,19 @@ const _sfc_main = {
28900
28984
  "update:model-value",
28901
28985
  "update-favorite-colors"
28902
28986
  ],
28903
- setup(__props, { expose: __expose, emit }) {
28987
+ setup(__props, { expose: __expose, emit: __emit }) {
28904
28988
  const props = __props;
28989
+ const emit = __emit;
28905
28990
  ContextWindow.use(props.window);
28906
28991
  const fonts = props.fonts.map((font) => new Font(font));
28907
- const toolbarRef = ref(null);
28908
28992
  const wysiwygRef = ref(null);
28909
- const wrapperRef = computed(() => {
28910
- var _a2;
28911
- return ((_a2 = wysiwygRef.value) == null ? void 0 : _a2.$el) || document.body;
28912
- });
28913
- const isToolbarActiveRef = computed(() => props.active && !props.readonly);
28914
- const toolbar = useToolbar({
28915
- wrapperRef: wysiwygRef,
28916
- placementRef: toRef(props, "toolbarPlacement"),
28917
- isActiveRef: isToolbarActiveRef,
28918
- offsets: props.toolbarOffsets
28919
- });
28920
- function onChange(content) {
28921
- emit("update:model-value", content);
28922
- }
28993
+ const wrapperRef = computed(() => wysiwygRef.value || document.body);
28994
+ const isToolbarVisible = computed(() => props.active && !props.readonly);
28995
+ const onChange = (content) => emit("update:model-value", content);
28923
28996
  const pageBlocks = toRef(props, "pageBlocks");
28924
28997
  const { editor, getContent } = useEditor({
28925
28998
  content: toRef(props, "modelValue"),
28926
- onChange: (content) => onChange(content),
28999
+ onChange,
28927
29000
  isReadonlyRef: toRef(props, "readonly"),
28928
29001
  extensions: buildExtensions({
28929
29002
  fonts,
@@ -28960,13 +29033,14 @@ const _sfc_main = {
28960
29033
  ref: wysiwygRef
28961
29034
  }, [
28962
29035
  createVNode(unref(Toolbar), {
28963
- toolbar: unref(toolbar),
28964
29036
  device: __props.device,
29037
+ visible: isToolbarVisible.value,
28965
29038
  "popup-mode": __props.popupMode,
28966
- "ai-component": __props.aiComponent,
28967
- ref_key: "toolbarRef",
28968
- ref: toolbarRef
28969
- }, null, 8, ["toolbar", "device", "popup-mode", "ai-component"]),
29039
+ "reference-ref": wysiwygRef.value,
29040
+ placement: __props.toolbarPlacement,
29041
+ offsets: __props.toolbarOffsets,
29042
+ "ai-component": __props.aiComponent
29043
+ }, null, 8, ["device", "visible", "popup-mode", "reference-ref", "placement", "offsets", "ai-component"]),
28970
29044
  createVNode(unref(EditorContent), { editor: unref(editor) }, null, 8, ["editor"])
28971
29045
  ], 512);
28972
29046
  };
@@ -28977,7 +29051,7 @@ export {
28977
29051
  Button,
28978
29052
  ButtonToggle,
28979
29053
  Checkbox,
28980
- _sfc_main$q as ColorPicker,
29054
+ _sfc_main$r as ColorPicker,
28981
29055
  Dropdown,
28982
29056
  DropdownOption,
28983
29057
  FieldLabel,