@tmagic/editor 1.2.0-beta.7 → 1.2.0-beta.8

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.
@@ -12,7 +12,7 @@ import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
12
12
  import Gesto from 'gesto';
13
13
  import KeyController from 'keycon';
14
14
 
15
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
15
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
16
16
  __name: "Code",
17
17
  props: {
18
18
  model: null,
@@ -42,7 +42,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
42
42
  }
43
43
  });
44
44
 
45
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
45
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
46
46
  __name: "CodeLink",
47
47
  props: {
48
48
  config: null,
@@ -153,15 +153,15 @@ var CodeSelectOp = /* @__PURE__ */ ((CodeSelectOp2) => {
153
153
  return CodeSelectOp2;
154
154
  })(CodeSelectOp || {});
155
155
 
156
- const _hoisted_1$d = { class: "tool-bar" };
157
- const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("path", {
156
+ const _hoisted_1$e = { class: "tool-bar" };
157
+ const _hoisted_2$6 = /* @__PURE__ */ createElementVNode("path", {
158
158
  fill: "currentColor",
159
159
  d: "m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414L23 12zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414L3.828 12z"
160
160
  }, null, -1);
161
161
  const _hoisted_3$3 = [
162
- _hoisted_2$5
162
+ _hoisted_2$6
163
163
  ];
164
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
164
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
165
165
  __name: "CodeSelect",
166
166
  props: {
167
167
  config: null,
@@ -196,11 +196,19 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
196
196
  });
197
197
  const fieldKey = ref("");
198
198
  const multiple = ref(true);
199
- const combineIds = ref([]);
200
199
  let lastTagSnapshot = cloneDeep(props.model[props.name]) || [];
200
+ let shouldWatch = true;
201
+ watch(
202
+ () => props.model[props.name],
203
+ (selectValue) => {
204
+ if (shouldWatch) {
205
+ lastTagSnapshot = cloneDeep(selectValue) || [];
206
+ }
207
+ }
208
+ );
201
209
  watchEffect(async () => {
202
210
  const combineNames = await Promise.all(
203
- combineIds.value.map(async (id) => {
211
+ props.model[props.name].map(async (id) => {
204
212
  const { name = "" } = await services?.codeBlockService.getCodeContentById(id) || {};
205
213
  return name;
206
214
  })
@@ -208,6 +216,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
208
216
  fieldKey.value = combineNames.join("-");
209
217
  });
210
218
  const changeHandler = async (value) => {
219
+ shouldWatch = false;
211
220
  let codeIds = value;
212
221
  if (typeof value === "string") {
213
222
  multiple.value = false;
@@ -227,20 +236,16 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
227
236
  }
228
237
  await services?.codeBlockService.setCombineRelation(id, diffValues, opFlag, props.prop);
229
238
  lastTagSnapshot = codeIds;
230
- await setCombineIds(codeIds);
231
- };
232
- const setCombineIds = async (codeIds) => {
233
- combineIds.value = codeIds;
234
- await services?.codeBlockService.setCombineIds(codeIds);
239
+ shouldWatch = true;
235
240
  };
236
241
  const viewHandler = async () => {
237
242
  if (props.model[props.name].length === 0) {
238
243
  tMagicMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
239
244
  return;
240
245
  }
241
- await setCombineIds(props.model[props.name]);
246
+ await services?.codeBlockService.setCombineIds(props.model[props.name]);
242
247
  await services?.codeBlockService.setMode(CodeEditorMode.LIST);
243
- services?.codeBlockService.setCodeEditorContent(true, combineIds.value[0]);
248
+ services?.codeBlockService.setCodeEditorContent(true, props.model[props.name][0]);
244
249
  };
245
250
  return (_ctx, _cache) => {
246
251
  const _component_m_fields_select = resolveComponent("m-fields-select");
@@ -260,7 +265,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
260
265
  }, null, 8, ["config", "model", "prop", "name", "size"])
261
266
  ]),
262
267
  default: withCtx(() => [
263
- createElementVNode("div", _hoisted_1$d, [
268
+ createElementVNode("div", _hoisted_1$e, [
264
269
  createVNode(unref(TMagicTooltip), {
265
270
  class: "tool-item",
266
271
  effect: "dark",
@@ -288,8 +293,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
288
293
  }
289
294
  });
290
295
 
291
- const _hoisted_1$c = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
292
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
296
+ const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
297
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
293
298
  __name: "UISelect",
294
299
  props: {
295
300
  config: null,
@@ -352,7 +357,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
352
357
  style: { "padding": "0" }
353
358
  }, {
354
359
  default: withCtx(() => [
355
- _hoisted_1$c
360
+ _hoisted_1$d
356
361
  ]),
357
362
  _: 1
358
363
  }, 8, ["icon"])
@@ -400,7 +405,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
400
405
 
401
406
  const UISelect_vue_vue_type_style_index_0_lang = '';
402
407
 
403
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
408
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
404
409
  __name: "CodeEditor",
405
410
  props: {
406
411
  initValues: null,
@@ -530,8 +535,8 @@ const setConfig = (option) => {
530
535
  };
531
536
  const getConfig = (key) => $TMAGIC_EDITOR[key];
532
537
 
533
- const _hoisted_1$b = ["src"];
534
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
538
+ const _hoisted_1$c = ["src"];
539
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
535
540
  __name: "Icon",
536
541
  props: {
537
542
  icon: null
@@ -551,7 +556,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
551
556
  class: "magic-editor-icon"
552
557
  }, {
553
558
  default: withCtx(() => [
554
- createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$b)
559
+ createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$c)
555
560
  ]),
556
561
  _: 1
557
562
  })) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
@@ -2412,6 +2417,11 @@ const useStage = (stageOptions) => {
2412
2417
  stage.on("sort", (ev) => {
2413
2418
  editorService.sort(ev.src, ev.dist);
2414
2419
  });
2420
+ stage.on("select-parent", () => {
2421
+ const parent = editorService.get("parent");
2422
+ editorService.select(parent);
2423
+ editorService.get("stage").select(parent.id);
2424
+ });
2415
2425
  stage.on("changeGuides", (e) => {
2416
2426
  uiService.set("showGuides", true);
2417
2427
  if (!root.value || !page.value)
@@ -2428,10 +2438,10 @@ const useStage = (stageOptions) => {
2428
2438
  return stage;
2429
2439
  };
2430
2440
 
2431
- const _hoisted_1$a = { class: "m-editor-empty-panel" };
2432
- const _hoisted_2$4 = { class: "m-editor-empty-content" };
2441
+ const _hoisted_1$b = { class: "m-editor-empty-panel" };
2442
+ const _hoisted_2$5 = { class: "m-editor-empty-content" };
2433
2443
  const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
2434
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
2444
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2435
2445
  __name: "AddPageBox",
2436
2446
  setup(__props) {
2437
2447
  const services = inject("services");
@@ -2445,14 +2455,14 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2445
2455
  });
2446
2456
  };
2447
2457
  return (_ctx, _cache) => {
2448
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
2449
- createElementVNode("div", _hoisted_2$4, [
2458
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
2459
+ createElementVNode("div", _hoisted_2$5, [
2450
2460
  createElementVNode("div", {
2451
2461
  class: "m-editor-empty-button",
2452
2462
  onClick: clickHandler
2453
2463
  }, [
2454
2464
  createElementVNode("div", null, [
2455
- createVNode(_sfc_main$n, { icon: unref(Plus) }, null, 8, ["icon"])
2465
+ createVNode(_sfc_main$o, { icon: unref(Plus) }, null, 8, ["icon"])
2456
2466
  ]),
2457
2467
  _hoisted_3$2
2458
2468
  ])
@@ -2462,7 +2472,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2462
2472
  }
2463
2473
  });
2464
2474
 
2465
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2475
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2466
2476
  __name: "Resizer",
2467
2477
  emits: ["change"],
2468
2478
  setup(__props, { emit }) {
@@ -2495,7 +2505,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2495
2505
  }
2496
2506
  });
2497
2507
 
2498
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2508
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2499
2509
  __name: "Layout",
2500
2510
  props: {
2501
2511
  left: null,
@@ -2574,7 +2584,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2574
2584
  }, [
2575
2585
  renderSlot(_ctx.$slots, "left")
2576
2586
  ], 6),
2577
- createVNode(_sfc_main$l, { onChange: changeLeft })
2587
+ createVNode(_sfc_main$m, { onChange: changeLeft })
2578
2588
  ], 64)) : createCommentVNode("", true),
