@byteluck-fe/model-driven-engine 2.22.1-beta.1 → 2.22.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
3
3
  * @Date: 2022-04-15 14:06:03
4
- * @LastEditors: zhaoxiaoyang zhaoxiaoyang@byteluck.com
5
- * @LastEditTime: 2023-11-30 16:38:47
4
+ * @LastEditors: SuperLuckyqi
5
+ * @LastEditTime: 2024-07-23 15:19:34
6
6
  * @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
7
7
  */ function _class_call_check(instance, Constructor) {
8
8
  if (!(instance instanceof Constructor)) {
@@ -56,15 +56,17 @@ export var StylePlugin = /*#__PURE__*/ function() {
56
56
  var _this_config_source;
57
57
  var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : '';
58
58
  var style = document.createElement('style');
59
- style.className = "edit-css-" + engine.id;
60
- style.type = 'text/css';
59
+ style.className = 'edit-css-' + engine.id;
60
+ var dom = document.querySelector('head');
61
+ dom.appendChild(style);
62
+ var styleSheet = style.sheet;
63
+ var rule;
61
64
  if (this.isPc) {
62
- style.innerHTML = "[data-engine-id='".concat(engine.id, "']{ ").concat(compiledStyle, " }");
65
+ rule = "[data-engine-id='".concat(engine.id, "']{ ").concat(compiledStyle, " }");
63
66
  } else {
64
- style.innerHTML = compiledStyle;
67
+ rule = compiledStyle;
65
68
  }
66
- var dom = document.querySelector('head');
67
- dom.appendChild(style);
69
+ styleSheet === null || styleSheet === void 0 ? void 0 : styleSheet.insertRule(rule, styleSheet.cssRules.length);
68
70
  }
69
71
  }
70
72
  ]);