@lvce-editor/main-area-worker 9.45.0 → 9.46.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.
@@ -3898,15 +3898,8 @@ const Directory = 3;
3898
3898
  const DirectoryExpanded = 4;
3899
3899
  const File = 7;
3900
3900
 
3901
- const isLocalEditorInput = editorInput => {
3902
- if (editorInput.type !== 'editor') {
3903
- return false;
3904
- }
3905
- return editorInput.uri.startsWith('file://') || !editorInput.uri.includes('://');
3906
- };
3907
-
3908
3901
  const shouldCheckDirectoryEditorInput = editorInput => {
3909
- if (!isLocalEditorInput(editorInput)) {
3902
+ if (editorInput.type !== 'editor') {
3910
3903
  return false;
3911
3904
  }
3912
3905
  const baseName = editorInput.uri.slice(editorInput.uri.lastIndexOf('/') + 1);
@@ -5166,7 +5159,7 @@ const getDropAction = async uris => {
5166
5159
  type: 'editor',
5167
5160
  uri
5168
5161
  }))) {
5169
- if (uri.startsWith('file://')) {
5162
+ if (uri.includes('://')) {
5170
5163
  return {
5171
5164
  command: 'setUri',
5172
5165
  value: uri
@@ -5434,9 +5427,19 @@ const set = rpc => {
5434
5427
  state.connected = true;
5435
5428
  };
5436
5429
 
5437
- const handleMessagePort = async port => {
5430
+ const handleMessagePort = async (port, viewletCommandMap) => {
5431
+ const executeViewletCommand = async (uid, command, ...args) => {
5432
+ const fn = viewletCommandMap[`MainArea.${command}`];
5433
+ if (typeof fn !== 'function') {
5434
+ throw new TypeError(`Viewlet command not found: ${command}`);
5435
+ }
5436
+ await fn(uid, ...args);
5437
+ await invoke$1('Viewlet.requestRender', uid);
5438
+ };
5438
5439
  const rpc = await create$8({
5439
- commandMap: {},
5440
+ commandMap: {
5441
+ 'Viewlet.executeViewletCommand': executeViewletCommand
5442
+ },
5440
5443
  messagePort: port
5441
5444
  });
5442
5445
  set(rpc);
@@ -8299,6 +8302,7 @@ const resize = async (uid, dimensions) => {
8299
8302
  set$1(uid, instance.oldState, resizedState);
8300
8303
  return handleResize(resizedState, dimensions);
8301
8304
  };
8305
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
8302
8306
  const commandMap = {
8303
8307
  'Main.closeActiveEditor': wrapSerialCommand(closeActiveEditor),
8304
8308
  'Main.closeAll': wrapSerialCommand(closeAll$1),
@@ -8362,7 +8366,7 @@ const commandMap = {
8362
8366
  'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
8363
8367
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
8364
8368
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
8365
- 'MainArea.handleMessagePort': handleMessagePort,
8369
+ 'MainArea.handleMessagePort': handleDirectMessagePort,
8366
8370
  'MainArea.handleModifiedStatusChange': wrapAsyncCommand(handleModifiedStatusChangeWithContext),
8367
8371
  'MainArea.handleResize': resize,
8368
8372
  'MainArea.handleSashCornerPointerDown': wrapSerialCommand(handleSashCornerPointerDown),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.45.0",
3
+ "version": "9.46.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",