@zipify/wysiwyg 4.1.0-0 → 4.1.0-1

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 +917 -981
  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 +30 -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 +41 -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,319 @@ 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;
25198
- }
25199
- function getSide(placement) {
25200
- return placement.split("-")[0];
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 });
25201
25133
  }
25202
- function getAlignment(placement) {
25203
- return placement.split("-")[1];
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();
25204
25151
  }
25205
- function getOppositeAxis(axis) {
25206
- return axis === "x" ? "y" : "x";
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
+ });
25207
25176
  }
25208
- function getAxisLength(axis) {
25209
- return axis === "y" ? "height" : "width";
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 };
25191
+ }
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 createCoords = (v) => ({
25409
+ x: v,
25410
+ y: v
25411
+ });
25412
+ function clamp(start2, value, end2) {
25413
+ return max(start2, min(value, end2));
25414
+ }
25415
+ function evaluate(value, param) {
25416
+ return typeof value === "function" ? value(param) : value;
25417
+ }
25418
+ function getSide(placement) {
25419
+ return placement.split("-")[0];
25420
+ }
25421
+ function getAlignment(placement) {
25422
+ return placement.split("-")[1];
25423
+ }
25424
+ function getOppositeAxis(axis) {
25425
+ return axis === "x" ? "y" : "x";
25426
+ }
25427
+ function getAxisLength(axis) {
25428
+ return axis === "y" ? "height" : "width";
25210
25429
  }
25211
25430
  function getSideAxis(placement) {
25212
25431
  return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
@@ -25762,11 +25981,11 @@ function getCssDimensions(element) {
25762
25981
  $: shouldFallback
25763
25982
  };
25764
25983
  }
25765
- function unwrapElement(element) {
25984
+ function unwrapElement$1(element) {
25766
25985
  return !isElement(element) ? element.contextElement : element;
25767
25986
  }
25768
25987
  function getScale(element) {
25769
- const domElement = unwrapElement(element);
25988
+ const domElement = unwrapElement$1(element);
25770
25989
  if (!isHTMLElement(domElement)) {
25771
25990
  return createCoords(1);
25772
25991
  }
@@ -25817,7 +26036,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
25817
26036
  isFixedStrategy = false;
25818
26037
  }
25819
26038
  const clientRect2 = element.getBoundingClientRect();
25820
- const domElement = unwrapElement(element);
26039
+ const domElement = unwrapElement$1(element);
25821
26040
  let scale = createCoords(1);
25822
26041
  if (includeScale) {
25823
26042
  if (offsetParent) {
@@ -26121,141 +26340,6 @@ const platform = {
26121
26340
  isElement,
26122
26341
  isRTL
26123
26342
  };
26124
- function observeMove(element, onMove) {
26125
- let io = null;
26126
- let timeoutId;
26127
- const root2 = getDocumentElement(element);
26128
- function cleanup() {
26129
- clearTimeout(timeoutId);
26130
- io && io.disconnect();
26131
- io = null;
26132
- }
26133
- function refresh(skip, threshold) {
26134
- if (skip === void 0) {
26135
- skip = false;
26136
- }
26137
- if (threshold === void 0) {
26138
- threshold = 1;
26139
- }
26140
- cleanup();
26141
- const {
26142
- left: left2,
26143
- top: top2,
26144
- width,
26145
- height
26146
- } = element.getBoundingClientRect();
26147
- if (!skip) {
26148
- onMove();
26149
- }
26150
- if (!width || !height) {
26151
- return;
26152
- }
26153
- const insetTop = floor(top2);
26154
- const insetRight = floor(root2.clientWidth - (left2 + width));
26155
- const insetBottom = floor(root2.clientHeight - (top2 + height));
26156
- const insetLeft = floor(left2);
26157
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
26158
- const options = {
26159
- rootMargin,
26160
- threshold: max(0, min(1, threshold)) || 1
26161
- };
26162
- let isFirstUpdate = true;
26163
- function handleObserve(entries) {
26164
- const ratio = entries[0].intersectionRatio;
26165
- if (ratio !== threshold) {
26166
- if (!isFirstUpdate) {
26167
- return refresh();
26168
- }
26169
- if (!ratio) {
26170
- timeoutId = setTimeout(() => {
26171
- refresh(false, 1e-7);
26172
- }, 100);
26173
- } else {
26174
- refresh(false, ratio);
26175
- }
26176
- }
26177
- isFirstUpdate = false;
26178
- }
26179
- try {
26180
- io = new IntersectionObserver(handleObserve, {
26181
- ...options,
26182
- // Handle <iframe>s
26183
- root: root2.ownerDocument
26184
- });
26185
- } catch (e) {
26186
- io = new IntersectionObserver(handleObserve, options);
26187
- }
26188
- io.observe(element);
26189
- }
26190
- refresh(true);
26191
- return cleanup;
26192
- }
26193
- function autoUpdate(reference2, floating, update, options) {
26194
- if (options === void 0) {
26195
- options = {};
26196
- }
26197
- const {
26198
- ancestorScroll = true,
26199
- ancestorResize = true,
26200
- elementResize = typeof ResizeObserver === "function",
26201
- layoutShift = typeof IntersectionObserver === "function",
26202
- animationFrame = false
26203
- } = options;
26204
- const referenceEl = unwrapElement(reference2);
26205
- const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
26206
- ancestors.forEach((ancestor) => {
26207
- ancestorScroll && ancestor.addEventListener("scroll", update, {
26208
- passive: true
26209
- });
26210
- ancestorResize && ancestor.addEventListener("resize", update);
26211
- });
26212
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
26213
- let reobserveFrame = -1;
26214
- let resizeObserver = null;
26215
- if (elementResize) {
26216
- resizeObserver = new ResizeObserver((_ref) => {
26217
- let [firstEntry] = _ref;
26218
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
26219
- resizeObserver.unobserve(floating);
26220
- cancelAnimationFrame(reobserveFrame);
26221
- reobserveFrame = requestAnimationFrame(() => {
26222
- resizeObserver && resizeObserver.observe(floating);
26223
- });
26224
- }
26225
- update();
26226
- });
26227
- if (referenceEl && !animationFrame) {
26228
- resizeObserver.observe(referenceEl);
26229
- }
26230
- resizeObserver.observe(floating);
26231
- }
26232
- let frameId;
26233
- let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
26234
- if (animationFrame) {
26235
- frameLoop();
26236
- }
26237
- function frameLoop() {
26238
- const nextRefRect = getBoundingClientRect(reference2);
26239
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
26240
- update();
26241
- }
26242
- prevRefRect = nextRefRect;
26243
- frameId = requestAnimationFrame(frameLoop);
26244
- }
26245
- update();
26246
- return () => {
26247
- ancestors.forEach((ancestor) => {
26248
- ancestorScroll && ancestor.removeEventListener("scroll", update);
26249
- ancestorResize && ancestor.removeEventListener("resize", update);
26250
- });
26251
- cleanupIo && cleanupIo();
26252
- resizeObserver && resizeObserver.disconnect();
26253
- resizeObserver = null;
26254
- if (animationFrame) {
26255
- cancelAnimationFrame(frameId);
26256
- }
26257
- };
26258
- }
26259
26343
  const computePosition = (reference2, floating, options) => {
26260
26344
  const cache = /* @__PURE__ */ new Map();
26261
26345
  const mergedOptions = {
@@ -26271,324 +26355,179 @@ const computePosition = (reference2, floating, options) => {
26271
26355
  platform: platformWithCache
26272
26356
  });
26273
26357
  };
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 };
26358
+ function unwrapElement(element) {
26359
+ var _$el;
26360
+ return (_$el = element == null ? void 0 : element.$el) != null ? _$el : element;
26314
26361
  }
