|
|
|
@ -4,7 +4,7 @@ import * as packageJson from '../../../../../package.json' |
|
|
|
|
import Registry from '../state/registry' |
|
|
|
|
import { EventEmitter } from 'events' |
|
|
|
|
import { RemixAppManager } from '../../../../../libs/remix-ui/plugin-manager/src/types' |
|
|
|
|
import { fileChangedToastMsg } from '@remix-ui/helper' |
|
|
|
|
import { fileChangedToastMsg, storageFullMessage } from '@remix-ui/helper' |
|
|
|
|
import helper from '../../lib/helper.js' |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
@ -722,8 +722,22 @@ class FileManager extends Plugin { |
|
|
|
|
if ((input !== null) && (input !== undefined)) { |
|
|
|
|
const provider = this.fileProviderOf(currentFile) |
|
|
|
|
if (provider) { |
|
|
|
|
await provider.set(currentFile, input) |
|
|
|
|
// use old content as default if save operation fails.
|
|
|
|
|
provider.get(currentFile, (error, oldContent) => { |
|
|
|
|
provider.set(currentFile, input, (error) => { |
|
|
|
|
if (error) { |
|
|
|
|
if (error.message ) this.call('notification', 'toast',
|
|
|
|
|
error.message.indexOf( |
|
|
|
|
'LocalStorage is full') !== -1 ? storageFullMessage() |
|
|
|
|
: error.message |
|
|
|
|
) |
|
|
|
|
provider.set(currentFile, oldContent) |
|
|
|
|
return console.error(error) |
|
|
|
|
} else { |
|
|
|
|
this.emit('fileSaved', currentFile) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
console.log('cannot save ' + currentFile + '. Does not belong to any explorer') |
|
|
|
|
} |
|
|
|
|