@lvce-editor/virtual-dom 1.37.0 → 1.38.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
@@ -639,6 +639,15 @@ const getEventListenerArgs = (params, event) => {
639
639
  return serialized;
640
640
  };
641
641
 
642
+ const preventEventsMaybe = (info, event) => {
643
+ if (info.preventDefault) {
644
+ event.preventDefault();
645
+ }
646
+ if (info.stopPropagation) {
647
+ event.stopPropagation();
648
+ }
649
+ };
650
+
642
651
  const createFn = info => {
643
652
  const fn = event => {
644
653
  if (enabled()) {
@@ -652,6 +661,7 @@ const createFn = info => {
652
661
  }
653
662
  const uid = getComponentUidFromEvent(event);
654
663
  const args = getEventListenerArgs(info.params, event);
664
+ preventEventsMaybe(info, event);
655
665
  if (args.length === 0) {
656
666
  return;
657
667
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom",
3
- "version": "1.37.0",
3
+ "version": "1.38.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -3,6 +3,7 @@ import * as EventState from '../EventState/EventState.ts'
3
3
  import * as GetEventListenerArgs from '../GetEventListenerArgs/GetEventListenerArgs.ts'
4
4
  import * as IpcState from '../IpcState/IpcState.ts'
5
5
  import * as NameAnonymousFunction from '../NameAnonymousFunction/NameAnonymousFunction.ts'
6
+ import { preventEventsMaybe } from '../PreventEventsMaybe/PreventEventsMaybe.ts'
6
7
 
7
8
  export const createFn = (info): any => {
8
9
  const fn = (event): void => {
@@ -17,6 +18,7 @@ export const createFn = (info): any => {
17
18
  }
18
19
  const uid = ComponentUid.getComponentUidFromEvent(event)
19
20
  const args = GetEventListenerArgs.getEventListenerArgs(info.params, event)
21
+ preventEventsMaybe(info, event)
20
22
  if (args.length === 0) {
21
23
  return
22
24
  }
@@ -0,0 +1,8 @@
1
+ export const preventEventsMaybe = (info: any, event: any): void => {
2
+ if (info.preventDefault) {
3
+ event.preventDefault()
4
+ }
5
+ if (info.stopPropagation) {
6
+ event.stopPropagation()
7
+ }
8
+ }