@lvce-editor/main-area-worker 9.1.0 → 9.3.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.
@@ -3194,13 +3194,14 @@ const show2 = async (uid, menuId, x, y, args) => {
3194
3194
  await showContextMenu2(uid, menuId, x, y, args);
3195
3195
  };
3196
3196
 
3197
+ const NoGroupId = -1;
3197
3198
  const handleContextMenu = async (state, rawGroupId, x, y) => {
3198
3199
  number(x);
3199
3200
  number(y);
3200
- if (!rawGroupId) {
3201
+ if (rawGroupId === undefined) {
3201
3202
  return state;
3202
3203
  }
3203
- const groupId = Number.parseInt(rawGroupId, 10);
3204
+ const groupId = rawGroupId === '' ? NoGroupId : Number.parseInt(rawGroupId, 10);
3204
3205
  if (Number.isNaN(groupId)) {
3205
3206
  return state;
3206
3207
  }
@@ -4065,8 +4066,11 @@ const menuEntrySeparator = {
4065
4066
  label: ''
4066
4067
  };
4067
4068
 
4069
+ const hasTargetGroup = groupId => {
4070
+ return groupId !== undefined && groupId >= 0;
4071
+ };
4068
4072
  const getArgs = groupId => {
4069
- if (groupId === undefined) {
4073
+ if (!hasTargetGroup(groupId)) {
4070
4074
  return undefined;
4071
4075
  }
4072
4076
  return [groupId];
@@ -4109,7 +4113,7 @@ const getMenuEntries$2 = groupId => {
4109
4113
  id: 'newWindow',
4110
4114
  label: newWindow()
4111
4115
  }];
4112
- if (groupId === undefined) {
4116
+ if (!hasTargetGroup(groupId)) {
4113
4117
  return entries;
4114
4118
  }
4115
4119
  return [...entries, menuEntrySeparator, {
@@ -4545,7 +4549,6 @@ const diffChildren = (oldChildren, newChildren, patches) => {
4545
4549
  patches.push({
4546
4550
  type: NavigateParent
4547
4551
  });
4548
- currentChildIndex = -1;
4549
4552
  }
4550
4553
  // Add remove patches in reverse order (highest index first)
4551
4554
  // This ensures indices remain valid as we remove
@@ -4611,6 +4614,17 @@ const diffTree = (oldNodes, newNodes) => {
4611
4614
  return removeTrailingNavigationPatches(patches);
4612
4615
  };
4613
4616
 
4617
+ const HandleContextMenu = 2;
4618
+ const HandleClickAction = 10;
4619
+ const HandleClick = 11;
4620
+ const HandleClickClose = 12;
4621
+ const HandleClickTab = 13;
4622
+ const HandleTabContextMenu = 14;
4623
+ const HandleHeaderDoubleClick = 15;
4624
+ const HandleSashPointerDown = 16;
4625
+ const HandleSashPointerMove = 17;
4626
+ const HandleSashPointerUp = 18;
4627
+
4614
4628
  const renderContent = content => {
4615
4629
  return [{
4616
4630
  childCount: 1,
@@ -4623,17 +4637,6 @@ const renderContent = content => {
4623
4637
  }, text(content)];
4624
4638
  };
4625
4639
 
4626
- const HandleContextMenu = 2;
4627
- const HandleClickAction = 10;
4628
- const HandleClick = 11;
4629
- const HandleClickClose = 12;
4630
- const HandleClickTab = 13;
4631
- const HandleTabContextMenu = 14;
4632
- const HandleHeaderDoubleClick = 15;
4633
- const HandleSashPointerDown = 16;
4634
- const HandleSashPointerMove = 17;
4635
- const HandleSashPointerUp = 18;
4636
-
4637
4640
  const renderError = errorMessage => {
4638
4641
  return [{
4639
4642
  childCount: 2,
@@ -4964,6 +4967,20 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false, width = 0) =>
4964
4967
  const isSplit = groups.length > 1;
4965
4968
  const directionClassName = isSplit ? direction === Horizontal ? EditorGroupsVertical : EditorGroupsHorizontal : '';
4966
4969
  const editorGroupsContainerClassName = directionClassName ? `${EDITOR_GROUPS_CONTAINER} ${directionClassName}` : EDITOR_GROUPS_CONTAINER;
4970
+ if (groups.length === 0) {
4971
+ return [{
4972
+ childCount: 1,
4973
+ className: Main,
4974
+ type: Div
4975
+ }, {
4976
+ childCount: 0,
4977
+ className: editorGroupsContainerClassName,
4978
+ 'data-groupId': '',
4979
+ onContextMenu: HandleContextMenu,
4980
+ role: None$1,
4981
+ type: Div
4982
+ }];
4983
+ }
4967
4984
  let childCount = 0;
4968
4985
  for (let i = 0; i < groups.length; i++) {
4969
4986
  if (i > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.1.0",
3
+ "version": "9.3.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",