@@ -20,7 +20,6 @@ import {
2020 DocumentStoreAction ,
2121 UndoableAction ,
2222} from 'src/stores/document/document-store-actions' ;
23- import { defaultDocumentState } from 'src/stores/document/default-document-state' ;
2423import { formatHeadings } from 'src/stores/document/reducers/content/format-content/format-headings' ;
2524import { pasteNode } from 'src/stores/document/reducers/clipboard/paste-node/paste-node' ;
2625import { updateSectionsDictionary } from 'src/stores/document/reducers/state/update-sections-dictionary' ;
@@ -45,18 +44,18 @@ const updateDocumentState = (
4544 let affectedNodeId : null | string = null ;
4645 let affectedNodeContent : Content [ string ] | null = null ;
4746 let affectedNodes : string [ ] | undefined = undefined ;
48- if ( action . type === 'DOCUMENT/SET_NODE_CONTENT ' ) {
47+ if ( action . type === 'document/update-node-content ' ) {
4948 const update = setNodeContent ( state . document . content , action ) ;
5049 if ( ! update ) return NO_UPDATE ;
5150 newActiveNodeId = action . payload . nodeId ;
52- } else if ( action . type === 'DOCUMENT/INSERT_NODE ' ) {
51+ } else if ( action . type === 'document/add-node ' ) {
5352 newActiveNodeId = insertNode (
5453 state . document ,
5554 action . payload . position ,
5655 action . payload . activeNodeId ,
5756 action . payload . content ,
5857 ) ;
59- } else if ( action . type === 'DOCUMENT/DELETE_NODE ' ) {
58+ } else if ( action . type === 'document/delete-node ' ) {
6059 affectedNodeContent =
6160 state . document . content [ action . payload . activeNodeId ] ;
6261 newActiveNodeId = deleteNode (
@@ -65,7 +64,7 @@ const updateDocumentState = (
6564 action . payload . selectedNodes ,
6665 ) ;
6766 affectedNodeId = action . payload . activeNodeId ;
68- } else if ( action . type === 'DOCUMENT/EXTRACT_BRANCH ' ) {
67+ } else if ( action . type === 'document/extract-node ' ) {
6968 affectedNodeContent = state . document . content [ action . payload . nodeId ] ;
7069 const update = setNodeContent ( state . document . content , {
7170 payload : {
@@ -76,18 +75,18 @@ const updateDocumentState = (
7675 if ( ! update ) return NO_UPDATE ;
7776 removeExtractedBranch ( state . document , action ) ;
7877 newActiveNodeId = action . payload . nodeId ;
79- } else if ( action . type === 'DOCUMENT/SPLIT_NODE ' ) {
78+ } else if ( action . type === 'document/split-node ' ) {
8079 affectedNodeId = action . payload . target ;
8180 affectedNodeContent = state . document . content [ affectedNodeId ] ;
8281 newActiveNodeId = splitNode ( state . document , action ) ;
83- } else if ( action . type === 'DOCUMENT/DROP_NODE ' ) {
82+ } else if ( action . type === 'document/drop-node ' ) {
8483 dropNode ( state . document , action ) ;
8584 newActiveNodeId = action . payload . droppedNodeId ;
86- } else if ( action . type === 'DOCUMENT/MOVE_NODE ' ) {
85+ } else if ( action . type === 'document/move-node ' ) {
8786 moveNode ( state . document , action ) ;
8887 newActiveNodeId = action . payload . activeNodeId ;
8988 affectedNodeId = newActiveNodeId ;
90- } else if ( action . type === 'DOCUMENT/MERGE_NODE ' ) {
89+ } else if ( action . type === 'document/merge-node ' ) {
9190 affectedNodeContent =
9291 state . document . content [ action . payload . activeNodeId ] ;
9392 newActiveNodeId = mergeNode ( state . document , action ) ;
@@ -96,7 +95,7 @@ const updateDocumentState = (
9695 sortDirectChildNodes ( state . document , action . payload ) ;
9796 newActiveNodeId = action . payload . id ;
9897 affectedNodeId = newActiveNodeId ;
99- } else if ( action . type === 'DOCUMENT/LOAD_FILE ' ) {
98+ } else if ( action . type === 'document/file/load-from-disk ' ) {
10099 if ( action . payload . __test_document__ ) {
101100 newActiveNodeId = loadDocumentFromJSON (
102101 state ,
@@ -105,41 +104,34 @@ const updateDocumentState = (
105104 } else {
106105 newActiveNodeId = loadDocumentFromFile ( state , action ) ;
107106 }
108- } else if ( action . type === 'RESET_STORE' ) {
109- const newState = defaultDocumentState ( ) ;
110- state . document = newState . document ;
111- state . history = newState . history ;
112- state . file = newState . file ;
113- } else if ( action . type === 'HISTORY/SELECT_SNAPSHOT' ) {
107+ } else if ( action . type === 'document/history/select-snapshot' ) {
114108 selectSnapshot ( state . document , state . history , action ) ;
115109 state . history = { ...state . history } ;
116- } else if ( action . type === 'HISTORY/APPLY_PREVIOUS_SNAPSHOT ' ) {
110+ } else if ( action . type === 'document/history/select-previous-snapshot ' ) {
117111 undoAction ( state . document , state . history ) ;
118112 state . history = { ...state . history } ;
119- } else if ( action . type === 'HISTORY/APPLY_NEXT_SNAPSHOT ' ) {
113+ } else if ( action . type === 'document/history/select-next-snapshot ' ) {
120114 redoAction ( state . document , state . history ) ;
121115 state . history = { ...state . history } ;
122- } else if ( action . type === 'FS/SET_FILE_PATH' ) {
123- state . file . path = action . payload . path ;
124- } else if ( action . type === 'DOCUMENT/FORMAT_HEADINGS' ) {
116+ } else if ( action . type === 'document/format-headings' ) {
125117 formatHeadings ( state . document . content , state . sections ) ;
126118 newActiveNodeId = getIdOfSection (
127119 state . sections ,
128120 state . history . context . activeSection ,
129121 ) ;
130- } else if ( action . type === 'DOCUMENT/PASTE_NODE ' ) {
122+ } else if ( action . type === 'document/paste-node ' ) {
131123 const result = pasteNode ( state . document , action ) ;
132124 newActiveNodeId = result . nextNode ;
133125 affectedNodes = result . rootNodes ;
134- } else if ( action . type === 'DOCUMENT/CUT_NODE ' ) {
126+ } else if ( action . type === 'document/cut-node ' ) {
135127 affectedNodeContent = state . document . content [ action . payload . nodeId ] ;
136128 newActiveNodeId = deleteNode (
137129 state . document ,
138130 action . payload . nodeId ,
139131 action . payload . selectedNodes ,
140132 ) ;
141133 affectedNodeId = action . payload . nodeId ;
142- } else if ( action . type === 'FILE/UPDATE_FRONTMATTER ' ) {
134+ } else if ( action . type === 'document/file/update-frontmatter ' ) {
143135 state . file . frontmatter = action . payload . frontmatter ;
144136 return ;
145137 } else if ( action . type === 'document/pinned-nodes/pin' ) {
@@ -158,7 +150,7 @@ const updateDocumentState = (
158150 action . payload . sections ,
159151 ) ;
160152 return ;
161- } else if ( action . type === 'META/REFRESH_GROUP_PARENT_IDS ' ) {
153+ } else if ( action . type === 'document/meta/refresh-group-parent-ids ' ) {
162154 refreshGroupParentIds ( state . document . columns , state . meta ) ;
163155 return ;
164156 }
@@ -175,7 +167,7 @@ const updateDocumentState = (
175167 }
176168
177169 // if file was modified externally, try to maintain active section
178- if ( action . type === 'DOCUMENT/LOAD_FILE ' ) {
170+ if ( action . type === 'document/file/load-from-disk ' ) {
179171 const activeSection = action . payload . activeSection ;
180172 if ( activeSection ) {
181173 const id = state . sections . section_id [ activeSection ] ;
0 commit comments