@lvce-editor/main-area-worker 9.35.1 → 9.35.3
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 +48 -10
- package/package.json +1 -1
|
@@ -1438,6 +1438,7 @@ const VirtualDomElements = {
|
|
|
1438
1438
|
const Button$1 = 'event.button';
|
|
1439
1439
|
const ClientX = 'event.clientX';
|
|
1440
1440
|
const ClientY = 'event.clientY';
|
|
1441
|
+
const DataTransferFiles = 'event.dataTransfer.files';
|
|
1441
1442
|
const DataTransferFiles2 = 'event.dataTransfer.files2';
|
|
1442
1443
|
const EventTargetClassName = 'event.target.className';
|
|
1443
1444
|
const TargetName = 'event.target.name';
|
|
@@ -1452,6 +1453,7 @@ const Add$1 = 6;
|
|
|
1452
1453
|
const NavigateChild$1 = 7;
|
|
1453
1454
|
const NavigateParent$1 = 8;
|
|
1454
1455
|
|
|
1456
|
+
const Web = 1;
|
|
1455
1457
|
const Electron = 2;
|
|
1456
1458
|
|
|
1457
1459
|
const ClipBoardWorker = 3400;
|
|
@@ -2193,8 +2195,9 @@ const createViewletForTab = (state, tabId, viewletModuleId, bounds) => {
|
|
|
2193
2195
|
return state;
|
|
2194
2196
|
}
|
|
2195
2197
|
|
|
2196
|
-
//
|
|
2197
|
-
|
|
2198
|
+
// The editor instance is identified by editorUid. Restored tabs can be marked
|
|
2199
|
+
// as loading or loaded before their renderer instance has been recreated.
|
|
2200
|
+
if (tab.editorUid !== -1) {
|
|
2198
2201
|
return state;
|
|
2199
2202
|
}
|
|
2200
2203
|
const editorUid = create$2();
|
|
@@ -4839,11 +4842,37 @@ const parseUriList = value => {
|
|
|
4839
4842
|
return value.split(lineSeparatorRegex).map(uri => uri.trim()).filter(uri => uri && !uri.startsWith('#'));
|
|
4840
4843
|
};
|
|
4841
4844
|
|
|
4845
|
+
const windowsDriveLetterRegex = /^[a-zA-Z]:\\/;
|
|
4846
|
+
const encodeFilePath = path => {
|
|
4847
|
+
return encodeURI(path).replaceAll('#', '%23').replaceAll('?', '%3F');
|
|
4848
|
+
};
|
|
4849
|
+
const toFileUri$1 = path => {
|
|
4850
|
+
if (path.startsWith('file://')) {
|
|
4851
|
+
return path;
|
|
4852
|
+
}
|
|
4853
|
+
if (windowsDriveLetterRegex.test(path)) {
|
|
4854
|
+
const normalizedPath = path.replaceAll('\\', '/');
|
|
4855
|
+
return `file:///${encodeFilePath(normalizedPath)}`;
|
|
4856
|
+
}
|
|
4857
|
+
return `file://${encodeFilePath(path)}`;
|
|
4858
|
+
};
|
|
4859
|
+
|
|
4842
4860
|
const suffixByHandleKind = {
|
|
4843
4861
|
directory: '/',
|
|
4844
4862
|
file: ''
|
|
4845
4863
|
};
|
|
4846
|
-
const
|
|
4864
|
+
const getDroppedElectronUris = async (itemIds, files) => {
|
|
4865
|
+
if (itemIds.length > 0) {
|
|
4866
|
+
await getFileHandles(itemIds);
|
|
4867
|
+
}
|
|
4868
|
+
const uris = [];
|
|
4869
|
+
for (const file of files) {
|
|
4870
|
+
const path = await invoke('FileSystemHandle.getFilePathElectron', file);
|
|
4871
|
+
uris.push(toFileUri$1(path));
|
|
4872
|
+
}
|
|
4873
|
+
return uris;
|
|
4874
|
+
};
|
|
4875
|
+
const getDroppedBrowserUris = async itemIds => {
|
|
4847
4876
|
if (itemIds.length === 0) {
|
|
4848
4877
|
return [];
|
|
4849
4878
|
}
|
|
@@ -4883,6 +4912,12 @@ const getDroppedUris = async itemIds => {
|
|
|
4883
4912
|
}
|
|
4884
4913
|
return uris;
|
|
4885
4914
|
};
|
|
4915
|
+
const getDroppedUris = async (itemIds, files = [], platform = Web) => {
|
|
4916
|
+
if (platform === Electron && files.length > 0) {
|
|
4917
|
+
return getDroppedElectronUris(itemIds, files);
|
|
4918
|
+
}
|
|
4919
|
+
return getDroppedBrowserUris(itemIds);
|
|
4920
|
+
};
|
|
4886
4921
|
|
|
4887
4922
|
const openUrisWithContext = async (context, uris) => {
|
|
4888
4923
|
for (const uri of uris) {
|
|
@@ -4890,9 +4925,12 @@ const openUrisWithContext = async (context, uris) => {
|
|
|
4890
4925
|
}
|
|
4891
4926
|
};
|
|
4892
4927
|
|
|
4893
|
-
const handleDrop = async (context, itemIds) => {
|
|
4928
|
+
const handleDrop = async (context, itemIds, files = []) => {
|
|
4894
4929
|
await context.updateState(handleDragLeave);
|
|
4895
|
-
const
|
|
4930
|
+
const {
|
|
4931
|
+
platform
|
|
4932
|
+
} = context.getState();
|
|
4933
|
+
const uris = await getDroppedUris(itemIds, files, platform);
|
|
4896
4934
|
for (const uri of uris) {
|
|
4897
4935
|
if (uri.endsWith('/') || (await isDirectoryEditorInput({
|
|
4898
4936
|
type: 'editor',
|
|
@@ -6054,25 +6092,25 @@ const getMenuEntries$2 = (state, groupId) => {
|
|
|
6054
6092
|
label: openFile()
|
|
6055
6093
|
}, menuEntrySeparator, {
|
|
6056
6094
|
args: groupArgs,
|
|
6057
|
-
command: '
|
|
6095
|
+
command: 'Main.splitUp',
|
|
6058
6096
|
flags: None$1,
|
|
6059
6097
|
id: 'splitUp',
|
|
6060
6098
|
label: splitUp$1()
|
|
6061
6099
|
}, {
|
|
6062
6100
|
args: groupArgs,
|
|
6063
|
-
command: '
|
|
6101
|
+
command: 'Main.splitDown',
|
|
6064
6102
|
flags: None$1,
|
|
6065
6103
|
id: 'splitDown',
|
|
6066
6104
|
label: splitDown$1()
|
|
6067
6105
|
}, {
|
|
6068
6106
|
args: groupArgs,
|
|
6069
|
-
command: '
|
|
6107
|
+
command: 'Main.splitLeft',
|
|
6070
6108
|
flags: None$1,
|
|
6071
6109
|
id: 'splitLeft',
|
|
6072
6110
|
label: splitLeft$1()
|
|
6073
6111
|
}, {
|
|
6074
6112
|
args: groupArgs,
|
|
6075
|
-
command: '
|
|
6113
|
+
command: 'Main.splitRight',
|
|
6076
6114
|
flags: None$1,
|
|
6077
6115
|
id: 'splitRight',
|
|
6078
6116
|
label: splitRight$1()
|
|
@@ -7353,7 +7391,7 @@ const renderEventListeners = () => {
|
|
|
7353
7391
|
params: ['handleDragLeave']
|
|
7354
7392
|
}, {
|
|
7355
7393
|
name: HandleDrop,
|
|
7356
|
-
params: ['handleDrop', DataTransferFiles2],
|
|
7394
|
+
params: ['handleDrop', DataTransferFiles2, DataTransferFiles],
|
|
7357
7395
|
preventDefault: true
|
|
7358
7396
|
}];
|
|
7359
7397
|
};
|