2579
2589
  createElementVNode("div", {
2580
2590
  class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
@@ -2583,7 +2593,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2583
2593
  renderSlot(_ctx.$slots, "center")
2584
2594
  ], 6),
2585
2595
  typeof props.right !== "undefined" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2586
- createVNode(_sfc_main$l, { onChange: changeRight }),
2596
+ createVNode(_sfc_main$m, { onChange: changeRight }),
2587
2597
  createElementVNode("div", {
2588
2598
  class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
2589
2599
  style: normalizeStyle(`width: ${__props.right}px`)
@@ -2596,8 +2606,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2596
2606
  }
2597
2607
  });
2598
2608
 
2599
- const _hoisted_1$9 = { class: "m-editor" };
2600
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
2609
+ const _hoisted_1$a = { class: "m-editor" };
2610
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2601
2611
  __name: "Framework",
2602
2612
  props: {
2603
2613
  codeOptions: { default: () => ({}) }
@@ -2664,7 +2674,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2664
2674
  };
2665
2675
  return (_ctx, _cache) => {
2666
2676
  const _component_magic_code_editor = resolveComponent("magic-code-editor");
2667
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
2677
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
2668
2678
  renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
2669
2679
  unref(showSrc) ? (openBlock(), createBlock(_component_magic_code_editor, {
2670
2680
  key: 0,
@@ -2672,7 +2682,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2672
2682
  "init-values": unref(root),
2673
2683
  options: __props.codeOptions,
2674
2684
  onSave: saveCode
2675
- }, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$k, {
2685
+ }, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$l, {
2676
2686
  key: 1,
2677
2687
  class: "m-editor-content",
2678
2688
  "left-class": "m-editor-framework-left",
@@ -2691,7 +2701,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2691
2701
  ]),
2692
2702
  center: withCtx(() => [
2693
2703
  unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
2694
- createVNode(_sfc_main$m)
2704
+ createVNode(_sfc_main$n)
2695
2705
  ])
2696
2706
  ]),
