@lvce-editor/virtual-dom 1.32.0 → 1.33.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.
package/dist/index.js CHANGED
@@ -533,6 +533,17 @@ const applyPatch = ($Element, patches) => {
533
533
  }
534
534
  };
535
535
 
536
+ let ignore = false;
537
+ const startIgnore = () => {
538
+ ignore = true;
539
+ };
540
+ const stopIgnore = () => {
541
+ ignore = false;
542
+ };
543
+ const enabled = () => {
544
+ return ignore;
545
+ };
546
+
536
547
  let id = 0;
537
548
  const create = () => {
538
549
  return ++id;
@@ -624,6 +635,9 @@ const getEventListenerArgs = (params, event) => {
624
635
 
625
636
  const createFn = info => {
626
637
  const fn = event => {
638
+ if (enabled()) {
639
+ return;
640
+ }
627
641
  if (info.preventDefault) {
628
642
  event.preventDefault(event);
629
643
  }
@@ -682,6 +696,7 @@ const render = (elements, eventMap = {}, newEventMap = {}) => {
682
696
  };
683
697
 
684
698
  const rememberFocus = ($Viewlet, dom, eventMap, uid = 0) => {
699
+ startIgnore();
685
700
  const oldLeft = $Viewlet.style.left;
686
701
  const oldTop = $Viewlet.style.top;
687
702
  const oldWidth = $Viewlet.style.width;
@@ -748,6 +763,7 @@ const rememberFocus = ($Viewlet, dom, eventMap, uid = 0) => {
748
763
  $Viewlet.style.left = oldLeft;
749
764
  $Viewlet.style.height = oldHeight;
750
765
  $Viewlet.style.width = oldWidth;
766
+ stopIgnore();
751
767
  return $Viewlet;
752
768
  };
753
769
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -1,10 +1,14 @@
1
1
  import * as ComponentUid from '../ComponentUid/ComponentUid.ts'
2
+ import * as EventState from '../EventState/EventState.ts'
2
3
  import * as GetEventListenerArgs from '../GetEventListenerArgs/GetEventListenerArgs.ts'
3
4
  import * as IpcState from '../IpcState/IpcState.ts'
4
5
  import * as NameAnonymousFunction from '../NameAnonymousFunction/NameAnonymousFunction.ts'
5
6
 
6
7
  export const createFn = (info): any => {
7
8
  const fn = (event): void => {
9
+ if (EventState.enabled()) {
10
+ return
11
+ }
8
12
  if (info.preventDefault) {
9
13
  event.preventDefault(event)
10
14
  }
@@ -0,0 +1,13 @@
1
+ let ignore = false
2
+
3
+ export const startIgnore = (): void => {
4
+ ignore = true
5
+ }
6
+
7
+ export const stopIgnore = (): void => {
8
+ ignore = false
9
+ }
10
+
11
+ export const enabled = (): boolean => {
12
+ return ignore
13
+ }
@@ -1,4 +1,5 @@
1
1
  import * as ComponentUid from '../ComponentUid/ComponentUid.ts'
2
+ import * as EventState from '../EventState/EventState.ts'
2
3
  import * as QueryInputs from '../QueryInputs/QueryInputs.ts'
3
4
  import * as RegisterEventListeners from '../RegisterEventListeners/RegisterEventListeners.ts'
4
5
  import * as VirtualDom from '../VirtualDom/VirtualDom.ts'
@@ -9,6 +10,7 @@ export const rememberFocus = (
9
10
  eventMap: any,
10
11
  uid = 0,
11
12
  ): any => {
13
+ EventState.startIgnore()
12
14
  const oldLeft = $Viewlet.style.left
13
15
  const oldTop = $Viewlet.style.top
14
16
  const oldWidth = $Viewlet.style.width
@@ -81,5 +83,7 @@ export const rememberFocus = (
81
83
  $Viewlet.style.height = oldHeight
82
84
  $Viewlet.style.width = oldWidth
83
85
 
86
+ EventState.stopIgnore()
87
+
84
88
  return $Viewlet
85
89
  }