mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 23:16:03 +00:00
dark iframe fallback
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"stylesheet": "client/css/espo/dark.css",
|
||||
"stylesheetIframe": "client/css/espo/dark-iframe.css",
|
||||
"stylesheetIframeFallback": "client/css/espo/hazyblue-iframe.css",
|
||||
"dashboardCellHeight": 155,
|
||||
"dashboardCellMargin": 19,
|
||||
"navbarHeight": 43,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"stylesheet": "client/css/espo/dark-vertical.css",
|
||||
"stylesheetIframe": "client/css/espo/dark-vertical-iframe.css",
|
||||
"stylesheetIframeFallback": "client/css/espo/hazyblue-iframe.css",
|
||||
"navbarIsVertical": true,
|
||||
"recordTopButtonsStickTop": 61,
|
||||
"recordTopButtonsBlockHeight": 21,
|
||||
|
||||
@@ -95,6 +95,17 @@ define('theme-manager', [], function () {
|
||||
return link;
|
||||
},
|
||||
|
||||
getIframeFallbackStylesheet: function () {
|
||||
let link = this.metadata.get(['themes', this.getName(), 'stylesheetIframeFallback']) ||
|
||||
'client/css/espo/espo-iframe.css';
|
||||
|
||||
if (this.config.get('cacheTimestamp')) {
|
||||
link += '?r=' + this.config.get('cacheTimestamp').toString();
|
||||
}
|
||||
|
||||
return link;
|
||||
},
|
||||
|
||||
getParam: function (name) {
|
||||
return this.metadata.get(['themes', this.getName(), name]) || this.defaultParams[name] || null;
|
||||
},
|
||||
|
||||
@@ -289,11 +289,17 @@ define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], function
|
||||
|
||||
var body = this.sanitizeHtml(this.model.get(this.name) || '');
|
||||
|
||||
let useFallbackStylesheet = this.getThemeManager().getParam('isDark') && this.htmlHasColors(body);
|
||||
|
||||
var linkElement = iframeElement.contentWindow.document.createElement('link');
|
||||
|
||||
linkElement.type = 'text/css';
|
||||
linkElement.rel = 'stylesheet';
|
||||
linkElement.href = this.getBasePath() + this.getThemeManager().getIframeStylesheet();
|
||||
linkElement.href = this.getBasePath() + (
|
||||
useFallbackStylesheet ?
|
||||
this.getThemeManager().getIframeFallbackStylesheet() :
|
||||
this.getThemeManager().getIframeStylesheet()
|
||||
);
|
||||
|
||||
body = linkElement.outerHTML + body;
|
||||
|
||||
@@ -987,5 +993,17 @@ define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], function
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
htmlHasColors: function (string) {
|
||||
if (~string.indexOf('background-color:')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (~string.indexOf('color:')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,6 +13,8 @@ body {
|
||||
> blockquote:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
background-color: var(--panel-bg);
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
Reference in New Issue
Block a user