@lvce-editor/main-area-worker 7.3.0 → 8.0.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.
@@ -1420,6 +1420,10 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1420
1420
  number(y);
1421
1421
  await invoke('ContextMenu.show2', uid, menuId, x, y, args);
1422
1422
  };
1423
+ const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
1424
+ const command = 'ClipBoard.handleMessagePort';
1425
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
1426
+ };
1423
1427
  const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1424
1428
  const command = 'IconTheme.handleMessagePort';
1425
1429
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
@@ -2664,18 +2668,13 @@ const handleModifiedStatusChange = (state, uri, newStatus) => {
2664
2668
  };
2665
2669
  };
2666
2670
 
2667
- const handleResize = async (state, x, y, width, height) => {
2668
- number(x);
2669
- number(y);
2670
- number(width);
2671
- number(height);
2672
- const newState = {
2673
- ...state,
2671
+ const handleResize = async (state, dimensions) => {
2672
+ const {
2674
2673
  height,
2675
2674
  width,
2676
2675
  x,
2677
2676
  y
2678
- };
2677
+ } = dimensions;
2679
2678
 
2680
2679
  // Resize all editor children to their new bounds
2681
2680
  const {
@@ -2686,26 +2685,28 @@ const handleResize = async (state, x, y, width, height) => {
2686
2685
  groups
2687
2686
  } = layout;
2688
2687
  const contentHeight = height - tabHeight;
2688
+ const allResizeCommands = [];
2689
2689
  for (const group of groups) {
2690
2690
  for (const tab of group.tabs) {
2691
2691
  if (tab.editorUid !== -1) {
2692
- await invoke('Viewlet.setBounds', tab.editorUid, {
2692
+ const resizeCommands = await invoke('Viewlet.resize', tab.editorUid, {
2693
2693
  height: contentHeight,
2694
2694
  width,
2695
2695
  x,
2696
2696
  y: y + tabHeight
2697
2697
  });
2698
+ allResizeCommands.push(...resizeCommands);
2698
2699
  }
2699
2700
  }
2700
2701
  }
2701
- return newState;
2702
+ return allResizeCommands;
2702
2703
  };
2703
2704
 
2704
2705
  const show2 = async (uid, menuId, x, y, args) => {
2705
2706
  await showContextMenu2(uid, menuId, x, y, args);
2706
2707
  };
2707
2708
 
2708
- const handleTabContextMenu = async (state, x, y) => {
2709
+ const handleTabContextMenu = async (state, button, x, y) => {
2709
2710
  number(x);
2710
2711
  number(y);
2711
2712
  const {
@@ -2957,7 +2958,19 @@ const tryRestoreLayout = savedState => {
2957
2958
  if (!isValidMainAreaLayout(layout)) {
2958
2959
  return undefined;
2959
2960
  }
2960
- return layout;
2961
+
2962
+ // Normalize all tabs to have editorUid: -1 so SelectTab will create viewlets
2963
+ const normalizedLayout = {
2964
+ ...layout,
2965
+ groups: layout.groups.map(group => ({
2966
+ ...group,
2967
+ tabs: group.tabs.map(tab => ({
2968
+ ...tab,
2969
+ editorUid: -1
2970
+ }))
2971
+ }))
2972
+ };
2973
+ return normalizedLayout;
2961
2974
  };
2962
2975
 
2963
2976
  const createViewlets = async (layout, viewletModuleIds, bounds) => {
@@ -4091,13 +4104,6 @@ const renderEventListeners = () => {
4091
4104
  }];
4092
4105
  };
4093
4106
 
4094
- const resize = (state, dimensions) => {
4095
- return {
4096
- ...state,
4097
- ...dimensions
4098
- };
4099
- };
4100
-
4101
4107
  const getActiveTab = state => {
4102
4108
  const {
4103
4109
  layout
@@ -4265,7 +4271,8 @@ const commandMap = {
4265
4271
  'MainArea.handleDoubleClick': wrapCommand(handleDoubleClick),
4266
4272
  'MainArea.handleHeaderDoubleClick': wrapCommand(handleHeaderDoubleClick),
4267
4273
  'MainArea.handleModifiedStatusChange': wrapCommand(handleModifiedStatusChange),
4268
- 'MainArea.handleResize': wrapCommand(handleResize),
4274
+ 'MainArea.handleResize': wrapGetter(handleResize),
4275
+ // TODO would need to have a function that returns newstate as well as commands
4269
4276
  'MainArea.handleTabContextMenu': wrapCommand(handleTabContextMenu),
4270
4277
  'MainArea.handleUriChange': wrapCommand(handleUriChange),
4271
4278
  'MainArea.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
@@ -4276,7 +4283,7 @@ const commandMap = {
4276
4283
  'MainArea.refresh': wrapCommand(refresh),
4277
4284
  'MainArea.render2': render2,
4278
4285
  'MainArea.renderEventListeners': renderEventListeners,
4279
- 'MainArea.resize': wrapCommand(resize),
4286
+ 'MainArea.resize': wrapGetter(handleResize),
4280
4287
  'MainArea.save': wrapCommand(save),
4281
4288
  'MainArea.saveState': wrapGetter(saveState),
4282
4289
  'MainArea.selectTab': wrapCommand(selectTab),
@@ -4287,7 +4294,7 @@ const commandMap = {
4287
4294
 
4288
4295
  const sendMessagePortToClipBoardWorker = async port => {
4289
4296
  // @ts-ignore
4290
- await undefined(port, 0);
4297
+ await sendMessagePortToClipBoardWorker$1(port, 0);
4291
4298
  };
4292
4299
 
4293
4300
  const initializeClipBoardWorker = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "7.3.0",
3
+ "version": "8.0.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",