@lvce-editor/main-area-worker 9.46.0 → 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.
@@ -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
- await invoke$1('Viewlet.focusSelector', editorUid, '[name="editor"]');
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,23 +5431,6 @@ const handleIconThemeChange = async state => {
5410
5431
  };
5411
5432
  };
5412
5433
 
5413
- const state = {
5414
- connected: false
5415
- };
5416
- const isConnected = () => {
5417
- const {
5418
- connected
5419
- } = state;
5420
- return connected;
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
5434
  const handleMessagePort = async (port, viewletCommandMap) => {
5431
5435
  const executeViewletCommand = async (uid, command, ...args) => {
5432
5436
  const fn = viewletCommandMap[`MainArea.${command}`];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.46.0",
3
+ "version": "9.47.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",