[dark theme] keep theme name for next session
This commit is contained in:
parent
00382dd815
commit
40a7e66834
|
@ -862,6 +862,9 @@
|
||||||
if (config.parentOrigin)
|
if (config.parentOrigin)
|
||||||
params += "&parentOrigin=" + config.parentOrigin;
|
params += "&parentOrigin=" + config.parentOrigin;
|
||||||
|
|
||||||
|
if (config.editorConfig && config.editorConfig.customization && config.editorConfig.customization.uiTheme )
|
||||||
|
params += "&uitheme=" + config.editorConfig.customization.uiTheme;
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ define([
|
||||||
|
|
||||||
|
|
||||||
var createExternalEditor = function() {
|
var createExternalEditor = function() {
|
||||||
|
!!customization && (customization.uiTheme = Common.localStorage.getItem("uitheme", "theme-light"));
|
||||||
externalEditor = new DocsAPI.DocEditor('id-diagram-editor-placeholder', {
|
externalEditor = new DocsAPI.DocEditor('id-diagram-editor-placeholder', {
|
||||||
width : '100%',
|
width : '100%',
|
||||||
height : '100%',
|
height : '100%',
|
||||||
|
@ -242,6 +243,15 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showExternalEditor: function () {
|
||||||
|
if ( externalEditor ) {
|
||||||
|
var value = Common.localStorage.getItem("uitheme", "theme-light");
|
||||||
|
externalEditor.serviceCommand('theme:change', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.diagramEditorView.show();
|
||||||
|
},
|
||||||
|
|
||||||
warningTitle: 'Warning',
|
warningTitle: 'Warning',
|
||||||
warningText: 'The object is disabled because of editing by another user.',
|
warningText: 'The object is disabled because of editing by another user.',
|
||||||
textClose: 'Close',
|
textClose: 'Close',
|
||||||
|
|
|
@ -189,6 +189,9 @@ define([
|
||||||
case '2': this.api.SetFontRenderingMode(2); break;
|
case '2': this.api.SetFontRenderingMode(2); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
value = Common.localStorage.getItem("uitheme", "theme-light");
|
||||||
|
me.api.asc_setSkin(value == "theme-dark" ? 'flatDark' : "flat");
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
||||||
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
|
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
|
||||||
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
||||||
|
@ -1119,12 +1122,19 @@ define([
|
||||||
$('#header-logo').children(0).click(e => {
|
$('#header-logo').children(0).click(e => {
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
$(':root').toggleClass('theme-dark');
|
var value = Common.localStorage.getItem("uitheme", "theme-light");
|
||||||
// getComputedStyle(document.documentElement).getPropertyValue('--background-normal');
|
var classname = document.documentElement.className.replace(/theme-\w+\s?/, '');
|
||||||
|
document.documentElement.className = classname;
|
||||||
if (AscCommon.GlobalSkin.Name == 'flat')
|
if ( value != "theme-dark" ) {
|
||||||
me.api.asc_setSkin('flatDark');
|
me.api.asc_setSkin('flatDark');
|
||||||
else me.api.asc_setSkin("flat");
|
$(':root').addClass('theme-dark');
|
||||||
|
Common.localStorage.setItem("uitheme", "theme-dark");
|
||||||
|
} else {
|
||||||
|
me.api.asc_setSkin("flat");
|
||||||
|
Common.localStorage.setItem("uitheme", "theme-light");
|
||||||
|
}
|
||||||
|
|
||||||
|
// getComputedStyle(document.documentElement).getPropertyValue('--background-normal');
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2056,12 +2056,14 @@ define([
|
||||||
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||||
} else {
|
} else {
|
||||||
|
var controller = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor');
|
||||||
if (!this.diagramEditor)
|
if (!this.diagramEditor)
|
||||||
this.diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
|
this.diagramEditor = controller.getView('Common.Views.ExternalDiagramEditor');
|
||||||
|
|
||||||
if (this.diagramEditor && me.api) {
|
if (this.diagramEditor && me.api) {
|
||||||
this.diagramEditor.setEditMode(false);
|
this.diagramEditor.setEditMode(false);
|
||||||
this.diagramEditor.show();
|
// this.diagramEditor.show();
|
||||||
|
controller.showExternalEditor();
|
||||||
|
|
||||||
chart = me.api.asc_getChartObject(type);
|
chart = me.api.asc_getChartObject(type);
|
||||||
if (chart) {
|
if (chart) {
|
||||||
|
|
|
@ -204,6 +204,11 @@
|
||||||
window.frameEditorId = params["frameEditorId"];
|
window.frameEditorId = params["frameEditorId"];
|
||||||
window.parentOrigin = params["parentOrigin"];
|
window.parentOrigin = params["parentOrigin"];
|
||||||
|
|
||||||
|
var ui_theme_name = params.uitheme || localStorage.getItem("uitheme");
|
||||||
|
if ( !!ui_theme_name ) {
|
||||||
|
document.documentElement.classList.add(ui_theme_name);
|
||||||
|
}
|
||||||
|
|
||||||
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
||||||
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -170,6 +170,9 @@ define([
|
||||||
Common.Utils.InternalSettings.set("pe-settings-fontrender", value);
|
Common.Utils.InternalSettings.set("pe-settings-fontrender", value);
|
||||||
this.api.SetFontRenderingMode(parseInt(value));
|
this.api.SetFontRenderingMode(parseInt(value));
|
||||||
|
|
||||||
|
value = Common.localStorage.getItem("uitheme", "theme-light");
|
||||||
|
me.api.asc_setSkin(value == "theme-dark" ? 'flatDark' : "flat");
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
||||||
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
|
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
|
||||||
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
||||||
|
@ -843,12 +846,17 @@ define([
|
||||||
$('#header-logo').children(0).click(e => {
|
$('#header-logo').children(0).click(e => {
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
$(':root').toggleClass('theme-dark');
|
var value = Common.localStorage.getItem("uitheme", "theme-light");
|
||||||
// getComputedStyle(document.documentElement).getPropertyValue('--background-normal');
|
var classname = document.documentElement.className.replace(/theme-\w+\s?/, '');
|
||||||
|
document.documentElement.className = classname;
|
||||||
if (AscCommon.GlobalSkin.Name == 'flat')
|
if ( value != "theme-dark" ) {
|
||||||
me.api.asc_setSkin('flatDark');
|
me.api.asc_setSkin('flatDark');
|
||||||
else me.api.asc_setSkin("flat");
|
$(':root').addClass('theme-dark');
|
||||||
|
Common.localStorage.setItem("uitheme", "theme-dark");
|
||||||
|
} else {
|
||||||
|
me.api.asc_setSkin("flat");
|
||||||
|
Common.localStorage.setItem("uitheme", "theme-light");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,11 @@
|
||||||
window.frameEditorId = params["frameEditorId"];
|
window.frameEditorId = params["frameEditorId"];
|
||||||
window.parentOrigin = params["parentOrigin"];
|
window.parentOrigin = params["parentOrigin"];
|
||||||
|
|
||||||
|
var ui_theme_name = params.uitheme || localStorage.getItem("uitheme");
|
||||||
|
if ( !!ui_theme_name ) {
|
||||||
|
document.documentElement.classList.add(ui_theme_name);
|
||||||
|
}
|
||||||
|
|
||||||
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
||||||
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -176,6 +176,9 @@ define([
|
||||||
Common.Utils.InternalSettings.set("sse-settings-fontrender", value);
|
Common.Utils.InternalSettings.set("sse-settings-fontrender", value);
|
||||||
this.api.asc_setFontRenderingMode(parseInt(value));
|
this.api.asc_setFontRenderingMode(parseInt(value));
|
||||||
|
|
||||||
|
value = Common.localStorage.getItem("uitheme", "theme-light");
|
||||||
|
this.api.asc_setSkin(value == "theme-dark" ? 'flatDark' : "flat");
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
this.api.asc_registerCallback('asc_onOpenDocumentProgress', _.bind(this.onOpenDocument, this));
|
||||||
this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this));
|
this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this));
|
||||||
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
|
||||||
|
@ -908,7 +911,16 @@ define([
|
||||||
$('#header-logo').children(0).click(e => {
|
$('#header-logo').children(0).click(e => {
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
|
||||||
$(':root').toggleClass('theme-dark');
|
document.documentElement.className = document.documentElement.className.replace(/theme-\w+\s?/, '');
|
||||||
|
if ( "theme-dark" != Common.localStorage.getItem("uitheme", "theme-light") ) {
|
||||||
|
me.api.asc_setSkin('flatDark');
|
||||||
|
$(':root').addClass('theme-dark');
|
||||||
|
Common.localStorage.setItem("uitheme", "theme-dark");
|
||||||
|
} else {
|
||||||
|
me.api.asc_setSkin("flat");
|
||||||
|
Common.localStorage.setItem("uitheme", "theme-light");
|
||||||
|
}
|
||||||
|
|
||||||
// getComputedStyle(document.documentElement).getPropertyValue('--background-normal');
|
// getComputedStyle(document.documentElement).getPropertyValue('--background-normal');
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -2042,6 +2054,11 @@ define([
|
||||||
case 'processmouse':
|
case 'processmouse':
|
||||||
this.onProcessMouse(data.data);
|
this.onProcessMouse(data.data);
|
||||||
break;
|
break;
|
||||||
|
case 'theme:change':
|
||||||
|
document.documentElement.className =
|
||||||
|
document.documentElement.className.replace(/theme-\w+\s?/, data.data);
|
||||||
|
this.api.asc_setSkin(data.data == "theme-dark" ? 'flatDark' : "flat");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -232,6 +232,11 @@
|
||||||
window.frameEditorId = params["frameEditorId"];
|
window.frameEditorId = params["frameEditorId"];
|
||||||
window.parentOrigin = params["parentOrigin"];
|
window.parentOrigin = params["parentOrigin"];
|
||||||
|
|
||||||
|
var ui_theme_name = params.uitheme || localStorage.getItem("uitheme");
|
||||||
|
if ( !!ui_theme_name ) {
|
||||||
|
document.documentElement.classList.add(ui_theme_name);
|
||||||
|
}
|
||||||
|
|
||||||
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
||||||
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -162,6 +162,10 @@
|
||||||
window.frameEditorId = params["frameEditorId"];
|
window.frameEditorId = params["frameEditorId"];
|
||||||
window.parentOrigin = params["parentOrigin"];
|
window.parentOrigin = params["parentOrigin"];
|
||||||
|
|
||||||
|
if ( !!params.uitheme ) {
|
||||||
|
document.documentElement.classList.add(params.uitheme);
|
||||||
|
}
|
||||||
|
|
||||||
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
|
||||||
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
document.write('<script src="../../common/main/lib/util/fix-ie-compat.js"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue