@lvce-editor/main-area-worker 9.45.1 → 9.47.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.
- package/dist/mainAreaWorkerMain.js +36 -21
- package/package.json +1 -1
|
@@ -2945,13 +2945,34 @@ const getActiveTab = state => {
|
|
|
2945
2945
|
};
|
|
2946
2946
|
};
|
|
2947
2947
|
|
|
2948
|
+
const state = {
|
|
2949
|
+
connected: false
|
|
2950
|
+
};
|
|
2951
|
+
const isConnected = () => {
|
|
2952
|
+
const {
|
|
2953
|
+
connected
|
|
2954
|
+
} = state;
|
|
2955
|
+
return connected;
|
|
2956
|
+
};
|
|
2957
|
+
const invoke = (method, ...params) => {
|
|
2958
|
+
return invoke$2(method, ...params);
|
|
2959
|
+
};
|
|
2960
|
+
const set = rpc => {
|
|
2961
|
+
set$3(rpc);
|
|
2962
|
+
state.connected = true;
|
|
2963
|
+
};
|
|
2964
|
+
|
|
2948
2965
|
const focus = async state => {
|
|
2949
2966
|
const activeTab = getActiveTab(state);
|
|
2950
2967
|
const editorUid = activeTab?.tab.editorUid;
|
|
2951
2968
|
if (typeof editorUid !== 'number' || editorUid < 0) {
|
|
2952
2969
|
return state;
|
|
2953
2970
|
}
|
|
2954
|
-
|
|
2971
|
+
if (isConnected()) {
|
|
2972
|
+
await invoke('Viewlet.focusSelectorAfterRender', editorUid, '[name="editor"]');
|
|
2973
|
+
} else {
|
|
2974
|
+
await invoke$1('Viewlet.focusSelector', editorUid, '[name="editor"]');
|
|
2975
|
+
}
|
|
2955
2976
|
return state;
|
|
2956
2977
|
};
|
|
2957
2978
|
|
|
@@ -5410,26 +5431,19 @@ const handleIconThemeChange = async state => {
|
|
|
5410
5431
|
};
|
|
5411
5432
|
};
|
|
5412
5433
|
|
|
5413
|
-
const
|
|
5414
|
-
|
|
5415
|
-
};
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
};
|
|
5422
|
-
const invoke = (method, ...params) => {
|
|
5423
|
-
return invoke$2(method, ...params);
|
|
5424
|
-
};
|
|
5425
|
-
const set = rpc => {
|
|
5426
|
-
set$3(rpc);
|
|
5427
|
-
state.connected = true;
|
|
5428
|
-
};
|
|
5429
|
-
|
|
5430
|
-
const handleMessagePort = async port => {
|
|
5434
|
+
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
5435
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
5436
|
+
const fn = viewletCommandMap[`MainArea.${command}`];
|
|
5437
|
+
if (typeof fn !== 'function') {
|
|
5438
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
5439
|
+
}
|
|
5440
|
+
await fn(uid, ...args);
|
|
5441
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
5442
|
+
};
|
|
5431
5443
|
const rpc = await create$8({
|
|
5432
|
-
commandMap: {
|
|
5444
|
+
commandMap: {
|
|
5445
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
5446
|
+
},
|
|
5433
5447
|
messagePort: port
|
|
5434
5448
|
});
|
|
5435
5449
|
set(rpc);
|
|
@@ -8292,6 +8306,7 @@ const resize = async (uid, dimensions) => {
|
|
|
8292
8306
|
set$1(uid, instance.oldState, resizedState);
|
|
8293
8307
|
return handleResize(resizedState, dimensions);
|
|
8294
8308
|
};
|
|
8309
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
8295
8310
|
const commandMap = {
|
|
8296
8311
|
'Main.closeActiveEditor': wrapSerialCommand(closeActiveEditor),
|
|
8297
8312
|
'Main.closeAll': wrapSerialCommand(closeAll$1),
|
|
@@ -8355,7 +8370,7 @@ const commandMap = {
|
|
|
8355
8370
|
'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
|
|
8356
8371
|
'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
|
|
8357
8372
|
'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
|
|
8358
|
-
'MainArea.handleMessagePort':
|
|
8373
|
+
'MainArea.handleMessagePort': handleDirectMessagePort,
|
|
8359
8374
|
'MainArea.handleModifiedStatusChange': wrapAsyncCommand(handleModifiedStatusChangeWithContext),
|
|
8360
8375
|
'MainArea.handleResize': resize,
|
|
8361
8376
|
'MainArea.handleSashCornerPointerDown': wrapSerialCommand(handleSashCornerPointerDown),
|