2697
2707
  _: 2
@@ -2713,12 +2723,12 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2713
2723
  }
2714
2724
  });
2715
2725
 
2716
- const _hoisted_1$8 = {
2726
+ const _hoisted_1$9 = {
2717
2727
  key: 1,
2718
2728
  class: "menu-item-text"
2719
2729
  };
2720
- const _hoisted_2$3 = { class: "el-dropdown-link menubar-menu-button" };
2721
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2730
+ const _hoisted_2$4 = { class: "el-dropdown-link menubar-menu-button" };
2731
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2722
2732
  __name: "ToolButton",
2723
2733
  props: {
2724
2734
  data: { default: () => ({
@@ -2794,7 +2804,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2794
2804
  __props.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
2795
2805
  key: 0,
2796
2806
  direction: __props.data.direction || "vertical"
2797
- }, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$8, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2807
+ }, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$9, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2798
2808
  __props.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
2799
2809
  key: 0,
2800
2810
  effect: "dark",
@@ -2808,7 +2818,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2808
2818
  disabled: unref(disabled)
2809
2819
  }, {
2810
2820
  default: withCtx(() => [
2811
- __props.data.icon ? (openBlock(), createBlock(_sfc_main$n, {
2821
+ __props.data.icon ? (openBlock(), createBlock(_sfc_main$o, {
2812
2822
  key: 0,
2813
2823
  icon: __props.data.icon
2814
2824
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -2825,7 +2835,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2825
2835
  disabled: unref(disabled)
2826
2836
  }, {
2827
2837
  default: withCtx(() => [
2828
- __props.data.icon ? (openBlock(), createBlock(_sfc_main$n, {
2838
+ __props.data.icon ? (openBlock(), createBlock(_sfc_main$o, {
2829
2839
  key: 0,
2830
2840
  icon: __props.data.icon
2831
2841
  }, null, 8, ["icon"])) : createCommentVNode("", true),
@@ -2858,7 +2868,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2858
2868
  })) : createCommentVNode("", true)
2859
2869
  ]),
2860
2870
  default: withCtx(() => [
2861
- createElementVNode("span", _hoisted_2$3, [
2871
+ createElementVNode("span", _hoisted_2$4, [
2862
2872
  createTextVNode(toDisplayString(__props.data.text), 1),
2863
2873
  createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
2864
2874
  default: withCtx(() => [
@@ -2875,7 +2885,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2875
2885
  }
2876
2886
  });
2877
2887
 
2878
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
2888
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2879
2889
  __name: "NavMenu",
2880
2890
  props: {
2881
2891
  data: { default: () => ({}) },
@@ -3031,7 +3041,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3031
3041
  style: normalizeStyle(`width: ${unref(columnWidth)?.[key]}px`)
3032
3042
  }, [
3033
3043
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(buttons)[key], (item, index) => {
3034
- return openBlock(), createBlock(_sfc_main$i, {
3044
+ return openBlock(), createBlock(_sfc_main$j, {
3035
3045
  data: item,
3036
3046
  key: index
3037
3047
  }, null, 8, ["data"]);
@@ -3043,8 +3053,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3043
3053
  }
3044
3054
  });
3045
3055
 
3046
- const _hoisted_1$7 = { class: "m-editor-props-panel" };
3047
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
3056
+ const _hoisted_1$8 = { class: "m-editor-props-panel" };
3057
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3048
3058
  __name: "PropsPanel",
3049
3059
  emits: ["mounted"],
3050
3060
  setup(__props, { expose, emit }) {
@@ -3088,7 +3098,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3088
3098
  expose({ submit });
3089
3099
  return (_ctx, _cache) => {
3090
3100
  const _component_m_form = resolveComponent("m-form");
3091
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
3101
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
3092
3102
  renderSlot(_ctx.$slots, "props-panel-header"),
3093
3103
  createVNode(_component_m_form, {
3094
3104
  ref_key: "configForm",
@@ -3105,8 +3115,8 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3105
3115
  }
3106
3116
  });
3107
3117
 
3108
- const _hoisted_1$6 = ["id"];
3109
- const _hoisted_2$2 = { class: "list-item" };
3118
+ const _hoisted_1$7 = ["id"];
3119
+ const _hoisted_2$3 = { class: "list-item" };
3110
3120
  const _hoisted_3$1 = { class: "code-name" };
3111
3121
  const _hoisted_4$1 = { class: "code-name-wrapper" };
3112
3122
  const _hoisted_5$1 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "\u4EE3\u7801\u5757\u540D\u79F0", -1);
@@ -3122,7 +3132,7 @@ const _hoisted_10 = {
3122
3132
  class: "m-editor-content-bottom"
3123
3133
  };
3124
3134
  const _hoisted_11 = /* @__PURE__ */ createTextVNode("\u5173\u95ED");
3125
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
3135
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3126
3136
  __name: "CodeBlockEditor",
3127
3137
  setup(__props) {
3128
3138
  const services = inject("services");
@@ -3194,7 +3204,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3194
3204
  "append-to-body": true
3195
3205
  }, {
3196
3206
  default: withCtx(() => [
3197
- createVNode(_sfc_main$k, {
3207
+ createVNode(_sfc_main$l, {
3198
3208
  left: left.value,
3199
3209
  "onUpdate:left": _cache[1] || (_cache[1] = ($event) => left.value = $event),
3200
3210
  "min-left": 45,
@@ -3223,7 +3233,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3223
3233
  ]),
3224
3234
  default: withCtx(() => [
3225
3235
  createElementVNode("div", _hoisted_6$1, [
3226
- codeConfig.value ? (openBlock(), createBlock(_sfc_main$o, {
3236
+ codeConfig.value ? (openBlock(), createBlock(_sfc_main$p, {
3227
3237
  key: 0,
3228
3238
  ref_key: "codeEditor",
3229
3239
  ref: codeEditor,
@@ -3296,10 +3306,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3296
3306
  id: data.id,
3297
3307
  class: "list-container"
3298
3308
  }, [
3299
- createElementVNode("div", _hoisted_2$2, [
3309
+ createElementVNode("div", _hoisted_2$3, [
3300
3310
  createElementVNode("div", _hoisted_3$1, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1)
3301
3311
  ])
3302
- ], 8, _hoisted_1$6)
3312
+ ], 8, _hoisted_1$7)
3303
3313
  ]),
3304
3314
  _: 1
3305
3315
  }, 8, ["data", "current-node-key"])) : createCommentVNode("", true)
@@ -3313,8 +3323,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3313
3323
  }
3314
3324
  });
3315
3325
 
3316
- const _hoisted_1$5 = { class: "m-editor-code-block-list" };
3317
- const _hoisted_2$1 = { class: "code-header-wrapper" };
3326
+ const _hoisted_1$6 = { class: "m-editor-code-block-list" };
3327
+ const _hoisted_2$2 = { class: "code-header-wrapper" };
3318
3328
  const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
3319
3329
  const _hoisted_4 = ["id"];
3320
3330
  const _hoisted_5 = { class: "list-item" };
@@ -3335,7 +3345,7 @@ const _hoisted_9 = /* @__PURE__ */ createElementVNode("svg", {
3335
3345
  d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
3336
3346
  })
3337
3347
  ], -1);
3338
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
3348
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3339
3349
  __name: "CodeBlockList",
3340
3350
  props: {
3341
3351
  customError: null
@@ -3463,9 +3473,9 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3463
3473
  stage?.select(compId);
3464
3474
  };
3465
3475
  return (_ctx, _cache) => {
3466
- return openBlock(), createElementBlock("div", _hoisted_1$5, [
3476
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [
3467
3477
  renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
3468
- createElementVNode("div", _hoisted_2$1, [
3478
+ createElementVNode("div", _hoisted_2$2, [
3469
3479
  createVNode(unref(TMagicInput), {
3470
3480
  class: normalizeClass([unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
3471
3481
  size: "small",
@@ -3514,7 +3524,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3514
3524
  placement: "bottom"
3515
3525
  }, {
3516
3526
  default: withCtx(() => [
3517
- createVNode(_sfc_main$n, {
3527
+ createVNode(_sfc_main$o, {
3518
3528
  icon: unref(editable) ? unref(Edit) : unref(View),
3519
3529
  class: "edit-icon",
3520
3530
  onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
@@ -3529,7 +3539,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3529
3539
  placement: "bottom"
3530
3540
  }, {
3531
3541
  default: withCtx(() => [
3532
- createVNode(_sfc_main$n, {
3542
+ createVNode(_sfc_main$o, {
3533
3543
  icon: unref(Link),
3534
3544
  class: "edit-icon",
3535
3545
  onClick: withModifiers(($event) => toggleCombineRelation(data), ["stop"])
@@ -3544,7 +3554,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3544
3554
  placement: "bottom"
3545
3555
  }, {
3546
3556
  default: withCtx(() => [
3547
- createVNode(_sfc_main$n, {
3557
+ createVNode(_sfc_main$o, {
3548
3558
  icon: unref(Close),
3549
3559
  class: "edit-icon",
3550
3560
  onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
@@ -3579,7 +3589,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3579
3589
  ]),
3580
3590
  _: 3
3581
3591
  }, 8, ["data"])) : createCommentVNode("", true),
3582
- createVNode(_sfc_main$f, null, {
3592
+ createVNode(_sfc_main$g, null, {
3583
3593
  "code-block-edit-panel-header": withCtx(({ id }) => [
3584
3594
  renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
3585
3595
  ]),
@@ -3590,8 +3600,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3590
3600
  }
3591
3601
  });
3592
3602
 
3593
- const _hoisted_1$4 = ["onClick", "onDragstart"];
3594
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
3603
+ const _hoisted_1$5 = ["onClick", "onDragstart"];
3604
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3595
3605
  __name: "ComponentListPanel",
3596
3606
  setup(__props) {
3597
3607
  const searchText = ref("");
@@ -3681,7 +3691,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3681
3691
  name: `${index}`
3682
3692
  }, {
3683
3693
  title: withCtx(() => [
3684
- createVNode(_sfc_main$n, { icon: unref(Grid) }, null, 8, ["icon"]),
3694
+ createVNode(_sfc_main$o, { icon: unref(Grid) }, null, 8, ["icon"]),
3685
3695
  createTextVNode(toDisplayString(group.title), 1)
3686
3696
  ]),
3687
3697
  default: withCtx(() => [
@@ -3696,7 +3706,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3696
3706
  onDrag: dragHandler
3697
3707
  }, [
3698
3708
  renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
3699
- createVNode(_sfc_main$n, {
3709
+ createVNode(_sfc_main$o, {
3700
3710
  icon: item.icon
3701
3711
  }, null, 8, ["icon"]),
3702
3712
  createVNode(unref(TMagicTooltip), {
@@ -3710,7 +3720,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3710
3720
  _: 2
3711
3721
  }, 1032, ["content"])
3712
3722
  ])
3713
- ], 40, _hoisted_1$4);
3723
+ ], 40, _hoisted_1$5);
3714
3724
  }), 128))
3715
3725
  ]),
3716
3726
  _: 2
@@ -3727,7 +3737,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3727
3737
  }
3728
3738
  });
3729
3739
 
3730
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
3740
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3731
3741
  __name: "ContentMenu",
3732
3742
  props: {
3733
3743
  menuData: { default: () => [] },
@@ -3816,7 +3826,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3816
3826
  }, [
3817
3827
  createElementVNode("div", null, [
3818
3828
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
3819
- return openBlock(), createBlock(_sfc_main$i, {
3829
+ return openBlock(), createBlock(_sfc_main$j, {
3820
3830
  "event-type": "mouseup",
3821
3831
  data: item,
3822
3832
  key: index,
@@ -3840,7 +3850,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3840
3850
  }
3841
3851
  });
3842
3852
 
3843
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
3853
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3844
3854
  __name: "LayerMenu",
3845
3855
  setup(__props, { expose }) {
3846
3856
  const services = inject("services");
@@ -3928,7 +3938,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3928
3938
  show
3929
3939
  });
3930
3940
  return (_ctx, _cache) => {
3931
- return openBlock(), createBlock(_sfc_main$c, {
3941
+ return openBlock(), createBlock(_sfc_main$d, {
3932
3942
  "menu-data": unref(menuData),
3933
3943
  ref_key: "menu",
3934
3944
  ref: menu,
@@ -3938,8 +3948,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3938
3948
  }
3939
3949
  });
3940
3950
 
3941
- const _hoisted_1$3 = ["id", "onMouseenter"];
3942
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
3951
+ const _hoisted_1$4 = ["id", "onMouseenter"];
3952
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3943
3953
  __name: "LayerPanel",
3944
3954
  setup(__props) {
3945
3955
  const throttleTime = 150;
@@ -4222,12 +4232,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4222
4232
  }, () => [
4223
4233
  createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
4224
4234
  ])
4225
- ], 42, _hoisted_1$3)
4235
+ ], 42, _hoisted_1$4)
4226
4236
  ]),
4227
4237
  _: 3
4228
4238
  }, 8, ["default-expanded-keys", "data", "show-checkbox"])) : createCommentVNode("", true),
4229
4239
  (openBlock(), createBlock(Teleport, { to: "body" }, [
4230
- createVNode(_sfc_main$b, {
4240
+ createVNode(_sfc_main$c, {
4231
4241
  ref_key: "menu",
4232
4242
  ref: menu
4233
4243
  }, null, 512)
@@ -4239,11 +4249,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4239
4249
  }
4240
4250
  });
4241
4251
 
4242
- const _hoisted_1$2 = {
4252
+ const _hoisted_1$3 = {
4243
4253
  key: 1,
4244
4254
  class: "magic-editor-tab-panel-title"
4245
4255
  };
4246
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4256
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
4247
4257
  __name: "TabPane",
4248
4258
  props: {
4249
4259
  data: null
@@ -4260,7 +4270,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4260
4270
  type: "component",
4261
4271
  icon: Coin,
4262
4272
  text: "\u7EC4\u4EF6",
4263
- component: _sfc_main$d,
4273
+ component: _sfc_main$e,
4264
4274
  slots: {}
4265
4275
  };
4266
4276
  case "layer":
@@ -4268,7 +4278,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4268
4278
  type: "component",
4269
4279
  icon: Files,
4270
4280
  text: "\u5DF2\u9009\u7EC4\u4EF6",
4271
- component: _sfc_main$a,
4281
+ component: _sfc_main$b,
4272
4282
  slots: {}
4273
4283
  };
4274
4284
  case "code-block":
@@ -4276,7 +4286,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4276
4286
  type: "component",
4277
4287
  icon: EditPen,
4278
4288
  text: "\u4EE3\u7801\u7F16\u8F91",
4279
- component: _sfc_main$e,
4289
+ component: _sfc_main$f,
4280
4290
  slots: {}
4281
4291
  };
4282
4292
  default:
@@ -4292,11 +4302,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4292
4302
  (openBlock(), createElementBlock("div", {
4293
4303
  key: unref(config).text
4294
4304
  }, [
4295
- unref(config).icon ? (openBlock(), createBlock(_sfc_main$n, {
4305
+ unref(config).icon ? (openBlock(), createBlock(_sfc_main$o, {
4296
4306
  key: 0,
4297
4307
  icon: unref(config).icon
4298
4308
  }, null, 8, ["icon"])) : createCommentVNode("", true),
4299
- unref(config).text ? (openBlock(), createElementBlock("div", _hoisted_1$2, toDisplayString(unref(config).text), 1)) : createCommentVNode("", true)
4309
+ unref(config).text ? (openBlock(), createElementBlock("div", _hoisted_1$3, toDisplayString(unref(config).text), 1)) : createCommentVNode("", true)
4300
4310
  ]))
4301
4311
  ]),
4302
4312
  default: withCtx(() => [
@@ -4372,7 +4382,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4372
4382
  }
4373
4383
  });
4374
4384
 
4375
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4385
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
4376
4386
  __name: "Sidebar",
4377
4387
  props: {
4378
4388
  data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) }
@@ -4400,7 +4410,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4400
4410
  }, {
4401
4411
  default: withCtx(() => [
4402
4412
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.items, (item, index) => {
4403
- return openBlock(), createBlock(_sfc_main$9, {
4413
+ return openBlock(), createBlock(_sfc_main$a, {
4404
4414
  key: index,
4405
4415
  data: item
4406
4416
  }, createSlots({ _: 2 }, [
@@ -4461,6 +4471,48 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4461
4471
  }
4462
4472
  });
4463
4473
 
4474
+ const _hoisted_1$2 = {
4475
+ key: 0,
4476
+ class: "m-editor-breadcrumb"
4477
+ };
4478
+ const _hoisted_2$1 = { key: 0 };
4479
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4480
+ __name: "Breadcrumb",
4481
+ setup(__props) {
4482
+ const services = inject("services");
4483
+ const editorService = services?.editorService;
4484
+ const node = computed(() => editorService?.get("node"));
4485
+ const nodes = computed(() => editorService?.get("nodes") || []);
4486
+ const root = computed(() => editorService?.get("root"));
4487
+ const path = computed(() => getNodePath(node.value?.id || "", root.value?.items || []));
4488
+ const select = async (node2) => {
4489
+ await editorService?.select(node2);
4490
+ editorService?.get("stage")?.select(node2.id);
4491
+ };
4492
+ return (_ctx, _cache) => {
4493
+ return unref(nodes).length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
4494
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(path), (item, index) => {
4495
+ return openBlock(), createElementBlock(Fragment, {
4496
+ key: item.id
4497
+ }, [
4498
+ createVNode(unref(TMagicButton), {
4499
+ text: "",
4500
+ disabled: item.id === unref(node)?.id,
4501
+ onClick: ($event) => select(item)
4502
+ }, {
4503
+ default: withCtx(() => [
4504
+ createTextVNode(toDisplayString(item.name), 1)
4505
+ ]),
4506
+ _: 2
4507
+ }, 1032, ["disabled", "onClick"]),
4508
+ index < unref(path).length - 1 ? (openBlock(), createElementBlock("span", _hoisted_2$1, "/")) : createCommentVNode("", true)
4509
+ ], 64);
4510
+ }), 128))
4511
+ ])) : createCommentVNode("", true);
4512
+ };
4513
+ }
4514
+ });
4515
+
4464
4516
  const _hoisted_1$1 = {
4465
4517
  key: 1,
4466
4518
  style: { "width": "21px" }
@@ -4547,14 +4599,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4547
4599
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4548
4600
  onClick: addPage
4549
4601
  }, [
4550
- createVNode(_sfc_main$n, { icon: unref(Plus) }, null, 8, ["icon"])
4602
+ createVNode(_sfc_main$o, { icon: unref(Plus) }, null, 8, ["icon"])
4551
4603
  ])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
4552
4604
  canScroll.value ? (openBlock(), createElementBlock("div", {
4553
4605
  key: 2,
4554
4606
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4555
4607
  onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
4556
4608
  }, [
4557
- createVNode(_sfc_main$n, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
4609
+ createVNode(_sfc_main$o, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
4558
4610
  ])) : createCommentVNode("", true),
4559
4611
  unref(pageLength) ? (openBlock(), createElementBlock("div", {
4560
4612
  key: 3,
@@ -4570,7 +4622,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4570
4622
  class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
4571
4623
  onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
4572
4624
  }, [
4573
- createVNode(_sfc_main$n, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
4625
+ createVNode(_sfc_main$o, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
4574
4626
  ])) : createCommentVNode("", true)
4575
4627
  ], 512);
4576
4628
  };
@@ -4639,7 +4691,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4639
4691
  default: withCtx(() => [
4640
4692
  createElementVNode("div", null, [
4641
4693
  renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
4642
- createVNode(_sfc_main$i, {
4694
+ createVNode(_sfc_main$j, {
4643
4695
  data: {
4644
4696
  type: "button",
4645
4697
  text: "\u590D\u5236",
@@ -4647,7 +4699,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4647
4699
  handler: () => copy(item)
4648
4700
  }
4649
4701
  }, null, 8, ["data"]),
4650
- createVNode(_sfc_main$i, {
4702
+ createVNode(_sfc_main$j, {
4651
4703
  data: {
4652
4704
  type: "button",
4653
4705
  text: "\u5220\u9664",
@@ -5113,7 +5165,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
5113
5165
  };
5114
5166
  expose({ show });
5115
5167
  return (_ctx, _cache) => {
5116
- return openBlock(), createBlock(_sfc_main$c, {
5168
+ return openBlock(), createBlock(_sfc_main$d, {
5117
5169
  "menu-data": menuData,
5118
5170
  ref_key: "menu",
5119
5171
  ref: menu
@@ -5378,6 +5430,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5378
5430
  ref_key: "workspace",
5379
5431
  ref: workspace
5380
5432
  }, [
5433
+ createVNode(_sfc_main$8),
5381
5434
  renderSlot(_ctx.$slots, "stage", {}, () => [
5382
5435
  (openBlock(), createBlock(_sfc_main$2, {
5383
5436
  key: unref(page)?.id
@@ -5421,11 +5474,11 @@ const componentListService = new ComponentList();
5421
5474
  const _sfc_main = defineComponent({
5422
5475
  name: "m-editor",
5423
5476
  components: {
5424
- NavMenu: _sfc_main$h,
5425
- Sidebar: _sfc_main$8,
5477
+ NavMenu: _sfc_main$i,
5478
+ Sidebar: _sfc_main$9,
5426
5479
  Workspace: _sfc_main$1,
5427
- PropsPanel: _sfc_main$g,
5428
- Framework: _sfc_main$j
5480
+ PropsPanel: _sfc_main$h,
5481
+ Framework: _sfc_main$k
5429
5482
  },
5430
5483
  props: {
5431
5484
  modelValue: {
@@ -5721,13 +5774,13 @@ const index = {
5721
5774
  app.config.globalProperties.$TMAGIC_EDITOR = option;
5722
5775
  setConfig(option);
5723
5776
  app.component(Editor.name, Editor);
5724
- app.component("m-fields-ui-select", _sfc_main$p);
5725
- app.component("m-fields-code-link", _sfc_main$r);
5726
- app.component("m-fields-vs-code", _sfc_main$s);
5727
- app.component("magic-code-editor", _sfc_main$o);
5728
- app.component("m-fields-code-select", _sfc_main$q);
5777
+ app.component("m-fields-ui-select", _sfc_main$q);
5778
+ app.component("m-fields-code-link", _sfc_main$s);
5779
+ app.component("m-fields-vs-code", _sfc_main$t);
5780
+ app.component("magic-code-editor", _sfc_main$p);
5781
+ app.component("m-fields-code-select", _sfc_main$r);
5729
5782
  }
5730
5783
  };
5731
5784
 
5732
- export { COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, _sfc_main$q as CodeSelect, CodeSelectOp, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$n as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$g as PropsPanel, _sfc_main$o as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$i as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, codeBlockService, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, useStage, warn };
5785
+ export { COPY_STORAGE_KEY, _sfc_main$f as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, _sfc_main$r as CodeSelect, CodeSelectOp, ColumnLayout, _sfc_main$e as ComponentListPanel, _sfc_main$d as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$o as Icon, Keys, LayerOffset, _sfc_main$b as LayerPanel, Layout, _sfc_main$h as PropsPanel, _sfc_main$p as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$j as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, codeBlockService, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, useStage, warn };
5733
5786
  //# sourceMappingURL=tmagic-editor.mjs.map