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.
@@ -33163,9 +33163,13 @@ function processElement(element) {
33163
33163
  for (let i = 0; i < children.length; i++) {
33164
33164
  processElement(children[i]);
33165
33165
  }
33166
- return false;
33166
+ // 检查是否是input元素
33167
+ const isButtonElement = element.tagName === "BUTTON";
33168
+ if (!isButtonElement) {
33169
+ return false;
33170
+ }
33167
33171
  }
33168
- element.setAttribute("i18nProcessed", "true"); // 标记元素已被处理
33172
+ // element.setAttribute("i18nProcessed", "true"); // 标记元素已被处理
33169
33173
  // 检查是否是input元素
33170
33174
  const isInputElement = element.tagName === "INPUT";
33171
33175
  // 检查placeholder是否匹配
@@ -33178,10 +33182,10 @@ function processElement(element) {
33178
33182
 
33179
33183
  // 检查innerHTML是否匹配(仅对没有子元素的元素)
33180
33184
  let innerHTMLMatch = null;
33181
- if (!hasChildren) {
33182
- const innerHTML = element.innerHTML;
33183
- innerHTMLMatch = checkTextFormat(innerHTML);
33184
- }
33185
+ // if (!hasChildren) {
33186
+ const innerHTML = element.innerHTML;
33187
+ innerHTMLMatch = checkTextFormat(innerHTML);
33188
+ // }
33185
33189
 
33186
33190
  // 如果没有匹配的内容,则不处理
33187
33191
  if (!placeholderMatch && !valueMatch && !innerHTMLMatch) {
@@ -33222,8 +33226,8 @@ function processElement(element) {
33222
33226
  oldValue: innerHTMLMatch ? element.innerHTML : null,
33223
33227
  oldPlaceholderValue: placeholderMatch ? placeholder : null,
33224
33228
  oldValueValue: valueMatch ? value : null,
33225
- isInputElement: isInputElement,
33226
- hasChildren: hasChildren
33229
+ isInputElement: isInputElement
33230
+ // hasChildren: hasChildren,
33227
33231
  });
33228
33232
  applyTranslation(element);
33229
33233
  return true;
@@ -33301,8 +33305,8 @@ const applyTranslation = async element => {
33301
33305
  }
33302
33306
  }
33303
33307
 
33304
- // 处理innerHTML(如果没有子元素)
33305
- if (!cachedItem.hasChildren && cachedItem.key) {
33308
+ // 处理innerHTML
33309
+ if (cachedItem.key) {
33306
33310
  const key = element.getAttribute("localKey");
33307
33311
  const oldValue = element.getAttribute("oldValue");
33308
33312
  if (key && oldValue) {
@@ -33330,7 +33334,8 @@ const initDomNodeI18NObserver = () => {
33330
33334
  } else {
33331
33335
  window.i18nElementsMap.clear();
33332
33336
  }
33333
- registerEventListener("IPORTAL_LANGUAGE_CHANGE_EVENT", async lang => {
33337
+ registerEventListener("IPORTAL_LANGUAGE_CHANGE_EVENT", async data => {
33338
+ const lang = data.lang;
33334
33339
  console.log("语言切换事件触发,更新已处理元素的翻译:", lang);
33335
33340
  // 遍历Map,更新每个已处理元素的翻译
33336
33341
  for (const [elementId, item] of window.i18nElementsMap.entries()) {