From 4e72c53a8a172ad304a83bf74deb1d2f3d64f9bc Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 13 Sep 2016 15:03:32 +0300 Subject: [PATCH] Load initial value for compact toolbar from editor config. --- apps/api/documents/api.js | 3 ++- apps/documenteditor/main/app/view/Toolbar.js | 4 ++-- apps/presentationeditor/main/app/view/Toolbar.js | 2 +- apps/spreadsheeteditor/main/app/view/Toolbar.js | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 74c1589bf2..5fb76ccaaa 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -106,7 +106,8 @@ }, chat: false, comments: false, - zoom: 100 + zoom: 100, + compactToolbar: false }, plugins: { url: '../../../../sdkjs-plugins/', diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 7e49aea012..ed01597052 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -983,7 +983,7 @@ define([ this.btnPageMargins.menu.items[0].setVisible(false); var value = Common.localStorage.getItem("de-compact-toolbar"); - var valueCompact = (value !== null && parseInt(value) == 1); + var valueCompact = !!(value !== null && parseInt(value) == 1 || value === null && mode.customization && mode.customization.compactToolbar); me.$el.html(this.template({ isCompactView: valueCompact @@ -1406,7 +1406,7 @@ define([ /**/ var mode = this.mode; var value = Common.localStorage.getItem("de-compact-toolbar"); - var valueCompact = (value !== null && parseInt(value) == 1); + var valueCompact = !!(value !== null && parseInt(value) == 1 || value === null && this.mode.customization && this.mode.customization.compactToolbar); value = Common.localStorage.getItem("de-hidden-title"); var valueTitle = (value !== null && parseInt(value) == 1); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 8d2b9802e1..07995abbdf 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1139,7 +1139,7 @@ define([ this.trigger('render:before', this); var value = Common.localStorage.getItem('pe-compact-toolbar'); - var valueCompact = (value!==null && parseInt(value) == 1); + var valueCompact = !!(value!==null && parseInt(value) == 1 || value === null && mode.customization && mode.customization.compactToolbar); value = Common.localStorage.getItem('pe-hidden-title'); var valueTitle = (value!==null && parseInt(value) == 1); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 6aaa5c58ae..30307b81ad 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1523,7 +1523,8 @@ define([ JSON.parse(Common.localStorage.getItem('sse-hidden-title')) && (options.title = true); JSON.parse(Common.localStorage.getItem('sse-hidden-formula')) && (options.formula = true); JSON.parse(Common.localStorage.getItem('sse-hidden-headings')) && (options.headings = true); - var isCompactView = !!JSON.parse(Common.localStorage.getItem('sse-toolbar-compact')); + var isCompactView = JSON.parse(Common.localStorage.getItem('sse-toolbar-compact')); + isCompactView = !!(isCompactView!==null && parseInt(isCompactView) == 1 || isCompactView === null && mode.customization && mode.customization.compactToolbar); me.mnuitemCompactToolbar.setChecked(isCompactView); me.mnuitemHideTitleBar.setChecked(!!options.title);