mechanica 1.0.13 → 1.0.15

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.
package/dist/editor.js CHANGED
@@ -1,10 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { defineComponent, ref, watch, createElementBlock, openBlock, normalizeStyle, createElementVNode, reactive, computed, shallowRef, onMounted, onBeforeUnmount, triggerRef, inject, normalizeClass, createCommentVNode, renderSlot, createVNode, createTextVNode, toDisplayString, Transition, withCtx, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, toValue as toValue$1, getCurrentInstance, nextTick, unref, createBlock, createSlots, withDirectives, vModelText, vModelDynamic, Fragment, renderList, h, TransitionGroup, useSlots, Teleport, mergeProps, withModifiers, mergeModels, useModel, createStaticVNode, resolveDynamicComponent, isRef, vShow, shallowReactive, vModelCheckbox, isProxy, toRaw, resolveComponent, normalizeProps, guardReactiveProps, provide, createApp } from "vue";
5
- import { p as passDefaultValue, d as defaultImageSrc, g as getDefaultValue, r as registerAliases, u as unfoldSchema } from "./schemaAliases-DFqu3A9-.js";
4
+ import { defineComponent, ref, watch, createElementBlock, openBlock, normalizeStyle, createElementVNode, reactive, computed, shallowRef, onMounted, onBeforeUnmount, triggerRef, inject, normalizeClass, createCommentVNode, renderSlot, createVNode, createTextVNode, toDisplayString, Transition, withCtx, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, toValue as toValue$1, getCurrentInstance, nextTick, unref, createBlock, createSlots, withDirectives, vModelText, vModelDynamic, Fragment, renderList, h, TransitionGroup, useSlots, Teleport, mergeProps, withModifiers, mergeModels, useModel, createStaticVNode, resolveDynamicComponent, resolveComponent, vShow, shallowReactive, vModelCheckbox, isProxy, toRaw, normalizeProps, guardReactiveProps, provide, createApp } from "vue";
5
+ import { p as passDefaultValue, d as defaultImageSrc, g as getDefaultValue, r as registerAliases, a as registerAlias, u as unfoldSchema } from "./schemaAliases-41dA1AHj.js";
6
6
  import { blocksList as blocksList$1, addUpdateListener } from "virtual:builder-blocks";
7
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
7
+ const _sfc_main$P = /* @__PURE__ */ defineComponent({
8
8
  __name: "HoverFrame",
9
9
  props: {
10
10
  element: {},
@@ -46,7 +46,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
46
46
  };
47
47
  }
48
48
  });
49
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
49
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
50
50
  __name: "InsertedPlace",
51
51
  props: {
52
52
  top: {}
@@ -67,40 +67,40 @@ const _export_sfc = (sfc, props) => {
67
67
  }
68
68
  return target;
69
69
  };
70
- const _sfc_main$L = {};
71
- const _hoisted_1$B = {
70
+ const _sfc_main$N = {};
71
+ const _hoisted_1$D = {
72
72
  width: "16",
73
73
  height: "16",
74
74
  viewBox: "0 0 16 16",
75
75
  fill: "none",
76
76
  xmlns: "http://www.w3.org/2000/svg"
77
77
  };
78
- function _sfc_render$g(_ctx, _cache) {
79
- return openBlock(), createElementBlock("svg", _hoisted_1$B, _cache[0] || (_cache[0] = [
78
+ function _sfc_render$h(_ctx, _cache) {
79
+ return openBlock(), createElementBlock("svg", _hoisted_1$D, _cache[0] || (_cache[0] = [
80
80
  createElementVNode("path", {
81
81
  d: "M10.707 14.364C10.8945 14.1764 10.9998 13.9221 10.9998 13.657C10.9998 13.3918 10.8945 13.1375 10.707 12.95L5.75705 7.99995L10.707 3.04995C10.8892 2.86135 10.99 2.60875 10.9877 2.34655C10.9854 2.08435 10.8803 1.83354 10.6949 1.64813C10.5095 1.46272 10.2586 1.35756 9.99645 1.35528C9.73425 1.353 9.48165 1.45379 9.29305 1.63595L3.63605 7.29295C3.44858 7.48048 3.34326 7.73479 3.34326 7.99995C3.34326 8.26512 3.44858 8.51942 3.63605 8.70695L9.29305 14.364C9.48058 14.5514 9.73488 14.6567 10 14.6567C10.2652 14.6567 10.5195 14.5514 10.707 14.364Z",
82
82
  fill: "currentColor"
83
83
  }, null, -1)
84
84
  ]));
85
85
  }
86
- const ChevronLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$g]]);
87
- const _sfc_main$K = {};
88
- const _hoisted_1$A = {
86
+ const ChevronLeftIcon = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$h]]);
87
+ const _sfc_main$M = {};
88
+ const _hoisted_1$C = {
89
89
  width: "16",
90
90
  height: "16",
91
91
  viewBox: "0 0 16 16",
92
92
  fill: "none",
93
93
  xmlns: "http://www.w3.org/2000/svg"
94
94
  };
95
- function _sfc_render$f(_ctx, _cache) {
96
- return openBlock(), createElementBlock("svg", _hoisted_1$A, _cache[0] || (_cache[0] = [
95
+ function _sfc_render$g(_ctx, _cache) {
96
+ return openBlock(), createElementBlock("svg", _hoisted_1$C, _cache[0] || (_cache[0] = [
97
97
  createElementVNode("path", {
98
98
  d: "M5.29295 1.63605C5.10548 1.82358 5.00017 2.07788 5.00017 2.34305C5.00017 2.60821 5.10548 2.86252 5.29295 3.05005L10.243 8.00005L5.29295 12.95C5.11079 13.1387 5.01 13.3913 5.01228 13.6534C5.01456 13.9156 5.11972 14.1665 5.30513 14.3519C5.49054 14.5373 5.74135 14.6424 6.00355 14.6447C6.26575 14.647 6.51835 14.5462 6.70695 14.364L12.364 8.70705C12.5514 8.51952 12.6567 8.26521 12.6567 8.00005C12.6567 7.73488 12.5514 7.48058 12.364 7.29305L6.70695 1.63605C6.51942 1.44858 6.26512 1.34326 5.99995 1.34326C5.73479 1.34326 5.48048 1.44858 5.29295 1.63605Z",
99
99
  fill: "currentColor"
100
100
  }, null, -1)
101
101
  ]));
102
102
  }
103
- const ChevronRightIcon = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$f]]);
103
+ const ChevronRightIcon = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$g]]);
104
104
  const findParent$1 = (el, callback) => {
105
105
  if (callback(el)) return el;
106
106
  if (!el.parentElement) return null;
@@ -599,10 +599,14 @@ const getValue = (item) => {
599
599
  const useSearch = (searchValue, data, keyExtractor) => {
600
600
  const searchKeys = computed(() => {
601
601
  var _a;
602
- return ((_a = getValue(data)) == null ? void 0 : _a.map((item) => getSearchFeed(keyExtractor(item)))) ?? [];
602
+ return ((_a = getValue(data)) == null ? void 0 : _a.map((item) => {
603
+ const data2 = keyExtractor(item);
604
+ return Array.isArray(data2) ? data2 : getSearchFeed(data2);
605
+ })) ?? [];
603
606
  });
604
607
  const dataSearched = computed(() => {
605
- const searchFeed = getSearchFeed(searchValue.value);
608
+ const val = getValue(searchValue);
609
+ const searchFeed = Array.isArray(val) ? val : getSearchFeed(val);
606
610
  const currentData = getValue(data);
607
611
  if (searchFeed.length === 0 || !currentData) return currentData;
608
612
  return findByKeys(currentData, searchKeys.value, searchFeed);
@@ -641,27 +645,27 @@ class BlockDropEvent extends Event {
641
645
  this.content = content;
642
646
  }
643
647
  }
644
- const _hoisted_1$z = {
648
+ const _hoisted_1$B = {
645
649
  key: 0,
646
650
  class: "v-form-control__label"
647
651
  };
648
- const _hoisted_2$b = {
652
+ const _hoisted_2$c = {
649
653
  key: 0,
650
654
  class: "v-form-control__required-marker"
651
655
  };
652
- const _hoisted_3$8 = {
656
+ const _hoisted_3$9 = {
653
657
  key: 1,
654
658
  class: "v-form-control__outline"
655
659
  };
656
- const _hoisted_4$5 = {
660
+ const _hoisted_4$6 = {
657
661
  key: 3,
658
662
  class: "v-form-control__actions"
659
663
  };
660
- const _hoisted_5$2 = {
664
+ const _hoisted_5$4 = {
661
665
  key: 0,
662
666
  class: "v-form-control__error"
663
667
  };
664
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
668
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
665
669
  __name: "VFormControl",
666
670
  props: {
667
671
  error: {},
@@ -686,19 +690,19 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
686
690
  return openBlock(), createElementBlock("div", {
687
691
  class: normalizeClass(["v-form-control", { error: !!props.error, disabled: props.disabled }])
688
692
  }, [
689
- !!props.label ? (openBlock(), createElementBlock("label", _hoisted_1$z, [
693
+ !!props.label ? (openBlock(), createElementBlock("label", _hoisted_1$B, [
690
694
  createTextVNode(toDisplayString(props.label), 1),
691
- props.required ? (openBlock(), createElementBlock("span", _hoisted_2$b, "*")) : createCommentVNode("", true)
695
+ props.required ? (openBlock(), createElementBlock("span", _hoisted_2$c, "*")) : createCommentVNode("", true)
692
696
  ])) : createCommentVNode("", true),
693
- props.outline ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
697
+ props.outline ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
694
698
  renderSlot(_ctx.$slots, "default")
695
699
  ])) : renderSlot(_ctx.$slots, "default", { key: 2 }),
696
- _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_4$5, [
700
+ _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_4$6, [
697
701
  renderSlot(_ctx.$slots, "actions")
698
702
  ])) : createCommentVNode("", true),
699
703
  createVNode(Transition, null, {
700
704
  default: withCtx(() => [
701
- !!props.error ? (openBlock(), createElementBlock("div", _hoisted_5$2, toDisplayString(error.value), 1)) : createCommentVNode("", true)
705
+ !!props.error ? (openBlock(), createElementBlock("div", _hoisted_5$4, toDisplayString(error.value), 1)) : createCommentVNode("", true)
702
706
  ]),
703
707
  _: 1
704
708
  })
@@ -1141,17 +1145,17 @@ function useVModel(props, key, emit, options = {}) {
1141
1145
  });
1142
1146
  }
1143
1147
  }
1144
- const _hoisted_1$y = {
1148
+ const _hoisted_1$A = {
1145
1149
  key: 0,
1146
1150
  class: "mech-v-input__start-adornment"
1147
1151
  };
1148
- const _hoisted_2$a = ["placeholder", "rows", "name"];
1149
- const _hoisted_3$7 = ["placeholder", "type", "name"];
1150
- const _hoisted_4$4 = {
1152
+ const _hoisted_2$b = ["placeholder", "rows", "name"];
1153
+ const _hoisted_3$8 = ["placeholder", "type", "name"];
1154
+ const _hoisted_4$5 = {
1151
1155
  key: 3,
1152
1156
  class: "mech-v-input__max-length"
1153
1157
  };
1154
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
1158
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
1155
1159
  __name: "VInput",
1156
1160
  props: {
1157
1161
  modelValue: {},
@@ -1222,7 +1226,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1222
1226
  useTextareaAutosize({ element: inputRef, input: model });
1223
1227
  }
1224
1228
  return (_ctx, _cache) => {
1225
- return openBlock(), createBlock(_sfc_main$J, {
1229
+ return openBlock(), createBlock(_sfc_main$L, {
1226
1230
  class: normalizeClass(["mech-v-input", { large: _ctx.large, multiline: _ctx.multiline }]),
1227
1231
  error: error.value,
1228
1232
  label: _ctx.label,
@@ -1232,7 +1236,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1232
1236
  }, createSlots({
1233
1237
  default: withCtx(() => [
1234
1238
  renderSlot(_ctx.$slots, "start-adornment"),
1235
- props.prefix ? (openBlock(), createElementBlock("div", _hoisted_1$y, toDisplayString(props.prefix), 1)) : createCommentVNode("", true),
1239
+ props.prefix ? (openBlock(), createElementBlock("div", _hoisted_1$A, toDisplayString(props.prefix), 1)) : createCommentVNode("", true),
1236
1240
  props.multiline ? withDirectives((openBlock(), createElementBlock("textarea", {
1237
1241
  key: 1,
1238
1242
  ref_key: "inputRef",
@@ -1242,7 +1246,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1242
1246
  rows: props.rows,
1243
1247
  class: "scroll",
1244
1248
  name: props.name
1245
- }, null, 8, _hoisted_2$a)), [
1249
+ }, null, 8, _hoisted_2$b)), [
1246
1250
  [vModelText, model.value]
1247
1251
  ]) : withDirectives((openBlock(), createElementBlock("input", {
1248
1252
  key: 2,
@@ -1252,10 +1256,10 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1252
1256
  placeholder: props.placeholder,
1253
1257
  type: inputType.value,
1254
1258
  name: props.name
1255
- }, null, 8, _hoisted_3$7)), [
1259
+ }, null, 8, _hoisted_3$8)), [
1256
1260
  [vModelDynamic, model.value]
1257
1261
  ]),
1258
- props.maxLength ? (openBlock(), createElementBlock("div", _hoisted_4$4, toDisplayString(model.value.length) + " / " + toDisplayString(props.maxLength), 1)) : createCommentVNode("", true),
1262
+ props.maxLength ? (openBlock(), createElementBlock("div", _hoisted_4$5, toDisplayString(model.value.length) + " / " + toDisplayString(props.maxLength), 1)) : createCommentVNode("", true),
1259
1263
  renderSlot(_ctx.$slots, "end-adornment")
1260
1264
  ]),
1261
1265
  _: 2
@@ -1271,16 +1275,16 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1271
1275
  };
1272
1276
  }
1273
1277
  });
1274
- const _hoisted_1$x = { class: "blocks-list" };
1275
- const _hoisted_2$9 = { class: "page-editor-blocks__group" };
1276
- const _hoisted_3$6 = { class: "title" };
1277
- const _hoisted_4$3 = { class: "blocks-list__blocks" };
1278
- const _hoisted_5$1 = ["onMousedown"];
1279
- const _hoisted_6$1 = {
1278
+ const _hoisted_1$z = { class: "blocks-list" };
1279
+ const _hoisted_2$a = { class: "page-editor-blocks__group" };
1280
+ const _hoisted_3$7 = { class: "title" };
1281
+ const _hoisted_4$4 = { class: "blocks-list__blocks" };
1282
+ const _hoisted_5$3 = ["onMousedown"];
1283
+ const _hoisted_6$2 = {
1280
1284
  key: 0,
1281
1285
  class: "page-editor__nothing-found"
1282
1286
  };
1283
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
1287
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
1284
1288
  __name: "BlocksList",
1285
1289
  props: {
1286
1290
  blocks: {}
@@ -1329,28 +1333,28 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
1329
1333
  });
1330
1334
  };
1331
1335
  return (_ctx, _cache) => {
1332
- return openBlock(), createElementBlock("div", _hoisted_1$x, [
1333
- createVNode(_sfc_main$I, {
1336
+ return openBlock(), createElementBlock("div", _hoisted_1$z, [
1337
+ createVNode(_sfc_main$K, {
1334
1338
  modelValue: searchValue.value,
1335
1339
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
1336
1340
  placeholder: "Поиск...",
1337
1341
  class: "page-editor-blocks__search"
1338
1342
  }, null, 8, ["modelValue"]),
1339
1343
  (openBlock(true), createElementBlock(Fragment, null, renderList(groupBlocks.value, (group) => {
1340
- return openBlock(), createElementBlock("div", _hoisted_2$9, [
1341
- createElementVNode("div", _hoisted_3$6, toDisplayString(groupNames[group.name] ?? group.name), 1),
1342
- createElementVNode("div", _hoisted_4$3, [
1344
+ return openBlock(), createElementBlock("div", _hoisted_2$a, [
1345
+ createElementVNode("div", _hoisted_3$7, toDisplayString(groupNames[group.name] ?? group.name), 1),
1346
+ createElementVNode("div", _hoisted_4$4, [
1343
1347
  (openBlock(true), createElementBlock(Fragment, null, renderList(group.blocks, (item) => {
1344
1348
  return openBlock(), createElementBlock("button", {
1345
1349
  class: "blocks-list__block editor-component",
1346
1350
  key: item.id,
1347
1351
  onMousedown: ($event) => onItemMouseDown($event, item)
1348
- }, toDisplayString(item.name), 41, _hoisted_5$1);
1352
+ }, toDisplayString(item.name), 41, _hoisted_5$3);
1349
1353
  }), 128))
1350
1354
  ])
1351
1355
  ]);
1352
1356
  }), 256)),
1353
- unref(filteredBlocks).length === 0 ? (openBlock(), createElementBlock("div", _hoisted_6$1, "Блоки не найдены")) : createCommentVNode("", true)
1357
+ unref(filteredBlocks).length === 0 ? (openBlock(), createElementBlock("div", _hoisted_6$2, "Блоки не найдены")) : createCommentVNode("", true)
1354
1358
  ]);
1355
1359
  };
1356
1360
  }
@@ -1629,8 +1633,8 @@ const deleteFromArray = (arr, item) => {
1629
1633
  const uid$1 = () => {
1630
1634
  return Math.trunc(Math.random() * 1e5).toString(16);
1631
1635
  };
1632
- const _hoisted_1$w = ["onClick"];
1633
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
1636
+ const _hoisted_1$y = ["onClick"];
1637
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
1634
1638
  __name: "VTabs",
1635
1639
  props: {
1636
1640
  items: {},
@@ -1684,7 +1688,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
1684
1688
  key: item.id,
1685
1689
  class: normalizeClass(["v-tabs__tab", { active: unref(model) === item.id }]),
1686
1690
  onClick: ($event) => model.value = item.id
1687
- }, toDisplayString(item.title), 11, _hoisted_1$w);
1691
+ }, toDisplayString(item.title), 11, _hoisted_1$y);
1688
1692
  }), 128))
1689
1693
  ]),
1690
1694
  _: 1
@@ -1697,7 +1701,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
1697
1701
  };
1698
1702
  }
1699
1703
  });