26315
- function useActivatedListener({ targetRef, isActiveRef, event, onEvent, options }) {
26316
- function addListener() {
26317
- targetRef.value.addEventListener(event, onEvent, options);
26362
+ function getDPR(element) {
26363
+ if (typeof window === "undefined") {
26364
+ return 1;
26318
26365
  }
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();
26327
- }
26328
- watch(isActiveRef, updateListener);
26329
- watch(targetRef, updateListener);
26330
- onUnmounted(removeListener);
26331
- updateListener();
26366
+ const win = element.ownerDocument.defaultView || window;
26367
+ return win.devicePixelRatio || 1;
26332
26368
  }
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
- });
26369
+ function roundByDPR(element, value) {
26370
+ const dpr = getDPR(element);
26371
+ return Math.round(value * dpr) / dpr;
26357
26372
  }
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
- });
26373
+ function useFloating(reference2, floating, options) {
26374
+ if (options === void 0) {
26375
+ options = {};
26370
26376
  }
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);
26377
+ const whileElementsMountedOption = options.whileElementsMounted;
26378
+ const openOption = computed(() => {
26379
+ var _unref;
26380
+ return (_unref = unref(options.open)) != null ? _unref : true;
26381
+ });
26382
+ const middlewareOption = computed(() => unref(options.middleware));
26383
+ const placementOption = computed(() => {
26384
+ var _unref2;
26385
+ return (_unref2 = unref(options.placement)) != null ? _unref2 : "bottom";
26386
+ });
26387
+ const strategyOption = computed(() => {
26388
+ var _unref3;
26389
+ return (_unref3 = unref(options.strategy)) != null ? _unref3 : "absolute";
26390
+ });
26391
+ const transformOption = computed(() => {
26392
+ var _unref4;
26393
+ return (_unref4 = unref(options.transform)) != null ? _unref4 : true;
26394
+ });
26395
+ const referenceElement = computed(() => unwrapElement(reference2.value));
26396
+ const floatingElement = computed(() => unwrapElement(floating.value));
26397
+ const x = ref(0);
26398
+ const y = ref(0);
26399
+ const strategy = ref(strategyOption.value);
26400
+ const placement = ref(placementOption.value);
26401
+ const middlewareData = shallowRef({});
26402
+ const isPositioned = ref(false);
26403
+ const floatingStyles = computed(() => {
26404
+ const initialStyles = {
26405
+ position: strategy.value,
26406
+ left: "0",
26407
+ top: "0"
26394
26408
  };
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
26409
+ if (!floatingElement.value) {
26410
+ return initialStyles;
26407
26411
  }
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);
26412
+ const xVal = roundByDPR(floatingElement.value, x.value);
26413
+ const yVal = roundByDPR(floatingElement.value, y.value);
26414
+ if (transformOption.value) {
26415
+ return {
26416
+ ...initialStyles,
26417
+ transform: "translate(" + xVal + "px, " + yVal + "px)",
26418
+ ...getDPR(floatingElement.value) >= 1.5 && {
26419
+ willChange: "transform"
26420
+ }
26421
+ };
26422
+ }
26423
+ return {
26424
+ position: strategy.value,
26425
+ left: xVal + "px",
26426
+ top: yVal + "px"
26417
26427
  };
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: ""
26428
+ });
26429
+ let whileElementsMountedCleanup;
26430
+ function update() {
26431
+ if (referenceElement.value == null || floatingElement.value == null) {
26432
+ return;
26446
26433
  }
26447
- },
26448
- emits: ["input"],
26449
- setup(__props, { emit }) {
26450
- const props = __props;
26451
- const tempValue = useTempValue({
26452
- valueRef: toRef(props, "value"),
26453
- format: Number
26454
- });
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}%` };
26434
+ computePosition(referenceElement.value, floatingElement.value, {
26435
+ middleware: middlewareOption.value,
26436
+ placement: placementOption.value,
26437
+ strategy: strategyOption.value
26438
+ }).then((position) => {
26439
+ x.value = position.x;
26440
+ y.value = position.y;
26441
+ strategy.value = position.strategy;
26442
+ placement.value = position.placement;
26443
+ middlewareData.value = position.middlewareData;
26444
+ isPositioned.value = true;
26462
26445
  });
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
26446
  }
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",
26447
+ function cleanup() {
26448
+ if (typeof whileElementsMountedCleanup === "function") {
26449
+ whileElementsMountedCleanup();
26450
+ whileElementsMountedCleanup = void 0;
26451
+ }
26452
+ }
26453
+ function attach() {
26454
+ cleanup();
26455
+ if (whileElementsMountedOption === void 0) {
26456
+ update();
26457
+ return;
26458
+ }
26459
+ if (referenceElement.value != null && floatingElement.value != null) {
26460
+ whileElementsMountedCleanup = whileElementsMountedOption(referenceElement.value, floatingElement.value, update);
26461
+ return;
26462
+ }
26463
+ }
26464
+ function reset2() {
26465
+ if (!openOption.value) {
26466
+ isPositioned.value = false;
26467
+ }
26468
+ }
26469
+ watch([middlewareOption, placementOption, strategyOption], update, {
26470
+ flush: "sync"
26471
+ });
26472
+ watch([referenceElement, floatingElement], attach, {
26473
+ flush: "sync"
26474
+ });
26475
+ watch(openOption, reset2, {
26476
+ flush: "sync"
26477
+ });
26478
+ if (getCurrentScope()) {
26479
+ onScopeDispose(cleanup);
26480
+ }
26481
+ return {
26482
+ x: shallowReadonly(x),
26483
+ y: shallowReadonly(y),
26484
+ strategy: shallowReadonly(strategy),
26485
+ placement: shallowReadonly(placement),
26486
+ middlewareData: shallowReadonly(middlewareData),
26487
+ isPositioned: shallowReadonly(isPositioned),
26488
+ floatingStyles,
26489
+ update
26490
+ };
26491
+ }
26492
+ const _sfc_main$B = {
26493
+ __name: "ModalFloating",
26493
26494
  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: ""
26495
+ referenceRef: {
26496
+ type: Object,
26497
+ required: true
26532
26498
  }
26533
26499
  },
26534
- emits: ["input"],
26535
- setup(__props, { emit }) {
26500
+ setup(__props) {
26536
26501
  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)
26502
+ const floatingRef = ref(null);
26503
+ const referenceRef = toRef(props, "referenceRef");
26504
+ const { floatingStyles } = useFloating(referenceRef, floatingRef, {
26505
+ placement: "bottom",
26506
+ strategy: "fixed",
26507
+ middleware: [
26508
+ shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
26509
+ offset({ mainAxis: 4 })
26510
+ ]
26544
26511
  });
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
26512
  return (_ctx, _cache) => {
26553
- return openBlock(), createElementBlock("label", {
26554
- class: normalizeClass([elementClasses.value, "zw-number-field"])
26513
+ return openBlock(), createElementBlock("div", {
26514
+ ref_key: "floatingRef",
26515
+ ref: floatingRef,
26516
+ style: normalizeStyle(unref(floatingStyles))
26555
26517
  }, [
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);
26518
+ renderSlot(_ctx.$slots, "default")
26519
+ ], 4);
26584
26520
  };
26585
26521
  }
26586
26522
  };
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 = {
26523
+ const _sfc_main$A = {
26590
26524
  __name: "Modal",
26591
26525
  props: {
26526
+ referenceRef: {
26527
+ type: Object,
26528
+ required: false,
26529
+ default: null
26530
+ },
26592
26531
  toggler: {
26593
26532
  type: Object,
26594
26533
  required: false,
@@ -26611,25 +26550,24 @@ const _sfc_main$z = {
26611
26550
  }
26612
26551
  },
26613
26552
  setup(__props) {
26553
+ useCssVars((_ctx) => ({
26554
+ "3cdf9de8": __props.maxHeight + "px",
26555
+ "8ae6b87e": __props.maxWidth + "px"
26556
+ }));
26614
26557
  const props = __props;
26615
- const transition = {
26558
+ const transitionDuration = {
26616
26559
  enter: 200,
26617
26560
  leave: 100
26618
26561
  };
26619
26562
  const toggler = props.toggler || useModalToggler();
26620
- const isOpened = computed(() => unref(toggler.isOpened));
26621
26563
  const hostRef = ref(null);
26622
26564
  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
26565
  useDeselectionLock({
26628
- isActiveRef: toggler.isOpened,
26566
+ isActiveRef: toRef(toggler, "isOpened"),
26629
26567
  hostRef
26630
26568
  });
26631
26569
  if (props.focusFirstControl) {
26632
- watch(toggler.isOpened, async (_, wasOpened) => {
26570
+ watch(toRef(toggler, "isOpened"), async (_, wasOpened) => {
26633
26571
  if (wasOpened)
26634
26572
  return;
26635
26573
  await nextTick();
@@ -26640,20 +26578,23 @@ const _sfc_main$z = {
26640
26578
  return (_ctx, _cache) => {
26641
26579
  return openBlock(), createBlock(Transition, {
26642
26580
  name: "zw-modal-",
26643
- duration: transition
26581
+ duration: transitionDuration
26644
26582
  }, {
26645
26583
  default: withCtx(() => [
26646
- isOpened.value ? withDirectives((openBlock(), createElementBlock("div", {
26584
+ unref(toggler).isOpened && __props.referenceRef ? withDirectives((openBlock(), createBlock(unref(_sfc_main$B), {
26647
26585
  key: 0,
26648
26586
  class: "zw-modal",
26649
26587
  ref_key: "hostRef",
26650
26588
  ref: hostRef,
26651
26589
  tabindex: "-1",
26652
- style: normalizeStyle(modalStyles.value),
26590
+ "reference-ref": __props.referenceRef,
26653
26591
  "data-test-selector": "modal"
26654
- }, [
26655
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
26656
- ], 4)), [
26592
+ }, {
26593
+ default: withCtx(() => [
26594
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
26595
+ ], void 0, true),
26596
+ _: 3
26597
+ }, 8, ["reference-ref"])), [
26657
26598
  [unref(outClick), unref(toggler).close]
26658
26599
  ]) : createCommentVNode("", true)
26659
26600
  ], void 0, true),
@@ -26662,17 +26603,16 @@ const _sfc_main$z = {
26662
26603
  };
26663
26604
  }
26664
26605
  };
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 = "";
26606
+ const Modal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-078bbe11"]]);
26667
26607
  const _hoisted_1$h = { class: "zw-field" };
26668
- const _hoisted_2$7 = ["for"];
26608
+ const _hoisted_2$6 = ["for"];
26669
26609
  const _hoisted_3$2 = ["value", "id", "placeholder"];
26670
26610
  const _hoisted_4$1 = {
26671
26611
  key: 0,
26672
26612
  class: "zw-field__label--error",
26673
26613
  "data-test-selector": "error"
26674
26614
  };
26675
- const _sfc_main$y = {
26615
+ const _sfc_main$z = {
26676
26616
  __name: "TextField",
26677
26617
  props: {
26678
26618
  value: {
@@ -26695,8 +26635,9 @@ const _sfc_main$y = {
26695
26635
  }
26696
26636
  },
26697
26637
  emits: ["input"],
26698
- setup(__props, { emit }) {
26638
+ setup(__props, { emit: __emit }) {
26699
26639
  const props = __props;
26640
+ const emit = __emit;
26700
26641
  const onInput = (event) => emit("input", event.target.value);
26701
26642
  const fieldId = computed(() => {
26702
26643
  return props.label.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase());
@@ -26707,7 +26648,7 @@ const _sfc_main$y = {
26707
26648
  class: "zw-field__label",
26708
26649
  for: fieldId.value,
26709
26650
  "data-test-selector": "label"
26710
- }, toDisplayString(__props.label), 9, _hoisted_2$7),
26651
+ }, toDisplayString(__props.label), 9, _hoisted_2$6),
26711
26652
  createElementVNode("input", {
26712
26653
  class: "zw-field__input",
26713
26654
  type: "text",
@@ -26722,14 +26663,13 @@ const _sfc_main$y = {
26722
26663
  };
26723
26664
  }
26724
26665
  };
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 = "";
26666
+ const TextField = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-dfa0d6f0"]]);
26727
26667
  const _withScopeId$2 = (n) => (pushScopeId("data-v-6e170d87"), n = n(), popScopeId(), n);
26728
26668
  const _hoisted_1$g = { class: "zw-checkbox" };
26729
- const _hoisted_2$6 = ["checked"];
26669
+ const _hoisted_2$5 = ["checked"];
26730
26670
  const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("span", { class: "zw-checkbox__indicator zw-margin-right--xs" }, null, -1));
26731
26671
  const _hoisted_4 = { class: "zw-checkbox__label" };
26732
- const _sfc_main$x = {
26672
+ const _sfc_main$y = {
26733
26673
  __name: "Checkbox",
26734
26674
  props: {
26735
26675
  value: {
@@ -26743,8 +26683,9 @@ const _sfc_main$x = {
26743
26683
  }
26744
26684
  },
26745
26685
  emits: ["input"],
26746
- setup(__props, { emit }) {
26686
+ setup(__props, { emit: __emit }) {
26747
26687
  const props = __props;
26688
+ const emit = __emit;
26748
26689
  const onCheckedChanged = () => emit("input", !props.value);
26749
26690
  return (_ctx, _cache) => {
26750
26691
  return openBlock(), createElementBlock("label", _hoisted_1$g, [
@@ -26753,14 +26694,14 @@ const _sfc_main$x = {
26753
26694
  type: "checkbox",
26754
26695
  checked: __props.value,
26755
26696
  onClick: onCheckedChanged
26756
- }, null, 8, _hoisted_2$6),
26697
+ }, null, 8, _hoisted_2$5),
26757
26698
  _hoisted_3$1,
26758
26699
  createElementVNode("span", _hoisted_4, toDisplayString(__props.label), 1)
26759
26700
  ]);
26760
26701
  };
26761
26702
  }
26762
26703
  };
26763
- const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-6e170d87"]]);
26704
+ const Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-6e170d87"]]);
26764
26705
  const InjectionTokens = Object.freeze({
26765
26706
  ACTIVE_MANAGER: Symbol("dropdownActiveManager"),
26766
26707
  TOGGLER: Symbol("dropdownToggler"),
@@ -26789,14 +26730,13 @@ function useDropdownEntityTitle(entityRef) {
26789
26730
  return ((_a2 = entityRef.value) == null ? void 0 : _a2.title) || ((_b = entityRef.value) == null ? void 0 : _b.id) || "";
26790
26731
  });
26791
26732
  }
26792
- const DropdownActivator_vue_vue_type_style_index_0_scoped_c73e0119_lang = "";
26793
26733
  const _hoisted_1$f = { class: "zw-dropdown__activator-title zw-text--truncate" };
26794
- const _hoisted_2$5 = {
26734
+ const _hoisted_2$4 = {
26795
26735
  key: 0,
26796
26736
  class: "zw-dropdown__customized-indicator",
26797
26737
  "data-test-selector": "customizedIndicator"
26798
26738
  };
26799
- const _sfc_main$w = {
26739
+ const _sfc_main$x = {
26800
26740
  __name: "DropdownActivator",
26801
26741
  props: {
26802
26742
  color: {
@@ -26814,27 +26754,26 @@ const _sfc_main$w = {
26814
26754
  const props = __props;
26815
26755
  const activeOptionManager = inject(InjectionTokens.ACTIVE_MANAGER);
26816
26756
  const dropdownToggler = inject(InjectionTokens.TOGGLER);
26817
- const isOpened = computed(() => unref(dropdownToggler.isOpened));
26818
26757
  const color = toRef(props, "color");
26819
26758
  const activeOptionTitle = useDropdownEntityTitle(activeOptionManager.activeOption);
26820
26759
  const dropdownClasses = computed(() => ({
26821
- "zw-dropdown__activator--active": dropdownToggler.isOpened.value,
26760
+ "zw-dropdown__activator--active": dropdownToggler.isOpened,
26822
26761
  "zw-dropdown__activator--gray": color.value === "gray"
26823
26762
  }));
26824
26763
  return (_ctx, _cache) => {
26825
26764
  return renderSlot(_ctx.$slots, "default", {
26826
26765
  open: unref(dropdownToggler).open,
26827
- isOpened: isOpened.value
26766
+ isOpened: unref(dropdownToggler).isOpened
26828
26767
  }, () => [
26829
26768
  createVNode(unref(Button), {
26830
26769
  skin: "toolbar",
26831
26770
  class: normalizeClass(["zw-dropdown__activator", dropdownClasses.value]),
26832
- active: isOpened.value,
26771
+ active: unref(dropdownToggler).isOpened,
26833
26772
  onClick: unref(dropdownToggler).open
26834
26773
  }, {
26835
26774
  default: withCtx(() => [
26836
26775
  createElementVNode("span", _hoisted_1$f, toDisplayString(unref(activeOptionTitle)), 1),
26837
- __props.isCustomized ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$5, null, 512)), [
26776
+ __props.isCustomized ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2$4, null, 512)), [
26838
26777
  [
26839
26778
  unref(tooltip),
26840
26779
  "Style differs from Page Styles",
@@ -26855,9 +26794,8 @@ const _sfc_main$w = {
26855
26794
  };
26856
26795
  }
26857
26796
  };
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 = {
26797
+ const DropdownActivator = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-678de368"]]);
26798
+ const _sfc_main$w = {
26861
26799
  __name: "DropdownOption",
26862
26800
  props: {
26863
26801
  option: {
@@ -26908,11 +26846,10 @@ const _sfc_main$v = {
26908
26846
  };
26909
26847
  }
26910
26848
  };
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 = "";
26849
+ const DropdownOption = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-2e8320d2"]]);
26913
26850
  const _hoisted_1$e = { class: "zw-dropdown__group" };
26914
- const _hoisted_2$4 = { class: "zw-dropdown__group-title" };
26915
- const _sfc_main$u = {
26851
+ const _hoisted_2$3 = { class: "zw-dropdown__group-title" };
26852
+ const _sfc_main$v = {
26916
26853
  __name: "DropdownGroup",
26917
26854
  props: {
26918
26855
  group: {
@@ -26925,7 +26862,7 @@ const _sfc_main$u = {
26925
26862
  const groupTitle = useDropdownEntityTitle(toRef(props, "group"));
26926
26863
  return (_ctx, _cache) => {
26927
26864
  return openBlock(), createElementBlock("div", _hoisted_1$e, [
26928
- createElementVNode("p", _hoisted_2$4, toDisplayString(unref(groupTitle)), 1),
26865
+ createElementVNode("p", _hoisted_2$3, toDisplayString(unref(groupTitle)), 1),
26929
26866
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(__props.group.options, (option) => {
26930
26867
  return renderSlot(_ctx.$slots, "option", { option }, () => [
26931
26868
  createVNode(unref(DropdownOption), { option }, null, 8, ["option"])
@@ -26935,20 +26872,18 @@ const _sfc_main$u = {
26935
26872
  };
26936
26873
  }
26937
26874
  };
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 = {};
26875
+ const DropdownGroup = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-2239aa7b"]]);
26876
+ const _sfc_main$u = {};
26941
26877
  const _hoisted_1$d = { class: "zw-dropdown__divider" };
26942
26878
  function _sfc_render$1(_ctx, _cache) {
26943
26879
  return openBlock(), createElementBlock("div", _hoisted_1$d);
26944
26880
  }
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 = "";
26881
+ const DropdownDivider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$1], ["__scopeId", "data-v-91a22273"]]);
26947
26882
  const _hoisted_1$c = {
26948
26883
  class: "zw-dropdown__menu",
26949
26884
  "data-test-selector": "dropdownMenu"
26950
26885
  };
26951
- const _sfc_main$s = {
26886
+ const _sfc_main$t = {
26952
26887
  __name: "DropdownMenu",
26953
26888
  props: {
26954
26889
  options: {
@@ -26992,8 +26927,7 @@ const _sfc_main$s = {
26992
26927
  };
26993
26928
  }
26994
26929
  };
26995
- const Dropdown_vue_vue_type_style_index_0_scoped_c59753d1_lang = "";
26996
- const _sfc_main$r = {
26930
+ const _sfc_main$s = {
26997
26931
  __name: "Dropdown",
26998
26932
  props: {
26999
26933
  value: {
@@ -27022,20 +26956,17 @@ const _sfc_main$r = {
27022
26956
  }
27023
26957
  },
27024
26958
  emits: ["change"],
27025
- setup(__props, { emit }) {
26959
+ setup(__props, { emit: __emit }) {
27026
26960
  const props = __props;
26961
+ const emit = __emit;
27027
26962
  const dropdownRef = ref(null);
27028
- const modalRef = ref(null);
27029
26963
  const activeOptionManager = useActiveOptionManager({
27030
26964
  optionsRef: toRef(props, "options"),
27031
26965
  inputRef: toRef(props, "value"),
27032
26966
  stateless: props.value === null,
27033
26967
  onChange: (value) => emit("change", value.id)
27034
26968
  });
27035
- const toggler = useModalToggler({
27036
- wrapperRef: dropdownRef,
27037
- modalRef
27038
- });
26969
+ const toggler = useModalToggler();
27039
26970
  provide(InjectionTokens.ACTIVE_MANAGER, activeOptionManager);
27040
26971
  provide(InjectionTokens.TOGGLER, toggler);
27041
26972
  return (_ctx, _cache) => {
@@ -27057,11 +26988,10 @@ const _sfc_main$r = {
27057
26988
  "max-height": "300",
27058
26989
  "max-width": __props.maxWidth,
27059
26990
  toggler: unref(toggler),
27060
- ref_key: "modalRef",
27061
- ref: modalRef
26991
+ "reference-ref": dropdownRef.value
27062
26992
  }, {
27063
26993
  default: withCtx(() => [
27064
- createVNode(unref(_sfc_main$s), { options: __props.options }, {
26994
+ createVNode(unref(_sfc_main$t), { options: __props.options }, {
27065
26995
  option: withCtx((attrs) => [
27066
26996
  renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(attrs)), void 0, true)
27067
26997
  ]),
@@ -27069,12 +26999,12 @@ const _sfc_main$r = {
27069
26999
  }, 8, ["options"])
27070
27000
  ], void 0, true),
27071
27001
  _: 3
27072
- }, 8, ["max-width", "toggler"])
27002
+ }, 8, ["max-width", "toggler", "reference-ref"])
27073
27003
  ], 512);
27074
27004
  };
27075
27005
  }
27076
27006
  };
27077
- const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-c59753d1"]]);
27007
+ const Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-0d65726d"]]);
27078
27008
  function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened }) {
27079
27009
  const isOpened = computed(() => {
27080
27010
  var _a2;
@@ -27141,7 +27071,7 @@ function usePickerHotkeys({ isOpenedRef, onCancel, onApply }) {
27141
27071
  options: { capture: true }
27142
27072
  });
27143
27073
  }
27144
- const _sfc_main$q = {
27074
+ const _sfc_main$r = {
27145
27075
  __name: "ColorPicker",
27146
27076
  props: {
27147
27077
  value: {
@@ -27150,8 +27080,9 @@ const _sfc_main$q = {
27150
27080
  }
27151
27081
  },
27152
27082
  emits: ["change"],
27153
- setup(__props, { emit }) {
27083
+ setup(__props, { emit: __emit }) {
27154
27084
  const props = __props;
27085
+ const emit = __emit;
27155
27086
  const favoriteColorsService = inject(InjectionTokens$1.FAVORITE_COLORS);
27156
27087
  const editor = inject(InjectionTokens$1.EDITOR);
27157
27088
  const pickerRef = ref(null);
@@ -27211,12 +27142,11 @@ function useRecentFonts({ limit }) {
27211
27142
  const isEmpty = computed(() => !fonts.value.length);
27212
27143
  return { fonts, isEmpty, add };
27213
27144
  }
27214
- const FontFamilyControl_vue_vue_type_style_index_0_scoped_3931975f_lang = "";
27215
27145
  const _hoisted_1$b = {
27216
27146
  key: 0,
27217
27147
  class: "zw-dropdown__default-option"
27218
27148
  };
27219
- const _sfc_main$p = {
27149
+ const _sfc_main$q = {
27220
27150
  __name: "FontFamilyControl",
27221
27151
  setup(__props) {
27222
27152
  const fonts = inject(InjectionTokens$1.FONTS);
@@ -27285,13 +27215,12 @@ const _sfc_main$p = {
27285
27215
  };
27286
27216
  }
27287
27217
  };
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 = "";
27218
+ const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-3931975f"]]);
27290
27219
  const _hoisted_1$a = {
27291
27220
  key: 0,
27292
27221
  class: "zw-dropdown__default-option"
27293
27222
  };
27294
- const _sfc_main$o = {
27223
+ const _sfc_main$p = {
27295
27224
  __name: "FontWeightControl",
27296
27225
  setup(__props) {
27297
27226
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27335,13 +27264,12 @@ const _sfc_main$o = {
27335
27264
  };
27336
27265
  }
27337
27266
  };
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 = "";
27267
+ const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-54f744a9"]]);
27340
27268
  const _hoisted_1$9 = {
27341
27269
  key: 0,
27342
27270
  class: "zw-dropdown__default-option"
27343
27271
  };
27344
- const _sfc_main$n = {
27272
+ const _sfc_main$o = {
27345
27273
  __name: "FontSizeControl",
27346
27274
  setup(__props) {
27347
27275
  const fontSizes = inject(InjectionTokens$1.FONT_SIZES);
@@ -27386,13 +27314,13 @@ const _sfc_main$n = {
27386
27314
  };
27387
27315
  }
27388
27316
  };
27389
- const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-9452b945"]]);
27317
+ const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-9452b945"]]);
27390
27318
  const _hoisted_1$8 = {
27391
27319
  key: 0,
27392
27320
  class: "zw-button__customized-indicator",
27393
27321
  "data-test-selector": "customizedIndicator"
27394
27322
  };
27395
- const _sfc_main$m = {
27323
+ const _sfc_main$n = {
27396
27324
  __name: "FontColorControl",
27397
27325
  setup(__props) {
27398
27326
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27400,7 +27328,7 @@ const _sfc_main$m = {
27400
27328
  const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_COLOR);
27401
27329
  const apply2 = (color) => editor.chain().applyFontColor(color).run();
27402
27330
  return (_ctx, _cache) => {
27403
- return openBlock(), createBlock(unref(_sfc_main$q), {
27331
+ return openBlock(), createBlock(unref(_sfc_main$r), {
27404
27332
  value: unref(currentValue),
27405
27333
  onChange: apply2
27406
27334
  }, {
@@ -27437,14 +27365,14 @@ const _sfc_main$m = {
27437
27365
  };
27438
27366
  }
27439
27367
  };
27440
- const _sfc_main$l = {
27368
+ const _sfc_main$m = {
27441
27369
  __name: "BackgroundColorControl",
27442
27370
  setup(__props) {
27443
27371
  const editor = inject(InjectionTokens$1.EDITOR);
27444
27372
  const currentValue = editor.commands.getBackgroundColor();
27445
27373
  const apply2 = (color) => editor.chain().applyBackgroundColor(color).run();
27446
27374
  return (_ctx, _cache) => {
27447
- return openBlock(), createBlock(unref(_sfc_main$q), {
27375
+ return openBlock(), createBlock(unref(_sfc_main$r), {
27448
27376
  value: unref(currentValue),
27449
27377
  onChange: apply2
27450
27378
  }, {
@@ -27477,7 +27405,7 @@ const _hoisted_1$7 = {
27477
27405
  class: "zw-button__customized-indicator",
27478
27406
  "data-test-selector": "customizedIndicator"
27479
27407
  };
27480
- const _sfc_main$k = {
27408
+ const _sfc_main$l = {
27481
27409
  __name: "ItalicControl",
27482
27410
  setup(__props) {
27483
27411
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27521,7 +27449,7 @@ const _hoisted_1$6 = {
27521
27449
  class: "zw-button__customized-indicator",
27522
27450
  "data-test-selector": "customizedIndicator"
27523
27451
  };
27524
- const _sfc_main$j = {
27452
+ const _sfc_main$k = {
27525
27453
  __name: "UnderlineControl",
27526
27454
  setup(__props) {
27527
27455
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27558,7 +27486,7 @@ const _sfc_main$j = {
27558
27486
  };
27559
27487
  }
27560
27488
  };
27561
- const _sfc_main$i = {
27489
+ const _sfc_main$j = {
27562
27490
  __name: "StrikeThroughControl",
27563
27491
  setup(__props) {
27564
27492
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27585,7 +27513,7 @@ const _sfc_main$i = {
27585
27513
  };
27586
27514
  }
27587
27515
  };
27588
- const _sfc_main$h = {
27516
+ const _sfc_main$i = {
27589
27517
  __name: "SuperscriptControl",
27590
27518
  setup(__props) {
27591
27519
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27612,7 +27540,7 @@ const _sfc_main$h = {
27612
27540
  };
27613
27541
  }
27614
27542
  };
27615
- const _sfc_main$g = {
27543
+ const _sfc_main$h = {
27616
27544
  __name: "CaseStyleControl",
27617
27545
  setup(__props) {
27618
27546
  const styles = [
@@ -27651,10 +27579,11 @@ const _sfc_main$g = {
27651
27579
  };
27652
27580
  }
27653
27581
  };
27654
- const _sfc_main$f = {
27582
+ const _sfc_main$g = {
27655
27583
  __name: "AlignmentControl",
27656
27584
  emits: ["applied"],
27657
- setup(__props, { emit }) {
27585
+ setup(__props, { emit: __emit }) {
27586
+ const emit = __emit;
27658
27587
  const alignments = [
27659
27588
  {
27660
27589
  id: Alignments.LEFT,
@@ -27725,24 +27654,21 @@ const _sfc_main$f = {
27725
27654
  };
27726
27655
  }
27727
27656
  };
27728
- const LineHeightControl_vue_vue_type_style_index_0_scoped_74a13b9d_lang = "";
27729
27657
  const _hoisted_1$5 = {
27730
27658
  key: 0,
27731
27659
  class: "zw-button__customized-indicator",
27732
27660
  "data-test-selector": "customizedIndicator"
27733
27661
  };
27734
- const _hoisted_2$3 = { class: "zw-line-height-control__row" };
27735
- const _sfc_main$e = {
27662
+ const _hoisted_2$2 = { class: "zw-line-height-control__row" };
27663
+ const _sfc_main$f = {
27736
27664
  __name: "LineHeightControl",
27737
27665
  setup(__props) {
27738
- const wrapperRef = ref(null);
27739
- const modalRef = ref(null);
27740
27666
  const editor = inject(InjectionTokens$1.EDITOR);
27741
- const toggler = useModalToggler({ wrapperRef, modalRef });
27667
+ const wrapperRef = ref(null);
27668
+ const toggler = useModalToggler();
27742
27669
  const currentValue = editor.commands.getLineHeight();
27743
27670
  const isCustomized = editor.commands.isSettingCustomized(TextSettings.LINE_HEIGHT);
27744
27671
  const apply2 = (value) => editor.commands.applyLineHeight(String(value));
27745
- const isOpened = computed(() => unref(toggler.isOpened));
27746
27672
  return (_ctx, _cache) => {
27747
27673
  return openBlock(), createElementBlock("div", {
27748
27674
  class: "zw-position--relative",
@@ -27753,7 +27679,7 @@ const _sfc_main$e = {
27753
27679
  class: "zw-position--relative",
27754
27680
  icon: "",
27755
27681
  skin: "toolbar",
27756
- active: isOpened.value,
27682
+ active: unref(toggler).isOpened,
27757
27683
  onClick: unref(toggler).open
27758
27684
  }, {
27759
27685
  default: withCtx(() => [
@@ -27777,9 +27703,8 @@ const _sfc_main$e = {
27777
27703
  ]),
27778
27704
  createVNode(unref(Modal), {
27779
27705
  class: "zw-line-height-control__modal",
27780
- ref_key: "modalRef",
27781
- ref: modalRef,
27782
- toggler: unref(toggler)
27706
+ toggler: unref(toggler),
27707
+ "reference-ref": wrapperRef.value
27783
27708
  }, {
27784
27709
  default: withCtx(() => [
27785
27710
  createVNode(unref(FieldLabel), {
@@ -27791,7 +27716,7 @@ const _sfc_main$e = {
27791
27716
  ], void 0, true),
27792
27717
  _: 1
27793
27718
  }),
27794
- createElementVNode("div", _hoisted_2$3, [
27719
+ createElementVNode("div", _hoisted_2$2, [
27795
27720
  createVNode(unref(Range), {
27796
27721
  class: "zw-line-height-control__range",
27797
27722
  step: "0.1",
@@ -27812,15 +27737,14 @@ const _sfc_main$e = {
27812
27737
  ])
27813
27738
  ], void 0, true),
27814
27739
  _: 1
27815
- }, 8, ["toggler"])
27740
+ }, 8, ["toggler", "reference-ref"])
27816
27741
  ], 512);
27817
27742
  };
27818
27743
  }
27819
27744
  };
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 = "";
27745
+ const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-8eb86211"]]);
27822
27746
  const _hoisted_1$4 = { class: "zpa-list-control" };
27823
- const _sfc_main$d = {
27747
+ const _sfc_main$e = {
27824
27748
  __name: "ListControl",
27825
27749
  setup(__props) {
27826
27750
  const listTypes = ListTypes.values.map((type) => ({
@@ -27903,8 +27827,8 @@ const _sfc_main$d = {
27903
27827
  };
27904
27828
  }
27905
27829
  };
27906
- const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-923a86d6"]]);
27907
- const _sfc_main$c = {
27830
+ const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-923a86d6"]]);
27831
+ const _sfc_main$d = {
27908
27832
  __name: "RemoveFormatControl",
27909
27833
  setup(__props) {
27910
27834
  const editor = inject(InjectionTokens$1.EDITOR);
@@ -27935,20 +27859,20 @@ const RegExps = {
27935
27859
  MAILTO_PROTOCOL: /^mailto:.+$/,
27936
27860
  TEL_PROTOCOL: /^tel:.+$/
27937
27861
  };
27938
- const LinkControlHeader_vue_vue_type_style_index_0_scoped_64870ac2_lang = "";
27939
27862
  const _withScopeId$1 = (n) => (pushScopeId("data-v-64870ac2"), n = n(), popScopeId(), n);
27940
27863
  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 = {
27864
+ const _hoisted_2$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "zw-link-modal-header__title" }, " Link ", -1));
27865
+ const _sfc_main$c = {
27943
27866
  __name: "LinkControlHeader",
27944
27867
  emits: ["remove-link"],
27945
- setup(__props, { emit }) {
27868
+ setup(__props, { emit: __emit }) {
27869
+ const emit = __emit;
27946
27870
  const editor = inject(InjectionTokens$1.EDITOR);
27947
27871
  const isLink = editor.commands.isLink();
27948
27872
  const removeLink = () => emit("remove-link");
27949
27873
  return (_ctx, _cache) => {
27950
27874
  return openBlock(), createElementBlock("div", _hoisted_1$3, [
27951
- _hoisted_2$2,
27875
+ _hoisted_2$1,
27952
27876
  createVNode(unref(Button), {
27953
27877
  class: "zw-link-modal-header__unlink-button",
27954
27878
  disabled: !unref(isLink),
@@ -27970,7 +27894,7 @@ const _sfc_main$b = {
27970
27894
  };
27971
27895
  }
27972
27896
  };
27973
- const LinkControlHeader = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-64870ac2"]]);
27897
+ const LinkControlHeader = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-64870ac2"]]);
27974
27898
  function useLink() {
27975
27899
  const editor = inject(InjectionTokens$1.EDITOR);
27976
27900
  const pageBlocks = inject(InjectionTokens$1.PAGE_BLOCKS);
@@ -28038,7 +27962,7 @@ function useLink() {
28038
27962
  updateText
28039
27963
  };
28040
27964
  }
28041
- const _sfc_main$a = {
27965
+ const _sfc_main$b = {
28042
27966
  __name: "LinkControlPageBlock",
28043
27967
  props: {
28044
27968
  value: {
@@ -28047,7 +27971,8 @@ const _sfc_main$a = {
28047
27971
  }
28048
27972
  },
28049
27973
  emits: ["update"],
28050
- setup(__props, { emit }) {
27974
+ setup(__props, { emit: __emit }) {
27975
+ const emit = __emit;
28051
27976
  const pageBlocks = inject(InjectionTokens$1.PAGE_BLOCKS);
28052
27977
  const applyBlock = (id) => {
28053
27978
  const block = pageBlocks.value.find((block2) => block2.id === id);
@@ -28060,7 +27985,7 @@ const _sfc_main$a = {
28060
27985
  "field-id": "link-destination"
28061
27986
  }, {
28062
27987
  default: withCtx(() => [
28063
- createTextVNode(" Select block ")
27988
+ createTextVNode(" Select section ")
28064
27989
  ], void 0, true),
28065
27990
  _: 1
28066
27991
  }),
@@ -28083,7 +28008,7 @@ const _sfc_main$a = {
28083
28008
  };
28084
28009
  }
28085
28010
  };
28086
- const _sfc_main$9 = {
28011
+ const _sfc_main$a = {
28087
28012
  __name: "LinkControlUrl",
28088
28013
  props: {
28089
28014
  href: {
@@ -28100,7 +28025,8 @@ const _sfc_main$9 = {
28100
28025
  }
28101
28026
  },
28102
28027
  emits: ["update-link", "update-target"],
28103
- setup(__props, { emit }) {
28028
+ setup(__props, { emit: __emit }) {
28029
+ const emit = __emit;
28104
28030
  const updateLink = (value) => emit("update-link", value);
28105
28031
  const updateTarget = (value) => emit("update-target", value);
28106
28032
  return (_ctx, _cache) => {
@@ -28122,7 +28048,7 @@ const _sfc_main$9 = {
28122
28048
  };
28123
28049
  }
28124
28050
  };
28125
- const _sfc_main$8 = {
28051
+ const _sfc_main$9 = {
28126
28052
  __name: "LinkControlDestination",
28127
28053
  props: {
28128
28054
  link: {
@@ -28135,11 +28061,12 @@ const _sfc_main$8 = {
28135
28061
  }
28136
28062
  },
28137
28063
  emits: ["reset-errors"],
28138
- setup(__props, { emit }) {
28064
+ setup(__props, { emit: __emit }) {
28139
28065
  const props = __props;
28066
+ const emit = __emit;
28140
28067
  const destinationTypes = [
28141
28068
  { id: LinkDestinations.URL, title: "URL" },
28142
- { id: LinkDestinations.BLOCK, title: "Page Block" }
28069
+ { id: LinkDestinations.BLOCK, title: "Page Section" }
28143
28070
  ];
28144
28071
  const link = toRef(props, "link");
28145
28072
  const isURLDestination = computed(() => link.value.currentDestination.value.id === LinkDestinations.URL);
@@ -28179,7 +28106,7 @@ const _sfc_main$8 = {
28179
28106
  ]),
28180
28107
  _: 1
28181
28108
  }, 8, ["value"]),
28182
- isURLDestination.value ? (openBlock(), createBlock(unref(_sfc_main$9), {
28109
+ isURLDestination.value ? (openBlock(), createBlock(unref(_sfc_main$a), {
28183
28110
  key: 0,
28184
28111
  class: "zw-margin-bottom--md",
28185
28112
  href: link.value.destinationHrefs.value.url,
@@ -28187,7 +28114,7 @@ const _sfc_main$8 = {
28187
28114
  validator: __props.validator,
28188
28115
  onUpdateLink: updateLink,
28189
28116
  onUpdateTarget: link.value.updateTarget
28190
- }, null, 8, ["href", "isTargetBlank", "validator", "onUpdateTarget"])) : (openBlock(), createBlock(unref(_sfc_main$a), {
28117
+ }, null, 8, ["href", "isTargetBlank", "validator", "onUpdateTarget"])) : (openBlock(), createBlock(unref(_sfc_main$b), {
28191
28118
  key: 1,
28192
28119
  value: link.value.destinationHrefs.value.block,
28193
28120
  onUpdate: updateLink
@@ -28196,15 +28123,12 @@ const _sfc_main$8 = {
28196
28123
  };
28197
28124
  }
28198
28125
  };
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 = {
28126
+ const _hoisted_1$2 = { class: "zw-link-modal__actions" };
28127
+ const _sfc_main$8 = {
28203
28128
  __name: "LinkControl",
28204
28129
  setup(__props) {
28205
- const wrapperRef = ref(null);
28206
- const modalRef = ref(null);
28207
28130
  const editor = inject(InjectionTokens$1.EDITOR);
28131
+ const wrapperRef = ref(null);
28208
28132
  const link = useLink();
28209
28133
  const isEmpty = () => {
28210
28134
  return link.linkData.value.text ? false : "Can't be empty";
@@ -28231,18 +28155,15 @@ const _sfc_main$7 = {
28231
28155
  nameValidator.reset();
28232
28156
  urlValidator.reset();
28233
28157
  };
28234
- const onBeforeOpened = () => {
28235
- editor.commands.extendMarkRange(TextSettings.LINK);
28236
- resetErrors();
28237
- link.prepareInitialFields();
28238
- };
28239
28158
  const toggler = useModalToggler({
28240
- onBeforeOpened: () => onBeforeOpened(),
28241
- wrapperRef,
28242
- modalRef
28159
+ onBeforeOpened: () => {
28160
+ editor.commands.extendMarkRange(TextSettings.LINK);
28161
+ resetErrors();
28162
+ link.prepareInitialFields();
28163
+ }
28243
28164
  });
28244
28165
  const isLink = editor.commands.isLink();
28245
- const isActive2 = computed(() => unref(toggler.isOpened) || unref(isLink));
28166
+ const isActive2 = computed(() => toggler.isOpened || unref(isLink));
28246
28167
  const updateLinkText = (value) => {
28247
28168
  resetErrors();
28248
28169
  link.updateText(value);
@@ -28286,8 +28207,7 @@ const _sfc_main$7 = {
28286
28207
  createVNode(unref(Modal), {
28287
28208
  class: "zw-link-modal",
28288
28209
  toggler: unref(toggler),
28289
- ref_key: "modalRef",
28290
- ref: modalRef,
28210
+ "reference-ref": wrapperRef.value,
28291
28211
  "focus-first-control": ""
28292
28212
  }, {
28293
28213
  default: withCtx(() => [
@@ -28305,13 +28225,13 @@ const _sfc_main$7 = {
28305
28225
  error: unref(nameValidator).error.value,
28306
28226
  onInput: updateLinkText
28307
28227
  }, null, 8, ["value", "error"]),
28308
- createVNode(unref(_sfc_main$8), {
28228
+ createVNode(unref(_sfc_main$9), {
28309
28229
  class: "zw-margin-bottom--md",
28310
28230
  link: unref(link),
28311
28231
  validator: unref(urlValidator),
28312
28232
  onResetErrors: resetErrors
28313
28233
  }, null, 8, ["link", "validator"]),
28314
- createElementVNode("div", _hoisted_2$1, [
28234
+ createElementVNode("div", _hoisted_1$2, [
28315
28235
  createVNode(unref(Button), {
28316
28236
  class: "zw-margin-right--xs",
28317
28237
  skin: "secondary",
@@ -28332,17 +28252,16 @@ const _sfc_main$7 = {
28332
28252
  _: 1
28333
28253
  })
28334
28254
  ])
28335
- ], 40, _hoisted_1$2)
28255
+ ], 32)
28336
28256
  ], void 0, true),
28337
28257
  _: 1
28338
- }, 8, ["toggler"])
28258
+ }, 8, ["toggler", "reference-ref"])
28339
28259
  ], 512);
28340
28260
  };
28341
28261
  }
28342
28262
  };
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 = {
28263
+ const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-5d6cf980"]]);
28264
+ const _sfc_main$7 = {
28346
28265
  name: "StylePresetOption",
28347
28266
  components: {
28348
28267
  DropdownOption
@@ -28389,10 +28308,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
28389
28308
  _: 1
28390
28309
  }, 8, ["style", "option"]);
28391
28310
  }
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 = "";
28311
+ const StylePresetOption = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render], ["__scopeId", "data-v-c80fcebf"]]);
28394
28312
  const _hoisted_1 = { class: "zw-style-preset-control" };
28395
- const _sfc_main$5 = {
28313
+ const _sfc_main$6 = {
28396
28314
  __name: "StylePresetControl",
28397
28315
  setup(__props) {
28398
28316
  const CLEAR_MARKS = [TextSettings.FONT_SIZE, TextSettings.FONT_WEIGHT];
@@ -28460,8 +28378,8 @@ const _sfc_main$5 = {
28460
28378
  };
28461
28379
  }
28462
28380
  };
28463
- const StylePresetControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-a8aff4db"]]);
28464
- const _sfc_main$4 = {
28381
+ const StylePresetControl = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-a8aff4db"]]);
28382
+ const _sfc_main$5 = {
28465
28383
  __name: "ToolbarDesktop",
28466
28384
  props: {
28467
28385
  aiComponent: {
@@ -28489,8 +28407,8 @@ const _sfc_main$4 = {
28489
28407
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28490
28408
  createVNode(unref(ToolbarGroup), null, {
28491
28409
  default: withCtx(() => [
28492
- createVNode(unref(_sfc_main$m)),
28493
- createVNode(unref(_sfc_main$l))
28410
+ createVNode(unref(_sfc_main$n)),
28411
+ createVNode(unref(_sfc_main$m))
28494
28412
  ], void 0, true),
28495
28413
  _: 1
28496
28414
  })
@@ -28502,16 +28420,16 @@ const _sfc_main$4 = {
28502
28420
  default: withCtx(() => [
28503
28421
  createVNode(unref(ToolbarGroup), null, {
28504
28422
  default: withCtx(() => [
28423
+ createVNode(unref(_sfc_main$l)),
28505
28424
  createVNode(unref(_sfc_main$k)),
28506
28425
  createVNode(unref(_sfc_main$j)),
28507
28426
  createVNode(unref(_sfc_main$i)),
28508
- createVNode(unref(_sfc_main$h)),
28509
- createVNode(unref(_sfc_main$g))
28427
+ createVNode(unref(_sfc_main$h))
28510
28428
  ], void 0, true),
28511
28429
  _: 1
28512
28430
  }),
28513
28431
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28514
- createVNode(unref(_sfc_main$f)),
28432
+ createVNode(unref(_sfc_main$g)),
28515
28433
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28516
28434
  createVNode(unref(LineHeightControl)),
28517
28435
  createVNode(unref(ToolbarDivider), { vertical: "" }),
@@ -28520,7 +28438,7 @@ const _sfc_main$4 = {
28520
28438
  createVNode(unref(ToolbarGroup), null, {
28521
28439
  default: withCtx(() => [
28522
28440
  createVNode(unref(LinkControl)),
28523
- createVNode(unref(_sfc_main$c))
28441
+ createVNode(unref(_sfc_main$d))
28524
28442
  ], void 0, true),
28525
28443
  _: 1
28526
28444
  })
@@ -28531,7 +28449,7 @@ const _sfc_main$4 = {
28531
28449
  };
28532
28450
  }
28533
28451
  };
28534
- const _sfc_main$3 = {
28452
+ const _sfc_main$4 = {
28535
28453
  __name: "ToolbarMobile",
28536
28454
  setup(__props) {
28537
28455
  return (_ctx, _cache) => {
@@ -28553,19 +28471,19 @@ const _sfc_main$3 = {
28553
28471
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28554
28472
  createVNode(unref(ToolbarGroup), null, {
28555
28473
  default: withCtx(() => [
28556
- createVNode(unref(_sfc_main$m)),
28557
- createVNode(unref(_sfc_main$l))
28474
+ createVNode(unref(_sfc_main$n)),
28475
+ createVNode(unref(_sfc_main$m))
28558
28476
  ], void 0, true),
28559
28477
  _: 1
28560
28478
  }),
28561
28479
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28562
28480
  createVNode(unref(ToolbarGroup), null, {
28563
28481
  default: withCtx(() => [
28482
+ createVNode(unref(_sfc_main$l)),
28564
28483
  createVNode(unref(_sfc_main$k)),
28565
28484
  createVNode(unref(_sfc_main$j)),
28566
28485
  createVNode(unref(_sfc_main$i)),
28567
- createVNode(unref(_sfc_main$h)),
28568
- createVNode(unref(_sfc_main$g))
28486
+ createVNode(unref(_sfc_main$h))
28569
28487
  ], void 0, true),
28570
28488
  _: 1
28571
28489
  })
@@ -28575,7 +28493,7 @@ const _sfc_main$3 = {
28575
28493
  createVNode(unref(ToolbarDivider), { horizontal: "" }),
28576
28494
  createVNode(unref(ToolbarRow), null, {
28577
28495
  default: withCtx(() => [
28578
- createVNode(unref(_sfc_main$f)),
28496
+ createVNode(unref(_sfc_main$g)),
28579
28497
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28580
28498
  createVNode(unref(LineHeightControl)),
28581
28499
  createVNode(unref(ToolbarDivider), { vertical: "" }),
@@ -28584,7 +28502,7 @@ const _sfc_main$3 = {
28584
28502
  createVNode(unref(ToolbarGroup), null, {
28585
28503
  default: withCtx(() => [
28586
28504
  createVNode(unref(LinkControl)),
28587
- createVNode(unref(_sfc_main$c))
28505
+ createVNode(unref(_sfc_main$d))
28588
28506
  ], void 0, true),
28589
28507
  _: 1
28590
28508
  })
@@ -28595,7 +28513,7 @@ const _sfc_main$3 = {
28595
28513
  };
28596
28514
  }
28597
28515
  };
28598
- const _sfc_main$2 = {
28516
+ const _sfc_main$3 = {
28599
28517
  __name: "ToolbarPopup",
28600
28518
  props: {
28601
28519
  aiComponent: {
@@ -28623,19 +28541,19 @@ const _sfc_main$2 = {
28623
28541
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28624
28542
  createVNode(unref(ToolbarGroup), null, {
28625
28543
  default: withCtx(() => [
28626
- createVNode(unref(_sfc_main$m)),
28627
- createVNode(unref(_sfc_main$l))
28544
+ createVNode(unref(_sfc_main$n)),
28545
+ createVNode(unref(_sfc_main$m))
28628
28546
  ], void 0, true),
28629
28547
  _: 1
28630
28548
  }),
28631
28549
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28632
28550
  createVNode(unref(ToolbarGroup), null, {
28633
28551
  default: withCtx(() => [
28552
+ createVNode(unref(_sfc_main$l)),
28634
28553
  createVNode(unref(_sfc_main$k)),
28635
28554
  createVNode(unref(_sfc_main$j)),
28636
28555
  createVNode(unref(_sfc_main$i)),
28637
- createVNode(unref(_sfc_main$h)),
28638
- createVNode(unref(_sfc_main$g))
28556
+ createVNode(unref(_sfc_main$h))
28639
28557
  ], void 0, true),
28640
28558
  _: 1
28641
28559
  })
@@ -28645,7 +28563,7 @@ const _sfc_main$2 = {
28645
28563
  createVNode(unref(ToolbarDivider), { horizontal: "" }),
28646
28564
  createVNode(unref(ToolbarRow), null, {
28647
28565
  default: withCtx(() => [
28648
- createVNode(unref(_sfc_main$f)),
28566
+ createVNode(unref(_sfc_main$g)),
28649
28567
  createVNode(unref(ToolbarDivider), { vertical: "" }),
28650
28568
  createVNode(unref(LineHeightControl)),
28651
28569
  createVNode(unref(ToolbarDivider), { vertical: "" }),
@@ -28654,7 +28572,7 @@ const _sfc_main$2 = {
28654
28572
  createVNode(unref(ToolbarGroup), null, {
28655
28573
  default: withCtx(() => [
28656
28574
  createVNode(unref(LinkControl)),
28657
- createVNode(unref(_sfc_main$c))
28575
+ createVNode(unref(_sfc_main$d))
28658
28576
  ], void 0, true),
28659
28577
  _: 1
28660
28578
  })
@@ -28665,7 +28583,46 @@ const _sfc_main$2 = {
28665
28583
  };
28666
28584
  }
28667
28585
  };
28668
- const Toolbar_vue_vue_type_style_index_0_scoped_d3e5d777_lang = "";
28586
+ const _sfc_main$2 = {
28587
+ __name: "ToolbarFloating",
28588
+ props: {
28589
+ referenceRef: {
28590
+ type: Object,
28591
+ required: true
28592
+ },
28593
+ placement: {
28594
+ type: String,
28595
+ required: true
28596
+ },
28597
+ offsets: {
28598
+ type: Array,
28599
+ required: true
28600
+ }
28601
+ },
28602
+ setup(__props) {
28603
+ const props = __props;
28604
+ const floatingRef = ref(null);
28605
+ const referenceRef = toRef(props, "referenceRef");
28606
+ const middlewares = computed(() => [
28607
+ shift({ padding: 16, crossAxis: true, limiter: limitShift() }),
28608
+ offset({ crossAxis: props.offsets[0], mainAxis: props.offsets[1] })
28609
+ ]);
28610
+ const { floatingStyles } = useFloating(referenceRef, floatingRef, {
28611
+ placement: toRef(props, "placement"),
28612
+ strategy: "fixed",
28613
+ middleware: middlewares
28614
+ });
28615
+ return (_ctx, _cache) => {
28616
+ return openBlock(), createElementBlock("div", {
28617
+ ref_key: "floatingRef",
28618
+ ref: floatingRef,
28619
+ style: normalizeStyle(unref(floatingStyles))
28620
+ }, [
28621
+ renderSlot(_ctx.$slots, "default")
28622
+ ], 4);
28623
+ };
28624
+ }
28625
+ };
28669
28626
  const _sfc_main$1 = {
28670
28627
  __name: "Toolbar",
28671
28628
  props: {
@@ -28673,14 +28630,27 @@ const _sfc_main$1 = {
28673
28630
  type: String,
28674
28631
  required: true
28675
28632
  },
28676
- toolbar: {
28677
- type: Object,
28633
+ visible: {
28634
+ type: Boolean,
28678
28635
  required: true
28679
28636
  },
28680
28637
  popupMode: {
28681
28638
  type: Boolean,
28682
28639
  required: true
28683
28640
  },
28641
+ referenceRef: {
28642
+ type: Object,
28643
+ required: false,
28644
+ default: null
28645
+ },
28646
+ placement: {
28647
+ type: String,
28648
+ required: true
28649
+ },
28650
+ offsets: {
28651
+ type: Array,
28652
+ required: true
28653
+ },
28684
28654
  aiComponent: {
28685
28655
  type: Object,
28686
28656
  required: false,
@@ -28688,19 +28658,14 @@ const _sfc_main$1 = {
28688
28658
  }
28689
28659
  },
28690
28660
  setup(__props) {
28691
- const props = __props;
28692
28661
  useCssVars((_ctx) => ({
28693
- "c6eda43c": __props.toolbar.offsets[1]
28662
+ "0f007386": __props.offsets[1]
28694
28663
  }));
28664
+ const props = __props;
28695
28665
  const layoutComponent = computed(() => {
28696
28666
  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);
28667
+ return _sfc_main$3;
28668
+ return props.device === Devices.MOBILE ? _sfc_main$4 : _sfc_main$5;
28704
28669
  });
28705
28670
  return (_ctx, _cache) => {
28706
28671
  return openBlock(), createBlock(KeepAlive, null, [
@@ -28709,14 +28674,18 @@ const _sfc_main$1 = {
28709
28674
  duration: "150"
28710
28675
  }, {
28711
28676
  default: withCtx(() => [
28712
- isVisible.value ? (openBlock(), createElementBlock("div", {
28677
+ __props.visible && __props.referenceRef ? (openBlock(), createBlock(unref(_sfc_main$2), {
28713
28678
  key: 0,
28714
28679
  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)
28680
+ "reference-ref": __props.referenceRef,
28681
+ placement: __props.placement,
28682
+ offsets: __props.offsets
28683
+ }, {
28684
+ default: withCtx(() => [
28685
+ (openBlock(), createBlock(resolveDynamicComponent(layoutComponent.value), { "ai-component": __props.aiComponent }, null, 8, ["ai-component"]))
28686
+ ], void 0, true),
28687
+ _: 1
28688
+ }, 8, ["reference-ref", "placement", "offsets"])) : createCommentVNode("", true)
28720
28689
  ], void 0, true),
28721
28690
  _: 1
28722
28691
  })
@@ -28724,7 +28693,7 @@ const _sfc_main$1 = {
28724
28693
  };
28725
28694
  }
28726
28695
  };
28727
- const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d3e5d777"]]);
28696
+ const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-39370f99"]]);
28728
28697
  function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
28729
28698
  let editor;
28730
28699
  const getContent = () => markWysiwygContent(editor.getJSON());
@@ -28733,7 +28702,12 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
28733
28702
  onUpdate: () => onChange(getContent()),
28734
28703
  extensions: extensions2,
28735
28704
  injectCSS: false,
28736
- editable: !unref(isReadonlyRef)
28705
+ editable: !unref(isReadonlyRef),
28706
+ editorProps: {
28707
+ attributes: {
28708
+ class: "zw-wysiwyg__content"
28709
+ }
28710
+ }
28737
28711
  }));
28738
28712
  onUnmounted(() => editor.destroy());
28739
28713
  watch(content, (value) => {
@@ -28742,36 +28716,9 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
28742
28716
  editor.commands.setContent(content2, false);
28743
28717
  }
28744
28718
  });
28745
- watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly));
28719
+ watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly, false));
28746
28720
  return { editor, getContent };
28747
28721
  }
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
28722
  class Font {
28776
28723
  constructor({ name, category, styles }) {
28777
28724
  this.name = name;
@@ -28806,7 +28753,6 @@ class Font {
28806
28753
  return String(closestWeight);
28807
28754
  }
28808
28755
  }
28809
- const main_css_vue_type_style_index_0_src_true_lang = "";
28810
28756
  const MIN_FONT_SIZE = 5;
28811
28757
  const MAX_FONT_SIZE = 112;
28812
28758
  const _sfc_main = {
@@ -28900,30 +28846,19 @@ const _sfc_main = {
28900
28846
  "update:model-value",
28901
28847
  "update-favorite-colors"
28902
28848
  ],
28903
- setup(__props, { expose: __expose, emit }) {
28849
+ setup(__props, { expose: __expose, emit: __emit }) {
28904
28850
  const props = __props;
28851
+ const emit = __emit;
28905
28852
  ContextWindow.use(props.window);
28906
28853
  const fonts = props.fonts.map((font) => new Font(font));
28907
- const toolbarRef = ref(null);
28908
28854
  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
- }
28855
+ const wrapperRef = computed(() => wysiwygRef.value || document.body);
28856
+ const isToolbarVisible = computed(() => props.active && !props.readonly);
28857
+ const onChange = (content) => emit("update:model-value", content);
28923
28858
  const pageBlocks = toRef(props, "pageBlocks");
28924
28859
  const { editor, getContent } = useEditor({
28925
28860
  content: toRef(props, "modelValue"),
28926
- onChange: (content) => onChange(content),
28861
+ onChange,
28927
28862
  isReadonlyRef: toRef(props, "readonly"),
28928
28863
  extensions: buildExtensions({
28929
28864
  fonts,
@@ -28960,13 +28895,14 @@ const _sfc_main = {
28960
28895
  ref: wysiwygRef
28961
28896
  }, [
28962
28897
  createVNode(unref(Toolbar), {
28963
- toolbar: unref(toolbar),
28964
28898
  device: __props.device,
28899
+ visible: isToolbarVisible.value,
28965
28900
  "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"]),
28901
+ "reference-ref": wysiwygRef.value,
28902
+ placement: __props.toolbarPlacement,
28903
+ offsets: __props.toolbarOffsets,
28904
+ "ai-component": __props.aiComponent
28905
+ }, null, 8, ["device", "visible", "popup-mode", "reference-ref", "placement", "offsets", "ai-component"]),
28970
28906
  createVNode(unref(EditorContent), { editor: unref(editor) }, null, 8, ["editor"])
28971
28907
  ], 512);
28972
28908
  };
@@ -28977,7 +28913,7 @@ export {
28977
28913
  Button,
28978
28914
  ButtonToggle,
28979
28915
  Checkbox,
28980
- _sfc_main$q as ColorPicker,
28916
+ _sfc_main$r as ColorPicker,
28981
28917
  Dropdown,
28982
28918
  DropdownOption,
28983
28919
  FieldLabel,