增加移除规则标记末尾的中文

This commit is contained in:
onvia 2023-09-15 10:39:40 +08:00
parent 12975ba1a8
commit 963a48256a
4 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ccc-tnt-psd2ui",
"version": "1.0.2",
"version": "1.0.3",
"description": "",
"main": "index.js",
"scripts": {

View File

@ -1256,11 +1256,14 @@
return obj;
}
removeChineseFromEnd(inputString) {
if (!inputString) {
return inputString;
}
const chineseRegex = /[\u4e00-\u9fa5]+$/;
const match = inputString.match(chineseRegex);
const match = inputString.trim().match(chineseRegex);
if (match && match[0]) {
const chineseLength = match[0].length;
return inputString.slice(0, -chineseLength);
return this.removeChineseFromEnd(inputString.slice(0, -chineseLength));
}
return inputString;
}

View File

@ -206,12 +206,15 @@ export abstract class PsdLayer {
return obj;
}
removeChineseFromEnd(inputString: string): string {
if (!inputString) {
return inputString;
}
const chineseRegex = /[\u4e00-\u9fa5]+$/;
const match = inputString.match(chineseRegex);
const match = inputString.trim().match(chineseRegex);
if (match && match[0]) {
const chineseLength = match[0].length;
return inputString.slice(0, -chineseLength);
return this.removeChineseFromEnd(inputString.slice(0, -chineseLength));
}
return inputString;

View File

@ -190,7 +190,7 @@ function reWriteVersion() {
cocosVersion = "v3.4.+"
//cocosVersion = "v2.4.x"
const pluginVersion = "1.0.1"; // 打包之前记得修改这里的版本号第三位为只更新lib文件前两位为更新整个插件。
const pluginVersion = "1.0.3"; // 打包之前记得修改这里的版本号第三位为只更新lib文件前两位为更新整个插件。
console.log(`打包版本号为${pluginVersion}\n记得升级版本号~\n版本规则第三位为只更新lib文件前两位为更新整个插件。\n调用本脚本时,会自动赋值给插件版本号`);