@lvce-editor/main-area-worker 9.67.5 → 9.67.6

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.
@@ -1531,7 +1531,7 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1531
1531
  const readFile = async uri => {
1532
1532
  return invoke$2('FileSystem.readFile', uri);
1533
1533
  };
1534
- const confirm$1 = async (message, options) => {
1534
+ const confirm = async (message, options) => {
1535
1535
  const result = await invoke$2('ConfirmPrompt.prompt', message, options);
1536
1536
  return result;
1537
1537
  };
@@ -2308,19 +2308,8 @@ const saveEditor = async (editorUid, skipFormatting = false) => {
2308
2308
  return invoke$2('Editor.save', editorUid);
2309
2309
  };
2310
2310
 
2311
- const confirm = async (message, options) => {
2312
- try {
2313
- return await confirm$1(message, options);
2314
- } catch (error) {
2315
- const errorMessage = String(error);
2316
- if (!errorMessage.includes('ConfirmPrompt.prompt') || !errorMessage.includes('not found')) {
2317
- throw error;
2318
- }
2319
- return invoke$6('ConfirmPrompt.prompt', message, options);
2320
- }
2321
- };
2322
- const promptSave = async title => {
2323
- const shouldSave = await confirm(`Do you want to save the changes you made to ${title}?`, {
2311
+ const promptLegacy = async (message, discardPrompt) => {
2312
+ const shouldSave = await confirm(message, {
2324
2313
  cancelMessage: 'More Options',
2325
2314
  confirmMessage: 'Save',
2326
2315
  title: 'Save Changes'
@@ -2328,13 +2317,47 @@ const promptSave = async title => {
2328
2317
  if (shouldSave) {
2329
2318
  return 'save';
2330
2319
  }
2331
- const shouldDiscard = await confirm(`Discard the changes you made to ${title}?`, {
2320
+ const shouldDiscard = await confirm(discardPrompt, {
2332
2321
  cancelMessage: 'Cancel',
2333
2322
  confirmMessage: "Don't Save",
2334
2323
  title: 'Save Changes'
2335
2324
  });
2336
2325
  return shouldDiscard ? 'discard' : 'cancel';
2337
2326
  };
2327
+ const promptSave = async title => {
2328
+ const message = `Do you want to save the changes you made to ${title}?`;
2329
+ const discardPrompt = `Discard the changes you made to ${title}?`;
2330
+ const options = {
2331
+ cancelMessage: 'Cancel',
2332
+ confirmMessage: 'Save',
2333
+ discardMessage: "Don't Save",
2334
+ discardPrompt,
2335
+ title: 'Save Changes'
2336
+ };
2337
+ try {
2338
+ const result = await invoke$2('ConfirmPrompt.prompt3', message, options);
2339
+ if (['cancel', 'discard', 'save'].includes(result)) {
2340
+ return result;
2341
+ }
2342
+ } catch (error) {
2343
+ const errorMessage = String(error);
2344
+ if (!errorMessage.includes('ConfirmPrompt.prompt3') || !errorMessage.includes('not found')) {
2345
+ throw error;
2346
+ }
2347
+ }
2348
+ try {
2349
+ const result = await invoke$6('ConfirmPrompt.prompt3', message, options);
2350
+ if (['cancel', 'discard', 'save'].includes(result)) {
2351
+ return result;
2352
+ }
2353
+ } catch (error) {
2354
+ const errorMessage = String(error);
2355
+ if (!errorMessage.includes('ConfirmPrompt.prompt3') || !errorMessage.includes('not found')) {
2356
+ throw error;
2357
+ }
2358
+ }
2359
+ return promptLegacy(message, discardPrompt);
2360
+ };
2338
2361
  const canCloseTab = async tab => {
2339
2362
  if (tab.editorUid === -1 || !tab.isDirty) {
2340
2363
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.67.5",
3
+ "version": "9.67.6",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",