Skip to content

Commit

Permalink
[Bugfix] Track changes drop down menu does not persist when opening a…
Browse files Browse the repository at this point in the history
… new file (#8975)

(master → master)
  • Loading branch information
webviewer-ui committed Jun 4, 2024
1 parent 17af3e6 commit 79efcc2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/event-listeners/onDocumentLoaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,22 @@ export default (store, documentViewerKey) => async () => {

const handleEditModeUpdate = (editMode) => {
dispatch(actions.setOfficeEditorEditMode(editMode));
if (editMode === OFFICE_EDITOR_EDIT_MODE.VIEW_ONLY) {
if (editMode === OFFICE_EDITOR_EDIT_MODE.VIEW_ONLY || editMode === OFFICE_EDITOR_EDIT_MODE.PREVIEW) {
dispatch(actions.closeElement(DataElements.OFFICE_EDITOR_TOOLS_HEADER));
dispatch(actions.disableElement(DataElements.CONTEXT_MENU_POPUP, PRIORITY_TWO));
dispatch(actions.disableElements([DataElements.CONTEXT_MENU_POPUP, DataElements.NOTE_MULTI_SELECT_MODE_BUTTON], PRIORITY_TWO));
} else {
dispatch(actions.enableElement(DataElements.CONTEXT_MENU_POPUP, PRIORITY_TWO));
dispatch(actions.openElement(DataElements.OFFICE_EDITOR_TOOLS_HEADER));
dispatch(actions.enableElements([DataElements.CONTEXT_MENU_POPUP, DataElements.NOTE_MULTI_SELECT_MODE_BUTTON], PRIORITY_TWO));
}
if (editMode === OFFICE_EDITOR_EDIT_MODE.REVIEWING) {
if (editMode === OFFICE_EDITOR_EDIT_MODE.REVIEWING || editMode === OFFICE_EDITOR_EDIT_MODE.PREVIEW) {
dispatch(actions.openElement(DataElements.LEFT_PANEL));
} else {
dispatch(actions.closeElement(DataElements.LEFT_PANEL));
}
};
const initialEditMode = selectors.getOfficeEditorEditMode(getState());
handleEditModeUpdate(initialEditMode);
handleEditModeUpdate(OFFICE_EDITOR_EDIT_MODE.EDITING);
doc.addEventListener('editModeUpdated', handleEditModeUpdate);
dispatch(actions.setOfficeEditorEditMode(OFFICE_EDITOR_EDIT_MODE.EDITING));
notesInLeftPanel = selectors.getNotesInLeftPanel(getState());
dispatch(actions.setNotesInLeftPanel(true));
} else {
Expand Down

0 comments on commit 79efcc2

Please sign in to comment.