@galacean/effects-plugin-rich-text 2.2.3 → 2.2.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/alipay.js CHANGED
@@ -578,7 +578,7 @@ exports.RichTextComponent = __decorate([
578
578
 
579
579
  /**
580
580
  * 插件版本号
581
- */ var version = "2.2.3";
581
+ */ var version = "2.2.4";
582
582
  EFFECTS.registerPlugin("richtext", RichTextLoader, EFFECTS.VFXItem, true);
583
583
  EFFECTS.logger.info("Plugin rich text version: " + version + ".");
584
584
  if (version !== EFFECTS__namespace.version) {
package/dist/alipay.mjs CHANGED
@@ -555,7 +555,7 @@ RichTextComponent = __decorate([
555
555
 
556
556
  /**
557
557
  * 插件版本号
558
- */ var version = "2.2.3";
558
+ */ var version = "2.2.4";
559
559
  registerPlugin("richtext", RichTextLoader, VFXItem, true);
560
560
  logger.info("Plugin rich text version: " + version + ".");
561
561
  if (version !== EFFECTS.version) {
package/dist/douyin.js CHANGED
@@ -578,7 +578,7 @@ exports.RichTextComponent = __decorate([
578
578
 
579
579
  /**
580
580
  * 插件版本号
581
- */ var version = "2.2.3";
581
+ */ var version = "2.2.4";
582
582
  EFFECTS.registerPlugin("richtext", RichTextLoader, EFFECTS.VFXItem, true);
583
583
  EFFECTS.logger.info("Plugin rich text version: " + version + ".");
584
584
  if (version !== EFFECTS__namespace.version) {
package/dist/douyin.mjs CHANGED
@@ -555,7 +555,7 @@ RichTextComponent = __decorate([
555
555
 
556
556
  /**
557
557
  * 插件版本号
558
- */ var version = "2.2.3";
558
+ */ var version = "2.2.4";
559
559
  registerPlugin("richtext", RichTextLoader, VFXItem, true);
560
560
  logger.info("Plugin rich text version: " + version + ".");
561
561
  if (version !== EFFECTS.version) {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player richtext plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 云垣
6
- * Version: v2.2.3
6
+ * Version: v2.2.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -586,7 +586,7 @@ exports.RichTextComponent = __decorate([
586
586
 
587
587
  /**
588
588
  * 插件版本号
589
- */ var version = "2.2.3";
589
+ */ var version = "2.2.4";
590
590
  EFFECTS.registerPlugin("richtext", RichTextLoader, EFFECTS.VFXItem, true);
591
591
  EFFECTS.logger.info("Plugin rich text version: " + version + ".");
592
592
  if (version !== EFFECTS__namespace.version) {
package/dist/index.min.js CHANGED
@@ -3,6 +3,6 @@
3
3
  * Description: Galacean Effects player richtext plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 云垣
6
- * Version: v2.2.3
7
- */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.richTextPlugin={}),t.ge)}(this,function(t,e){"use strict";var n,i,r=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,Object.freeze(e)}(e);function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}var s=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="richtext",e}return a(e,t),e}(e.AbstractPlugin);function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return l(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(n=i||(i={})).ContextStart="ContextStart",n.Text="Text",n.ContextEnd="ContextEnd";var c=/^<([a-z]+)(=([^>]+))?>$/,u=/^<\/([a-z]+)>$/,h=[["ContextStart",/^<[a-z]+(=[^>]+)?>/],["Text",/^[^</>=]+/],["ContextEnd",/^<\/[a-z]+>/]],p=function(t,e,n){if(void 0===e&&(e=[]),void 0===n&&(n=0),!t)return e;for(var i,r=f(h);!(i=r()).done;){var o,a=i.value,s=a[0],l=(null!=(o=a[1].exec(t))?o:[])[0];if(l){var c=l.length;return p(t.slice(c),e.concat({tokenType:s,value:l}),n+c)}}throw Error('Unexpected token: "'+t[0]+'" at position '+n+' while reading "'+t+'"')},v=function(t){var e=function(){var t=s();if((null==t?void 0:t.tokenType)==="Text")return a(),t.value},n=function(){var t=s();if((null==t?void 0:t.tokenType)==="ContextStart"){a();var e,n=t.value.match(c);if(n)return{attributeName:n[1],attributeParam:null!=(e=n[3])?e:""};throw Error("Expected a start tag marker at position "+o)}return{}},i=function(){var t=s();if((null==t?void 0:t.tokenType)==="ContextEnd"){a();var e=t.value.match(u);if(e)return{attributeName:e[1]};throw Error("Expect an end tag marker at position "+o)}return{}},r=p(t),o=0,a=function(){var t,e=r.shift();return o+=null!=(t=null==e?void 0:e.value.length)?t:0,e},s=function(){return r[0]},l=[];return!function t(r,a){for(void 0===r&&(r=[]),void 0===a&&(a="");;){var s=e();if(s){l.push({attributes:r,text:s});continue}var f=n(),c=f.attributeName,u=f.attributeParam;if(c){t(r.concat({attributeName:c,attributeParam:u}),c);continue}if(a){var h=i().attributeName;if(!h)throw Error('Expect an end tag marker "'+a+'" at position '+o+" but found no tag!");if(h!==a)throw Error('Expect an end tag marker "'+a+'" at position '+o+' but found tag "'+h+'"');return}break}}(),l};function d(t){return function(e){for(var n,i=v(e),r=f(i);!(n=r()).done;){var o=n.value;t(o.text,o.attributes.reduce(function(t,e){var n=e.attributeName,i=e.attributeParam;return n&&(t[n]=i),t},{}))}}}function g(t,e){if(void 0===e&&(e=1),(3===(t=t.replace(/^#/,"")).length||4===t.length)&&(t=t.split("").map(function(t){return t+t}).join("")),8===t.length){var n=parseInt(t.slice(6,8),16)/255;t=t.slice(0,6),e=n}var i=parseInt(t,16);return[i>>16&255,i>>8&255,255&i,e]}"function"==typeof SuppressedError&&SuppressedError;var x=0;t.RichTextComponent=function(t){function n(e){var n;return(n=t.call(this,e)||this).processedTextOptions=[],n.singleLineHeight=1.571,n.size=null,n.initialized=!1,n.canvasSize=null,n.name="MRichText"+x++,n}a(n,t);var i=n.prototype;return i.generateTextProgram=function(t){var n=this;this.processedTextOptions=[],d(function(t,i){/^\n+$/.test(t)&&(t=t.replace(/\n/g,"\n ")),t.split("\n").forEach(function(t,r){var o={text:t,fontSize:n.textStyle.fontSize,isNewLine:!1};r>0&&(o.isNewLine=!0),"b"in i&&(o.fontWeight=e.spec.TextWeight.bold),"i"in i&&(o.fontStyle=e.spec.FontStyle.italic),"size"in i&&i.size&&(o.fontSize=parseInt(i.size,10)),"color"in i&&i.color&&(o.fontColor=function(t,e){if(void 0===e&&(e=1),"string"!=typeof t||!t)throw Error("Invalid color string");return t.startsWith("#")?g(t,e):g(function(t){if("string"!=typeof t||!t)throw Error("Invalid color name provided");if("undefined"==typeof document)throw Error("This method requires a browser environment");var e=document.createElement("canvas"),n=e.getContext("2d");if(n)try{return n.fillStyle=t,n.fillStyle}finally{e.remove()}throw Error("Failed to get 2D context for color conversion!")}(t))}(i.color)),n.processedTextOptions.push(o)})})(t)},i.updateTexture=function(t){var n=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){this.generateTextProgram(this.text);var i=0,r=0,o=this.textLayout,a=this.textStyle,s=o.overflow,l=this.context;l.save();var f=[],c=a.fontSize*this.textStyle.fontScale,u={richOptions:[],offsetX:[],width:0,lineHeight:c*this.singleLineHeight,offsetY:c*(this.singleLineHeight-1)/2};if(this.processedTextOptions.forEach(function(t){var e=t.text,o=t.isNewLine,s=t.fontSize;o&&(f.push(u),i=Math.max(i,u.width),u={richOptions:[],offsetX:[],width:0,lineHeight:c*n.singleLineHeight,offsetY:c*(n.singleLineHeight-1)/2},r+=u.lineHeight),l.font=(t.fontWeight||a.textWeight)+" 10px "+(t.fontFamily||a.fontFamily);var h=l.measureText(e).width,p=s*n.singleLineHeight*n.textStyle.fontScale;p>u.lineHeight&&(r+=p-u.lineHeight,u.lineHeight=p,u.offsetY=s*n.textStyle.fontScale*(n.singleLineHeight-1)/2),u.offsetX.push(u.width),u.width+=h*s*n.SCALE_FACTOR*n.textStyle.fontScale,u.richOptions.push(t)}),f.push(u),i=Math.max(i,u.width),r+=u.lineHeight,0===i||0===r){this.isDirty=!1;return}(void 0===this.size||null===this.size)&&(this.size=this.item.transform.size.clone());var h=this.size,p=h.x,v=h.y;this.initialized||(this.canvasSize=new e.math.Vector2(i,r),this.item.transform.size.set((void 0===p?1:p)*i*this.SCALE_FACTOR*this.SCALE_FACTOR,(void 0===v?1:v)*r*this.SCALE_FACTOR*this.SCALE_FACTOR),this.size=this.item.transform.size.clone(),this.initialized=!0),e.assertExist(this.canvasSize);var d=this.canvasSize,g=d.x,x=d.y;if(this.textLayout.width=g/a.fontScale,this.textLayout.height=x/a.fontScale,this.canvas.width=g,this.canvas.height=x,l.clearRect(0,0,g,x),l.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",t||(l.translate(0,x),l.scale(1,-1)),0!==f.length){var y=o.getOffsetY(a,f.length,c*this.singleLineHeight,a.fontSize);f.forEach(function(t,i){var r=t.richOptions,o=t.offsetX,f=t.width,c=f,u=o;if(s===e.spec.TextOverflow.display&&f>g){var h=g/f;c*=h,u=o.map(function(t){return t*h})}var p=n.textLayout.getOffsetX(a,c);i>0&&(y+=t.lineHeight-t.offsetY),r.forEach(function(t,n){var i=a.fontScale,r=a.textColor,o=a.fontFamily,c=a.textWeight,h=a.fontStyle,v=t.text,d=t.fontSize,x=t.fontColor,m=void 0===x?r:x,T=t.fontFamily,S=t.fontWeight,b=t.fontStyle,w=d;s===e.spec.TextOverflow.display&&f>g&&(w/=f/g),l.font=(void 0===b?h:b)+" "+(void 0===S?c:S)+" "+w*i+"px "+(void 0===T?o:T),l.fillStyle="rgba("+m[0]+", "+m[1]+", "+m[2]+", "+m[3]+")",l.fillText(v,u[n]+p,y)})});var m=l.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("_MainTex",e.Texture.createWithData(this.engine,{data:new Uint8Array(m.data),width:m.width,height:m.height},{flipY:t,magFilter:e.glContext.LINEAR,minFilter:e.glContext.LINEAR,wrapS:e.glContext.CLAMP_TO_EDGE,wrapT:e.glContext.CLAMP_TO_EDGE})),this.isDirty=!1,l.restore()}}},i.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},i.updateWithOptions=function(t){this.textStyle=new e.TextStyle(t),this.textLayout=new e.TextLayout(t),this.textLayout.textBaseline=t.textBaseline||e.spec.TextBaseline.middle,this.text=t.text?t.text.toString():" "},n}(e.TextComponent),t.RichTextComponent=function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}([e.effectsClass(e.spec.DataType.RichTextComponent)],t.RichTextComponent);var y="2.2.3";e.registerPlugin("richtext",s,e.VFXItem,!0),e.logger.info("Plugin rich text version: "+y+"."),y!==r.version&&console.error("注意:请统一 RichText 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the RichText plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),t.RichTextLoader=s,t.generateProgram=d,t.isRichText=function(t){var e=p(t).filter(function(t){var e=t.tokenType;return"ContextStart"===e||"ContextEnd"===e}),n=e.filter(function(t){return"ContextStart"===t.tokenType}),i=e.filter(function(t){return"ContextEnd"===t.tokenType});return n.length===i.length&&!!n.length&&function t(e,n){var i=e[0],r=e.slice(1);if(void 0===n&&(n=[]),!i)return 0===n.length;if("ContextStart"===i.tokenType)return t(r,n.concat(i.value));if("ContextEnd"===i.tokenType)return n[n.length-1]===i.value&&t(r,n.slice(0,-1));throw Error("Unexpected token: "+i.tokenType)}(e.map(function(t){var e=t.tokenType,n=t.value;return{tokenType:e,value:"ContextStart"===e?n.match(c)[1]:n.match(u)[1]}}))},t.lexer=p,t.richTextParser=v,t.version=y,Object.defineProperty(t,"__esModule",{value:!0})});
6
+ * Version: v2.2.4
7
+ */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.richTextPlugin={}),t.ge)}(this,function(t,e){"use strict";var n,i,r=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,Object.freeze(e)}(e);function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}var s=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="richtext",e}return a(e,t),e}(e.AbstractPlugin);function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return l(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(n=i||(i={})).ContextStart="ContextStart",n.Text="Text",n.ContextEnd="ContextEnd";var c=/^<([a-z]+)(=([^>]+))?>$/,u=/^<\/([a-z]+)>$/,h=[["ContextStart",/^<[a-z]+(=[^>]+)?>/],["Text",/^[^</>=]+/],["ContextEnd",/^<\/[a-z]+>/]],p=function(t,e,n){if(void 0===e&&(e=[]),void 0===n&&(n=0),!t)return e;for(var i,r=f(h);!(i=r()).done;){var o,a=i.value,s=a[0],l=(null!=(o=a[1].exec(t))?o:[])[0];if(l){var c=l.length;return p(t.slice(c),e.concat({tokenType:s,value:l}),n+c)}}throw Error('Unexpected token: "'+t[0]+'" at position '+n+' while reading "'+t+'"')},v=function(t){var e=function(){var t=s();if((null==t?void 0:t.tokenType)==="Text")return a(),t.value},n=function(){var t=s();if((null==t?void 0:t.tokenType)==="ContextStart"){a();var e,n=t.value.match(c);if(n)return{attributeName:n[1],attributeParam:null!=(e=n[3])?e:""};throw Error("Expected a start tag marker at position "+o)}return{}},i=function(){var t=s();if((null==t?void 0:t.tokenType)==="ContextEnd"){a();var e=t.value.match(u);if(e)return{attributeName:e[1]};throw Error("Expect an end tag marker at position "+o)}return{}},r=p(t),o=0,a=function(){var t,e=r.shift();return o+=null!=(t=null==e?void 0:e.value.length)?t:0,e},s=function(){return r[0]},l=[];return!function t(r,a){for(void 0===r&&(r=[]),void 0===a&&(a="");;){var s=e();if(s){l.push({attributes:r,text:s});continue}var f=n(),c=f.attributeName,u=f.attributeParam;if(c){t(r.concat({attributeName:c,attributeParam:u}),c);continue}if(a){var h=i().attributeName;if(!h)throw Error('Expect an end tag marker "'+a+'" at position '+o+" but found no tag!");if(h!==a)throw Error('Expect an end tag marker "'+a+'" at position '+o+' but found tag "'+h+'"');return}break}}(),l};function d(t){return function(e){for(var n,i=v(e),r=f(i);!(n=r()).done;){var o=n.value;t(o.text,o.attributes.reduce(function(t,e){var n=e.attributeName,i=e.attributeParam;return n&&(t[n]=i),t},{}))}}}function g(t,e){if(void 0===e&&(e=1),(3===(t=t.replace(/^#/,"")).length||4===t.length)&&(t=t.split("").map(function(t){return t+t}).join("")),8===t.length){var n=parseInt(t.slice(6,8),16)/255;t=t.slice(0,6),e=n}var i=parseInt(t,16);return[i>>16&255,i>>8&255,255&i,e]}"function"==typeof SuppressedError&&SuppressedError;var x=0;t.RichTextComponent=function(t){function n(e){var n;return(n=t.call(this,e)||this).processedTextOptions=[],n.singleLineHeight=1.571,n.size=null,n.initialized=!1,n.canvasSize=null,n.name="MRichText"+x++,n}a(n,t);var i=n.prototype;return i.generateTextProgram=function(t){var n=this;this.processedTextOptions=[],d(function(t,i){/^\n+$/.test(t)&&(t=t.replace(/\n/g,"\n ")),t.split("\n").forEach(function(t,r){var o={text:t,fontSize:n.textStyle.fontSize,isNewLine:!1};r>0&&(o.isNewLine=!0),"b"in i&&(o.fontWeight=e.spec.TextWeight.bold),"i"in i&&(o.fontStyle=e.spec.FontStyle.italic),"size"in i&&i.size&&(o.fontSize=parseInt(i.size,10)),"color"in i&&i.color&&(o.fontColor=function(t,e){if(void 0===e&&(e=1),"string"!=typeof t||!t)throw Error("Invalid color string");return t.startsWith("#")?g(t,e):g(function(t){if("string"!=typeof t||!t)throw Error("Invalid color name provided");if("undefined"==typeof document)throw Error("This method requires a browser environment");var e=document.createElement("canvas"),n=e.getContext("2d");if(n)try{return n.fillStyle=t,n.fillStyle}finally{e.remove()}throw Error("Failed to get 2D context for color conversion!")}(t))}(i.color)),n.processedTextOptions.push(o)})})(t)},i.updateTexture=function(t){var n=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){this.generateTextProgram(this.text);var i=0,r=0,o=this.textLayout,a=this.textStyle,s=o.overflow,l=this.context;l.save();var f=[],c=a.fontSize*this.textStyle.fontScale,u={richOptions:[],offsetX:[],width:0,lineHeight:c*this.singleLineHeight,offsetY:c*(this.singleLineHeight-1)/2};if(this.processedTextOptions.forEach(function(t){var e=t.text,o=t.isNewLine,s=t.fontSize;o&&(f.push(u),i=Math.max(i,u.width),u={richOptions:[],offsetX:[],width:0,lineHeight:c*n.singleLineHeight,offsetY:c*(n.singleLineHeight-1)/2},r+=u.lineHeight),l.font=(t.fontWeight||a.textWeight)+" 10px "+(t.fontFamily||a.fontFamily);var h=l.measureText(e).width,p=s*n.singleLineHeight*n.textStyle.fontScale;p>u.lineHeight&&(r+=p-u.lineHeight,u.lineHeight=p,u.offsetY=s*n.textStyle.fontScale*(n.singleLineHeight-1)/2),u.offsetX.push(u.width),u.width+=h*s*n.SCALE_FACTOR*n.textStyle.fontScale,u.richOptions.push(t)}),f.push(u),i=Math.max(i,u.width),r+=u.lineHeight,0===i||0===r){this.isDirty=!1;return}(void 0===this.size||null===this.size)&&(this.size=this.item.transform.size.clone());var h=this.size,p=h.x,v=h.y;this.initialized||(this.canvasSize=new e.math.Vector2(i,r),this.item.transform.size.set((void 0===p?1:p)*i*this.SCALE_FACTOR*this.SCALE_FACTOR,(void 0===v?1:v)*r*this.SCALE_FACTOR*this.SCALE_FACTOR),this.size=this.item.transform.size.clone(),this.initialized=!0),e.assertExist(this.canvasSize);var d=this.canvasSize,g=d.x,x=d.y;if(this.textLayout.width=g/a.fontScale,this.textLayout.height=x/a.fontScale,this.canvas.width=g,this.canvas.height=x,l.clearRect(0,0,g,x),l.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",t||(l.translate(0,x),l.scale(1,-1)),0!==f.length){var y=o.getOffsetY(a,f.length,c*this.singleLineHeight,a.fontSize);f.forEach(function(t,i){var r=t.richOptions,o=t.offsetX,f=t.width,c=f,u=o;if(s===e.spec.TextOverflow.display&&f>g){var h=g/f;c*=h,u=o.map(function(t){return t*h})}var p=n.textLayout.getOffsetX(a,c);i>0&&(y+=t.lineHeight-t.offsetY),r.forEach(function(t,n){var i=a.fontScale,r=a.textColor,o=a.fontFamily,c=a.textWeight,h=a.fontStyle,v=t.text,d=t.fontSize,x=t.fontColor,m=void 0===x?r:x,T=t.fontFamily,S=t.fontWeight,b=t.fontStyle,w=d;s===e.spec.TextOverflow.display&&f>g&&(w/=f/g),l.font=(void 0===b?h:b)+" "+(void 0===S?c:S)+" "+w*i+"px "+(void 0===T?o:T),l.fillStyle="rgba("+m[0]+", "+m[1]+", "+m[2]+", "+m[3]+")",l.fillText(v,u[n]+p,y)})});var m=l.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("_MainTex",e.Texture.createWithData(this.engine,{data:new Uint8Array(m.data),width:m.width,height:m.height},{flipY:t,magFilter:e.glContext.LINEAR,minFilter:e.glContext.LINEAR,wrapS:e.glContext.CLAMP_TO_EDGE,wrapT:e.glContext.CLAMP_TO_EDGE})),this.isDirty=!1,l.restore()}}},i.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},i.updateWithOptions=function(t){this.textStyle=new e.TextStyle(t),this.textLayout=new e.TextLayout(t),this.textLayout.textBaseline=t.textBaseline||e.spec.TextBaseline.middle,this.text=t.text?t.text.toString():" "},n}(e.TextComponent),t.RichTextComponent=function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}([e.effectsClass(e.spec.DataType.RichTextComponent)],t.RichTextComponent);var y="2.2.4";e.registerPlugin("richtext",s,e.VFXItem,!0),e.logger.info("Plugin rich text version: "+y+"."),y!==r.version&&console.error("注意:请统一 RichText 插件与 Player 版本,不统一的版本混用会有不可预知的后果!","\nAttention: Please ensure the RichText plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!"),t.RichTextLoader=s,t.generateProgram=d,t.isRichText=function(t){var e=p(t).filter(function(t){var e=t.tokenType;return"ContextStart"===e||"ContextEnd"===e}),n=e.filter(function(t){return"ContextStart"===t.tokenType}),i=e.filter(function(t){return"ContextEnd"===t.tokenType});return n.length===i.length&&!!n.length&&function t(e,n){var i=e[0],r=e.slice(1);if(void 0===n&&(n=[]),!i)return 0===n.length;if("ContextStart"===i.tokenType)return t(r,n.concat(i.value));if("ContextEnd"===i.tokenType)return n[n.length-1]===i.value&&t(r,n.slice(0,-1));throw Error("Unexpected token: "+i.tokenType)}(e.map(function(t){var e=t.tokenType,n=t.value;return{tokenType:e,value:"ContextStart"===e?n.match(c)[1]:n.match(u)[1]}}))},t.lexer=p,t.richTextParser=v,t.version=y,Object.defineProperty(t,"__esModule",{value:!0})});
8
8
  //# sourceMappingURL=index.min.js.map
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects player richtext plugin
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 云垣
6
- * Version: v2.2.3
6
+ * Version: v2.2.4
7
7
  */
8
8
 
9
9
  import * as EFFECTS from '@galacean/effects';
@@ -563,7 +563,7 @@ RichTextComponent = __decorate([
563
563
 
564
564
  /**
565
565
  * 插件版本号
566
- */ var version = "2.2.3";
566
+ */ var version = "2.2.4";
567
567
  registerPlugin("richtext", RichTextLoader, VFXItem, true);
568
568
  logger.info("Plugin rich text version: " + version + ".");
569
569
  if (version !== EFFECTS.version) {
package/dist/weapp.js CHANGED
@@ -578,7 +578,7 @@ exports.RichTextComponent = __decorate([
578
578
 
579
579
  /**
580
580
  * 插件版本号
581
- */ var version = "2.2.3";
581
+ */ var version = "2.2.4";
582
582
  EFFECTS.registerPlugin("richtext", RichTextLoader, EFFECTS.VFXItem, true);
583
583
  EFFECTS.logger.info("Plugin rich text version: " + version + ".");
584
584
  if (version !== EFFECTS__namespace.version) {
package/dist/weapp.mjs CHANGED
@@ -555,7 +555,7 @@ RichTextComponent = __decorate([
555
555
 
556
556
  /**
557
557
  * 插件版本号
558
- */ var version = "2.2.3";
558
+ */ var version = "2.2.4";
559
559
  registerPlugin("richtext", RichTextLoader, VFXItem, true);
560
560
  logger.info("Plugin rich text version: " + version + ".");
561
561
  if (version !== EFFECTS.version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-plugin-rich-text",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Galacean Effects player richtext plugin",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "registry": "https://registry.npmjs.org"
44
44
  },
45
45
  "devDependencies": {
46
- "@galacean/effects": "2.2.3"
46
+ "@galacean/effects": "2.2.4"
47
47
  },
48
48
  "scripts": {
49
49
  "dev": "vite",