@lvce-editor/opener-worker 1.3.0 → 1.4.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.
@@ -1149,8 +1149,23 @@ const enable = () => {
1149
1149
  return set(true);
1150
1150
  };
1151
1151
 
1152
- const showSaveDialog = (title, properties) => {
1153
- return invoke$1('ElectronDialog.showSaveDialog', title, properties);
1152
+ let saveDialogMockReturnValue = null;
1153
+ const registerSaveDialogMock = value => {
1154
+ saveDialogMockReturnValue = value;
1155
+ };
1156
+ const clearSaveDialogMock = () => {
1157
+ saveDialogMockReturnValue = null;
1158
+ };
1159
+ const showSaveDialog = async (title, properties, platform) => {
1160
+ if (saveDialogMockReturnValue !== null) {
1161
+ return saveDialogMockReturnValue;
1162
+ }
1163
+ if (platform === Electron) {
1164
+ return invoke$1('ElectronDialog.showSaveDialog', title, properties);
1165
+ }
1166
+ // TODO when running in web, maybe only make a prompt and ask for a filename
1167
+ // and the use the workspace path as directory
1168
+ return invoke$2('ConfirmPompt.prompt', title);
1154
1169
  };
1155
1170
 
1156
1171
  const commandMap = {
@@ -1159,7 +1174,9 @@ const commandMap = {
1159
1174
  'Open.openExternal': openExternal,
1160
1175
  'Open.openUrl': openUrl,
1161
1176
  'Open.readOpenedUrl': readOpenedMemory,
1162
- 'Open.showSaveDialog': showSaveDialog
1177
+ 'Open.showSaveDialog': showSaveDialog,
1178
+ 'ShowSaveDialog.clearSaveDialogMock': clearSaveDialogMock,
1179
+ 'ShowSaveDialog.registerSaveDialogMock': registerSaveDialogMock
1163
1180
  };
1164
1181
 
1165
1182
  const send = async port => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/opener-worker",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Opener Worker",
5
5
  "repository": {
6
6
  "type": "git",