@files-stack/client-redux
Advanced tools
Comparing version 0.0.27-1 to 0.0.27-2
119
lib/index.js
@@ -298,4 +298,4 @@ module.exports = | ||
const lodash_1 = __webpack_require__(7); | ||
const client_core_1 = __webpack_require__(8); | ||
const core_1 = __webpack_require__(9); | ||
const core_1 = __webpack_require__(8); | ||
const client_core_1 = __webpack_require__(9); | ||
const actionTypes = __webpack_require__(0); | ||
@@ -336,3 +336,3 @@ const initialEditState = { | ||
editingFiles.push(Object.assign({}, openingFiles[index])); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource) }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editorWrappers: client_core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource) }); | ||
} | ||
@@ -368,3 +368,3 @@ else { | ||
return Object.assign({}, state, { readingFile, | ||
activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource), oldValue: action.payload ? action.payload.oldValue : null, deleted: action.payload ? action.payload.deleted : null, addIgnore: action.payload ? action.payload.addIgnore : null }); | ||
activeEditorId, editors: [...editors], editorWrappers: client_core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource), oldValue: action.payload ? action.payload.oldValue : null, deleted: action.payload ? action.payload.deleted : null, addIgnore: action.payload ? action.payload.addIgnore : null }); | ||
} | ||
@@ -426,3 +426,3 @@ case actionTypes.ADD_EDIT: | ||
editingFiles.push(Object.assign({}, action.content, { editorId: activeEditorId })); | ||
return Object.assign({}, state, { readingFile: { resource: '' }, openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, editorId, action.content.resource), oldValue: '', addIgnore: '' }); | ||
return Object.assign({}, state, { readingFile: { resource: '' }, openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: client_core_1.addEditorHistory(editorWrappers, editorId, action.content.resource), oldValue: '', addIgnore: '' }); | ||
} | ||
@@ -433,3 +433,2 @@ else { | ||
case actionTypes.REMOVE_EDIT: | ||
editorId = action.content.editorId; | ||
openingFiles = [...state.openingFiles]; | ||
@@ -440,40 +439,74 @@ editingFiles = [...state.editingFiles]; | ||
activeEditorId = state.activeEditorId; | ||
index = ramda_1.findIndex(ramda_1.whereEq({ | ||
resource: action.content.resource, | ||
editorId, | ||
}))(openingFiles); | ||
if (index !== -1) { | ||
openingFiles = ramda_1.remove(index, 1, openingFiles); | ||
} | ||
if (openingFiles.length === 0) { | ||
return initialEditState; | ||
} | ||
else { | ||
if (action.content.editorId) { | ||
editorId = action.content.editorId; | ||
index = ramda_1.findIndex(ramda_1.whereEq({ | ||
resource: action.content.resource, | ||
editorId, | ||
}))(editingFiles); | ||
}))(openingFiles); | ||
if (index !== -1) { | ||
editingFiles = ramda_1.remove(index, 1, editingFiles); | ||
const activeEditorFiles = lodash_1.filter(openingFiles, item => item.editorId === editorId); | ||
if (activeEditorFiles.length) { | ||
editorWrappers = core_1.removeEditorHistory(editorWrappers, editorId, action.content.resource); | ||
const lastResource = core_1.getLastEditorHistory(editorWrappers, editorId); | ||
if (lastResource) { | ||
const editingFile = ramda_1.find(ramda_1.whereEq({ resource: lastResource }))(activeEditorFiles); | ||
editingFiles.push(editingFile); | ||
openingFiles = ramda_1.remove(index, 1, openingFiles); | ||
} | ||
if (openingFiles.length === 0) { | ||
return initialEditState; | ||
} | ||
else { | ||
index = ramda_1.findIndex(ramda_1.whereEq({ | ||
resource: action.content.resource, | ||
editorId, | ||
}))(editingFiles); | ||
if (index !== -1) { | ||
editingFiles = ramda_1.remove(index, 1, editingFiles); | ||
const activeEditorFiles = lodash_1.filter(openingFiles, item => item.editorId === editorId); | ||
if (activeEditorFiles.length) { | ||
editorWrappers = client_core_1.removeEditorHistory(editorWrappers, editorId, action.content.resource); | ||
const lastResource = client_core_1.getLastEditorHistory(editorWrappers, editorId); | ||
if (lastResource) { | ||
const editingFile = ramda_1.find(ramda_1.whereEq({ resource: lastResource }))(activeEditorFiles); | ||
editingFiles.push(editingFile); | ||
} | ||
} | ||
else { | ||
const editorIndex = editors.indexOf(editorId); | ||
if (editorIndex !== -1) { | ||
editors.splice(editorIndex, 1); | ||
editorWrappers.splice(editorIndex, 1); | ||
} | ||
if (activeEditorId === editorId) { | ||
activeEditorId = editors[0]; | ||
} | ||
} | ||
} | ||
else { | ||
const editorIndex = editors.indexOf(editorId); | ||
if (editorIndex !== -1) { | ||
editors.splice(editorIndex, 1); | ||
editorWrappers.splice(editorIndex, 1); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorWrappers: [...editorWrappers], activeEditorId }); | ||
} | ||
} | ||
else { | ||
openingFiles = lodash_1.filter(openingFiles, item => item.resource !== action.content.resource); | ||
if (openingFiles.length === 0) { | ||
return initialEditState; | ||
} | ||
else { | ||
editingFiles = lodash_1.filter(editingFiles, item => item.resource !== action.content.resource); | ||
editors.forEach((editorId) => { | ||
const activeEditorFiles = lodash_1.filter(openingFiles, item => item.editorId === editorId); | ||
if (activeEditorFiles.length) { | ||
editorWrappers = client_core_1.removeEditorHistory(editorWrappers, editorId, action.content.resource); | ||
const lastResource = client_core_1.getLastEditorHistory(editorWrappers, editorId); | ||
if (lastResource) { | ||
const editingFile = ramda_1.find(ramda_1.whereEq({ resource: lastResource }))(activeEditorFiles); | ||
editingFiles.push(editingFile); | ||
} | ||
} | ||
if (activeEditorId === editorId) { | ||
activeEditorId = editors[0]; | ||
else { | ||
const editorIndex = editors.indexOf(editorId); | ||
if (editorIndex !== -1) { | ||
editors.splice(editorIndex, 1); | ||
editorWrappers.splice(editorIndex, 1); | ||
} | ||
if (activeEditorId === editorId) { | ||
activeEditorId = editors[0]; | ||
} | ||
} | ||
} | ||
}); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorWrappers: [...editorWrappers], activeEditorId }); | ||
} | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorWrappers: [...editorWrappers], activeEditorId }); | ||
} | ||
@@ -492,3 +525,3 @@ case actionTypes.SELECT_EDIT: | ||
editingFiles.push(Object.assign({}, openingFiles[index])); | ||
return Object.assign({}, state, { editingFiles: [...editingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
return Object.assign({}, state, { editingFiles: [...editingFiles], editorWrappers: client_core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
} | ||
@@ -521,3 +554,3 @@ else { | ||
return Object.assign({}, state, { readingFile, | ||
activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource), openingFiles: [...openingFiles] }); | ||
activeEditorId, editors: [...editors], editorWrappers: client_core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource), openingFiles: [...openingFiles] }); | ||
} | ||
@@ -554,6 +587,6 @@ case actionTypes.CHANGE_EDIT: | ||
openingFiles[index] = Object.assign({}, openingFiles[index], { preopen: false }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: client_core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
} | ||
else { | ||
return Object.assign({}, state, { editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
return Object.assign({}, state, { editorWrappers: client_core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
} | ||
@@ -570,3 +603,3 @@ case actionTypes.UPDATE_CONTENT: | ||
}); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: client_core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
case actionTypes.ACTIVATE_EDITOR: | ||
@@ -608,3 +641,3 @@ index = state.editors.indexOf(action.editorId); | ||
editingFiles.push(Object.assign({}, action.content, { name: `Preview ${action.content.name}`, preview: true, editorId })); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: client_core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
case actionTypes.CLOSE_ALL_EDITORS: | ||
@@ -646,3 +679,3 @@ return initialEditState; | ||
module.exports = require("@files-stack/client-core"); | ||
module.exports = require("@files-stack/core"); | ||
@@ -653,3 +686,3 @@ /***/ }), | ||
module.exports = require("@files-stack/core"); | ||
module.exports = require("@files-stack/client-core"); | ||
@@ -656,0 +689,0 @@ /***/ }), |
{ | ||
"name": "@files-stack/client-redux", | ||
"version": "0.0.27-1", | ||
"version": "0.0.27-2", | ||
"description": "Files Redux consists of reducers and actions", | ||
@@ -56,4 +56,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@files-stack/client-core": "^0.0.27-1", | ||
"@files-stack/core": "^0.0.27-1" | ||
"@files-stack/client-core": "^0.0.27-2", | ||
"@files-stack/core": "^0.0.27-2" | ||
}, | ||
@@ -60,0 +60,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118988
1360