@lvce-editor/renderer-process 11.3.0 → 11.4.0

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.
@@ -1703,7 +1703,7 @@ const getEventListenerArg = (param, event) => {
1703
1703
  case 'event.detail':
1704
1704
  return event.detail;
1705
1705
  case 'event.target.name':
1706
- return event.target.name;
1706
+ return event.target.name || '';
1707
1707
  case 'event.target.href':
1708
1708
  return event.target.href;
1709
1709
  case 'event.target.src':
@@ -1794,28 +1794,40 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
1794
1794
  const isTreeFocused = activeElement?.getAttribute('role') === 'tree';
1795
1795
  const isRootTree = $Viewlet.getAttribute('role') === 'tree' && activeElement === $Viewlet;
1796
1796
  const focused = activeElement?.getAttribute('name');
1797
+ const $Hidden = document.createElement('div');
1798
+ $Hidden.style.display = 'none';
1799
+ if (focused) {
1800
+ if (document.body) {
1801
+ document.body.append($Hidden);
1802
+ }
1803
+ // @ts-ignore
1804
+ $Hidden.append(activeElement);
1805
+ }
1797
1806
  const $$Inputs = queryInputs($Viewlet);
1798
1807
  const inputMap = Object.create(null);
1799
1808
  for (const $Input of $$Inputs) {
1800
- // @ts-ignore
1801
1809
  inputMap[$Input.name] = $Input.value;
1802
1810
  }
1803
1811
  if (uid) {
1804
1812
  const newEventMap = getEventListenerMap(uid);
1805
1813
  const $New = render(dom, eventMap, newEventMap).firstChild;
1806
1814
  setComponentUid($New, uid);
1807
- // @ts-ignore
1815
+ const $$NewInputs = queryInputs($New);
1816
+ for (const $Input of $$NewInputs) {
1817
+ $Input.value = inputMap[$Input.name] || $Input.value || '';
1818
+ }
1808
1819
  $Viewlet.replaceWith($New);
1809
- // @ts-ignore
1820
+ if (focused) {
1821
+ const $NewFocused = $New.querySelector(`[name="${focused}"]`);
1822
+ if ($NewFocused) {
1823
+ $NewFocused.replaceWith($Hidden.firstChild);
1824
+ }
1825
+ }
1826
+ $Hidden.remove();
1810
1827
  $Viewlet = $New;
1811
1828
  } else {
1812
1829
  renderInto($Viewlet, dom, eventMap);
1813
1830
  }
1814
- const $$NewInputs = queryInputs($Viewlet);
1815
- for (const $Input of $$NewInputs) {
1816
- // @ts-ignore
1817
- $Input.value = inputMap[$Input.name] || $Input.value || '';
1818
- }
1819
1831
  if (isRootTree) {
1820
1832
  $Viewlet.focus();
1821
1833
  } else if (isTreeFocused) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "11.3.0",
3
+ "version": "11.4.0",
4
4
  "description": "",
5
5
  "main": "dist/rendererProcessMain.js",
6
6
  "type": "module",