1700
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
1704
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
1701
1705
  __name: "VTabsPages",
1702
1706
  props: {
1703
1707
  page: {},
@@ -1755,16 +1759,16 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
1755
1759
  };
1756
1760
  }
1757
1761
  });
1758
- const _sfc_main$E = {};
1759
- const _hoisted_1$v = {
1762
+ const _sfc_main$G = {};
1763
+ const _hoisted_1$x = {
1760
1764
  width: "20",
1761
1765
  height: "20",
1762
1766
  viewBox: "0 0 20 20",
1763
1767
  fill: "none",
1764
1768
  xmlns: "http://www.w3.org/2000/svg"
1765
1769
  };
1766
- function _sfc_render$e(_ctx, _cache) {
1767
- return openBlock(), createElementBlock("svg", _hoisted_1$v, _cache[0] || (_cache[0] = [
1770
+ function _sfc_render$f(_ctx, _cache) {
1771
+ return openBlock(), createElementBlock("svg", _hoisted_1$x, _cache[0] || (_cache[0] = [
1768
1772
  createElementVNode("path", {
1769
1773
  "fill-rule": "evenodd",
1770
1774
  "clip-rule": "evenodd",
@@ -1773,8 +1777,8 @@ function _sfc_render$e(_ctx, _cache) {
1773
1777
  }, null, -1)
1774
1778
  ]));
1775
1779
  }
1776
- const CollapseArrowIcon = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["render", _sfc_render$e]]);
1777
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
1780
+ const CollapseArrowIcon = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$f]]);
1781
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
1778
1782
  __name: "VCollapse",
1779
1783
  props: {
1780
1784
  open: { type: Boolean },
@@ -1862,7 +1866,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1862
1866
  }
1863
1867
  });
1864
1868
  const margin = 8;
1865
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
1869
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
1866
1870
  ...{
1867
1871
  inheritAttrs: false
1868
1872
  },
@@ -2030,65 +2034,65 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
2030
2034
  };
2031
2035
  }
2032
2036
  });
2033
- const _sfc_main$B = {};
2034
- const _hoisted_1$u = {
2037
+ const _sfc_main$D = {};
2038
+ const _hoisted_1$w = {
2035
2039
  width: "16",
2036
2040
  height: "16",
2037
2041
  viewBox: "0 0 16 16",
2038
2042
  fill: "none",
2039
2043
  xmlns: "http://www.w3.org/2000/svg"
2040
2044
  };
2041
- function _sfc_render$d(_ctx, _cache) {
2042
- return openBlock(), createElementBlock("svg", _hoisted_1$u, _cache[0] || (_cache[0] = [
2045
+ function _sfc_render$e(_ctx, _cache) {
2046
+ return openBlock(), createElementBlock("svg", _hoisted_1$w, _cache[0] || (_cache[0] = [
2043
2047
  createElementVNode("path", {
2044
2048
  d: "M14.364 5.293C14.1764 5.10553 13.9221 5.00021 13.657 5.00021C13.3918 5.00021 13.1375 5.10553 12.95 5.293L7.99995 10.243L3.04995 5.293C2.86135 5.11084 2.60875 5.01005 2.34655 5.01232C2.08435 5.0146 1.83354 5.11977 1.64813 5.30518C1.46272 5.49059 1.35756 5.7414 1.35528 6.0036C1.353 6.26579 1.45379 6.5184 1.63595 6.707L7.29295 12.364C7.48048 12.5515 7.73479 12.6568 7.99995 12.6568C8.26512 12.6568 8.51942 12.5515 8.70695 12.364L14.364 6.707C14.5514 6.51947 14.6567 6.26516 14.6567 6C14.6567 5.73483 14.5514 5.48053 14.364 5.293Z",
2045
2049
  fill: "currentColor"
2046
2050
  }, null, -1)
2047
2051
  ]));
2048
2052
  }
2049
- const ArrowDownIcon = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$d]]);
2050
- const _sfc_main$A = {};
2051
- const _hoisted_1$t = { class: "v-icon-button" };
2052
- function _sfc_render$c(_ctx, _cache) {
2053
- return openBlock(), createElementBlock("button", _hoisted_1$t, [
2053
+ const ArrowDownIcon = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$e]]);
2054
+ const _sfc_main$C = {};
2055
+ const _hoisted_1$v = { class: "v-icon-button" };
2056
+ function _sfc_render$d(_ctx, _cache) {
2057
+ return openBlock(), createElementBlock("button", _hoisted_1$v, [
2054
2058
  renderSlot(_ctx.$slots, "default")
2055
2059
  ]);
2056
2060
  }
2057
- const VIconButton = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$c]]);
2058
- const _sfc_main$z = {};
2059
- const _hoisted_1$s = {
2061
+ const VIconButton = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$d]]);
2062
+ const _sfc_main$B = {};
2063
+ const _hoisted_1$u = {
2060
2064
  width: "16",
2061
2065
  height: "16",
2062
2066
  viewBox: "0 0 16 16",
2063
2067
  fill: "none",
2064
2068
  xmlns: "http://www.w3.org/2000/svg"
2065
2069
  };
2066
- function _sfc_render$b(_ctx, _cache) {
2067
- return openBlock(), createElementBlock("svg", _hoisted_1$s, _cache[0] || (_cache[0] = [
2070
+ function _sfc_render$c(_ctx, _cache) {
2071
+ return openBlock(), createElementBlock("svg", _hoisted_1$u, _cache[0] || (_cache[0] = [
2068
2072
  createElementVNode("path", {
2069
2073
  d: "M9.31382 7.9L12.8488 4.364C12.9443 4.27176 13.0205 4.16141 13.0729 4.03941C13.1253 3.9174 13.1529 3.78618 13.1541 3.6534C13.1552 3.52062 13.1299 3.38894 13.0796 3.26605C13.0294 3.14315 12.9551 3.0315 12.8612 2.93761C12.7673 2.84371 12.6557 2.76946 12.5328 2.71918C12.4099 2.6689 12.2782 2.6436 12.1454 2.64475C12.0126 2.64591 11.8814 2.67349 11.7594 2.7259C11.6374 2.77831 11.5271 2.85449 11.4348 2.95L7.89882 6.485L4.36382 2.95C4.27157 2.85449 4.16123 2.77831 4.03922 2.7259C3.91722 2.67349 3.786 2.64591 3.65322 2.64475C3.52044 2.6436 3.38876 2.6689 3.26587 2.71918C3.14297 2.76946 3.03132 2.84371 2.93742 2.93761C2.84353 3.0315 2.76928 3.14315 2.719 3.26605C2.66872 3.38894 2.64342 3.52062 2.64457 3.6534C2.64572 3.78618 2.67331 3.9174 2.72572 4.03941C2.77813 4.16141 2.85431 4.27176 2.94982 4.364L6.48482 7.899L2.94982 11.435C2.85431 11.5273 2.77813 11.6376 2.72572 11.7596C2.67331 11.8816 2.64572 12.0128 2.64457 12.1456C2.64342 12.2784 2.66872 12.4101 2.719 12.533C2.76928 12.6559 2.84353 12.7675 2.93742 12.8614C3.03132 12.9553 3.14297 13.0295 3.26587 13.0798C3.38876 13.1301 3.52044 13.1554 3.65322 13.1543C3.786 13.1531 3.91722 13.1255 4.03922 13.0731C4.16123 13.0207 4.27157 12.9445 4.36382 12.849L7.89882 9.314L11.4348 12.849C11.5271 12.9445 11.6374 13.0207 11.7594 13.0731C11.8814 13.1255 12.0126 13.1531 12.1454 13.1543C12.2782 13.1554 12.4099 13.1301 12.5328 13.0798C12.6557 13.0295 12.7673 12.9553 12.8612 12.8614C12.9551 12.7675 13.0294 12.6559 13.0796 12.533C13.1299 12.4101 13.1552 12.2784 13.1541 12.1456C13.1529 12.0128 13.1253 11.8816 13.0729 11.7596C13.0205 11.6376 12.9443 11.5273 12.8488 11.435L9.31382 7.9Z",
2070
2074
  fill: "currentColor"
2071
2075
  }, null, -1)
2072
2076
  ]));
2073
2077
  }
2074
- const CloseMinIcon = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$b]]);
2075
- const _hoisted_1$r = { key: 0 };
2076
- const _hoisted_2$8 = {
2078
+ const CloseMinIcon = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$c]]);
2079
+ const _hoisted_1$t = { key: 0 };
2080
+ const _hoisted_2$9 = {
2077
2081
  key: 1,
2078
2082
  class: "v-select__placeholder"
2079
2083
  };
