@lark-apaas/miaoda-inspector 1.0.2 → 1.0.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.
@@ -9,8 +9,7 @@ import { ClickOverlay } from "../Inspector/Overlay";
9
9
  import {
10
10
  extractPropsFromFiber,
11
11
  getElementCodeInfo,
12
- getElementInspect,
13
- getParentElement
12
+ getElementInspect
14
13
  } from "../Inspector/utils";
15
14
  import {
16
15
  cx,
@@ -136,7 +135,7 @@ function MiaodaInspector(props) {
136
135
  const clickOverlay = new ClickOverlay({
137
136
  positionUpdate: () => {
138
137
  var _a2;
139
- const el = ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element) || element;
138
+ const el = element || ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element);
140
139
  const _coords = getElementCoordinates(el);
141
140
  postMessage({
142
141
  type: "ElementResize",
@@ -190,24 +189,23 @@ function MiaodaInspector(props) {
190
189
  const imageInfo = extractImageInfo(element);
191
190
  const dataMiaodaId = element.getAttribute("data-miaoda-id");
192
191
  const id = dataMiaodaId || elementInfoToKey(codeInfo.relativePath, codeInfo.lineNumber, codeInfo.columnNumber);
193
- const selectElement = selectedElementMap.has(id);
194
- if (!selectElement) {
195
- const originalState = {
196
- textContent: textInfo.textContent,
197
- styles: {},
198
- attributes: {},
199
- className: safeClassName(element)
200
- };
201
- if (element instanceof HTMLImageElement) {
202
- originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
203
- }
204
- selectedElementMap.set(id, {
205
- elementId: id,
206
- element,
207
- title,
208
- originalState
209
- });
192
+ const originalState = {
193
+ textContent: textInfo.textContent,
194
+ styles: {},
195
+ attributes: {},
196
+ className: safeClassName(element),
197
+ props: {},
198
+ iconProps: {}
199
+ };
200
+ if (element instanceof HTMLImageElement) {
201
+ originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
210
202
  }
203
+ selectedElementMap.set(id, {
204
+ elementId: id,
205
+ element,
206
+ title,
207
+ originalState
208
+ });
211
209
  const importSourceAttr = element.getAttribute("data-miaoda-import-source");
212
210
  const isAntdComponent = importSourceAttr === "antd" && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setProps;
213
211
  const isNativeTagImage = (imageInfo == null ? void 0 : imageInfo.type) === "img" && !isAntdComponent;
@@ -289,11 +287,10 @@ function MiaodaInspector(props) {
289
287
  if (!selectedElement || !selectedElement.element) {
290
288
  return;
291
289
  }
292
- const htmlElementParent = selectedElement.element.parentElement;
293
- if (!htmlElementParent) {
294
- return;
290
+ let targetElement = selectedElement.element.parentElement;
291
+ while (targetElement && !targetElement.dataset.miaodaComponentName) {
292
+ targetElement = targetElement.parentElement;
295
293
  }
296
- const targetElement = getParentElement(htmlElementParent);
297
294
  if (!targetElement) {
298
295
  return;
299
296
  }
@@ -321,7 +318,7 @@ function MiaodaInspector(props) {
321
318
  const updateIntervalRef = useRef(500);
322
319
  const handleMessage = useCallback(
323
320
  (event) => {
324
- var _a, _b, _c;
321
+ var _a, _b, _c, _d, _e;
325
322
  const { data } = event;
326
323
  if (isIncomingMessage(data, "InitConfig")) {
327
324
  const { inspectorActive, userToken, appId, inspectorVersion, updateInterval } = data.data;
@@ -352,34 +349,45 @@ function MiaodaInspector(props) {
352
349
  const { keepModifications = false } = data.data;
353
350
  (_b = clickOverlayRef.current) == null ? void 0 : _b.remove();
354
351
  clickOverlayRef.current = null;
355
- if (canUseNewInspector.current && !keepModifications) {
356
- for (const [_, selectedElement] of selectedElementMap.entries()) {
357
- if (selectedElement.element) {
358
- if (selectedElement.originalState.textContent) {
359
- selectedElement.element.textContent = selectedElement.originalState.textContent;
360
- }
361
- if (selectedElement.originalState.className && !(selectedElement.element instanceof SVGElement)) {
362
- selectedElement.element.className = selectedElement.originalState.className;
363
- }
352
+ if (canUseNewInspector.current) {
353
+ if (!keepModifications) {
354
+ for (const selectedElement of selectedElementMap.values()) {
355
+ (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
364
356
  }
365
- if (selectedElement.dispose) {
366
- selectedElement.dispose();
357
+ selectedElementMap.clear();
358
+ } else {
359
+ for (const selectedElement of selectedElementMap.values()) {
360
+ (_d = selectedElement.commit) == null ? void 0 : _d.call(selectedElement);
367
361
  }
368
362
  }
369
- selectedElementMap.clear();
370
363
  }
371
364
  } else if (isIncomingMessage(data, "ClearModification")) {
372
365
  const { elementId } = data.data;
373
366
  const selectedElement = selectedElementMap.get(elementId);
374
367
  if (selectedElement && selectedElement.element) {
375
368
  selectedElementMap.delete(elementId);
376
- (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
369
+ (_e = selectedElement.dispose) == null ? void 0 : _e.call(selectedElement);
377
370
  }
378
371
  } else if (isIncomingMessage(data, "EditText")) {
379
372
  const { elementId, textContent } = data.data;
380
373
  const selectedElement = selectedElementMap.get(elementId);
381
374
  if (selectedElement && selectedElement.element) {
382
- selectedElement.element.textContent = textContent;
375
+ const { element } = selectedElement;
376
+ element.textContent = textContent;
377
+ const existingDispose = selectedElement.dispose;
378
+ selectedElement.dispose = () => {
379
+ if (selectedElement.originalState.textContent) {
380
+ element.textContent = selectedElement.originalState.textContent;
381
+ }
382
+ existingDispose == null ? void 0 : existingDispose();
383
+ };
384
+ const existingCommit = selectedElement.commit;
385
+ selectedElement.commit = () => {
386
+ existingCommit == null ? void 0 : existingCommit();
387
+ if (selectedElement.originalState.textContent != null) {
388
+ selectedElement.originalState.textContent = element.textContent;
389
+ }
390
+ };
383
391
  }
384
392
  } else if (isIncomingMessage(data, "EditStyle")) {
385
393
  const { elementId, styles } = data.data;
@@ -410,6 +418,13 @@ function MiaodaInspector(props) {
410
418
  existingDispose();
411
419
  }
412
420
  };
421
+ const existingCommit = selectedElement.commit;
422
+ selectedElement.commit = () => {
423
+ existingCommit == null ? void 0 : existingCommit();
424
+ for (const property of Object.keys(selectedElement.originalState.styles)) {
425
+ selectedElement.originalState.styles[property] = element.style.getPropertyValue(property);
426
+ }
427
+ };
413
428
  }
414
429
  } else if (isIncomingMessage(data, "EditClassName")) {
415
430
  const { elementId, className } = data.data;
@@ -419,11 +434,19 @@ function MiaodaInspector(props) {
419
434
  if (selectedElement.originalState.className === void 0) {
420
435
  selectedElement.originalState.className = safeClassName(element);
421
436
  }
422
- element.className = cx(element.className, className);
437
+ if (!(element instanceof SVGElement)) {
438
+ element.className = cx(element.className, className);
439
+ } else {
440
+ element.className.baseVal = cx(element.className.baseVal, className);
441
+ }
423
442
  const existingDispose = selectedElement.dispose;
424
443
  const classDispose = () => {
425
444
  if (selectedElement.originalState.className) {
426
- element.className = selectedElement.originalState.className;
445
+ if (!(element instanceof SVGElement)) {
446
+ element.className = selectedElement.originalState.className;
447
+ } else {
448
+ element.className.baseVal = selectedElement.originalState.className;
449
+ }
427
450
  }
428
451
  };
429
452
  selectedElement.dispose = () => {
@@ -432,6 +455,11 @@ function MiaodaInspector(props) {
432
455
  existingDispose();
433
456
  }
434
457
  };
458
+ const existingCommit = selectedElement.commit;
459
+ selectedElement.commit = () => {
460
+ existingCommit == null ? void 0 : existingCommit();
461
+ selectedElement.originalState.className = safeClassName(element);
462
+ };
435
463
  }
436
464
  } else if (isIncomingMessage(data, "EditProps")) {
437
465
  const { elementId, props: _props } = data.data;
@@ -466,6 +494,9 @@ function MiaodaInspector(props) {
466
494
  const { elementId, prop, value } = data.data;
467
495
  const selectedElement = selectedElementMap.get(elementId);
468
496
  if (selectedElement && selectedElement.element) {
497
+ if (!(prop in selectedElement.originalState.iconProps)) {
498
+ selectedElement.originalState.iconProps[prop] = value;
499
+ }
469
500
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
470
501
  window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, value);
471
502
  } else {
@@ -479,9 +510,13 @@ function MiaodaInspector(props) {
479
510
  const existingDispose = selectedElement.dispose;
480
511
  const iconDispose = () => {
481
512
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
482
- window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, void 0);
513
+ window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, selectedElement.originalState.iconProps[prop]);
483
514
  } else if (selectedElement.element) {
484
- selectedElement.element.removeAttribute(`data-${prop}`);
515
+ if (selectedElement.originalState.iconProps[prop]) {
516
+ selectedElement.element.setAttribute(`data-${prop}`, String(selectedElement.originalState.iconProps[prop]));
517
+ } else {
518
+ selectedElement.element.removeAttribute(`data-${prop}`);
519
+ }
485
520
  }
486
521
  };
487
522
  selectedElement.dispose = () => {
@@ -490,11 +525,19 @@ function MiaodaInspector(props) {
490
525
  existingDispose();
491
526
  }
492
527
  };
528
+ const existingCommit = selectedElement.commit;
529
+ selectedElement.commit = () => {
530
+ existingCommit == null ? void 0 : existingCommit();
531
+ selectedElement.originalState.iconProps[prop] = value;
532
+ };
493
533
  }
494
534
  } else if (isIncomingMessage(data, "ReverseSelect")) {
495
535
  const { elementId } = data.data;
496
536
  const selectedElement = selectedElementMap.get(elementId);
497
537
  if (selectedElement && selectedElement.element) {
538
+ selectedElement.element.scrollIntoView({
539
+ block: "center"
540
+ });
498
541
  updateClickOverlay(selectedElement.element, selectedElement.title, selectedElement.elementId);
499
542
  }
500
543
  } else if (isIncomingMessage(data, "SelectParent")) {
@@ -537,6 +580,13 @@ function MiaodaInspector(props) {
537
580
  existingDispose();
538
581
  }
539
582
  };
583
+ const existingCommit = selectedElement.commit;
584
+ selectedElement.commit = () => {
585
+ existingCommit == null ? void 0 : existingCommit();
586
+ for (const attr of Object.keys(selectedElement.originalState.attributes)) {
587
+ selectedElement.originalState.attributes[attr] = element.getAttribute(attr);
588
+ }
589
+ };
540
590
  }
541
591
  }
542
592
  },
@@ -571,7 +621,7 @@ function MiaodaInspector(props) {
571
621
  postMessage({
572
622
  type: "PageMounted",
573
623
  data: {
574
- version: "1.0.2",
624
+ version: "1.0.4",
575
625
  feature: {
576
626
  selectParent: true,
577
627
  reverseSelect: true
@@ -153,7 +153,7 @@ function MiaodaInspector(props) {
153
153
  const clickOverlay = new import_Overlay.ClickOverlay({
154
154
  positionUpdate: () => {
155
155
  var _a2;
156
- const el = ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element) || element;
156
+ const el = element || ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element);
157
157
  const _coords = getElementCoordinates(el);
158
158
  (0, import_utils2.postMessage)({
159
159
  type: "ElementResize",
@@ -207,24 +207,23 @@ function MiaodaInspector(props) {
207
207
  const imageInfo = extractImageInfo(element);
208
208
  const dataMiaodaId = element.getAttribute("data-miaoda-id");
209
209
  const id = dataMiaodaId || elementInfoToKey(codeInfo.relativePath, codeInfo.lineNumber, codeInfo.columnNumber);
210
- const selectElement = selectedElementMap.has(id);
211
- if (!selectElement) {
212
- const originalState = {
213
- textContent: textInfo.textContent,
214
- styles: {},
215
- attributes: {},
216
- className: safeClassName(element)
217
- };
218
- if (element instanceof HTMLImageElement) {
219
- originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
220
- }
221
- selectedElementMap.set(id, {
222
- elementId: id,
223
- element,
224
- title,
225
- originalState
226
- });
210
+ const originalState = {
211
+ textContent: textInfo.textContent,
212
+ styles: {},
213
+ attributes: {},
214
+ className: safeClassName(element),
215
+ props: {},
216
+ iconProps: {}
217
+ };
218
+ if (element instanceof HTMLImageElement) {
219
+ originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
227
220
  }
221
+ selectedElementMap.set(id, {
222
+ elementId: id,
223
+ element,
224
+ title,
225
+ originalState
226
+ });
228
227
  const importSourceAttr = element.getAttribute("data-miaoda-import-source");
229
228
  const isAntdComponent = importSourceAttr === "antd" && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setProps;
230
229
  const isNativeTagImage = (imageInfo == null ? void 0 : imageInfo.type) === "img" && !isAntdComponent;
@@ -306,11 +305,10 @@ function MiaodaInspector(props) {
306
305
  if (!selectedElement || !selectedElement.element) {
307
306
  return;
308
307
  }
309
- const htmlElementParent = selectedElement.element.parentElement;
310
- if (!htmlElementParent) {
311
- return;
308
+ let targetElement = selectedElement.element.parentElement;
309
+ while (targetElement && !targetElement.dataset.miaodaComponentName) {
310
+ targetElement = targetElement.parentElement;
312
311
  }
313
- const targetElement = (0, import_utils.getParentElement)(htmlElementParent);
314
312
  if (!targetElement) {
315
313
  return;
316
314
  }
@@ -338,7 +336,7 @@ function MiaodaInspector(props) {
338
336
  const updateIntervalRef = (0, import_react.useRef)(500);
339
337
  const handleMessage = (0, import_react.useCallback)(
340
338
  (event) => {
341
- var _a, _b, _c;
339
+ var _a, _b, _c, _d, _e;
342
340
  const { data } = event;
343
341
  if ((0, import_utils2.isIncomingMessage)(data, "InitConfig")) {
344
342
  const { inspectorActive, userToken, appId, inspectorVersion, updateInterval } = data.data;
@@ -369,34 +367,45 @@ function MiaodaInspector(props) {
369
367
  const { keepModifications = false } = data.data;
370
368
  (_b = clickOverlayRef.current) == null ? void 0 : _b.remove();
371
369
  clickOverlayRef.current = null;
372
- if (canUseNewInspector.current && !keepModifications) {
373
- for (const [_, selectedElement] of selectedElementMap.entries()) {
374
- if (selectedElement.element) {
375
- if (selectedElement.originalState.textContent) {
376
- selectedElement.element.textContent = selectedElement.originalState.textContent;
377
- }
378
- if (selectedElement.originalState.className && !(selectedElement.element instanceof SVGElement)) {
379
- selectedElement.element.className = selectedElement.originalState.className;
380
- }
370
+ if (canUseNewInspector.current) {
371
+ if (!keepModifications) {
372
+ for (const selectedElement of selectedElementMap.values()) {
373
+ (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
381
374
  }
382
- if (selectedElement.dispose) {
383
- selectedElement.dispose();
375
+ selectedElementMap.clear();
376
+ } else {
377
+ for (const selectedElement of selectedElementMap.values()) {
378
+ (_d = selectedElement.commit) == null ? void 0 : _d.call(selectedElement);
384
379
  }
385
380
  }
386
- selectedElementMap.clear();
387
381
  }
388
382
  } else if ((0, import_utils2.isIncomingMessage)(data, "ClearModification")) {
389
383
  const { elementId } = data.data;
390
384
  const selectedElement = selectedElementMap.get(elementId);
391
385
  if (selectedElement && selectedElement.element) {
392
386
  selectedElementMap.delete(elementId);
393
- (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
387
+ (_e = selectedElement.dispose) == null ? void 0 : _e.call(selectedElement);
394
388
  }
395
389
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditText")) {
396
390
  const { elementId, textContent } = data.data;
397
391
  const selectedElement = selectedElementMap.get(elementId);
398
392
  if (selectedElement && selectedElement.element) {
399
- selectedElement.element.textContent = textContent;
393
+ const { element } = selectedElement;
394
+ element.textContent = textContent;
395
+ const existingDispose = selectedElement.dispose;
396
+ selectedElement.dispose = () => {
397
+ if (selectedElement.originalState.textContent) {
398
+ element.textContent = selectedElement.originalState.textContent;
399
+ }
400
+ existingDispose == null ? void 0 : existingDispose();
401
+ };
402
+ const existingCommit = selectedElement.commit;
403
+ selectedElement.commit = () => {
404
+ existingCommit == null ? void 0 : existingCommit();
405
+ if (selectedElement.originalState.textContent != null) {
406
+ selectedElement.originalState.textContent = element.textContent;
407
+ }
408
+ };
400
409
  }
401
410
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditStyle")) {
402
411
  const { elementId, styles } = data.data;
@@ -427,6 +436,13 @@ function MiaodaInspector(props) {
427
436
  existingDispose();
428
437
  }
429
438
  };
439
+ const existingCommit = selectedElement.commit;
440
+ selectedElement.commit = () => {
441
+ existingCommit == null ? void 0 : existingCommit();
442
+ for (const property of Object.keys(selectedElement.originalState.styles)) {
443
+ selectedElement.originalState.styles[property] = element.style.getPropertyValue(property);
444
+ }
445
+ };
430
446
  }
431
447
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditClassName")) {
432
448
  const { elementId, className } = data.data;
@@ -436,11 +452,19 @@ function MiaodaInspector(props) {
436
452
  if (selectedElement.originalState.className === void 0) {
437
453
  selectedElement.originalState.className = safeClassName(element);
438
454
  }
439
- element.className = (0, import_utils2.cx)(element.className, className);
455
+ if (!(element instanceof SVGElement)) {
456
+ element.className = (0, import_utils2.cx)(element.className, className);
457
+ } else {
458
+ element.className.baseVal = (0, import_utils2.cx)(element.className.baseVal, className);
459
+ }
440
460
  const existingDispose = selectedElement.dispose;
441
461
  const classDispose = () => {
442
462
  if (selectedElement.originalState.className) {
443
- element.className = selectedElement.originalState.className;
463
+ if (!(element instanceof SVGElement)) {
464
+ element.className = selectedElement.originalState.className;
465
+ } else {
466
+ element.className.baseVal = selectedElement.originalState.className;
467
+ }
444
468
  }
445
469
  };
446
470
  selectedElement.dispose = () => {
@@ -449,6 +473,11 @@ function MiaodaInspector(props) {
449
473
  existingDispose();
450
474
  }
451
475
  };
476
+ const existingCommit = selectedElement.commit;
477
+ selectedElement.commit = () => {
478
+ existingCommit == null ? void 0 : existingCommit();
479
+ selectedElement.originalState.className = safeClassName(element);
480
+ };
452
481
  }
453
482
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditProps")) {
454
483
  const { elementId, props: _props } = data.data;
@@ -483,6 +512,9 @@ function MiaodaInspector(props) {
483
512
  const { elementId, prop, value } = data.data;
484
513
  const selectedElement = selectedElementMap.get(elementId);
485
514
  if (selectedElement && selectedElement.element) {
515
+ if (!(prop in selectedElement.originalState.iconProps)) {
516
+ selectedElement.originalState.iconProps[prop] = value;
517
+ }
486
518
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
487
519
  window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, value);
488
520
  } else {
@@ -496,9 +528,13 @@ function MiaodaInspector(props) {
496
528
  const existingDispose = selectedElement.dispose;
497
529
  const iconDispose = () => {
498
530
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
499
- window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, void 0);
531
+ window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, selectedElement.originalState.iconProps[prop]);
500
532
  } else if (selectedElement.element) {
501
- selectedElement.element.removeAttribute(`data-${prop}`);
533
+ if (selectedElement.originalState.iconProps[prop]) {
534
+ selectedElement.element.setAttribute(`data-${prop}`, String(selectedElement.originalState.iconProps[prop]));
535
+ } else {
536
+ selectedElement.element.removeAttribute(`data-${prop}`);
537
+ }
502
538
  }
503
539
  };
504
540
  selectedElement.dispose = () => {
@@ -507,11 +543,19 @@ function MiaodaInspector(props) {
507
543
  existingDispose();
508
544
  }
509
545
  };
546
+ const existingCommit = selectedElement.commit;
547
+ selectedElement.commit = () => {
548
+ existingCommit == null ? void 0 : existingCommit();
549
+ selectedElement.originalState.iconProps[prop] = value;
550
+ };
510
551
  }
511
552
  } else if ((0, import_utils2.isIncomingMessage)(data, "ReverseSelect")) {
512
553
  const { elementId } = data.data;
513
554
  const selectedElement = selectedElementMap.get(elementId);
514
555
  if (selectedElement && selectedElement.element) {
556
+ selectedElement.element.scrollIntoView({
557
+ block: "center"
558
+ });
515
559
  updateClickOverlay(selectedElement.element, selectedElement.title, selectedElement.elementId);
516
560
  }
517
561
  } else if ((0, import_utils2.isIncomingMessage)(data, "SelectParent")) {
@@ -554,6 +598,13 @@ function MiaodaInspector(props) {
554
598
  existingDispose();
555
599
  }
556
600
  };
601
+ const existingCommit = selectedElement.commit;
602
+ selectedElement.commit = () => {
603
+ existingCommit == null ? void 0 : existingCommit();
604
+ for (const attr of Object.keys(selectedElement.originalState.attributes)) {
605
+ selectedElement.originalState.attributes[attr] = element.getAttribute(attr);
606
+ }
607
+ };
557
608
  }
558
609
  }
559
610
  },
@@ -588,7 +639,7 @@ function MiaodaInspector(props) {
588
639
  (0, import_utils2.postMessage)({
589
640
  type: "PageMounted",
590
641
  data: {
591
- version: "1.0.2",
642
+ version: "1.0.4",
592
643
  feature: {
593
644
  selectParent: true,
594
645
  reverseSelect: true
@@ -1,5 +1,5 @@
1
- import { useLayoutEffect as useLayoutEffect$1 } from 'react';
1
+ import { useEffect } from 'react';
2
2
 
3
- declare const useLayoutEffect: typeof useLayoutEffect$1;
3
+ declare const useLayoutEffect: typeof useEffect;
4
4
 
5
5
  export { useLayoutEffect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-inspector",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Inspector for Lark Apaas",
5
5
  "sideEffects": [
6
6
  "*.css"