|
|
@ -4,7 +4,7 @@ import * as packageJson from '../../../../../package.json' |
|
|
|
import Registry from '../state/registry' |
|
|
|
import Registry from '../state/registry' |
|
|
|
import { EventEmitter } from 'events' |
|
|
|
import { EventEmitter } from 'events' |
|
|
|
import { RemixAppManager } from '../../../../../libs/remix-ui/plugin-manager/src/types' |
|
|
|
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' |
|
|
|
import helper from '../../lib/helper.js' |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
@ -715,8 +715,22 @@ class FileManager extends Plugin { |
|
|
|
if ((input !== null) && (input !== undefined)) { |
|
|
|
if ((input !== null) && (input !== undefined)) { |
|
|
|
const provider = this.fileProviderOf(currentFile) |
|
|
|
const provider = this.fileProviderOf(currentFile) |
|
|
|
if (provider) { |
|
|
|
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) |
|
|
|
this.emit('fileSaved', currentFile) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log('cannot save ' + currentFile + '. Does not belong to any explorer') |
|
|
|
console.log('cannot save ' + currentFile + '. Does not belong to any explorer') |
|
|
|
} |
|
|
|
} |
|
|
|