isdata-customer-sdk 0.1.96 → 0.1.98
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.common.js +16 -11
- package/dist/index.common.js.map +1 -1
- package/dist/index.umd.js +16 -11
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -33173,9 +33173,13 @@ function processElement(element) {
|
|
|
33173
33173
|
for (let i = 0; i < children.length; i++) {
|
|
33174
33174
|
processElement(children[i]);
|
|
33175
33175
|
}
|
|
33176
|
-
|
|
33176
|
+
// 检查是否是input元素
|
|
33177
|
+
const isButtonElement = element.tagName === "BUTTON";
|
|
33178
|
+
if (!isButtonElement) {
|
|
33179
|
+
return false;
|
|
33180
|
+
}
|
|
33177
33181
|
}
|
|
33178
|
-
element.setAttribute("i18nProcessed", "true"); // 标记元素已被处理
|
|
33182
|
+
// element.setAttribute("i18nProcessed", "true"); // 标记元素已被处理
|
|
33179
33183
|
// 检查是否是input元素
|
|
33180
33184
|
const isInputElement = element.tagName === "INPUT";
|
|
33181
33185
|
// 检查placeholder是否匹配
|
|
@@ -33188,10 +33192,10 @@ function processElement(element) {
|
|
|
33188
33192
|
|
|
33189
33193
|
// 检查innerHTML是否匹配(仅对没有子元素的元素)
|
|
33190
33194
|
let innerHTMLMatch = null;
|
|
33191
|
-
if (!hasChildren) {
|
|
33192
|
-
|
|
33193
|
-
|
|
33194
|
-
}
|
|
33195
|
+
// if (!hasChildren) {
|
|
33196
|
+
const innerHTML = element.innerHTML;
|
|
33197
|
+
innerHTMLMatch = checkTextFormat(innerHTML);
|
|
33198
|
+
// }
|
|
33195
33199
|
|
|
33196
33200
|
// 如果没有匹配的内容,则不处理
|
|
33197
33201
|
if (!placeholderMatch && !valueMatch && !innerHTMLMatch) {
|
|
@@ -33232,8 +33236,8 @@ function processElement(element) {
|
|
|
33232
33236
|
oldValue: innerHTMLMatch ? element.innerHTML : null,
|
|
33233
33237
|
oldPlaceholderValue: placeholderMatch ? placeholder : null,
|
|
33234
33238
|
oldValueValue: valueMatch ? value : null,
|
|
33235
|
-
isInputElement: isInputElement
|
|
33236
|
-
hasChildren: hasChildren
|
|
33239
|
+
isInputElement: isInputElement
|
|
33240
|
+
// hasChildren: hasChildren,
|
|
33237
33241
|
});
|
|
33238
33242
|
applyTranslation(element);
|
|
33239
33243
|
return true;
|
|
@@ -33311,8 +33315,8 @@ const applyTranslation = async element => {
|
|
|
33311
33315
|
}
|
|
33312
33316
|
}
|
|
33313
33317
|
|
|
33314
|
-
// 处理innerHTML
|
|
33315
|
-
if (
|
|
33318
|
+
// 处理innerHTML
|
|
33319
|
+
if (cachedItem.key) {
|
|
33316
33320
|
const key = element.getAttribute("localKey");
|
|
33317
33321
|
const oldValue = element.getAttribute("oldValue");
|
|
33318
33322
|
if (key && oldValue) {
|
|
@@ -33340,7 +33344,8 @@ const initDomNodeI18NObserver = () => {
|
|
|
33340
33344
|
} else {
|
|
33341
33345
|
window.i18nElementsMap.clear();
|
|
33342
33346
|
}
|
|
33343
|
-
registerEventListener("IPORTAL_LANGUAGE_CHANGE_EVENT", async
|
|
33347
|
+
registerEventListener("IPORTAL_LANGUAGE_CHANGE_EVENT", async data => {
|
|
33348
|
+
const lang = data.lang;
|
|
33344
33349
|
console.log("语言切换事件触发,更新已处理元素的翻译:", lang);
|
|
33345
33350
|
// 遍历Map,更新每个已处理元素的翻译
|
|
33346
33351
|
for (const [elementId, item] of window.i18nElementsMap.entries()) {
|