Prevents file name collisions that are possible with the folder system.
This commit is contained in:
parent
03d7533e2a
commit
5fdcd08add
3 changed files with 6 additions and 6 deletions
|
@ -29,10 +29,10 @@ function createUniqueName(name, parentId, files) {
|
|||
return testName;
|
||||
}
|
||||
|
||||
export function updateFileContent(name, content) {
|
||||
export function updateFileContent(id, content) {
|
||||
return {
|
||||
type: ActionTypes.UPDATE_FILE_CONTENT,
|
||||
name,
|
||||
id,
|
||||
content
|
||||
};
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ export function hideFolderChildren(id) {
|
|||
export function setBlobUrl(file, blobURL) {
|
||||
return {
|
||||
type: ActionTypes.SET_BLOB_URL,
|
||||
name: file.name,
|
||||
id: file.id,
|
||||
blobURL
|
||||
};
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class Editor extends React.Component {
|
|||
|
||||
this._cm.on('change', debounce(() => {
|
||||
this.props.setUnsavedChanges(true);
|
||||
this.props.updateFileContent(this.props.file.name, this._cm.getValue());
|
||||
this.props.updateFileContent(this.props.file.id, this._cm.getValue());
|
||||
if (this.props.autorefresh && this.props.isPlaying) {
|
||||
this.props.clearConsole();
|
||||
this.props.startRefreshSketch();
|
||||
|
|
|
@ -118,7 +118,7 @@ const files = (state, action) => {
|
|||
switch (action.type) {
|
||||
case ActionTypes.UPDATE_FILE_CONTENT:
|
||||
return state.map((file) => {
|
||||
if (file.name !== action.name) {
|
||||
if (file.id !== action.id) {
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ const files = (state, action) => {
|
|||
});
|
||||
case ActionTypes.SET_BLOB_URL:
|
||||
return state.map((file) => {
|
||||
if (file.name !== action.name) {
|
||||
if (file.id !== action.id) {
|
||||
return file;
|
||||
}
|
||||
return Object.assign({}, file, { blobURL: action.blobURL });
|
||||
|
|
Loading…
Reference in a new issue