2080
- const _hoisted_3$5 = { class: "v-select__actions" };
2081
- const _hoisted_4$2 = { class: "v-select__menu" };
2082
- const _hoisted_5 = {
2084
+ const _hoisted_3$6 = { class: "v-select__actions" };
2085
+ const _hoisted_4$3 = { class: "v-select__menu" };
2086
+ const _hoisted_5$2 = {
2083
2087
  key: 0,
2084
2088
  class: "v-select__divider"
2085
2089
  };
2086
- const _hoisted_6 = {
2090
+ const _hoisted_6$1 = {
2087
2091
  key: 1,
2088
2092
  class: "group-title"
2089
2093
  };
2090
- const _hoisted_7 = ["onClick"];
2091
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
2094
+ const _hoisted_7$1 = ["onClick"];
2095
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
2092
2096
  __name: "VSelect",
2093
2097
  props: /* @__PURE__ */ mergeModels({
2094
2098
  items: {},
@@ -2124,7 +2128,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2124
2128
  opened.value = false;
2125
2129
  };
2126
2130
  return (_ctx, _cache) => {
2127
- return openBlock(), createBlock(_sfc_main$J, {
2131
+ return openBlock(), createBlock(_sfc_main$L, {
2128
2132
  outline: "",
2129
2133
  class: "v-select",
2130
2134
  label: props.label,
@@ -2133,7 +2137,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2133
2137
  required: props.required
2134
2138
  }, {
2135
2139
  default: withCtx(() => [
2136
- createVNode(_sfc_main$C, {
2140
+ createVNode(_sfc_main$E, {
2137
2141
  open: opened.value,
2138
2142
  "onUpdate:open": _cache[0] || (_cache[0] = ($event) => opened.value = $event),
2139
2143
  placement: "bottom",
@@ -2144,10 +2148,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2144
2148
  createElementVNode("button", mergeProps({
2145
2149
  class: ["v-select__activator", { opened: opened.value }]
2146
2150
  }, activatorProps), [
2147
- currentItem.value ? (openBlock(), createElementBlock("div", _hoisted_1$r, toDisplayString(currentItem.value.title), 1)) : (openBlock(), createElementBlock("div", _hoisted_2$8, toDisplayString(props.placeholder ?? "Выберите значение"), 1)),
2151
+ currentItem.value ? (openBlock(), createElementBlock("div", _hoisted_1$t, toDisplayString(currentItem.value.title), 1)) : (openBlock(), createElementBlock("div", _hoisted_2$9, toDisplayString(props.placeholder ?? "Выберите значение"), 1)),
2148
2152
  createVNode(ArrowDownIcon)
2149
2153
  ], 16),
2150
- createElementVNode("div", _hoisted_3$5, [
2154
+ createElementVNode("div", _hoisted_3$6, [
2151
2155
  renderSlot(_ctx.$slots, "default"),
2152
2156
  _ctx.nullable && model.value ? (openBlock(), createBlock(VIconButton, {
2153
2157
  key: 0,
@@ -2163,10 +2167,10 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2163
2167
  ])
2164
2168
  ]),
2165
2169
  default: withCtx(() => [
2166
- createElementVNode("div", _hoisted_4$2, [
2170
+ createElementVNode("div", _hoisted_4$3, [
2167
2171
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
2168
2172
  return openBlock(), createElementBlock(Fragment, null, [
2169
- item === "" ? (openBlock(), createElementBlock("div", _hoisted_5)) : typeof item === "string" ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(item), 1)) : (openBlock(), createElementBlock("button", {
2173
+ item === "" ? (openBlock(), createElementBlock("div", _hoisted_5$2)) : typeof item === "string" ? (openBlock(), createElementBlock("div", _hoisted_6$1, toDisplayString(item), 1)) : (openBlock(), createElementBlock("button", {
2170
2174
  key: 2,
2171
2175
  class: normalizeClass({ active: item.id === model.value }),
2172
2176
  onClick: ($event) => onItemClick(item)
@@ -2174,7 +2178,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2174
2178
  renderSlot(_ctx.$slots, "item", { item }, () => [
2175
2179
  createTextVNode(toDisplayString(item.title), 1)
2176
2180
  ])
2177
- ], 10, _hoisted_7))
2181
+ ], 10, _hoisted_7$1))
2178
2182
  ], 64);
2179
2183
  }), 256))
2180
2184
  ])
@@ -2187,8 +2191,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
2187
2191
  };
2188
2192
  }
2189
2193
  });
2190
- const _hoisted_1$q = { class: "json-editor__array" };
2191
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
2194
+ const _hoisted_1$s = { class: "json-editor__array" };
2195
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
2192
2196
  __name: "JsonEditorArray",
2193
2197
  props: {
2194
2198
  label: {},
@@ -2221,13 +2225,13 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
2221
2225
  return `${props.label} (${length.value})`;
2222
2226
  });
2223
2227
  return (_ctx, _cache) => {
2224
- return openBlock(), createElementBlock("div", _hoisted_1$q, [
2225
- createVNode(_sfc_main$D, {
2228
+ return openBlock(), createElementBlock("div", _hoisted_1$s, [
2229
+ createVNode(_sfc_main$F, {
2226
2230
  label: label.value,
2227
2231
  open: props.expanded
2228
2232
  }, {
2229
2233
  default: withCtx(() => [
2230
- createVNode(_sfc_main$I, {
2234
+ createVNode(_sfc_main$K, {
2231
2235
  label: "Количество элементов",
2232
2236
  modelValue: length.value,
2233
2237
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => length.value = $event),
@@ -2251,38 +2255,38 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
2251
2255
  };
2252
2256
  }
2253
2257
  });
2254
- const _sfc_main$w = {};
2255
- const _hoisted_1$p = {
2258
+ const _sfc_main$y = {};
2259
+ const _hoisted_1$r = {
2256
2260
  width: "46",
2257
2261
  height: "28",
2258
2262
  viewBox: "0 0 46 28",
2259
2263
  fill: "none",
2260
2264
  xmlns: "http://www.w3.org/2000/svg"
2261
2265
  };
2262
- function _sfc_render$a(_ctx, _cache) {
2263
- return openBlock(), createElementBlock("svg", _hoisted_1$p, _cache[0] || (_cache[0] = [
2266
+ function _sfc_render$b(_ctx, _cache) {
2267
+ return openBlock(), createElementBlock("svg", _hoisted_1$r, _cache[0] || (_cache[0] = [
2264
2268
  createStaticVNode('<mask id="mask0_1044_6" style="mask-type:luminance;" maskUnits="userSpaceOnUse" x="0" y="0" width="46" height="28"><path d="M45.5 0H0.5V28H45.5V0Z" fill="white"></path></mask><g mask="url(#mask0_1044_6)"><path d="M23.5 27.8537C35.9264 27.8537 46 25.6664 46 22.9683C46 20.2702 35.9264 18.083 23.5 18.083C11.0736 18.083 1 20.2702 1 22.9683C1 25.6664 11.0736 27.8537 23.5 27.8537Z" fill="#D7D7D7"></path><path d="M39.6719 9.5459L32.538 1.51859C32.1955 0.971432 31.6956 0.640625 31.169 0.640625H15.831C15.3044 0.640625 14.8045 0.971432 14.462 1.51789L7.32812 9.5466V15.9946H39.6719V9.5459Z" stroke="#A0A0A0" stroke-width="0.703125"></path><path d="M30.2591 11.7594C30.2591 10.6393 30.958 9.71457 31.825 9.71387H39.6719V22.3718C39.6719 23.8534 38.7437 25.0678 37.5977 25.0678H9.40234C8.25625 25.0678 7.32812 23.8527 7.32812 22.3718V9.71387H15.175C16.042 9.71387 16.7409 10.6372 16.7409 11.7573V11.7727C16.7409 12.8928 17.4475 13.7973 18.3138 13.7973H28.6862C29.5525 13.7973 30.2591 12.8845 30.2591 11.7643V11.7594Z" fill="#FAFAFA" stroke="#A0A0A0" stroke-width="0.703125"></path></g>', 2)
2265
2269
  ]));
2266
2270
  }
2267
- const EmptyFileIcon = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$a]]);
2268
- const _sfc_main$v = {};
2269
- const _hoisted_1$o = {
2271
+ const EmptyFileIcon = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$b]]);
2272
+ const _sfc_main$x = {};
2273
+ const _hoisted_1$q = {
2270
2274
  width: "24",
2271
2275
  height: "24",
2272
2276
  viewBox: "0 0 24 24",
2273
2277
  fill: "none",
2274
2278
  xmlns: "http://www.w3.org/2000/svg"
2275
2279
  };
2276
- function _sfc_render$9(_ctx, _cache) {
2277
- return openBlock(), createElementBlock("svg", _hoisted_1$o, _cache[0] || (_cache[0] = [
2280
+ function _sfc_render$a(_ctx, _cache) {
2281
+ return openBlock(), createElementBlock("svg", _hoisted_1$q, _cache[0] || (_cache[0] = [
2278
2282
  createElementVNode("path", {
2279
2283
  d: "M14 18C14 18.5304 13.7893 19.0391 13.4142 19.4142C13.0391 19.7893 12.5304 20 12 20C11.4696 20 10.9609 19.7893 10.5858 19.4142C10.2107 19.0391 10 18.5304 10 18C10 17.4696 10.2107 16.9609 10.5858 16.5858C10.9609 16.2107 11.4696 16 12 16C12.5304 16 13.0391 16.2107 13.4142 16.5858C13.7893 16.9609 14 17.4696 14 18ZM14 12C14 12.5304 13.7893 13.0391 13.4142 13.4142C13.0391 13.7893 12.5304 14 12 14C11.4696 14 10.9609 13.7893 10.5858 13.4142C10.2107 13.0391 10 12.5304 10 12C10 11.4696 10.2107 10.9609 10.5858 10.5858C10.9609 10.2107 11.4696 10 12 10C12.5304 10 13.0391 10.2107 13.4142 10.5858C13.7893 10.9609 14 11.4696 14 12ZM12 8C12.5304 8 13.0391 7.78929 13.4142 7.41421C13.7893 7.03914 14 6.53043 14 6C14 5.46957 13.7893 4.96086 13.4142 4.58579C13.0391 4.21071 12.5304 4 12 4C11.4696 4 10.9609 4.21071 10.5858 4.58579C10.2107 4.96086 10 5.46957 10 6C10 6.53043 10.2107 7.03914 10.5858 7.41421C10.9609 7.78929 11.4696 8 12 8Z",
2280
2284
  fill: "currentColor"
2281
2285
  }, null, -1)
2282
2286
  ]));
2283
2287
  }
2284
- const MoreIcon = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$9]]);
2285
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
2288
+ const MoreIcon = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$a]]);
2289
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
2286
2290
  __name: "VButton",
2287
2291
  props: {
2288
2292
  component: {},
@@ -2335,22 +2339,31 @@ const useContextMenu = (creator) => {
2335
2339
  open
2336
2340
  };
2337
2341
  };
2338
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
2342
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
2343
+ ...{
2344
+ inheritAttrs: false
2345
+ },
2339
2346
  __name: "VContextMenu",
2340
- props: {
2341
- open: { type: Boolean },
2347
+ props: /* @__PURE__ */ mergeModels({
2348
+ element: {},
2342
2349
  placement: {},
2343
2350
  anchorPosition: {},
2344
2351
  offset: {},
2345
2352
  fitAnchor: { type: Boolean },
2346
2353
  items: { type: [Array, Function] }
2347
- },
2348
- emits: ["update:open"],
2354
+ }, {
2355
+ "open": { type: Boolean, ...{ default: false } },
2356
+ "openModifiers": {}
2357
+ }),
2358
+ emits: /* @__PURE__ */ mergeModels(["itemclick"], ["update:open"]),
2349
2359
  setup(__props, { emit: __emit }) {
2350
2360
  const props = __props;
2351
- const activatorElement = ref();
2352
2361
  const emit = __emit;
2353
- const open = useVModel(props, "open", emit, { passive: true });
2362
+ const activatorElement = ref(null);
2363
+ watch(() => props.element, (element) => {
2364
+ activatorElement.value = element ?? null;
2365
+ }, { immediate: true });
2366
+ const open = useModel(__props, "open");
2354
2367
  const items = shallowRef([]);
2355
2368
  watch(open, (open2) => {
2356
2369
  if (!open2) return;
@@ -2368,39 +2381,95 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2368
2381
  if (item.onClick) {
2369
2382
  item.onClick();
2370
2383
  open.value = false;
2384
+ emit("itemclick");
2371
2385
  }
2372
2386
  if (((_a = item.props) == null ? void 0 : _a.to) || ((_b = item.props) == null ? void 0 : _b.href)) {
2373
2387
  open.value = false;
2388
+ emit("itemclick");
2389
+ }
2390
+ };
2391
+ const hasChildren = computed(() => items.value.find((item) => !!item.children));
2392
+ let openTimeout = null;
2393
+ const menuChildrenItems = ref([]);
2394
+ const menuChildrenElement = ref(null);
2395
+ const onItemHover = (e, item) => {
2396
+ if (openTimeout) {
2397
+ clearTimeout(openTimeout);
2398
+ openTimeout = null;
2399
+ }
2400
+ if (!item.children && menuChildrenElement.value !== null) {
2401
+ menuChildrenElement.value.classList.remove("hover");
2402
+ openTimeout = setTimeout(() => {
2403
+ menuChildrenElement.value = null;
2404
+ }, 200);
2405
+ return;
2406
+ }
2407
+ if (item.children) {
2408
+ let target = e.currentTarget;
2409
+ openTimeout = setTimeout(() => {
2410
+ menuChildrenElement.value = target;
2411
+ menuChildrenElement.value.classList.add("hover");
2412
+ menuChildrenItems.value = item.children;
2413
+ }, 150);
2374
2414
  }
2375
2415
  };
2416
+ watch(open, (open2) => {
2417
+ var _a;
2418
+ if (open2 === false) {
2419
+ if (openTimeout) {
2420
+ clearTimeout(openTimeout);
2421
+ openTimeout = null;
2422
+ }
2423
+ (_a = menuChildrenElement.value) == null ? void 0 : _a.classList.remove("hover");
2424
+ menuChildrenElement.value = null;
2425
+ }
2426
+ });
2427
+ const onChildrenClick = () => {
2428
+ open.value = false;
2429
+ };
2376
2430
  return (_ctx, _cache) => {
2431
+ const _component_VContextMenu = resolveComponent("VContextMenu", true);
2377
2432
  return openBlock(), createElementBlock(Fragment, null, [
2378
2433
  renderSlot(_ctx.$slots, "activator", { props: activatorProps }),
2379
- createVNode(_sfc_main$C, {
2380
- open: unref(open),
2381
- "onUpdate:open": _cache[0] || (_cache[0] = ($event) => isRef(open) ? open.value = $event : null),
2434
+ createVNode(_sfc_main$E, mergeProps({
2435
+ open: open.value,
2436
+ "onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
2382
2437
  element: activatorElement.value,
2383
2438
  anchorPosition: props.anchorPosition,
2384
2439
  placement: props.placement ?? "bottom-start",
2385
2440
  offset: _ctx.offset,
2386
2441
  fitAnchor: props.fitAnchor,
2387
2442
  class: "v-context-menu"
2388
- }, {
2443
+ }, _ctx.$attrs), {
2389
2444
  default: withCtx(() => [
2390
2445
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
2391
- return openBlock(), createBlock(_sfc_main$u, mergeProps({ ref_for: true }, item.props, {
2446
+ return openBlock(), createBlock(_sfc_main$w, mergeProps({ ref_for: true }, item.props, {
2392
2447
  class: "v-context-menu__item",
2448
+ onMouseenter: ($event) => onItemHover($event, item),
2393
2449
  onClick: ($event) => onItemClick(item)
2394
2450
  }), {
2395
2451
  default: withCtx(() => [
2396
- createTextVNode(toDisplayString(item.title), 1)
2452
+ createTextVNode(toDisplayString(item.title) + " ", 1),
2453
+ !!item.children ? (openBlock(), createBlock(ChevronRightIcon, {
2454
+ key: 0,
2455
+ class: "v-context-menu__item-more-icon"
2456
+ })) : createCommentVNode("", true)
2397
2457
  ]),
2398
2458
  _: 2
2399
- }, 1040, ["onClick"]);
2459
+ }, 1040, ["onMouseenter", "onClick"]);
2400
2460
  }), 256))
2401
2461
  ]),
2402
2462
  _: 1
2403
- }, 8, ["open", "element", "anchorPosition", "placement", "offset", "fitAnchor"])
2463
+ }, 16, ["open", "element", "anchorPosition", "placement", "offset", "fitAnchor"]),
2464
+ hasChildren.value ? (openBlock(), createBlock(_component_VContextMenu, {
2465
+ key: 0,
2466
+ open: !!menuChildrenElement.value,
2467
+ items: menuChildrenItems.value,
2468
+ element: menuChildrenElement.value,
2469
+ placement: "right-start",
2470
+ style: { "margin-top": "-8px", "margin-left": "-1px" },
2471
+ onItemclick: onChildrenClick
2472
+ }, null, 8, ["open", "items", "element"])) : createCommentVNode("", true)
2404
2473
  ], 64);
2405
2474
  };
2406
2475
  }
@@ -2429,7 +2498,7 @@ const createDialogSystem = () => {
2429
2498
  };
2430
2499
  };
2431
2500
  const useDialog = () => inject("dialogStore");
2432
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
2501
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
2433
2502
  __name: "VDialogProvider",
2434
2503
  setup(__props) {
2435
2504
  const dialogStore = inject("dialogStore");
@@ -2486,15 +2555,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2486
2555
  };
2487
2556
  }
2488
2557
  });
2489
- const _hoisted_1$n = {
2558
+ const _hoisted_1$p = {
2490
2559
  key: 0,
2491
2560
  class: "v-dialog__header heading"
2492
2561
  };
2493
- const _hoisted_2$7 = {
2562
+ const _hoisted_2$8 = {
2494
2563
  key: 1,
2495
2564
  class: "v-dialog__actions"
2496
2565
  };
2497
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
2566
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
2498
2567
  __name: "VDialog",
2499
2568
  props: {
2500
2569
  "content:class": {},
@@ -2510,7 +2579,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2510
2579
  role: "dialog"
2511
2580
  }, {
2512
2581
  default: withCtx(() => [
2513
- unref(slots).header ? (openBlock(), createElementBlock("div", _hoisted_1$n, [
2582
+ unref(slots).header ? (openBlock(), createElementBlock("div", _hoisted_1$p, [
2514
2583
  renderSlot(_ctx.$slots, "header"),
2515
2584
  createVNode(VIconButton, {
2516
2585
  role: "button",
@@ -2528,7 +2597,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2528
2597
  }, [
2529
2598
  renderSlot(_ctx.$slots, "default")
2530
2599
  ], 2),
2531
- unref(slots).actions ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
2600
+ unref(slots).actions ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
2532
2601
  renderSlot(_ctx.$slots, "actions")
2533
2602
  ])) : createCommentVNode("", true)
2534
2603
  ]),
@@ -2537,13 +2606,13 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2537
2606
  };
2538
2607
  }
2539
2608
  });
2540
- const _hoisted_1$m = {
2609
+ const _hoisted_1$o = {
2541
2610
  key: 0,
2542
2611
  class: "project-images__grid"
2543
2612
  };
2544
- const _hoisted_2$6 = ["onClick"];
2545
- const _hoisted_3$4 = ["src"];
2546
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
2613
+ const _hoisted_2$7 = ["onClick"];
2614
+ const _hoisted_3$5 = ["src"];
2615
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
2547
2616
  __name: "ProjectImagesDialog",
2548
2617
  props: {
2549
2618
  fileRequest: { type: Function },
@@ -2558,20 +2627,20 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2558
2627
  dialog.back();
2559
2628
  };
2560
2629
  return (_ctx, _cache) => {
2561
- return openBlock(), createBlock(_sfc_main$r, { style: { "width": "900px" } }, {
2630
+ return openBlock(), createBlock(_sfc_main$t, { style: { "width": "900px" } }, {
2562
2631
  header: withCtx(() => _cache[0] || (_cache[0] = [
2563
2632
  createTextVNode("Изображения проекта")
2564
2633
  ])),
2565
2634
  default: withCtx(() => [
2566
- unref(data) ? (openBlock(), createElementBlock("div", _hoisted_1$m, [
2635
+ unref(data) ? (openBlock(), createElementBlock("div", _hoisted_1$o, [
2567
2636
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(data), (item) => {
2568
2637
  return openBlock(), createElementBlock("button", {
2569
2638
  onClick: ($event) => openImage(item)
2570
2639
  }, [
2571
2640
  createElementVNode("img", {
2572
2641
  src: item.previewSrc ?? item.src
2573
- }, null, 8, _hoisted_3$4)
2574
- ], 8, _hoisted_2$6);
2642
+ }, null, 8, _hoisted_3$5)
2643
+ ], 8, _hoisted_2$7);
2575
2644
  }), 256))
2576
2645
  ])) : createCommentVNode("", true)
2577
2646
  ]),
@@ -2580,14 +2649,14 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2580
2649
  };
2581
2650
  }
2582
2651
  });
2583
- const _hoisted_1$l = {
2652
+ const _hoisted_1$n = {
2584
2653
  key: 0,
2585
2654
  class: "v-image-uploader__drag-label"
2586
2655
  };
2587
- const _hoisted_2$5 = { class: "v-image-uploader__image-preview" };
2588
- const _hoisted_3$3 = ["src"];
2589
- const _hoisted_4$1 = { class: "v-image-uploader__image-info" };
2590
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
2656
+ const _hoisted_2$6 = { class: "v-image-uploader__image-preview" };
2657
+ const _hoisted_3$4 = ["src"];
2658
+ const _hoisted_4$2 = { class: "v-image-uploader__image-info" };
2659
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
2591
2660
  __name: "VImageUploader",
2592
2661
  props: {
2593
2662
  accept: {},
@@ -2653,10 +2722,10 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2653
2722
  emit("update:modelValue", image);
2654
2723
  };
2655
2724
  if (fileRequest) {
2656
- contextMenuItems.push({ title: "Выбрать из файлов проекта", onClick: () => dialog.open(_sfc_main$q, { fileRequest, onOpenImage }) });
2725
+ contextMenuItems.push({ title: "Выбрать из файлов проекта", onClick: () => dialog.open(_sfc_main$s, { fileRequest, onOpenImage }) });
2657
2726
  }
2658
2727
  return (_ctx, _cache) => {
2659
- return openBlock(), createBlock(_sfc_main$J, {
2728
+ return openBlock(), createBlock(_sfc_main$L, {
2660
2729
  class: normalizeClass(["v-image-uploader", { drag: drag.value }]),
2661
2730
  error: _ctx.error,
2662
2731
  label: _ctx.label,
@@ -2668,7 +2737,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2668
2737
  onDragleave: onDragLeave
2669
2738
  }, {
2670
2739
  default: withCtx(() => [
2671
- drag.value ? (openBlock(), createElementBlock("div", _hoisted_1$l, "Отпустите файл здесь")) : !props.modelValue || props.modelValue.src === unref(defaultImageSrc) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2740
+ drag.value ? (openBlock(), createElementBlock("div", _hoisted_1$n, "Отпустите файл здесь")) : !props.modelValue || props.modelValue.src === unref(defaultImageSrc) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2672
2741
  createVNode(EmptyFileIcon),
2673
2742
  createElementVNode("div", null, [
2674
2743
  createElementVNode("a", {
@@ -2676,7 +2745,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2676
2745
  }, "Загрузите изображение"),
2677
2746
  _cache[1] || (_cache[1] = createElementVNode("br", null, null, -1)),
2678
2747
  _cache[2] || (_cache[2] = createTextVNode("или перетащите сюда ")),
2679
- contextMenuItems.length > 0 ? (openBlock(), createBlock(_sfc_main$t, {
2748
+ contextMenuItems.length > 0 ? (openBlock(), createBlock(_sfc_main$v, {
2680
2749
  key: 0,
2681
2750
  items: contextMenuItems,
2682
2751
  placement: "bottom-end"
@@ -2693,11 +2762,11 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2693
2762
  })) : createCommentVNode("", true)
2694
2763
  ])
2695
2764
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2696
- createElementVNode("div", _hoisted_2$5, [
2765
+ createElementVNode("div", _hoisted_2$6, [
2697
2766
  createElementVNode("img", {
2698
2767
  src: props.modelValue.previewSrc ?? props.modelValue.src,
2699
2768
  alt: "Preview Image"
2700
- }, null, 8, _hoisted_3$3),
2769
+ }, null, 8, _hoisted_3$4),
2701
2770
  createVNode(VIconButton, {
2702
2771
  class: "v-image-uploader__delete-button",
2703
2772
  onClick: removeImage
@@ -2708,7 +2777,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2708
2777
  _: 1
2709
2778
  })
2710
2779
  ]),
2711
- createElementVNode("div", _hoisted_4$1, [
2780
+ createElementVNode("div", _hoisted_4$2, [
2712
2781
  createElementVNode("div", null, toDisplayString(props.modelValue.name), 1)
2713
2782
  ])
2714
2783
  ], 64))
@@ -2718,33 +2787,33 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2718
2787
  };
2719
2788
  }
2720
2789
  });
2721
- const _sfc_main$o = {};
2722
- const _hoisted_1$k = {
2790
+ const _sfc_main$q = {};
2791
+ const _hoisted_1$m = {
2723
2792
  width: "18",
2724
2793
  height: "18",
2725
2794
  viewBox: "0 0 18 18",
2726
2795
  fill: "none",
2727
2796
  xmlns: "http://www.w3.org/2000/svg"
2728
2797
  };
2729
- function _sfc_render$8(_ctx, _cache) {
2730
- return openBlock(), createElementBlock("svg", _hoisted_1$k, _cache[0] || (_cache[0] = [
2798
+ function _sfc_render$9(_ctx, _cache) {
2799
+ return openBlock(), createElementBlock("svg", _hoisted_1$m, _cache[0] || (_cache[0] = [
2731
2800
  createElementVNode("path", {
2732
2801
  d: "M14.0326 5.40749C13.9629 5.33719 13.8799 5.28139 13.7885 5.24332C13.6971 5.20524 13.5991 5.18564 13.5001 5.18564C13.4011 5.18564 13.303 5.20524 13.2117 5.24332C13.1203 5.28139 13.0373 5.33719 12.9676 5.40749L7.38008 11.0025L5.03258 8.64749C4.96019 8.57756 4.87474 8.52257 4.7811 8.48567C4.68745 8.44877 4.58746 8.43067 4.48683 8.43241C4.38619 8.43415 4.28688 8.4557 4.19457 8.49582C4.10227 8.53594 4.01876 8.59385 3.94883 8.66624C3.87891 8.73863 3.82392 8.82408 3.78702 8.91773C3.75011 9.01137 3.73202 9.11136 3.73376 9.212C3.7355 9.31263 3.75704 9.41194 3.79716 9.50425C3.83728 9.59656 3.89519 9.68006 3.96758 9.74999L6.84758 12.63C6.91731 12.7003 7.00026 12.7561 7.09165 12.7942C7.18305 12.8322 7.28108 12.8518 7.38008 12.8518C7.47909 12.8518 7.57712 12.8322 7.66852 12.7942C7.75991 12.7561 7.84286 12.7003 7.91258 12.63L14.0326 6.50999C14.1087 6.43976 14.1695 6.35452 14.211 6.25964C14.2526 6.16477 14.274 6.06231 14.274 5.95874C14.274 5.85516 14.2526 5.75271 14.211 5.65783C14.1695 5.56296 14.1087 5.47772 14.0326 5.40749Z",
2733
2802
  fill: "currentColor"
2734
2803
  }, null, -1)
2735
2804
  ]));
2736
2805
  }
2737
- const CheckIcon = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$8]]);
2738
- const _hoisted_1$j = {
2806
+ const CheckIcon = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$9]]);
2807
+ const _hoisted_1$l = {
2739
2808
  key: 0,
2740
2809
  class: "mech-v-checkbox__label left"
2741
2810
  };
2742
- const _hoisted_2$4 = ["name"];
2743
- const _hoisted_3$2 = {
2811
+ const _hoisted_2$5 = ["name"];
2812
+ const _hoisted_3$3 = {
2744
2813
  key: 1,
2745
2814
  class: "mech-v-checkbox__label"
2746
2815
  };
2747
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
2816
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2748
2817
  __name: "VCheckbox",
2749
2818
  props: /* @__PURE__ */ mergeModels({
2750
2819
  label: {},
@@ -2776,7 +2845,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2776
2845
  onClick,
2777
2846
  onKeydown: onClick
2778
2847
  }, [
2779
- labelPosition.value === "left" ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
2848
+ labelPosition.value === "left" ? (openBlock(), createElementBlock("div", _hoisted_1$l, [
2780
2849
  renderSlot(_ctx.$slots, "label", {}, () => [
2781
2850
  createTextVNode(toDisplayString(props.label), 1)
2782
2851
  ])
@@ -2790,10 +2859,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2790
2859
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
2791
2860
  type: "checkbox",
2792
2861
  name: props.name
2793
- }, null, 8, _hoisted_2$4), [
2862
+ }, null, 8, _hoisted_2$5), [
2794
2863
  [vModelCheckbox, model.value]
2795
2864
  ]),
2796
- labelPosition.value === "right" ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
2865
+ labelPosition.value === "right" ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
2797
2866
  renderSlot(_ctx.$slots, "label", {}, () => [
2798
2867
  createTextVNode(toDisplayString(props.label), 1)
2799
2868
  ])
@@ -2813,16 +2882,16 @@ const capitalize = (text) => {
2813
2882
  const spaceCamelCase = (str) => {
2814
2883
  return capitalize(str.replace(/([A-Z])/g, " $1").trimStart());
2815
2884
  };
2816
- const _sfc_main$m = {};
2817
- const _hoisted_1$i = {
2885
+ const _sfc_main$o = {};
2886
+ const _hoisted_1$k = {
2818
2887
  width: "24",
2819
2888
  height: "24",
2820
2889
  viewBox: "0 0 24 24",
2821
2890
  fill: "none",
2822
2891
  xmlns: "http://www.w3.org/2000/svg"
2823
2892
  };
2824
- function _sfc_render$7(_ctx, _cache) {
2825
- return openBlock(), createElementBlock("svg", _hoisted_1$i, _cache[0] || (_cache[0] = [
2893
+ function _sfc_render$8(_ctx, _cache) {
2894
+ return openBlock(), createElementBlock("svg", _hoisted_1$k, _cache[0] || (_cache[0] = [
2826
2895
  createElementVNode("path", {
2827
2896
  "fill-rule": "evenodd",
2828
2897
  "clip-rule": "evenodd",
@@ -2831,9 +2900,9 @@ function _sfc_render$7(_ctx, _cache) {
2831
2900
  }, null, -1)
2832
2901
  ]));
2833
2902
  }
2834
- const EditIcon = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$7]]);
2835
- const _hoisted_1$h = { class: "v-link-editor__custom" };
2836
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2903
+ const EditIcon = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$8]]);
2904
+ const _hoisted_1$j = { class: "v-link-editor__custom" };
2905
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2837
2906
  __name: "VLinkEditor",
2838
2907
  props: /* @__PURE__ */ mergeModels({
2839
2908
  nullable: { type: Boolean }
@@ -2888,7 +2957,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2888
2957
  return arr;
2889
2958
  });
2890
2959
  return (_ctx, _cache) => {
2891
- return openBlock(), createBlock(_sfc_main$y, {
2960
+ return openBlock(), createBlock(_sfc_main$A, {
2892
2961
  class: "v-link-editor",
2893
2962
  modelValue: linkType.value,
2894
2963
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => linkType.value = $event),
@@ -2896,7 +2965,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2896
2965
  nullable: props.nullable
2897
2966
  }, {
2898
2967
  default: withCtx(() => [
2899
- model.value && model.value.id ? (openBlock(), createBlock(_sfc_main$C, {
2968
+ model.value && model.value.id ? (openBlock(), createBlock(_sfc_main$E, {
2900
2969
  key: 0,
2901
2970
  offset: 4,
2902
2971
  placement: "bottom-end"
@@ -2912,27 +2981,27 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2912
2981
  default: withCtx(() => {
2913
2982
  var _a;
2914
2983
  return [
2915
- createElementVNode("div", _hoisted_1$h, [
2916
- model.value.id === "_external" ? (openBlock(), createBlock(_sfc_main$I, {
2984
+ createElementVNode("div", _hoisted_1$j, [
2985
+ model.value.id === "_external" ? (openBlock(), createBlock(_sfc_main$K, {
2917
2986
  key: 0,
2918
2987
  modelValue: model.value.url,
2919
2988
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value.url = $event),
2920
2989
  label: "URL ссылки",
2921
2990
  autofocus: ""
2922
2991
  }, null, 8, ["modelValue"])) : createCommentVNode("", true),
2923
- model.value.id !== "_external" ? (openBlock(), createBlock(_sfc_main$I, {
2992
+ model.value.id !== "_external" ? (openBlock(), createBlock(_sfc_main$K, {
2924
2993
  key: 1,
2925
2994
  modelValue: model.value.query,
2926
2995
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => model.value.query = $event),
2927
2996
  label: "Якорь",
2928
2997
  prefix: (_a = model.value) == null ? void 0 : _a.url
2929
2998
  }, null, 8, ["modelValue", "prefix"])) : createCommentVNode("", true),
2930
- createVNode(_sfc_main$I, {
2999
+ createVNode(_sfc_main$K, {
2931
3000
  modelValue: model.value.title,
2932
3001
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => model.value.title = $event),
2933
3002
  label: "Заголовок"
2934
3003
  }, null, 8, ["modelValue"]),
2935
- createVNode(_sfc_main$n, {
3004
+ createVNode(_sfc_main$p, {
2936
3005
  modelValue: model.value.openNewTab,
2937
3006
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => model.value.openNewTab = $event),
2938
3007
  label: "Открывать в новой вкладке"
@@ -3763,7 +3832,7 @@ const createClipboardEvents = (store, props) => {
3763
3832
  store.deleteSelected();
3764
3833
  store.history.push("setText");
3765
3834
  };
3766
- const insertText = (text) => {
3835
+ const insertText = (text, type) => {
3767
3836
  if (props.preventMultiline) {
3768
3837
  const blocks = text.split("\n");
3769
3838
  store.insertText(blocks[0]);
@@ -3772,11 +3841,14 @@ const createClipboardEvents = (store, props) => {
3772
3841
  store.insertText(blocks[i]);
3773
3842
  }
3774
3843
  } else {
3844
+ if (type && store.currentBlock) {
3845
+ store.currentBlock.type = type;
3846
+ }
3775
3847
  store.insertText(text);
3776
3848
  }
3777
3849
  };
3778
- const parseHtml = (node) => {
3779
- var _a;
3850
+ const parseHtml = (node, type) => {
3851
+ var _a, _b, _c, _d;
3780
3852
  let isTextNode = false;
3781
3853
  for (let _node of node.childNodes) {
3782
3854
  if (_node.nodeType === Node.TEXT_NODE && ((_a = _node.textContent) == null ? void 0 : _a.trim()) || _node.nodeType == Node.ELEMENT_NODE && _node.tagName === "SPAN") {
@@ -3788,15 +3860,19 @@ const createClipboardEvents = (store, props) => {
3788
3860
  const text = node.textContent;
3789
3861
  if (!text)
3790
3862
  return;
3791
- insertText(text);
3863
+ insertText(text, type ?? ((_b = props.htmlParser) == null ? void 0 : _b.call(props, node)) ?? void 0);
3792
3864
  store.addNewLine();
3793
3865
  return;
3794
3866
  }
3795
3867
  for (let child of node.children) {
3796
3868
  if (child.tagName === "DIV") {
3797
- parseHtml(child);
3869
+ parseHtml(child, type);
3870
+ } else if (child.tagName === "UL" || child.tagName === "OL") {
3871
+ for (let li of child.children) {
3872
+ parseHtml(li, ((_c = props.htmlParser) == null ? void 0 : _c.call(props, li)) ?? void 0);
3873
+ }
3798
3874
  } else {
3799
- insertText(child.textContent ?? "");
3875
+ insertText(child.textContent ?? "", type ?? ((_d = props.htmlParser) == null ? void 0 : _d.call(props, child)) ?? void 0);
3800
3876
  store.addNewLine();
3801
3877
  }
3802
3878
  }
@@ -3838,7 +3914,8 @@ const _sfc_main$1$1 = /* @__PURE__ */ defineComponent({
3838
3914
  styles: {},
3839
3915
  autofocus: { type: Boolean },
3840
3916
  autoselect: { type: Boolean },
3841
- preventMultiline: { type: Boolean }
3917
+ preventMultiline: { type: Boolean },
3918
+ htmlParser: { type: Function }
3842
3919
  },
3843
3920
  emits: ["keydown", "update:modelValue", "update:styles"],
3844
3921
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -4054,24 +4131,61 @@ const _sfc_main$1$1 = /* @__PURE__ */ defineComponent({
4054
4131
  };
4055
4132
  }
4056
4133
  });
4134
+ const wrapLists = (blocks, creator) => {
4135
+ if (!blocks.some((i) => !!creator(i))) {
4136
+ return blocks;
4137
+ }
4138
+ const arr = [];
4139
+ let liArray = [];
4140
+ let currentListTag = null;
4141
+ for (let i of blocks) {
4142
+ let listTag = creator(i);
4143
+ if (listTag) {
4144
+ if (currentListTag == null || listTag !== currentListTag) {
4145
+ liArray = [];
4146
+ arr.push(liArray);
4147
+ currentListTag = listTag;
4148
+ }
4149
+ liArray.push(i);
4150
+ } else {
4151
+ arr.push(i);
4152
+ currentListTag = null;
4153
+ }
4154
+ }
4155
+ return arr;
4156
+ };
4057
4157
  defineComponent({
4058
- props: ["modelValue", "decorator", "parser", "styles", "renderer"],
4158
+ props: ["modelValue", "decorator", "parser", "styles", "renderer", "listParser"],
4059
4159
  setup(props, { slots }) {
4060
4160
  const blocks = computed(() => {
4061
4161
  if (Array.isArray(props.modelValue)) {
4162
+ if (props.listParser && props.modelValue.some((i) => props.listParser(i))) {
4163
+ return wrapLists(props.modelValue, props.listParser);
4164
+ }
4062
4165
  return props.modelValue;
4063
4166
  }
4064
4167
  return [{ text: props.modelValue, styles: props.styles ?? [] }];
4065
4168
  });
4066
- return () => h("div", blocks.value.map((block) => h(_sfc_main$2$1, {
4067
- key: block.id,
4068
- block,
4069
- slots,
4070
- decorator: props.decorator,
4071
- renderer: props.renderer,
4072
- parser: props.parser,
4073
- static: true
4074
- })));
4169
+ return () => h("div", blocks.value.map((block) => {
4170
+ var _a;
4171
+ return Array.isArray(block) ? h(((_a = props.listParser) == null ? void 0 : _a.call(props, block[0])) ?? "ul", { key: block[0].id }, block.map((block2) => h(_sfc_main$2$1, {
4172
+ key: block2.id,
4173
+ block: block2,
4174
+ slots,
4175
+ decorator: props.decorator,
4176
+ renderer: props.renderer,
4177
+ parser: props.parser,
4178
+ static: true
4179
+ }))) : h(_sfc_main$2$1, {
4180
+ key: block.id,
4181
+ block,
4182
+ slots,
4183
+ decorator: props.decorator,
4184
+ renderer: props.renderer,
4185
+ parser: props.parser,
4186
+ static: true
4187
+ });
4188
+ }));
4075
4189
  }
4076
4190
  });
4077
4191
  const defaultDecorator = (style) => {
@@ -4079,19 +4193,22 @@ const defaultDecorator = (style) => {
4079
4193
  return { style: `color: ${style.meta.color};` };
4080
4194
  }
4081
4195
  if (style.style === "bold") {
4082
- return { tag: "b" };
4196
+ return { tag: "b", class: "bold" };
4083
4197
  }
4084
4198
  if (style.style === "underline") {
4085
- return { tag: "u" };
4199
+ return { tag: "u", class: "underline" };
4086
4200
  }
4087
4201
  if (style.style === "italic") {
4088
- return { tag: "i" };
4202
+ return { tag: "i", class: "italic" };
4203
+ }
4204
+ if (style.style === "strikethrough") {
4205
+ return { tag: "s", class: "strikethrough" };
4089
4206
  }
4090
4207
  if (style.style === "code") {
4091
4208
  return { class: style.style };
4092
4209
  }
4093
4210
  if (style.style === "link") {
4094
- return { tag: "a", href: style.meta.url };
4211
+ return { tag: "a", href: style.meta.url, title: style.meta.pageName ?? style.meta.url, target: style.meta.blank ? "_blank" : void 0 };
4095
4212
  }
4096
4213
  };
4097
4214
  const defaultRenderer = (block) => {
@@ -4181,11 +4298,11 @@ const codeParser = (text) => {
4181
4298
  }
4182
4299
  return arr;
4183
4300
  };
4184
- const _hoisted_1$g = {
4301
+ const _hoisted_1$i = {
4185
4302
  class: "code-editor",
4186
4303
  contenteditable: false
4187
4304
  };
4188
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
4305
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
4189
4306
  __name: "RichTextEditorCode",
4190
4307
  props: {
4191
4308
  modelValue: {}
@@ -4213,7 +4330,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
4213
4330
  }
4214
4331
  };
4215
4332
  return (_ctx, _cache) => {
4216
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
4333
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
4217
4334
  createVNode(unref(_sfc_main$1$1), {
4218
4335
  modelValue: model.value,
4219
4336
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
@@ -4228,6 +4345,132 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
4228
4345
  };
4229
4346
  }
4230
4347
  });
4348
+ const _hoisted_1$h = { class: "rich-text-editor-link-popover__current-item" };
4349
+ const _hoisted_2$4 = { class: "title" };
4350
+ const _hoisted_3$2 = { class: "path" };
4351
+ const _hoisted_4$1 = { class: "rich-text-editor-link-popover__items" };
4352
+ const _hoisted_5$1 = ["onClick"];
4353
+ const _hoisted_6 = { class: "title" };
4354
+ const _hoisted_7 = { class: "path" };
4355
+ const _hoisted_8 = { class: "path" };
4356
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
4357
+ __name: "RichTextEditorLinkPopover",
4358
+ props: {
4359
+ state: {}
4360
+ },
4361
+ emits: ["apply"],
4362
+ setup(__props, { emit: __emit }) {
4363
+ const props = __props;
4364
+ const emit = __emit;
4365
+ const pagesRequest = inject("pagesRequest");
4366
+ const { data } = useRequest(pagesRequest);
4367
+ const searchValue = ref("");
4368
+ const dataSearchFeed = (item) => {
4369
+ return [
4370
+ ...item.name.toLowerCase().split(" "),
4371
+ ...item.path.split("/")
4372
+ ].filter((i) => !!i);
4373
+ };
4374
+ const searchFeed = (str) => {
4375
+ return str.replace(/[_\-,()\/]/g, " ").split(" ");
4376
+ };
4377
+ const searchData = useSearch(() => searchFeed(searchValue.value), data, dataSearchFeed);
4378
+ const openInNewPage = ref(false);
4379
+ const items = computed(() => {
4380
+ return searchData.value;
4381
+ });
4382
+ const onButtonClick = (item) => {
4383
+ props.state.isInternal = true;
4384
+ props.state.url = item.path;
4385
+ props.state.pageName = item.name;
4386
+ delete props.state.blank;
4387
+ emit("apply");
4388
+ };
4389
+ const createExternalLink = () => {
4390
+ delete props.state.isInternal;
4391
+ delete props.state.pageName;
4392
+ props.state.url = searchValue.value.trim();
4393
+ if (openInNewPage.value) {
4394
+ props.state.blank = true;
4395
+ } else {
4396
+ delete props.state.blank;
4397
+ }
4398
+ emit("apply");
4399
+ };
4400
+ const deleteLink = () => {
4401
+ props.state.url = "";
4402
+ emit("apply");
4403
+ };
4404
+ return (_ctx, _cache) => {
4405
+ return props.state.url ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4406
+ createElementVNode("div", _hoisted_1$h, [
4407
+ createElementVNode("div", _hoisted_2$4, toDisplayString(props.state.pageName ?? "Внешняя ссылка"), 1),
4408
+ createElementVNode("div", _hoisted_3$2, toDisplayString(props.state.url), 1)
4409
+ ]),
4410
+ createVNode(_sfc_main$w, {
4411
+ style: { "margin-top": "8px", "margin-bottom": "4px" },
4412
+ onClick: deleteLink
4413
+ }, {
4414
+ default: withCtx(() => _cache[2] || (_cache[2] = [
4415
+ createTextVNode("Удалить ссылку")
4416
+ ])),
4417
+ _: 1,
4418
+ __: [2]
4419
+ })
4420
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4421
+ createVNode(_sfc_main$K, {
4422
+ modelValue: searchValue.value,
4423
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
4424
+ autofocus: "",
4425
+ placeholder: "Введите URL или название страницы"
4426
+ }, null, 8, ["modelValue"]),
4427
+ createElementVNode("div", _hoisted_4$1, [
4428
+ (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
4429
+ return openBlock(), createElementBlock("button", {
4430
+ class: "rich-text-editor-link-popover__item",
4431
+ onClick: ($event) => onButtonClick(item)
4432
+ }, [
4433
+ createElementVNode("div", _hoisted_6, toDisplayString(item.name), 1),
4434
+ createElementVNode("div", _hoisted_7, toDisplayString(item.path), 1)
4435
+ ], 8, _hoisted_5$1);
4436
+ }), 256)),
4437
+ searchValue.value.length > 0 ? (openBlock(), createElementBlock("button", {
4438
+ key: 0,
4439
+ class: "rich-text-editor-link-popover__item",
4440
+ onClick: createExternalLink
4441
+ }, [
4442
+ _cache[3] || (_cache[3] = createElementVNode("div", { class: "title" }, "Создать внешнюю ссылку", -1)),
4443
+ createElementVNode("div", _hoisted_8, toDisplayString(searchValue.value), 1)
4444
+ ])) : createCommentVNode("", true),
4445
+ searchValue.value.startsWith("http") ? (openBlock(), createBlock(_sfc_main$p, {
4446
+ key: 1,
4447
+ modelValue: openInNewPage.value,
4448
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => openInNewPage.value = $event),
4449
+ label: "Открывать в новой вкладке",
4450
+ class: "rich-text-editor-link-popover__checkbox"
4451
+ }, null, 8, ["modelValue"])) : createCommentVNode("", true)
4452
+ ])
4453
+ ], 64));
4454
+ };
4455
+ }
4456
+ });
4457
+ const _sfc_main$k = {};
4458
+ const _hoisted_1$g = {
4459
+ width: "16",
4460
+ height: "16",
4461
+ viewBox: "0 0 16 16",
4462
+ fill: "none",
4463
+ xmlns: "http://www.w3.org/2000/svg"
4464
+ };
4465
+ function _sfc_render$7(_ctx, _cache) {
4466
+ return openBlock(), createElementBlock("svg", _hoisted_1$g, _cache[0] || (_cache[0] = [
4467
+ createElementVNode("path", {
4468
+ d: "M4 2H8.5C9.14255 2.0002 9.77266 2.17723 10.3213 2.51171C10.8699 2.84618 11.3159 3.32519 11.6105 3.89627C11.905 4.46734 12.0367 5.10846 11.9911 5.7494C11.9455 6.39033 11.7244 7.00636 11.352 7.53C11.9979 7.93183 12.4953 8.53322 12.7688 9.24307C13.0423 9.95292 13.077 10.7326 12.8676 11.4639C12.6583 12.1952 12.2163 12.8384 11.6086 13.2961C11.001 13.7537 10.2607 14.0008 9.5 14H4C3.73478 14 3.48043 13.8946 3.29289 13.7071C3.10536 13.5196 3 13.2652 3 13V3C3 2.73478 3.10536 2.48043 3.29289 2.29289C3.48043 2.10536 3.73478 2 4 2ZM5 9V12H9.5C9.89782 12 10.2794 11.842 10.5607 11.5607C10.842 11.2794 11 10.8978 11 10.5C11 10.1022 10.842 9.72064 10.5607 9.43934C10.2794 9.15804 9.89782 9 9.5 9H5ZM8.5 7C8.89782 7 9.27936 6.84196 9.56066 6.56066C9.84196 6.27936 10 5.89782 10 5.5C10 5.10218 9.84196 4.72064 9.56066 4.43934C9.27936 4.15804 8.89782 4 8.5 4H5V7H8.5Z",
4469
+ fill: "currentColor"
4470
+ }, null, -1)
4471
+ ]));
4472
+ }
4473
+ const TextBoldIcon = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$7]]);
4231
4474
  const _sfc_main$j = {};
4232
4475
  const _hoisted_1$f = {
4233
4476
  width: "16",
@@ -4239,12 +4482,12 @@ const _hoisted_1$f = {
4239
4482
  function _sfc_render$6(_ctx, _cache) {
4240
4483
  return openBlock(), createElementBlock("svg", _hoisted_1$f, _cache[0] || (_cache[0] = [
4241
4484
  createElementVNode("path", {
4242
- d: "M4 2H8.5C9.14255 2.0002 9.77266 2.17723 10.3213 2.51171C10.8699 2.84618 11.3159 3.32519 11.6105 3.89627C11.905 4.46734 12.0367 5.10846 11.9911 5.7494C11.9455 6.39033 11.7244 7.00636 11.352 7.53C11.9979 7.93183 12.4953 8.53322 12.7688 9.24307C13.0423 9.95292 13.077 10.7326 12.8676 11.4639C12.6583 12.1952 12.2163 12.8384 11.6086 13.2961C11.001 13.7537 10.2607 14.0008 9.5 14H4C3.73478 14 3.48043 13.8946 3.29289 13.7071C3.10536 13.5196 3 13.2652 3 13V3C3 2.73478 3.10536 2.48043 3.29289 2.29289C3.48043 2.10536 3.73478 2 4 2ZM5 9V12H9.5C9.89782 12 10.2794 11.842 10.5607 11.5607C10.842 11.2794 11 10.8978 11 10.5C11 10.1022 10.842 9.72064 10.5607 9.43934C10.2794 9.15804 9.89782 9 9.5 9H5ZM8.5 7C8.89782 7 9.27936 6.84196 9.56066 6.56066C9.84196 6.27936 10 5.89782 10 5.5C10 5.10218 9.84196 4.72064 9.56066 4.43934C9.27936 4.15804 8.89782 4 8.5 4H5V7H8.5Z",
4485
+ d: "M6 2.75C6 2.55109 6.07902 2.36032 6.21967 2.21967C6.36032 2.07902 6.55109 2 6.75 2H13.25C13.4489 2 13.6397 2.07902 13.7803 2.21967C13.921 2.36032 14 2.55109 14 2.75C14 2.94891 13.921 3.13968 13.7803 3.28033C13.6397 3.42098 13.4489 3.5 13.25 3.5H10.745L6.887 12.5H9.25C9.44891 12.5 9.63968 12.579 9.78033 12.7197C9.92098 12.8603 10 13.0511 10 13.25C10 13.4489 9.92098 13.6397 9.78033 13.7803C9.63968 13.921 9.44891 14 9.25 14H2.75C2.55109 14 2.36032 13.921 2.21967 13.7803C2.07902 13.6397 2 13.4489 2 13.25C2 13.0511 2.07902 12.8603 2.21967 12.7197C2.36032 12.579 2.55109 12.5 2.75 12.5H5.255L9.113 3.5H6.75C6.55109 3.5 6.36032 3.42098 6.21967 3.28033C6.07902 3.13968 6 2.94891 6 2.75Z",
4243
4486
  fill: "currentColor"
4244
4487
  }, null, -1)
4245
4488
  ]));
4246
4489
  }
4247
- const TextBoldIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$6]]);
4490
+ const TextItalicIcon = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$6]]);
4248
4491
  const _sfc_main$i = {};
4249
4492
  const _hoisted_1$e = {
4250
4493
  width: "16",
@@ -4256,12 +4499,12 @@ const _hoisted_1$e = {
4256
4499
  function _sfc_render$5(_ctx, _cache) {
4257
4500
  return openBlock(), createElementBlock("svg", _hoisted_1$e, _cache[0] || (_cache[0] = [
4258
4501
  createElementVNode("path", {
4259
- d: "M6 2.75C6 2.55109 6.07902 2.36032 6.21967 2.21967C6.36032 2.07902 6.55109 2 6.75 2H13.25C13.4489 2 13.6397 2.07902 13.7803 2.21967C13.921 2.36032 14 2.55109 14 2.75C14 2.94891 13.921 3.13968 13.7803 3.28033C13.6397 3.42098 13.4489 3.5 13.25 3.5H10.745L6.887 12.5H9.25C9.44891 12.5 9.63968 12.579 9.78033 12.7197C9.92098 12.8603 10 13.0511 10 13.25C10 13.4489 9.92098 13.6397 9.78033 13.7803C9.63968 13.921 9.44891 14 9.25 14H2.75C2.55109 14 2.36032 13.921 2.21967 13.7803C2.07902 13.6397 2 13.4489 2 13.25C2 13.0511 2.07902 12.8603 2.21967 12.7197C2.36032 12.579 2.55109 12.5 2.75 12.5H5.255L9.113 3.5H6.75C6.55109 3.5 6.36032 3.42098 6.21967 3.28033C6.07902 3.13968 6 2.94891 6 2.75Z",
4502
+ d: "M8 11.0625C9.16032 11.0625 10.2731 10.6016 11.0936 9.78109C11.9141 8.96062 12.375 7.84782 12.375 6.6875V2.3125C12.375 2.08044 12.2828 1.85788 12.1187 1.69378C11.9546 1.52969 11.7321 1.4375 11.5 1.4375C11.2679 1.4375 11.0454 1.52969 10.8813 1.69378C10.7172 1.85788 10.625 2.08044 10.625 2.3125V6.6875C10.625 7.38369 10.3484 8.05137 9.85616 8.54366C9.36387 9.03594 8.69619 9.3125 8 9.3125C7.30381 9.3125 6.63613 9.03594 6.14384 8.54366C5.65156 8.05137 5.375 7.38369 5.375 6.6875V2.3125C5.375 2.08044 5.28281 1.85788 5.11872 1.69378C4.95462 1.52969 4.73206 1.4375 4.5 1.4375C4.26794 1.4375 4.04538 1.52969 3.88128 1.69378C3.71719 1.85788 3.625 2.08044 3.625 2.3125V6.6875C3.625 7.84782 4.08594 8.96062 4.90641 9.78109C5.72688 10.6016 6.83968 11.0625 8 11.0625ZM12.375 12.8125H3.625C3.39294 12.8125 3.17038 12.9047 3.00628 13.0688C2.84219 13.2329 2.75 13.4554 2.75 13.6875C2.75 13.9196 2.84219 14.1421 3.00628 14.3062C3.17038 14.4703 3.39294 14.5625 3.625 14.5625H12.375C12.6071 14.5625 12.8296 14.4703 12.9937 14.3062C13.1578 14.1421 13.25 13.9196 13.25 13.6875C13.25 13.4554 13.1578 13.2329 12.9937 13.0688C12.8296 12.9047 12.6071 12.8125 12.375 12.8125Z",
4260
4503
  fill: "currentColor"
4261
4504
  }, null, -1)
4262
4505
  ]));
4263
4506
  }
4264
- const TextItalicIcon = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$5]]);
4507
+ const TextUnderlineIcon = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$5]]);
4265
4508
  const _sfc_main$h = {};
4266
4509
  const _hoisted_1$d = {
4267
4510
  width: "16",
@@ -4273,12 +4516,12 @@ const _hoisted_1$d = {
4273
4516
  function _sfc_render$4(_ctx, _cache) {
4274
4517
  return openBlock(), createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
4275
4518
  createElementVNode("path", {
4276
- d: "M8 11.0625C9.16032 11.0625 10.2731 10.6016 11.0936 9.78109C11.9141 8.96062 12.375 7.84782 12.375 6.6875V2.3125C12.375 2.08044 12.2828 1.85788 12.1187 1.69378C11.9546 1.52969 11.7321 1.4375 11.5 1.4375C11.2679 1.4375 11.0454 1.52969 10.8813 1.69378C10.7172 1.85788 10.625 2.08044 10.625 2.3125V6.6875C10.625 7.38369 10.3484 8.05137 9.85616 8.54366C9.36387 9.03594 8.69619 9.3125 8 9.3125C7.30381 9.3125 6.63613 9.03594 6.14384 8.54366C5.65156 8.05137 5.375 7.38369 5.375 6.6875V2.3125C5.375 2.08044 5.28281 1.85788 5.11872 1.69378C4.95462 1.52969 4.73206 1.4375 4.5 1.4375C4.26794 1.4375 4.04538 1.52969 3.88128 1.69378C3.71719 1.85788 3.625 2.08044 3.625 2.3125V6.6875C3.625 7.84782 4.08594 8.96062 4.90641 9.78109C5.72688 10.6016 6.83968 11.0625 8 11.0625ZM12.375 12.8125H3.625C3.39294 12.8125 3.17038 12.9047 3.00628 13.0688C2.84219 13.2329 2.75 13.4554 2.75 13.6875C2.75 13.9196 2.84219 14.1421 3.00628 14.3062C3.17038 14.4703 3.39294 14.5625 3.625 14.5625H12.375C12.6071 14.5625 12.8296 14.4703 12.9937 14.3062C13.1578 14.1421 13.25 13.9196 13.25 13.6875C13.25 13.4554 13.1578 13.2329 12.9937 13.0688C12.8296 12.9047 12.6071 12.8125 12.375 12.8125Z",
4519
+ d: "M11.055 8.5C11.579 9.036 11.87 9.757 11.866 10.507C11.8673 10.9659 11.7676 11.4195 11.574 11.8357C11.3805 12.2518 11.0978 12.6203 10.746 12.915C9.948 13.597 8.748 14 7.096 14C5.39 14 3.992 13.393 3.194 12.623C3.06263 12.4823 2.99028 12.2966 2.99188 12.1041C2.99349 11.9117 3.06893 11.7272 3.20264 11.5887C3.33634 11.4503 3.5181 11.3684 3.7104 11.3601C3.90269 11.3518 4.09084 11.4176 4.236 11.544C4.716 12.007 5.723 12.5 7.096 12.5C8.518 12.5 9.328 12.154 9.772 11.774C10.207 11.402 10.366 10.935 10.366 10.507C10.366 10.035 10.158 9.65 9.719 9.31C9.271 8.964 8.603 8.687 7.768 8.5H1.75C1.55109 8.5 1.36032 8.42098 1.21967 8.28033C1.07902 8.13968 1 7.94891 1 7.75C1 7.55109 1.07902 7.36032 1.21967 7.21967C1.36032 7.07902 1.55109 7 1.75 7H14.25C14.4489 7 14.6397 7.07902 14.7803 7.21967C14.921 7.36032 15 7.55109 15 7.75C15 7.94891 14.921 8.13968 14.7803 8.28033C14.6397 8.42098 14.4489 8.5 14.25 8.5H11.055ZM7.581 3.25C5.545 3.25 4.803 4.332 4.803 5.036C4.803 5.09067 4.805 5.143 4.809 5.193C4.82412 5.39138 4.75981 5.58764 4.63022 5.73861C4.50063 5.88958 4.31638 5.98288 4.118 5.998C3.91962 6.01312 3.72336 5.94881 3.57239 5.81922C3.42142 5.68963 3.32812 5.50538 3.313 5.307C3.3066 5.21681 3.30327 5.12642 3.303 5.036C3.303 3.204 5.053 1.75 7.581 1.75C8.999 1.75 10.302 2.33 11.095 2.843C11.1777 2.89645 11.2491 2.96567 11.3051 3.04671C11.3611 3.12775 11.4006 3.21902 11.4213 3.31532C11.442 3.41161 11.4435 3.51104 11.4258 3.60793C11.4081 3.70482 11.3714 3.79727 11.318 3.88C11.2646 3.96273 11.1953 4.03413 11.1143 4.09011C11.0333 4.14609 10.942 4.18556 10.8457 4.20627C10.7494 4.22698 10.65 4.22852 10.5531 4.2108C10.4562 4.19308 10.3637 4.15645 10.281 4.103C9.641 3.689 8.619 3.25 7.581 3.25Z",
4277
4520
  fill: "currentColor"
4278
4521
  }, null, -1)
4279
4522
  ]));
4280
4523
  }
4281
- const TextUnderlineIcon = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$4]]);
4524
+ const TextStrikethroughIcon = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$4]]);
4282
4525
  const _sfc_main$g = {};
4283
4526
  const _hoisted_1$c = {
4284
4527
  width: "16",
@@ -4290,12 +4533,12 @@ const _hoisted_1$c = {
4290
4533
  function _sfc_render$3(_ctx, _cache) {
4291
4534
  return openBlock(), createElementBlock("svg", _hoisted_1$c, _cache[0] || (_cache[0] = [
4292
4535
  createElementVNode("path", {
4293
- d: "M11.055 8.5C11.579 9.036 11.87 9.757 11.866 10.507C11.8673 10.9659 11.7676 11.4195 11.574 11.8357C11.3805 12.2518 11.0978 12.6203 10.746 12.915C9.948 13.597 8.748 14 7.096 14C5.39 14 3.992 13.393 3.194 12.623C3.06263 12.4823 2.99028 12.2966 2.99188 12.1041C2.99349 11.9117 3.06893 11.7272 3.20264 11.5887C3.33634 11.4503 3.5181 11.3684 3.7104 11.3601C3.90269 11.3518 4.09084 11.4176 4.236 11.544C4.716 12.007 5.723 12.5 7.096 12.5C8.518 12.5 9.328 12.154 9.772 11.774C10.207 11.402 10.366 10.935 10.366 10.507C10.366 10.035 10.158 9.65 9.719 9.31C9.271 8.964 8.603 8.687 7.768 8.5H1.75C1.55109 8.5 1.36032 8.42098 1.21967 8.28033C1.07902 8.13968 1 7.94891 1 7.75C1 7.55109 1.07902 7.36032 1.21967 7.21967C1.36032 7.07902 1.55109 7 1.75 7H14.25C14.4489 7 14.6397 7.07902 14.7803 7.21967C14.921 7.36032 15 7.55109 15 7.75C15 7.94891 14.921 8.13968 14.7803 8.28033C14.6397 8.42098 14.4489 8.5 14.25 8.5H11.055ZM7.581 3.25C5.545 3.25 4.803 4.332 4.803 5.036C4.803 5.09067 4.805 5.143 4.809 5.193C4.82412 5.39138 4.75981 5.58764 4.63022 5.73861C4.50063 5.88958 4.31638 5.98288 4.118 5.998C3.91962 6.01312 3.72336 5.94881 3.57239 5.81922C3.42142 5.68963 3.32812 5.50538 3.313 5.307C3.3066 5.21681 3.30327 5.12642 3.303 5.036C3.303 3.204 5.053 1.75 7.581 1.75C8.999 1.75 10.302 2.33 11.095 2.843C11.1777 2.89645 11.2491 2.96567 11.3051 3.04671C11.3611 3.12775 11.4006 3.21902 11.4213 3.31532C11.442 3.41161 11.4435 3.51104 11.4258 3.60793C11.4081 3.70482 11.3714 3.79727 11.318 3.88C11.2646 3.96273 11.1953 4.03413 11.1143 4.09011C11.0333 4.14609 10.942 4.18556 10.8457 4.20627C10.7494 4.22698 10.65 4.22852 10.5531 4.2108C10.4562 4.19308 10.3637 4.15645 10.281 4.103C9.641 3.689 8.619 3.25 7.581 3.25Z",
4536
+ d: "M14.8574 13.3334V2.66669C14.8574 1.8286 14.1716 1.14288 13.3335 1.14288H2.66688C1.82878 1.14288 1.14307 1.8286 1.14307 2.66669V13.3334C1.14307 14.1715 1.82878 14.8572 2.66688 14.8572H13.3335C14.1716 14.8572 14.8574 14.1715 14.8574 13.3334ZM5.33354 9.14288L7.2383 11.4362L9.90497 8.00003L13.3335 12.5715H2.66688L5.33354 9.14288Z",
4294
4537
  fill: "currentColor"
4295
4538
  }, null, -1)
4296
4539
  ]));
4297
4540
  }
4298
- const TextStrikethroughIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$3]]);
4541
+ const ImageSolidIcon = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$3]]);
4299
4542
  const _sfc_main$f = {};
4300
4543
  const _hoisted_1$b = {
4301
4544
  width: "16",
@@ -4307,33 +4550,34 @@ const _hoisted_1$b = {
4307
4550
  function _sfc_render$2(_ctx, _cache) {
4308
4551
  return openBlock(), createElementBlock("svg", _hoisted_1$b, _cache[0] || (_cache[0] = [
4309
4552
  createElementVNode("path", {
4310
- d: "M14.8574 13.3334V2.66669C14.8574 1.8286 14.1716 1.14288 13.3335 1.14288H2.66688C1.82878 1.14288 1.14307 1.8286 1.14307 2.66669V13.3334C1.14307 14.1715 1.82878 14.8572 2.66688 14.8572H13.3335C14.1716 14.8572 14.8574 14.1715 14.8574 13.3334ZM5.33354 9.14288L7.2383 11.4362L9.90497 8.00003L13.3335 12.5715H2.66688L5.33354 9.14288Z",
4553
+ d: "M10.189 2.04806C10.605 2.19806 10.8186 2.65181 10.6674 3.06281L6.83704 13.4788C6.68504 13.8898 6.22664 14.1013 5.81144 13.9521C5.39544 13.8021 5.18184 13.3483 5.33304 12.9373L9.16344 2.52131C9.31544 2.11031 9.77384 1.89881 10.189 2.04806ZM1.93144 8.19206L4.76024 10.9926C5.07224 11.3016 5.07224 11.8026 4.76024 12.1116C4.68811 12.1847 4.60063 12.243 4.50329 12.2829C4.40596 12.3228 4.30087 12.3434 4.19464 12.3434C4.08841 12.3434 3.98332 12.3228 3.88599 12.2829C3.78865 12.243 3.70117 12.1847 3.62904 12.1116L0.234639 8.75231C0.084409 8.59988 0.000976562 8.39997 0.000976562 8.19244C0.000976562 7.9849 0.084409 7.78499 0.234639 7.63256L3.62904 4.27256C3.70117 4.19944 3.78865 4.1411 3.88599 4.1012C3.98332 4.0613 4.08841 4.0407 4.19464 4.0407C4.30087 4.0407 4.40596 4.0613 4.50329 4.1012C4.60063 4.1411 4.68811 4.19944 4.76024 4.27256C4.9107 4.42503 4.99427 4.6251 4.99427 4.83281C4.99427 5.04052 4.9107 5.24059 4.76024 5.39306L1.93144 8.19206ZM14.069 8.19206L11.2402 5.39306C11.09 5.24063 11.0066 5.04072 11.0066 4.83319C11.0066 4.62565 11.09 4.42574 11.2402 4.27331C11.3124 4.20019 11.3998 4.14185 11.4972 4.10195C11.5945 4.06205 11.6996 4.04145 11.8058 4.04145C11.9121 4.04145 12.0172 4.06205 12.1145 4.10195C12.2118 4.14185 12.2993 4.20019 12.3714 4.27331L15.7658 7.63256C16.0778 7.94156 16.0778 8.44256 15.7658 8.75231L12.3714 12.1108C12.2993 12.1839 12.2118 12.2423 12.1145 12.2822C12.0172 12.3221 11.9121 12.3427 11.8058 12.3427C11.6996 12.3427 11.5945 12.3221 11.4972 12.2822C11.3998 12.2423 11.3124 12.1839 11.2402 12.1108C11.0902 11.9584 11.0069 11.7587 11.0069 11.5513C11.0069 11.344 11.0902 11.1442 11.2402 10.9918L14.069 8.19206Z",
4311
4554
  fill: "currentColor"
4312
4555
  }, null, -1)
4313
4556
  ]));
4314
4557
  }
4315
- const ImageSolidIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$2]]);
4558
+ const CodeIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$2]]);
4316
4559
  const _sfc_main$e = {};
4317
4560
  const _hoisted_1$a = {
4318
- width: "16",
4319
- height: "16",
4320
- viewBox: "0 0 16 16",
4561
+ width: "24",
4562
+ height: "24",
4563
+ viewBox: "0 0 24 24",
4321
4564
  fill: "none",
4322
4565
  xmlns: "http://www.w3.org/2000/svg"
4323
4566
  };
4324
4567
  function _sfc_render$1(_ctx, _cache) {
4325
4568
  return openBlock(), createElementBlock("svg", _hoisted_1$a, _cache[0] || (_cache[0] = [
4326
4569
  createElementVNode("path", {
4327
- d: "M10.189 2.04806C10.605 2.19806 10.8186 2.65181 10.6674 3.06281L6.83704 13.4788C6.68504 13.8898 6.22664 14.1013 5.81144 13.9521C5.39544 13.8021 5.18184 13.3483 5.33304 12.9373L9.16344 2.52131C9.31544 2.11031 9.77384 1.89881 10.189 2.04806ZM1.93144 8.19206L4.76024 10.9926C5.07224 11.3016 5.07224 11.8026 4.76024 12.1116C4.68811 12.1847 4.60063 12.243 4.50329 12.2829C4.40596 12.3228 4.30087 12.3434 4.19464 12.3434C4.08841 12.3434 3.98332 12.3228 3.88599 12.2829C3.78865 12.243 3.70117 12.1847 3.62904 12.1116L0.234639 8.75231C0.084409 8.59988 0.000976562 8.39997 0.000976562 8.19244C0.000976562 7.9849 0.084409 7.78499 0.234639 7.63256L3.62904 4.27256C3.70117 4.19944 3.78865 4.1411 3.88599 4.1012C3.98332 4.0613 4.08841 4.0407 4.19464 4.0407C4.30087 4.0407 4.40596 4.0613 4.50329 4.1012C4.60063 4.1411 4.68811 4.19944 4.76024 4.27256C4.9107 4.42503 4.99427 4.6251 4.99427 4.83281C4.99427 5.04052 4.9107 5.24059 4.76024 5.39306L1.93144 8.19206ZM14.069 8.19206L11.2402 5.39306C11.09 5.24063 11.0066 5.04072 11.0066 4.83319C11.0066 4.62565 11.09 4.42574 11.2402 4.27331C11.3124 4.20019 11.3998 4.14185 11.4972 4.10195C11.5945 4.06205 11.6996 4.04145 11.8058 4.04145C11.9121 4.04145 12.0172 4.06205 12.1145 4.10195C12.2118 4.14185 12.2993 4.20019 12.3714 4.27331L15.7658 7.63256C16.0778 7.94156 16.0778 8.44256 15.7658 8.75231L12.3714 12.1108C12.2993 12.1839 12.2118 12.2423 12.1145 12.2822C12.0172 12.3221 11.9121 12.3427 11.8058 12.3427C11.6996 12.3427 11.5945 12.3221 11.4972 12.2822C11.3998 12.2423 11.3124 12.1839 11.2402 12.1108C11.0902 11.9584 11.0069 11.7587 11.0069 11.5513C11.0069 11.344 11.0902 11.1442 11.2402 10.9918L14.069 8.19206Z",
4570
+ d: "M11 17H7C5.61667 17 4.43767 16.5123 3.463 15.537C2.48833 14.5617 2.00067 13.3827 2 12C1.99933 10.6173 2.487 9.43833 3.463 8.463C4.439 7.48767 5.618 7 7 7H11V9H7C6.16667 9 5.45833 9.29167 4.875 9.875C4.29167 10.4583 4 11.1667 4 12C4 12.8333 4.29167 13.5417 4.875 14.125C5.45833 14.7083 6.16667 15 7 15H11V17ZM8 13V11H16V13H8ZM13 17V15H17C17.8333 15 18.5417 14.7083 19.125 14.125C19.7083 13.5417 20 12.8333 20 12C20 11.1667 19.7083 10.4583 19.125 9.875C18.5417 9.29167 17.8333 9 17 9H13V7H17C18.3833 7 19.5627 7.48767 20.538 8.463C21.5133 9.43833 22.0007 10.6173 22 12C21.9993 13.3827 21.5117 14.562 20.537 15.538C19.5623 16.514 18.3833 17.0013 17 17H13Z",
4328
4571
  fill: "currentColor"
4329
4572
  }, null, -1)
4330
4573
  ]));
4331
4574
  }
4332
- const CodeIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$1]]);
4575
+ const LinkIcon = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$1]]);
4333
4576
  const _hoisted_1$9 = { class: "rich-text-editor__controls" };
4334
4577
  const _hoisted_2$3 = { class: "rich-text-editor__actions-group" };
4335
4578
  const _hoisted_3$1 = ["onClick"];
4336
4579
  const _hoisted_4 = { class: "rich-text-editor__actions-group" };
4580
+ const _hoisted_5 = { class: "rich-text-editor__actions-group" };
4337
4581
  const _sfc_main$d = /* @__PURE__ */ defineComponent({
4338
4582
  __name: "RichTextEditorDialog",
4339
4583
  props: /* @__PURE__ */ mergeModels({
@@ -4371,11 +4615,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4371
4615
  break;
4372
4616
  }
4373
4617
  }
4374
- return type;
4618
+ return type ?? "default";
4375
4619
  },
4376
4620
  set(type) {
4377
4621
  if (!model.value || !textEditorRef.value) return;
4378
- console.log(textEditorRef.value);
4379
4622
  for (let block of textEditorRef.value.getCurrentBlocks()) {
4380
4623
  if (type === "default") {
4381
4624
  delete block.type;
@@ -4401,8 +4644,68 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4401
4644
  { icon: TextStrikethroughIcon, active: currentStyles.has("strikethrough"), onClick: () => textEditor.toggleStyle("strikethrough") }
4402
4645
  ];
4403
4646
  });
4647
+ const canInsertLink = computed(() => {
4648
+ if (!textEditorRef.value) return false;
4649
+ return !textEditorRef.value.isCollapsed && textEditorRef.value.selection.anchor.blockId === textEditorRef.value.selection.focus.blockId;
4650
+ });
4651
+ const linkPopoverPosition = shallowRef({ x: 0, y: 0 });
4652
+ const cachedSelection = shallowRef(null);
4653
+ const linkPopoverState = shallowRef(null);
4654
+ const el = getCurrentInstance();
4655
+ let lastSelection;
4656
+ const insertLink = () => {
4657
+ var _a, _b;
4658
+ const currentLink = textEditorRef.value.currentStyles.get("link");
4659
+ if (!currentLink && !canInsertLink.value) return;
4660
+ const selection = window.getSelection();
4661
+ let range = selection == null ? void 0 : selection.getRangeAt(0);
4662
+ if (!selection || !range) return;
4663
+ lastSelection = JSON.parse(JSON.stringify(textEditorRef.value.selection));
4664
+ if (currentLink && range && ((_a = textEditorRef.value) == null ? void 0 : _a.isCollapsed)) {
4665
+ const newRange = document.createRange();
4666
+ newRange.selectNodeContents(range.startContainer.parentElement);
4667
+ selection.removeAllRanges();
4668
+ selection.addRange(newRange);
4669
+ lastSelection.anchor.offset -= range.startOffset;
4670
+ lastSelection.focus.offset += range.startContainer.textContent.length - range.endOffset;
4671
+ }
4672
+ const rect = (_b = selection == null ? void 0 : selection.getRangeAt(0)) == null ? void 0 : _b.getBoundingClientRect();
4673
+ if (!rect) return;
4674
+ linkPopoverPosition.value = { x: rect.left, y: rect.bottom };
4675
+ linkPopoverState.value = (currentLink == null ? void 0 : currentLink.meta) ? { ...currentLink.meta } : { url: "" };
4676
+ const container = el.vnode.el;
4677
+ const containerRect = container.getBoundingClientRect();
4678
+ cachedSelection.value = {
4679
+ top: rect.top - containerRect.top + container.scrollTop + "px",
4680
+ left: rect.left - containerRect.left + "px",
4681
+ width: rect.width + "px",
4682
+ height: rect.height + "px"
4683
+ };
4684
+ };
4685
+ const onUpdateLinkPopoverOpen = (val) => {
4686
+ if (val === false) {
4687
+ linkPopoverState.value = null;
4688
+ cachedSelection.value = null;
4689
+ el.vnode.el.querySelector(".text-editor").focus();
4690
+ setTimeout(() => {
4691
+ Object.assign(textEditorRef.value.selection, lastSelection);
4692
+ }, 0);
4693
+ }
4694
+ };
4695
+ const onLinkApply = () => {
4696
+ var _a, _b;
4697
+ const state = linkPopoverState.value;
4698
+ linkPopoverState.value = null;
4699
+ Object.assign(textEditorRef.value.selection, lastSelection);
4700
+ if (!state || state.url === "") {
4701
+ (_a = textEditorRef.value) == null ? void 0 : _a.removeStyle("link");
4702
+ } else {
4703
+ (_b = textEditorRef.value) == null ? void 0 : _b.applyStyle("link", state);
4704
+ }
4705
+ onUpdateLinkPopoverOpen(false);
4706
+ };
4404
4707
  const onKeyDown = (e) => {
4405
- var _a, _b, _c, _d, _e, _f, _g;
4708
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4406
4709
  if ((e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey) {
4407
4710
  if (e.code === "KeyB") {
4408
4711
  (_a = textEditorRef.value) == null ? void 0 : _a.toggleStyle("bold");
@@ -4413,18 +4716,32 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4413
4716
  if (e.code === "KeyU") {
4414
4717
  (_c = textEditorRef.value) == null ? void 0 : _c.toggleStyle("underline");
4415
4718
  }
4719
+ if (e.code === "KeyK") {
4720
+ e.preventDefault();
4721
+ if ((_d = textEditorRef.value) == null ? void 0 : _d.currentStyles.has("link")) {
4722
+ textEditorRef.value.removeStyle("link");
4723
+ } else {
4724
+ insertLink();
4725
+ }
4726
+ }
4416
4727
  }
4417
- if (e.key === "Enter" && !e.shiftKey && ((_e = (_d = textEditorRef.value) == null ? void 0 : _d.currentBlock) == null ? void 0 : _e.type) === "li") {
4728
+ if (e.key === "Enter" && !e.shiftKey && ((_f = (_e = textEditorRef.value) == null ? void 0 : _e.currentBlock) == null ? void 0 : _f.type) === "li") {
4418
4729
  e.preventDefault();
4419
4730
  textEditorRef.value.addNewLine();
4420
4731
  textEditorRef.value.currentBlock.type = "li";
4421
4732
  textEditorRef.value.pushHistory("setText");
4422
4733
  }
4423
- if (((_g = (_f = textEditorRef.value) == null ? void 0 : _f.currentBlock) == null ? void 0 : _g.editable) === false && textEditorRef.value.currentBlock.type !== "code" && (e.code === "Backspace" || e.code === "Delete")) {
4734
+ if (((_h = (_g = textEditorRef.value) == null ? void 0 : _g.currentBlock) == null ? void 0 : _h.editable) === false && textEditorRef.value.currentBlock.type !== "code" && (e.code === "Backspace" || e.code === "Delete")) {
4424
4735
  textEditorRef.value.removeCurrentBlock();
4425
4736
  e.preventDefault();
4426
4737
  }
4427
4738
  };
4739
+ const htmlParser = (el2) => {
4740
+ if (el2.tagName === "LI") return "li";
4741
+ if (el2.tagName === "H1") return "h1";
4742
+ if (el2.tagName === "H2") return "h2";
4743
+ if (el2.tagName === "H3") return "h3";
4744
+ };
4428
4745
  const insertCodeBlock = () => {
4429
4746
  var _a;
4430
4747
  (_a = textEditorRef.value) == null ? void 0 : _a.insertBlock({ type: "code", editable: false, text: "" });
@@ -4434,90 +4751,124 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
4434
4751
  (_a = textEditorRef.value) == null ? void 0 : _a.insertBlock({ type: "image", editable: false, text: "" });
4435
4752
  };
4436
4753
  return (_ctx, _cache) => {
4437
- return openBlock(), createBlock(_sfc_main$r, { class: "rich-text-editor__dialog" }, {
4754
+ return openBlock(), createBlock(_sfc_main$t, { class: "rich-text-editor__dialog" }, {
4438
4755
  header: withCtx(() => [
4439
4756
  createTextVNode(toDisplayString(props.label ?? "Редактирование текста"), 1)
4440
4757
  ]),
4441
- default: withCtx(() => [
4442
- createElementVNode("div", _hoisted_1$9, [
4443
- createVNode(_sfc_main$y, {
4444
- modelValue: blockType.value,
4445
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => blockType.value = $event),
4446
- items: blockTypes,
4447
- style: { "width": "200px" }
4448
- }, null, 8, ["modelValue"]),
4449
- createElementVNode("div", _hoisted_2$3, [
4450
- (openBlock(true), createElementBlock(Fragment, null, renderList(styles.value, (item) => {
4451
- return openBlock(), createElementBlock("button", {
4452
- class: normalizeClass({ active: item.active }),
4453
- onClick: item.onClick
4758
+ default: withCtx(() => {
4759
+ var _a;
4760
+ return [
4761
+ createElementVNode("div", _hoisted_1$9, [
4762
+ createVNode(_sfc_main$A, {
4763
+ modelValue: blockType.value,
4764
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => blockType.value = $event),
4765
+ items: blockTypes,
4766
+ style: { "width": "200px" }
4767
+ }, null, 8, ["modelValue"]),
4768
+ createElementVNode("div", _hoisted_2$3, [
4769
+ (openBlock(true), createElementBlock(Fragment, null, renderList(styles.value, (item) => {
4770
+ return openBlock(), createElementBlock("button", {
4771
+ class: normalizeClass({ active: item.active }),
4772
+ onClick: item.onClick
4773
+ }, [
4774
+ (openBlock(), createBlock(resolveDynamicComponent(item.icon)))
4775
+ ], 10, _hoisted_3$1);
4776
+ }), 256))
4777
+ ]),
4778
+ createElementVNode("div", _hoisted_4, [
4779
+ createElementVNode("button", {
4780
+ class: normalizeClass({ active: (_a = textEditorRef.value) == null ? void 0 : _a.currentStyles.has("link") }),
4781
+ onClick: insertLink
4454
4782
  }, [
4455
- (openBlock(), createBlock(resolveDynamicComponent(item.icon)))
4456
- ], 10, _hoisted_3$1);
4457
- }), 256))
4458
- ]),
4459
- createElementVNode("div", _hoisted_4, [
4460
- createElementVNode("button", {
4461
- title: "Вставить изображение",
4462
- onClick: insertImage
4463
- }, [
4464
- createVNode(ImageSolidIcon)
4783
+ createVNode(LinkIcon)
4784
+ ], 2)
4465
4785
  ]),
4466
- createElementVNode("button", {
4467
- title: "Вставить элемент кода",
4468
- onClick: insertCodeBlock
4469
- }, [
4470
- createVNode(CodeIcon)
4786
+ createElementVNode("div", _hoisted_5, [
4787
+ createElementVNode("button", {
4788
+ title: "Вставить изображение",
4789
+ onClick: insertImage
4790
+ }, [
4791
+ createVNode(ImageSolidIcon)
4792
+ ]),
4793
+ createElementVNode("button", {
4794
+ title: "Вставить элемент кода",
4795
+ onClick: insertCodeBlock
4796
+ }, [
4797
+ createVNode(CodeIcon)
4798
+ ])
4471
4799
  ])
4472
- ])
4473
- ]),
4474
- createVNode(unref(_sfc_main$1$1), {
4475
- ref_key: "textEditorRef",
4476
- ref: textEditorRef,
4477
- modelValue: model.value,
4478
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => model.value = $event),
4479
- class: "text-editor",
4480
- renderer: unref(defaultRenderer),
4481
- decorator: unref(defaultDecorator),
4482
- onKeydown: onKeyDown
4483
- }, {
4484
- code: withCtx(({ props: props2, block }) => [
4485
- createVNode(_sfc_main$k, mergeProps({
4486
- modelValue: block.text,
4487
- "onUpdate:modelValue": ($event) => block.text = $event
4488
- }, props2, {
4489
- onNewblock: _cache[1] || (_cache[1] = ($event) => {
4490
- var _a;
4491
- return (_a = textEditorRef.value) == null ? void 0 : _a.addNewLine();
4492
- }),
4493
- onRemove: _cache[2] || (_cache[2] = ($event) => {
4494
- var _a;
4495
- return (_a = textEditorRef.value) == null ? void 0 : _a.removeCurrentBlock();
4496
- })
4497
- }), null, 16, ["modelValue", "onUpdate:modelValue"])
4498
4800
  ]),
4499
- image: withCtx(({ props: props2, block }) => {
4500
- var _a;
4501
- return [
4502
- createVNode(_sfc_main$p, mergeProps({
4503
- modelValue: block.image,
4504
- "onUpdate:modelValue": ($event) => block.image = $event
4801
+ createVNode(unref(_sfc_main$1$1), {
4802
+ ref_key: "textEditorRef",
4803
+ ref: textEditorRef,
4804
+ modelValue: model.value,
4805
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => model.value = $event),
4806
+ class: "text-editor",
4807
+ renderer: unref(defaultRenderer),
4808
+ decorator: unref(defaultDecorator),
4809
+ onKeydown: onKeyDown,
4810
+ "html-parser": htmlParser
4811
+ }, {
4812
+ code: withCtx(({ props: props2, block }) => [
4813
+ createVNode(_sfc_main$m, mergeProps({
4814
+ modelValue: block.text,
4815
+ "onUpdate:modelValue": ($event) => block.text = $event
4505
4816
  }, props2, {
4506
- class: { selected: ((_a = textEditorRef.value) == null ? void 0 : _a.selection.focus.blockId) === block.id },
4507
- contenteditable: "false",
4508
- onKeydown: onKeyDown
4509
- }), null, 16, ["modelValue", "onUpdate:modelValue", "class"])
4510
- ];
4511
- }),
4512
- placeholder: withCtx(() => _cache[4] || (_cache[4] = [
4513
- createElementVNode("div", {
4514
- class: "rich-text-editor__placeholder",
4515
- contenteditable: false
4516
- }, "Введите текст...", -1)
4517
- ])),
4518
- _: 1
4519
- }, 8, ["modelValue", "renderer", "decorator"])
4520
- ]),
4817
+ onNewblock: _cache[1] || (_cache[1] = ($event) => {
4818
+ var _a2;
4819
+ return (_a2 = textEditorRef.value) == null ? void 0 : _a2.addNewLine();
4820
+ }),
4821
+ onRemove: _cache[2] || (_cache[2] = ($event) => {
4822
+ var _a2;
4823
+ return (_a2 = textEditorRef.value) == null ? void 0 : _a2.removeCurrentBlock();
4824
+ })
4825
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])
4826
+ ]),
4827
+ image: withCtx(({ props: props2, block }) => {
4828
+ var _a2;
4829
+ return [
4830
+ createVNode(_sfc_main$r, mergeProps({
4831
+ modelValue: block.image,
4832
+ "onUpdate:modelValue": ($event) => block.image = $event
4833
+ }, props2, {
4834
+ class: { selected: ((_a2 = textEditorRef.value) == null ? void 0 : _a2.selection.focus.blockId) === block.id },
4835
+ contenteditable: "false",
4836
+ onKeydown: onKeyDown
4837
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "class"])
4838
+ ];
4839
+ }),
4840
+ placeholder: withCtx(() => _cache[4] || (_cache[4] = [
4841
+ createElementVNode("div", {
4842
+ class: "rich-text-editor__placeholder",
4843
+ contenteditable: false
4844
+ }, "Введите текст...", -1)
4845
+ ])),
4846
+ _: 1
4847
+ }, 8, ["modelValue", "renderer", "decorator"]),
4848
+ createVNode(_sfc_main$E, {
4849
+ class: "rich-text-editor-link-popover scroll",
4850
+ open: linkPopoverState.value != null,
4851
+ placement: "bottom-start",
4852
+ "anchor-position": linkPopoverPosition.value,
4853
+ offset: 4,
4854
+ "onUpdate:open": onUpdateLinkPopoverOpen
4855
+ }, {
4856
+ default: withCtx(() => [
4857
+ linkPopoverState.value !== null ? (openBlock(), createBlock(_sfc_main$l, {
4858
+ key: 0,
4859
+ state: linkPopoverState.value,
4860
+ onApply: onLinkApply
4861
+ }, null, 8, ["state"])) : createCommentVNode("", true)
4862
+ ]),
4863
+ _: 1
4864
+ }, 8, ["open", "anchor-position"]),
4865
+ cachedSelection.value ? (openBlock(), createElementBlock("div", {
4866
+ key: 0,
4867
+ style: normalizeStyle(cachedSelection.value),
4868
+ class: "rich-text-editor__cached-selection"
4869
+ }, null, 4)) : createCommentVNode("", true)
4870
+ ];
4871
+ }),
4521
4872
  _: 1
4522
4873
  });
4523
4874
  };
@@ -4545,7 +4896,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4545
4896
  });
4546
4897
  };
4547
4898
  return (_ctx, _cache) => {
4548
- return openBlock(), createBlock(_sfc_main$J, {
4899
+ return openBlock(), createBlock(_sfc_main$L, {
4549
4900
  label: props.label,
4550
4901
  class: "rich-text-editor"
4551
4902
  }, {
@@ -4557,7 +4908,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
4557
4908
  class: "rich-text-editor__editor"
4558
4909
  }, null, 8, ["modelValue"])
4559
4910
  ]),
4560
- createVNode(_sfc_main$u, { onClick: openTextEditor }, {
4911
+ createVNode(_sfc_main$w, { onClick: openTextEditor }, {
4561
4912
  default: withCtx(() => _cache[1] || (_cache[1] = [
4562
4913
  createTextVNode("Редактировать")
4563
4914
  ])),
@@ -4616,13 +4967,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4616
4967
  watch(vModel, () => emit("edit"));
4617
4968
  return (_ctx, _cache) => {
4618
4969
  const _component_JsonEditor = resolveComponent("JsonEditor", true);
4619
- return props.schema.type === "object" && props.schema.format === "image" ? (openBlock(), createBlock(_sfc_main$p, {
4970
+ return props.schema.type === "object" && props.schema.format === "image" ? (openBlock(), createBlock(_sfc_main$r, {
4620
4971
  key: 0,
4621
4972
  modelValue: vModel.value,
4622
4973
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vModel.value = $event),
4623
4974
  label: props.schema.name ?? props.name,
4624
4975
  schema: props.schema
4625
- }, null, 8, ["modelValue", "label", "schema"])) : props.schema.type === "object" && props.schema.format === "smartLink" ? (openBlock(), createBlock(_sfc_main$l, {
4976
+ }, null, 8, ["modelValue", "label", "schema"])) : props.schema.type === "object" && props.schema.format === "smartLink" ? (openBlock(), createBlock(_sfc_main$n, {
4626
4977
  key: 1,
4627
4978
  modelValue: vModel.value,
4628
4979
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vModel.value = $event),
@@ -4648,7 +4999,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4648
4999
  nullable: !((_a = props.schema.required) == null ? void 0 : _a.includes(key)),
4649
5000
  onEdit: ($event) => emit("edit", join(key, $event))
4650
5001
  }, null, 8, ["modelValue", "onUpdate:modelValue", "schema", "expanded", "name", "nullable", "onEdit"]);
4651
- }), 128)) : (openBlock(), createBlock(_sfc_main$D, {
5002
+ }), 128)) : (openBlock(), createBlock(_sfc_main$F, {
4652
5003
  key: 1,
4653
5004
  label: props.schema.name ?? props.name,
4654
5005
  open: props.expanded
@@ -4670,7 +5021,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4670
5021
  ]),
4671
5022
  _: 1
4672
5023
  }, 8, ["label", "open"]))
4673
- ])) : props.schema.type === "array" ? (openBlock(), createBlock(_sfc_main$x, {
5024
+ ])) : props.schema.type === "array" ? (openBlock(), createBlock(_sfc_main$z, {
4674
5025
  key: 4,
4675
5026
  modelValue: vModel.value,
4676
5027
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vModel.value = $event),
@@ -4678,19 +5029,19 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
4678
5029
  label: props.schema.name ?? props.name,
4679
5030
  expanded: props.expanded,
4680
5031
  onEdit: _cache[4] || (_cache[4] = ($event) => emit("edit", $event))
4681
- }, null, 8, ["modelValue", "schema", "label", "expanded"])) : props.schema.type === "string" && props.schema.enum ? (openBlock(), createBlock(_sfc_main$y, {
5032
+ }, null, 8, ["modelValue", "schema", "label", "expanded"])) : props.schema.type === "string" && props.schema.enum ? (openBlock(), createBlock(_sfc_main$A, {
4682
5033
  key: 5,
4683
5034
  nullable: props.schema.nullable || props.nullable,
4684
5035
  items: getItems(props.schema),
4685
5036
  modelValue: vModel.value,
4686
5037
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vModel.value = $event),
4687
5038
  label: props.schema.name ?? props.name
4688
- }, null, 8, ["nullable", "items", "modelValue", "label"])) : props.schema.type === "boolean" ? (openBlock(), createBlock(_sfc_main$n, {
5039
+ }, null, 8, ["nullable", "items", "modelValue", "label"])) : props.schema.type === "boolean" ? (openBlock(), createBlock(_sfc_main$p, {
4689
5040
  key: 6,
4690
5041
  modelValue: vModel.value,
4691
5042
  "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vModel.value = $event),
4692
5043
  label: props.schema.name ?? props.name
4693
- }, null, 8, ["modelValue", "label"])) : (openBlock(), createBlock(_sfc_main$I, {
5044
+ }, null, 8, ["modelValue", "label"])) : (openBlock(), createBlock(_sfc_main$K, {
4694
5045
  key: 7,
4695
5046
  modelValue: vModel.value,
4696
5047
  "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => vModel.value = $event),
@@ -4772,14 +5123,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4772
5123
  }, ["stop"]))
4773
5124
  }, [
4774
5125
  renderSlot(_ctx.$slots, "default"),
4775
- createVNode(_sfc_main$G, {
5126
+ createVNode(_sfc_main$I, {
4776
5127
  modelValue: currentTab.value,
4777
5128
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentTab.value = $event),
4778
5129
  items: tabs.value
4779
5130
  }, null, 8, ["modelValue", "items"]),
4780
- createVNode(_sfc_main$F, { page: currentTab.value }, {
5131
+ createVNode(_sfc_main$H, { page: currentTab.value }, {
4781
5132
  blocks: withCtx(() => [
4782
- createVNode(_sfc_main$H, { blocks: _ctx.blocksList }, null, 8, ["blocks"])
5133
+ createVNode(_sfc_main$J, { blocks: _ctx.blocksList }, null, 8, ["blocks"])
4783
5134
  ]),
4784
5135
  blockEdit: withCtx(() => [
4785
5136
  currentBlock.value && currentContentBlock.value ? (openBlock(), createBlock(_sfc_main$b, {
@@ -4789,7 +5140,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4789
5140
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentContentBlock.value.data = $event),
4790
5141
  flat: ""
4791
5142
  }, null, 8, ["schema", "modelValue"])) : currentDataEntry.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
4792
- props.dataEntryScopes ? (openBlock(), createBlock(_sfc_main$y, {
5143
+ props.dataEntryScopes ? (openBlock(), createBlock(_sfc_main$A, {
4793
5144
  key: 0,
4794
5145
  modelValue: props.dataEntryScopes[currentDataEntry.value.id],
4795
5146
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => props.dataEntryScopes[currentDataEntry.value.id] = $event),
@@ -5057,7 +5408,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5057
5408
  onBlockdrop: ($event) => onPlaceBlockDrop($event, item.index)
5058
5409
  }, null, 44, _hoisted_2$2);
5059
5410
  }), 256)),
5060
- createVNode(_sfc_main$t, normalizeProps(guardReactiveProps(unref(contextMenu).props)), null, 16)
5411
+ createVNode(_sfc_main$v, normalizeProps(guardReactiveProps(unref(contextMenu).props)), null, 16)
5061
5412
  ], 512);
5062
5413
  };
5063
5414
  }
@@ -5300,12 +5651,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5300
5651
  dialog.close();
5301
5652
  });
5302
5653
  return (_ctx, _cache) => {
5303
- return openBlock(), createBlock(_sfc_main$r, { style: { "width": "500px" } }, {
5654
+ return openBlock(), createBlock(_sfc_main$t, { style: { "width": "500px" } }, {
5304
5655
  header: withCtx(() => [
5305
5656
  createTextVNode(toDisplayString(props.item ? "Редактировать" : "Создать") + " страницу", 1)
5306
5657
  ]),
5307
5658
  actions: withCtx(() => [
5308
- createVNode(_sfc_main$u, {
5659
+ createVNode(_sfc_main$w, {
5309
5660
  disabled: unref(pending),
5310
5661
  large: "",
5311
5662
  onClick: unref(apply)
@@ -5321,15 +5672,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5321
5672
  default: withCtx(() => {
5322
5673
  var _a;
5323
5674
  return [
5324
- createVNode(_sfc_main$I, mergeProps(unref(register)("name"), {
5675
+ createVNode(_sfc_main$K, mergeProps(unref(register)("name"), {
5325
5676
  label: "Название страницы",
5326
5677
  autofocus: ""
5327
5678
  }), null, 16),
5328
- createVNode(_sfc_main$I, mergeProps(unref(register)("path"), {
5679
+ createVNode(_sfc_main$K, mergeProps(unref(register)("path"), {
5329
5680
  prefix: (_a = currentFoler.value) == null ? void 0 : _a.path,
5330
5681
  label: "URL адрес"
5331
5682
  }), null, 16, ["prefix"]),
5332
- folders.value.length > 0 ? (openBlock(), createBlock(_sfc_main$y, mergeProps({
5683
+ folders.value.length > 0 ? (openBlock(), createBlock(_sfc_main$A, mergeProps({
5333
5684
  key: 0,
5334
5685
  nullable: ""
5335
5686
  }, unref(register)("folderId"), {
@@ -5431,7 +5782,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
5431
5782
  class: "v-table__check",
5432
5783
  onClick: withModifiers(checkboxClick, ["prevent", "stop"])
5433
5784
  }, [
5434
- createVNode(_sfc_main$n, {
5785
+ createVNode(_sfc_main$p, {
5435
5786
  modelValue: modelValue.value.has(item),
5436
5787
  "onUpdate:modelValue": ($event) => modelValue.value.has(item) ? modelValue.value.delete(item) : modelValue.value.add(item)
5437
5788
  }, null, 8, ["modelValue", "onUpdate:modelValue"])
@@ -5468,7 +5819,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
5468
5819
  path: { title: "Путь" }
5469
5820
  };
5470
5821
  return (_ctx, _cache) => {
5471
- return openBlock(), createBlock(_sfc_main$r, { class: "standart" }, {
5822
+ return openBlock(), createBlock(_sfc_main$t, { class: "standart" }, {
5472
5823
  header: withCtx(() => _cache[0] || (_cache[0] = [
5473
5824
  createTextVNode(" Страницы проекта ")
5474
5825
  ])),
@@ -5523,12 +5874,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
5523
5874
  dialog.close();
5524
5875
  });
5525
5876
  return (_ctx, _cache) => {
5526
- return openBlock(), createBlock(_sfc_main$r, { class: "standart" }, {
5877
+ return openBlock(), createBlock(_sfc_main$t, { class: "standart" }, {
5527
5878
  header: withCtx(() => _cache[1] || (_cache[1] = [
5528
5879
  createTextVNode("Настройки страницы")
5529
5880
  ])),
5530
5881
  actions: withCtx(() => [
5531
- createVNode(_sfc_main$u, {
5882
+ createVNode(_sfc_main$w, {
5532
5883
  large: "",
5533
5884
  onClick: unref(apply)
5534
5885
  }, {
@@ -5540,19 +5891,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
5540
5891
  }, 8, ["onClick"])
5541
5892
  ]),
5542
5893
  default: withCtx(() => [
5543
- createVNode(_sfc_main$G, {
5894
+ createVNode(_sfc_main$I, {
5544
5895
  modelValue: currentTab.value,
5545
5896
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentTab.value = $event),
5546
5897
  items: tabs.value,
5547
5898
  style: { "margin-bottom": "12px" }
5548
5899
  }, null, 8, ["modelValue", "items"]),
5549
- createVNode(_sfc_main$F, { page: currentTab.value }, createSlots({
5900
+ createVNode(_sfc_main$H, { page: currentTab.value }, createSlots({
5550
5901
  _main: withCtx(() => [
5551
5902
  createVNode(_sfc_main$7, null, {
5552
5903
  default: withCtx(() => [
5553
5904
  createElementVNode("div", _hoisted_1$3, [
5554
- createVNode(_sfc_main$I, mergeProps(unref(register)("name"), { label: "Название страницы" }), null, 16),
5555
- createVNode(_sfc_main$I, mergeProps(unref(register)("path"), { label: "Путь к странице" }), null, 16)
5905
+ createVNode(_sfc_main$K, mergeProps(unref(register)("name"), { label: "Название страницы" }), null, 16),
5906
+ createVNode(_sfc_main$K, mergeProps(unref(register)("path"), { label: "Путь к странице" }), null, 16)
5556
5907
  ])
5557
5908
  ]),
5558
5909
  _: 1
@@ -5685,13 +6036,27 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5685
6036
  props.state.currentPage.name = values.name;
5686
6037
  } });
5687
6038
  };
5688
- const menuItems = computed(() => [
5689
- { title: "Настройки страницы", onClick: openPageSettingsDialog },
5690
- { title: "Открыть страницу...", onClick: openPage },
5691
- { title: "Новая страница...", onClick: createNewPage }
5692
- ]);
6039
+ const menuItems = computed(() => {
6040
+ var _a;
6041
+ const arr = [
6042
+ { title: "Настройки страницы", onClick: openPageSettingsDialog },
6043
+ { title: "Открыть страницу...", onClick: openPage },
6044
+ { title: "Новая страница...", onClick: createNewPage }
6045
+ ];
6046
+ if ((_a = window.__mechanicaConfig__) == null ? void 0 : _a.languages) {
6047
+ arr.push({
6048
+ title: "Язык",
6049
+ children: Object.entries(window.__mechanicaConfig__.languages).map((i) => ({
6050
+ title: i[1].title,
6051
+ onClick() {
6052
+ }
6053
+ }))
6054
+ });
6055
+ }
6056
+ return arr;
6057
+ });
5693
6058
  return (_ctx, _cache) => {
5694
- return openBlock(), createBlock(_sfc_main$t, {
6059
+ return openBlock(), createBlock(_sfc_main$v, {
5695
6060
  placement: "bottom",
5696
6061
  fitAnchor: "",
5697
6062
  offset: 4,
@@ -5715,7 +6080,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5715
6080
  };
5716
6081
  }
5717
6082
  });
5718
- registerAliases();
6083
+ registerAliases(registerAlias);
5719
6084
  const blocksList = shallowRef(blocksList$1.map((file) => ({
5720
6085
  ...file.blockSchema,
5721
6086
  id: file.blockSchema.id ?? file.__name,
@@ -5834,16 +6199,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5834
6199
  ]),
5835
6200
  _: 1
5836
6201
  }),
5837
- controlsOpened.value ? (openBlock(), createBlock(_sfc_main$N, {
6202
+ controlsOpened.value ? (openBlock(), createBlock(_sfc_main$P, {
5838
6203
  key: 0,
5839
6204
  element: unref(control).hoverBlockElement.value
5840
6205
  }, null, 8, ["element"])) : createCommentVNode("", true),
5841
- controlsOpened.value ? (openBlock(), createBlock(_sfc_main$N, {
6206
+ controlsOpened.value ? (openBlock(), createBlock(_sfc_main$P, {
5842
6207
  key: 1,
5843
6208
  element: unref(control).activeBlockElement.value,
5844
6209
  resizable: ""
5845
6210
  }, null, 8, ["element"])) : createCommentVNode("", true),
5846
- unref(control).insertedPlace.value ? (openBlock(), createBlock(_sfc_main$M, {
6211
+ unref(control).insertedPlace.value ? (openBlock(), createBlock(_sfc_main$O, {
5847
6212
  key: 2,
5848
6213
  top: unref(control).insertedPlace.value.top
5849
6214
  }, null, 8, ["top"])) : createCommentVNode("", true),
@@ -5898,7 +6263,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5898
6263
  ]),
5899
6264
  _: 1
5900
6265
  }),
5901
- createVNode(_sfc_main$s)
6266
+ createVNode(_sfc_main$u)
5902
6267
  ], 64);
5903
6268
  };
5904
6269
  }