@lvce-editor/opener-worker 1.3.0 → 1.5.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/openerWorkerMain.js +34 -3
- package/package.json +1 -1
package/dist/openerWorkerMain.js
CHANGED
|
@@ -1149,8 +1149,37 @@ const enable = () => {
|
|
|
1149
1149
|
return set(true);
|
|
1150
1150
|
};
|
|
1151
1151
|
|
|
1152
|
-
const
|
|
1153
|
-
return invoke$
|
|
1152
|
+
const getWorkspaceUri = async () => {
|
|
1153
|
+
return invoke$2('Workspace.getUri');
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
let saveDialogMockReturnValue = null;
|
|
1157
|
+
const registerSaveDialogMock = value => {
|
|
1158
|
+
saveDialogMockReturnValue = value;
|
|
1159
|
+
};
|
|
1160
|
+
const clearSaveDialogMock = () => {
|
|
1161
|
+
saveDialogMockReturnValue = null;
|
|
1162
|
+
};
|
|
1163
|
+
const showSaveDialog = async (title, properties, platform) => {
|
|
1164
|
+
if (saveDialogMockReturnValue !== null) {
|
|
1165
|
+
return saveDialogMockReturnValue;
|
|
1166
|
+
}
|
|
1167
|
+
if (platform === Electron) {
|
|
1168
|
+
return invoke$1('ElectronDialog.showSaveDialog', title, properties);
|
|
1169
|
+
}
|
|
1170
|
+
// When running in web, prompt for filename and combine with workspace path
|
|
1171
|
+
const fileName = await invoke$2('Prompt.prompt', title);
|
|
1172
|
+
if (!fileName) {
|
|
1173
|
+
return {
|
|
1174
|
+
canceled: true
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
const workspaceUri = await getWorkspaceUri();
|
|
1178
|
+
const filePath = `${workspaceUri}/${fileName}`;
|
|
1179
|
+
return {
|
|
1180
|
+
canceled: false,
|
|
1181
|
+
filePath
|
|
1182
|
+
};
|
|
1154
1183
|
};
|
|
1155
1184
|
|
|
1156
1185
|
const commandMap = {
|
|
@@ -1159,7 +1188,9 @@ const commandMap = {
|
|
|
1159
1188
|
'Open.openExternal': openExternal,
|
|
1160
1189
|
'Open.openUrl': openUrl,
|
|
1161
1190
|
'Open.readOpenedUrl': readOpenedMemory,
|
|
1162
|
-
'Open.showSaveDialog': showSaveDialog
|
|
1191
|
+
'Open.showSaveDialog': showSaveDialog,
|
|
1192
|
+
'ShowSaveDialog.clearSaveDialogMock': clearSaveDialogMock,
|
|
1193
|
+
'ShowSaveDialog.registerSaveDialogMock': registerSaveDialogMock
|
|
1163
1194
|
};
|
|
1164
1195
|
|
|
1165
1196
|
const send = async port => {
|