@lvce-editor/main-area-worker 9.2.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, {
@@ -4610,6 +4614,17 @@ const diffTree = (oldNodes, newNodes) => {
4610
4614
  return removeTrailingNavigationPatches(patches);
4611
4615
  };
4612
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
+
4613
4628
  const renderContent = content => {
4614
4629
  return [{
4615
4630
  childCount: 1,
@@ -4622,17 +4637,6 @@ const renderContent = content => {
4622
4637
  }, text(content)];
4623
4638
  };
4624
4639
 
4625
- const HandleContextMenu = 2;
4626
- const HandleClickAction = 10;
4627
- const HandleClick = 11;
4628
- const HandleClickClose = 12;
4629
- const HandleClickTab = 13;
4630
- const HandleTabContextMenu = 14;
4631
- const HandleHeaderDoubleClick = 15;
4632
- const HandleSashPointerDown = 16;
4633
- const HandleSashPointerMove = 17;
4634
- const HandleSashPointerUp = 18;
4635
-
4636
4640
  const renderError = errorMessage => {
4637
4641
  return [{
4638
4642
  childCount: 2,
@@ -4963,6 +4967,20 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false, width = 0) =>
4963
4967
  const isSplit = groups.length > 1;
4964
4968
  const directionClassName = isSplit ? direction === Horizontal ? EditorGroupsVertical : EditorGroupsHorizontal : '';
4965
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
+ }
4966
4984
  let childCount = 0;
4967
4985
  for (let i = 0; i < groups.length; i++) {
4968
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.2.0",
3
+ "version": "9.3.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",