@lvce-editor/main-area-worker 7.4.0 → 8.1.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.
@@ -2216,11 +2216,9 @@ const focusNextTab = async state => {
2216
2216
  return state;
2217
2217
  }
2218
2218
 
2219
- // If not at the last tab, select the next tab
2220
- if (activeTabIndex < activeGroup.tabs.length - 1) {
2221
- return selectTab(state, activeGroupIndex, activeTabIndex + 1);
2222
- }
2223
- return state;
2219
+ // If not at the last tab, select the next tab, otherwise cycle to first
2220
+ const nextTabIndex = activeTabIndex < activeGroup.tabs.length - 1 ? activeTabIndex + 1 : 0;
2221
+ return selectTab(state, activeGroupIndex, nextTabIndex);
2224
2222
  };
2225
2223
 
2226
2224
  const focusPreviousTab = async state => {
@@ -2250,11 +2248,9 @@ const focusPreviousTab = async state => {
2250
2248
  return state;
2251
2249
  }
2252
2250
 
2253
- // If not at the first tab, select the previous tab
2254
- if (activeTabIndex > 0) {
2255
- return selectTab(state, activeGroupIndex, activeTabIndex - 1);
2256
- }
2257
- return state;
2251
+ // If not at the first tab, select the previous tab, otherwise cycle to last
2252
+ const previousTabIndex = activeTabIndex > 0 ? activeTabIndex - 1 : activeGroup.tabs.length - 1;
2253
+ return selectTab(state, activeGroupIndex, previousTabIndex);
2258
2254
  };
2259
2255
 
2260
2256
  const getMenuIds = () => {
@@ -2668,18 +2664,13 @@ const handleModifiedStatusChange = (state, uri, newStatus) => {
2668
2664
  };
2669
2665
  };
2670
2666
 
2671
- const handleResize = async (state, x, y, width, height) => {
2672
- number(x);
2673
- number(y);
2674
- number(width);
2675
- number(height);
2676
- const newState = {
2677
- ...state,
2667
+ const handleResize = async (state, dimensions) => {
2668
+ const {
2678
2669
  height,
2679
2670
  width,
2680
2671
  x,
2681
2672
  y
2682
- };
2673
+ } = dimensions;
2683
2674
 
2684
2675
  // Resize all editor children to their new bounds
2685
2676
  const {
@@ -2690,26 +2681,28 @@ const handleResize = async (state, x, y, width, height) => {
2690
2681
  groups
2691
2682
  } = layout;
2692
2683
  const contentHeight = height - tabHeight;
2684
+ const allResizeCommands = [];
2693
2685
  for (const group of groups) {
2694
2686
  for (const tab of group.tabs) {
2695
2687
  if (tab.editorUid !== -1) {
2696
- await invoke('Viewlet.setBounds', tab.editorUid, {
2688
+ const resizeCommands = await invoke('Viewlet.resize', tab.editorUid, {
2697
2689
  height: contentHeight,
2698
2690
  width,
2699
2691
  x,
2700
2692
  y: y + tabHeight
2701
2693
  });
2694
+ allResizeCommands.push(...resizeCommands);
2702
2695
  }
2703
2696
  }
2704
2697
  }
2705
- return newState;
2698
+ return allResizeCommands;
2706
2699
  };
2707
2700
 
2708
2701
  const show2 = async (uid, menuId, x, y, args) => {
2709
2702
  await showContextMenu2(uid, menuId, x, y, args);
2710
2703
  };
2711
2704
 
2712
- const handleTabContextMenu = async (state, x, y) => {
2705
+ const handleTabContextMenu = async (state, button, x, y) => {
2713
2706
  number(x);
2714
2707
  number(y);
2715
2708
  const {
@@ -4107,13 +4100,6 @@ const renderEventListeners = () => {
4107
4100
  }];
4108
4101
  };
4109
4102
 
4110
- const resize = (state, dimensions) => {
4111
- return {
4112
- ...state,
4113
- ...dimensions
4114
- };
4115
- };
4116
-
4117
4103
  const getActiveTab = state => {
4118
4104
  const {
4119
4105
  layout
@@ -4281,7 +4267,8 @@ const commandMap = {
4281
4267
  'MainArea.handleDoubleClick': wrapCommand(handleDoubleClick),
4282
4268
  'MainArea.handleHeaderDoubleClick': wrapCommand(handleHeaderDoubleClick),
4283
4269
  'MainArea.handleModifiedStatusChange': wrapCommand(handleModifiedStatusChange),
4284
- 'MainArea.handleResize': wrapCommand(handleResize),
4270
+ 'MainArea.handleResize': wrapGetter(handleResize),
4271
+ // TODO would need to have a function that returns newstate as well as commands
4285
4272
  'MainArea.handleTabContextMenu': wrapCommand(handleTabContextMenu),
4286
4273
  'MainArea.handleUriChange': wrapCommand(handleUriChange),
4287
4274
  'MainArea.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
@@ -4292,7 +4279,7 @@ const commandMap = {
4292
4279
  'MainArea.refresh': wrapCommand(refresh),
4293
4280
  'MainArea.render2': render2,
4294
4281
  'MainArea.renderEventListeners': renderEventListeners,
4295
- 'MainArea.resize': wrapCommand(resize),
4282
+ 'MainArea.resize': wrapGetter(handleResize),
4296
4283
  'MainArea.save': wrapCommand(save),
4297
4284
  'MainArea.saveState': wrapGetter(saveState),
4298
4285
  'MainArea.selectTab': wrapCommand(selectTab),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "7.4.0",
3
+ "version": "8.1.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,6 +11,6 @@
11
11
  "type": "module",
12
12
  "main": "dist/mainAreaWorkerMain.js",
13
13
  "dependencies": {
14
- "@lvce-editor/virtual-dom-worker": "^6.11.0"
14
+ "@lvce-editor/virtual-dom-worker": "^7.1.0"
15
15
  }
16
16
  }