@files-stack/client-redux
Advanced tools
Comparing version 0.0.26-7 to 0.0.26-8
@@ -26,3 +26,3 @@ import * as actionTypes from './types'; | ||
type: actionTypes.UPDATE_EDITORS_HEIGHT; | ||
editorsHeight: any[]; | ||
editorWrappers: any[]; | ||
}) | ({ | ||
@@ -51,3 +51,3 @@ type: actionTypes.OPEN_MARKDOWN; | ||
export declare const activateEditorAction: (editorId: number) => EditAction; | ||
export declare const updateEditorsHeightAction: (editorsHeight: any[]) => EditAction; | ||
export declare const updateEditorsHeightAction: (editorWrappers: any[]) => EditAction; | ||
export declare const openMarkdownAction: (content: IContent, previewEditorId: number) => EditAction; | ||
@@ -54,0 +54,0 @@ export declare const setFinderOptionsAction: (options: IFinderOptions) => EditAction; |
@@ -120,4 +120,4 @@ module.exports = | ||
__export(__webpack_require__(0)); | ||
__export(__webpack_require__(9)); | ||
__export(__webpack_require__(10)); | ||
__export(__webpack_require__(11)); | ||
@@ -137,3 +137,3 @@ | ||
__export(__webpack_require__(2)); | ||
__export(__webpack_require__(11)); | ||
__export(__webpack_require__(12)); | ||
@@ -300,3 +300,4 @@ | ||
const lodash_1 = __webpack_require__(7); | ||
const core_1 = __webpack_require__(8); | ||
const client_core_1 = __webpack_require__(8); | ||
const core_1 = __webpack_require__(9); | ||
const actionTypes = __webpack_require__(0); | ||
@@ -307,3 +308,3 @@ const initialEditState = { | ||
editors: [], | ||
editorsHeight: [], | ||
editorWrappers: [], | ||
activeEditorId: 0, | ||
@@ -321,3 +322,3 @@ readingFile: { resource: '' }, | ||
let editors; | ||
let editorsHeight; | ||
let editorWrappers; | ||
let editorId; | ||
@@ -329,3 +330,3 @@ let readingFile; | ||
editors = [...state.editors]; | ||
editorsHeight = state.editorsHeight; | ||
editorWrappers = [...state.editorWrappers]; | ||
openingFiles = [...state.openingFiles]; | ||
@@ -340,3 +341,3 @@ index = ramda_1.findIndex(ramda_1.whereEq({ | ||
editingFiles.push(Object.assign({}, openingFiles[index])); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles] }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, activeEditorId, 'file://' + action.payload.resource) }); | ||
} | ||
@@ -346,3 +347,7 @@ else { | ||
editors = [1]; | ||
editorsHeight = [{ editorId: 1, height: 80 }]; | ||
editorWrappers = [{ | ||
editorId: 1, | ||
height: client_core_1.EDITOR_DEFAULT_HEIGHT, | ||
history: ['file://' + action.payload.resource], | ||
}]; | ||
activeEditorId = 1; | ||
@@ -356,3 +361,3 @@ } | ||
editors.push(action.payload.editorId); | ||
editorsHeight.push({ editorId: action.payload.editorId, height: 80 }); | ||
editorWrappers.push({ editorId: action.payload.editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT }); | ||
} | ||
@@ -370,3 +375,3 @@ else { | ||
return Object.assign({}, state, { readingFile, | ||
activeEditorId, editors: [...editors], editorsHeight: [...editorsHeight], 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: 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 }); | ||
} | ||
@@ -378,3 +383,3 @@ case actionTypes.ADD_EDIT: | ||
editors = [...state.editors]; | ||
editorsHeight = [...state.editorsHeight]; | ||
editorWrappers = [...state.editorWrappers]; | ||
if (action.content.preopen) { | ||
@@ -385,3 +390,3 @@ openingFiles = lodash_1.filter(openingFiles, item => !(item.editorId === editorId && item.preopen)); | ||
editors = [editorId]; | ||
editorsHeight = [{ editorId: 1, height: 80 }]; | ||
editorWrappers = [{ editorId: 1, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] }]; | ||
} | ||
@@ -393,3 +398,3 @@ activeEditorId = editorId; | ||
editors.push(editorId); | ||
editorsHeight.push({ editorId, height: 80 }); | ||
editorWrappers.push({ editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] }); | ||
} | ||
@@ -431,3 +436,3 @@ else { | ||
editingFiles.push(Object.assign({}, action.content, { editorId: activeEditorId })); | ||
return Object.assign({}, state, { readingFile: { resource: '' }, openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorsHeight: [...editorsHeight], oldValue: '', addIgnore: '' }); | ||
return Object.assign({}, state, { readingFile: { resource: '' }, openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, editorId, action.content.resource), oldValue: '', addIgnore: '' }); | ||
} | ||
@@ -442,3 +447,3 @@ else { | ||
editors = [...state.editors]; | ||
editorsHeight = [...state.editorsHeight]; | ||
editorWrappers = [...state.editorWrappers]; | ||
activeEditorId = state.activeEditorId; | ||
@@ -464,3 +469,8 @@ index = ramda_1.findIndex(ramda_1.whereEq({ | ||
if (activeEditorFiles.length) { | ||
editingFiles.push(activeEditorFiles[0]); | ||
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); | ||
} | ||
} | ||
@@ -471,3 +481,3 @@ else { | ||
editors.splice(editorIndex, 1); | ||
editorsHeight.splice(editorIndex, 1); | ||
editorWrappers.splice(editorIndex, 1); | ||
} | ||
@@ -479,3 +489,3 @@ if (activeEditorId === editorId) { | ||
} | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorsHeight: [...editorsHeight], activeEditorId }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], editors: [...editors], editorWrappers: [...editorWrappers], activeEditorId }); | ||
} | ||
@@ -485,3 +495,3 @@ case actionTypes.SELECT_EDIT: | ||
editors = [...state.editors]; | ||
editorsHeight = state.editorsHeight; | ||
editorWrappers = [...state.editorWrappers]; | ||
openingFiles = [...state.openingFiles]; | ||
@@ -495,3 +505,3 @@ index = ramda_1.findIndex(ramda_1.whereEq({ | ||
editingFiles.push(Object.assign({}, openingFiles[index])); | ||
return Object.assign({}, state, { editingFiles: [...editingFiles] }); | ||
return Object.assign({}, state, { editingFiles: [...editingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
} | ||
@@ -501,3 +511,3 @@ else { | ||
editors = [1]; | ||
editorsHeight = [{ editorId: 1, height: 80 }]; | ||
editorWrappers = [{ editorId: 1, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] }]; | ||
activeEditorId = 1; | ||
@@ -511,3 +521,3 @@ } | ||
editors.push(action.content.editorId); | ||
editorsHeight.push({ editorId: action.content.editorId, height: 80 }); | ||
editorWrappers.push({ editorId: action.content.editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT, history: [] }); | ||
} | ||
@@ -526,3 +536,3 @@ else { | ||
return Object.assign({}, state, { readingFile, | ||
activeEditorId, editors: [...editors], editorsHeight: [...editorsHeight], openingFiles: [...openingFiles] }); | ||
activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource), openingFiles: [...openingFiles] }); | ||
} | ||
@@ -552,2 +562,3 @@ case actionTypes.CHANGE_EDIT: | ||
openingFiles = state.openingFiles; | ||
editorWrappers = [...state.editorWrappers]; | ||
index = ramda_1.findIndex(ramda_1.whereEq({ | ||
@@ -559,9 +570,10 @@ editorId: action.content.editorId, | ||
openingFiles[index] = Object.assign({}, openingFiles[index], { preopen: false }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles] }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
} | ||
else { | ||
return state; | ||
return Object.assign({}, state, { editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
} | ||
case actionTypes.UPDATE_CONTENT: | ||
openingFiles = state.openingFiles; | ||
editorWrappers = [...state.editorWrappers]; | ||
let items = lodash_1.filter(openingFiles, item => item.resource === action.content.resource && !item.deleted); | ||
@@ -574,3 +586,3 @@ items.forEach(item => { | ||
}); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles] }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
case actionTypes.ACTIVATE_EDITOR: | ||
@@ -585,3 +597,3 @@ index = state.editors.indexOf(action.editorId); | ||
case actionTypes.UPDATE_EDITORS_HEIGHT: | ||
return Object.assign({}, state, { editorsHeight: [...action.editorsHeight] }); | ||
return Object.assign({}, state, { editorWrappers: [...action.editorWrappers] }); | ||
case actionTypes.OPEN_MARKDOWN: | ||
@@ -591,3 +603,3 @@ editorId = action.previewEditorId; | ||
editors = lodash_1.clone(state.editors); | ||
editorsHeight = state.editorsHeight; | ||
editorWrappers = [...state.editorWrappers]; | ||
activeEditorId = editorId; | ||
@@ -598,3 +610,3 @@ index = editors.indexOf(editorId); | ||
editors.push(editorId); | ||
editorsHeight.push({ editorId, height: 80 }); | ||
editorWrappers.push({ editorId, height: client_core_1.EDITOR_DEFAULT_HEIGHT }); | ||
} | ||
@@ -615,3 +627,3 @@ else { | ||
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], editorsHeight: [...editorsHeight] }); | ||
return Object.assign({}, state, { openingFiles: [...openingFiles], editingFiles: [...editingFiles], activeEditorId, editors: [...editors], editorWrappers: core_1.addEditorHistory(editorWrappers, action.content.editorId, action.content.resource) }); | ||
case actionTypes.CLOSE_ALL_EDITORS: | ||
@@ -653,6 +665,12 @@ return initialEditState; | ||
module.exports = require("@files-stack/client-core"); | ||
/***/ }), | ||
/* 9 */ | ||
/***/ (function(module, exports) { | ||
module.exports = require("@files-stack/core"); | ||
/***/ }), | ||
/* 9 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -712,3 +730,3 @@ | ||
/***/ }), | ||
/* 10 */ | ||
/* 11 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -741,4 +759,4 @@ | ||
}); | ||
exports.updateEditorsHeightAction = (editorsHeight) => ({ | ||
type: actionTypes.UPDATE_EDITORS_HEIGHT, editorsHeight, | ||
exports.updateEditorsHeightAction = (editorWrappers) => ({ | ||
type: actionTypes.UPDATE_EDITORS_HEIGHT, editorWrappers, | ||
}); | ||
@@ -763,3 +781,3 @@ exports.openMarkdownAction = (content, previewEditorId) => ({ | ||
/***/ }), | ||
/* 11 */ | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -773,7 +791,7 @@ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(__webpack_require__(12)); | ||
__export(__webpack_require__(13)); | ||
/***/ }), | ||
/* 12 */ | ||
/* 13 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -780,0 +798,0 @@ |
@@ -27,3 +27,3 @@ export { Store } from './Store'; | ||
type: "@@files-stack/UPDATE_EDITORS_HEIGHT"; | ||
editorsHeight: any[]; | ||
editorWrappers: any[]; | ||
} | { | ||
@@ -68,3 +68,3 @@ type: "@@files-stack/OPEN_MARKDOWN"; | ||
type: "@@files-stack/UPDATE_EDITORS_HEIGHT"; | ||
editorsHeight: any[]; | ||
editorWrappers: any[]; | ||
} | { | ||
@@ -71,0 +71,0 @@ type: "@@files-stack/OPEN_MARKDOWN"; |
{ | ||
"name": "@files-stack/client-redux", | ||
"version": "0.0.26-7", | ||
"version": "0.0.26-8", | ||
"description": "Files Redux consists of reducers and actions", | ||
@@ -56,4 +56,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@files-stack/client-core": "^0.0.26-7", | ||
"@files-stack/core": "^0.0.26-7" | ||
"@files-stack/client-core": "^0.0.26-8", | ||
"@files-stack/core": "^0.0.26-8" | ||
}, | ||
@@ -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
113434
1327