@galacean/effects-plugin-rich-text 2.8.0-alpha.2 → 2.8.0-alpha.4

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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player rich text plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 云垣
6
- * Version: v2.8.0-alpha.2
6
+ * Version: v2.8.0-alpha.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -54,16 +54,84 @@ function _inherits(subClass, superClass) {
54
54
  if (superClass) _set_prototype_of(subClass, superClass);
55
55
  }
56
56
 
57
- var RichTextLoader = /*#__PURE__*/ function(AbstractPlugin) {
58
- _inherits(RichTextLoader, AbstractPlugin);
57
+ function _is_native_reflect_construct() {
58
+ // Since Reflect.construct can't be properly polyfilled, some
59
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
60
+ // Those polyfills don't allow us to subclass built-ins, so we need to
61
+ // use our fallback implementation.
62
+ try {
63
+ // If the internal slots aren't set, this throws an error similar to
64
+ // TypeError: this is not a Boolean object.
65
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
66
+ } catch (_) {}
67
+ return (_is_native_reflect_construct = function _is_native_reflect_construct() {
68
+ return !!result;
69
+ })();
70
+ }
71
+
72
+ function _construct(Parent, args, Class) {
73
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
74
+ else {
75
+ _construct = function construct(Parent, args, Class) {
76
+ var a = [
77
+ null
78
+ ];
79
+ a.push.apply(a, args);
80
+ var Constructor = Function.bind.apply(Parent, a);
81
+ var instance = new Constructor();
82
+ if (Class) _set_prototype_of(instance, Class.prototype);
83
+ return instance;
84
+ };
85
+ }
86
+ return _construct.apply(null, arguments);
87
+ }
88
+
89
+ function _get_prototype_of(o) {
90
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
91
+ return o.__proto__ || Object.getPrototypeOf(o);
92
+ };
93
+ return _get_prototype_of(o);
94
+ }
95
+
96
+ function _is_native_function(fn) {
97
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
98
+ }
99
+
100
+ function _wrap_native_super(Class) {
101
+ var _cache = typeof Map === "function" ? new Map() : undefined;
102
+ _wrap_native_super = function _wrap_native_super(Class) {
103
+ if (Class === null || !_is_native_function(Class)) return Class;
104
+ if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
105
+ if (typeof _cache !== "undefined") {
106
+ if (_cache.has(Class)) return _cache.get(Class);
107
+ _cache.set(Class, Wrapper);
108
+ }
109
+ function Wrapper() {
110
+ return _construct(Class, arguments, _get_prototype_of(this).constructor);
111
+ }
112
+ Wrapper.prototype = Object.create(Class.prototype, {
113
+ constructor: {
114
+ value: Wrapper,
115
+ enumerable: false,
116
+ writable: true,
117
+ configurable: true
118
+ }
119
+ });
120
+ return _set_prototype_of(Wrapper, Class);
121
+ };
122
+ return _wrap_native_super(Class);
123
+ }
124
+
125
+ var RichTextLoader = /*#__PURE__*/ function(Plugin) {
126
+ _inherits(RichTextLoader, Plugin);
59
127
  function RichTextLoader() {
60
128
  var _this;
61
- _this = AbstractPlugin.apply(this, arguments) || this;
129
+ _this = Plugin.apply(this, arguments) || this;
62
130
  _this.name = "rich-text";
63
131
  return _this;
64
132
  }
65
133
  return RichTextLoader;
66
- }(EFFECTS.AbstractPlugin);
134
+ }(_wrap_native_super(EFFECTS.Plugin));
67
135
 
68
136
  function _array_like_to_array(arr, len) {
69
137
  if (len == null || len > arr.length) len = arr.length;
@@ -490,7 +558,8 @@ var RichTextLayout = /*#__PURE__*/ function() {
490
558
  return result;
491
559
  } finally{
492
560
  // Clean up DOM element
493
- canvas.remove();
561
+ // 支付宝小程序不支持 remove 方法
562
+ canvas.remove == null ? void 0 : canvas.remove.call(canvas);
494
563
  }
495
564
  }
496
565
  throw new Error("Failed to get 2D context for color conversion!");
@@ -1627,7 +1696,7 @@ EFFECTS.applyMixins(exports.RichTextComponent, [
1627
1696
 
1628
1697
  /**
1629
1698
  * 插件版本号
1630
- */ var version = "2.8.0-alpha.2";
1699
+ */ var version = "2.8.0-alpha.4";
1631
1700
  EFFECTS.registerPlugin("rich-text", RichTextLoader);
1632
1701
  EFFECTS.logger.info("Plugin rich text version: " + version + ".");
1633
1702
  if (version !== EFFECTS__namespace.version) {