diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 7ec1689ab..6b68b5f80 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -155,7 +155,8 @@ macros: true // can run macros in document plugins: true // can run plugins in document macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn', - trackChanges: undefined // true/false - open editor with track changes mode on/off + trackChanges: undefined // true/false - open editor with track changes mode on/off, + hideRulers: false, // hide or show rulers on first loading (presentation or document editor) }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 9593875f2..84a33732d 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1440,7 +1440,9 @@ define([ Common.Utils.InternalSettings.set("de-settings-unit", value); me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); - me.api.asc_SetViewRulers(!Common.localStorage.getBool('de-hidden-rulers')); + value = Common.localStorage.itemExists('de-hidden-rulers') ? Common.localStorage.getBool('de-hidden-rulers') : (this.appOptions.customization && !!this.appOptions.customization.hideRulers); + Common.Utils.InternalSettings.set("de-hidden-rulers", value); + me.api.asc_SetViewRulers(!value); me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me)); /** coauthoring begin **/ diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index 5f44a908a..3597aaee3 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -241,7 +241,7 @@ define([ var mnuitemHideRulers = new Common.UI.MenuItem({ caption: me.header.textHideLines, - checked: Common.localStorage.getBool("de-hidden-rulers"), + checked: Common.Utils.InternalSettings.get("de-hidden-rulers"), checkable: true, value: 'rulers' }); @@ -387,6 +387,7 @@ define([ case 'rulers': me.api.asc_SetViewRulers(!item.isChecked()); Common.localStorage.setBool('de-hidden-rulers', item.isChecked()); + Common.Utils.InternalSettings.set("de-hidden-rulers", item.isChecked()); Common.NotificationCenter.trigger('layout:changed', 'rulers'); Common.NotificationCenter.trigger('edit:complete', me.header); break; diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 33c80e6b0..353afd908 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1135,7 +1135,9 @@ define([ Common.Utils.InternalSettings.set("pe-settings-unit", value); me.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? Asc.c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? Asc.c_oAscDocumentUnits.Point : Asc.c_oAscDocumentUnits.Millimeter)); - if (me.api.asc_SetViewRulers) me.api.asc_SetViewRulers(!Common.localStorage.getBool('pe-hidden-rulers', true)); + value = Common.localStorage.itemExists('pe-hidden-rulers') ? Common.localStorage.getBool('pe-hidden-rulers') : (!this.appOptions.customization || this.appOptions.customization.hideRulers!==false); + Common.Utils.InternalSettings.set("pe-hidden-rulers", value); + if (me.api.asc_SetViewRulers) me.api.asc_SetViewRulers(!value); me.api.asc_registerCallback('asc_onChangeObjectLock', _.bind(me._onChangeObjectLock, me)); me.api.asc_registerCallback('asc_onDocumentCanSaveChanged', _.bind(me.onDocumentCanSaveChanged, me)); diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 1832ccc8c..08e9608ca 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -244,7 +244,7 @@ define([ var mnuitemHideRulers = new Common.UI.MenuItem({ caption: me.header.textHideLines, - checked: Common.localStorage.getBool("pe-hidden-rulers", true), + checked: Common.Utils.InternalSettings.get("pe-hidden-rulers"), checkable: true, value: 'rulers' }); @@ -430,6 +430,7 @@ define([ case 'rulers': me.api.asc_SetViewRulers(!item.isChecked()); Common.localStorage.setBool('pe-hidden-rulers', item.isChecked()); + Common.Utils.InternalSettings.set("pe-hidden-rulers", item.isChecked()); Common.NotificationCenter.trigger('layout:changed', 'rulers'); Common.NotificationCenter.trigger('edit:complete', me.header); break;