@lvce-editor/main-area-worker 9.47.0 → 9.48.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.
@@ -3495,6 +3495,15 @@ const focusPreviousTab = async state => {
3495
3495
  return selectTab(state, activeGroupIndex, previousTabIndex);
3496
3496
  };
3497
3497
 
3498
+ const getActiveEditorUid = state => {
3499
+ const activeTab = getActiveTab(state);
3500
+ const editorUid = activeTab?.tab.editorUid;
3501
+ if (editorUid === undefined || editorUid < 0) {
3502
+ throw new Error('no active editor found');
3503
+ }
3504
+ return editorUid;
3505
+ };
3506
+
3498
3507
  const getMenuIds = () => {
3499
3508
  return [Main$1, Tab];
3500
3509
  };
@@ -5431,7 +5440,7 @@ const handleIconThemeChange = async state => {
5431
5440
  };
5432
5441
  };
5433
5442
 
5434
- const handleMessagePort = async (port, viewletCommandMap) => {
5443
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
5435
5444
  const executeViewletCommand = async (uid, command, ...args) => {
5436
5445
  const fn = viewletCommandMap[`MainArea.${command}`];
5437
5446
  if (typeof fn !== 'function') {
@@ -5446,7 +5455,9 @@ const handleMessagePort = async (port, viewletCommandMap) => {
5446
5455
  },
5447
5456
  messagePort: port
5448
5457
  });
5449
- set(rpc);
5458
+ if (setAsRendererProcess) {
5459
+ set(rpc);
5460
+ }
5450
5461
  };
5451
5462
 
5452
5463
  const handleModifiedStatusChange = (state, uri, newStatus) => {
@@ -8306,7 +8317,8 @@ const resize = async (uid, dimensions) => {
8306
8317
  set$1(uid, instance.oldState, resizedState);
8307
8318
  return handleResize(resizedState, dimensions);
8308
8319
  };
8309
- const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
8320
+ const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
8321
+ const handleTestWorkerMessagePort = port => handleMessagePort(port, commandMap, false);
8310
8322
  const commandMap = {
8311
8323
  'Main.closeActiveEditor': wrapSerialCommand(closeActiveEditor),
8312
8324
  'Main.closeAll': wrapSerialCommand(closeAll$1),
@@ -8353,6 +8365,7 @@ const commandMap = {
8353
8365
  'MainArea.focusNextTab': wrapSerialCommand(focusNextTab),
8354
8366
  'MainArea.focusPrevious': wrapSerialCommand(focusPreviousTab),
8355
8367
  'MainArea.focusPreviousTab': wrapSerialCommand(focusPreviousTab),
8368
+ 'MainArea.getActiveEditorUid': wrapGetter(getActiveEditorUid),
8356
8369
  'MainArea.getCommandIds': getCommandIds,
8357
8370
  'MainArea.getMenuEntries': wrapGetter(getMenuEntries),
8358
8371
  'MainArea.getMenuIds': getMenuIds,
@@ -8381,6 +8394,7 @@ const commandMap = {
8381
8394
  'MainArea.handleSashPointerUp': wrapSerialCommand(handleSashPointerUp),
8382
8395
  'MainArea.handleTabContextMenu': wrapSerialCommand(handleTabContextMenu),
8383
8396
  'MainArea.handleTabMouseUp': wrapSerialCommand(resetPointerDown),
8397
+ 'MainArea.handleTestWorkerMessagePort': handleTestWorkerMessagePort,
8384
8398
  'MainArea.handleUriChange': wrapSerialCommand(handleUriChange),
8385
8399
  'MainArea.handleWorkspaceChange': wrapSerialCommand(handleWorkspaceChange),
8386
8400
  'MainArea.handleWorkspaceRefresh': wrapAsyncCommand(handleWorkspaceRefreshWithContext),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.47.0",
3
+ "version": "9.48.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",