@tmagic/editor 1.3.8 → 1.3.9

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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('monaco-editor'), require('serialize-javascript'), require('@tmagic/design'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('moveable'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'monaco-editor', 'serialize-javascript', '@tmagic/design', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', 'moveable', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.monaco, global.serialize, global.design, global.schema, global.form, global.table, global.utils, global.Gesto, global.Moveable, global.dep, global.StageCore, global.events, global.core, global.KeyController));
5
- })(this, (function (exports, vue, iconsVue, lodashEs, monaco, serialize, design, schema, form, table, utils, Gesto, Moveable, dep, StageCore, events, core, KeyController) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('moveable'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', 'moveable', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.table, global.utils, global.Gesto, global.Moveable, global.dep, global.StageCore, global.events, global.core, global.KeyController));
5
+ })(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, table, utils, Gesto, Moveable, dep, StageCore, events, core, KeyController) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
@@ -29,6 +29,9 @@
29
29
  };
30
30
  const getConfig = (key) => $TMAGIC_EDITOR[key];
31
31
 
32
+ emmetMonacoEs.emmetHTML(monaco__namespace);
33
+ emmetMonacoEs.emmetCSS(monaco__namespace, ["css", "scss"]);
34
+
32
35
  const _hoisted_1$t = {
33
36
  class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
34
37
  };
@@ -2259,11 +2262,11 @@
2259
2262
  if (!targetConfig)
2260
2263
  return;
2261
2264
  target.deps[config.id]?.keys?.forEach((fullKey) => {
2262
- const relateOriginId = lodashEs.get(config, fullKey);
2265
+ const relateOriginId = utils.getValueByKeyPath(fullKey, config);
2263
2266
  const relateTargetId = relateIdMap[relateOriginId];
2264
2267
  if (!relateTargetId)
2265
2268
  return;
2266
- lodashEs.set(targetConfig, fullKey, relateTargetId);
2269
+ utils.setValueByKeyPath(fullKey, relateTargetId, targetConfig);
2267
2270
  });
2268
2271
  });
2269
2272
  }
@@ -2903,14 +2906,19 @@
2903
2906
  const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
2904
2907
  const layout = await this.getLayout(parent, node);
2905
2908
  const isRelative = layout === Layout.RELATIVE;
2906
- brothers.splice(index, 1);
2909
+ let offsetIndex;
2907
2910
  if (offset === LayerOffset.TOP) {
2908
- brothers.splice(isRelative ? 0 : brothers.length, 0, node);
2911
+ offsetIndex = isRelative ? 0 : brothers.length;
2909
2912
  } else if (offset === LayerOffset.BOTTOM) {
2910
- brothers.splice(isRelative ? brothers.length : 0, 0, node);
2913
+ offsetIndex = isRelative ? brothers.length : 0;
2911
2914
  } else {
2912
- brothers.splice(index + (isRelative ? -offset : offset), 0, node);
2915
+ offsetIndex = index + (isRelative ? -offset : offset);
2913
2916
  }
2917
+ if (offsetIndex > 0 && offsetIndex > brothers.length || offsetIndex < 0) {
2918
+ return;
2919
+ }
2920
+ brothers.splice(index, 1);
2921
+ brothers.splice(offsetIndex, 0, node);
2914
2922
  const grandparent = this.getParentById(parent.id);
2915
2923
  this.get("stage")?.update({
2916
2924
  config: lodashEs.cloneDeep(vue.toRaw(parent)),
@@ -2919,6 +2927,7 @@
2919
2927
  });
2920
2928
  this.addModifiedNodeId(parent.id);
2921
2929
  this.pushHistoryState();
2930
+ this.emit("move-layer", offset);
2922
2931
  }
2923
2932
  /**
2924
2933
  * 移动到指定容器中