Merge pull request #1732 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
catbasilio 2022-05-06 17:41:46 +03:00 committed by GitHub
commit c0ebd82c05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 95 additions and 68 deletions

View file

@ -79,6 +79,10 @@ define([
mode: mode, mode: mode,
compactToolbar: this.toolbar.toolbar.isCompactView compactToolbar: this.toolbar.toolbar.isCompactView
}); });
if (!Common.UI.Themes.available()) {
this.view.btnInterfaceTheme.$el.closest('.group').remove();
this.view.cmpEl.find('.separator-theme').remove();
}
if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) { if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) {
this.view.chStatusbar.$el.remove(); this.view.chStatusbar.$el.remove();
var slotChkRulers = this.view.chRulers.$el, var slotChkRulers = this.view.chRulers.$el,
@ -144,30 +148,32 @@ define([
me.view.turnNavigation(state); me.view.turnNavigation(state);
}); });
var menuItems = [], if (Common.UI.Themes.available()) {
currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); var menuItems = [],
for (var t in Common.UI.Themes.map()) { currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
menuItems.push({ for (var t in Common.UI.Themes.map()) {
value: t, menuItems.push({
caption: Common.UI.Themes.get(t).text, value: t,
checked: t === currentTheme, caption: Common.UI.Themes.get(t).text,
checkable: true, checked: t === currentTheme,
toggleGroup: 'interface-theme' checkable: true,
}); toggleGroup: 'interface-theme'
} });
}
if (menuItems.length) { if (menuItems.length) {
me.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); me.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems}));
me.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { me.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value; var value = item.value;
Common.UI.Themes.setTheme(value); Common.UI.Themes.setTheme(value);
me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme());
}, me)); }, me));
setTimeout(function () { setTimeout(function () {
me.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark()); me.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark());
me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme());
}, 0); }, 0);
}
} }
}); });
} }
@ -243,7 +249,7 @@ define([
}, },
onThemeChanged: function () { onThemeChanged: function () {
if (this.view) { if (this.view && Common.UI.Themes.available()) {
var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(),
menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme});
if ( menu_item ) { if ( menu_item ) {

View file

@ -200,7 +200,7 @@
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span> <span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
<span class="btn-slot text x-huge" id="slot-btn-dark-document"></span> <span class="btn-slot text x-huge" id="slot-btn-dark-document"></span>
</div> </div>
<div class="separator long"></div> <div class="separator long separator-theme"></div>
<div class="group small"> <div class="group small">
<div class="elset"> <div class="elset">
<span class="btn-slot text" id="slot-chk-toolbar"></span> <span class="btn-slot text" id="slot-chk-toolbar"></span>

View file

@ -245,8 +245,10 @@
window.frameEditorId = params["frameEditorId"]; window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"]; window.parentOrigin = params["parentOrigin"];
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>');
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>');
}
</script> </script>
<script src="../../common/main/lib/util/themeinit.js"></script> <script src="../../common/main/lib/util/themeinit.js"></script>

View file

@ -81,6 +81,10 @@ define([
mode: mode, mode: mode,
compactToolbar: this.toolbar.toolbar.isCompactView compactToolbar: this.toolbar.toolbar.isCompactView
}); });
if (!Common.UI.Themes.available()) {
this.view.btnInterfaceTheme.$el.closest('.group').remove();
this.view.cmpEl.find('.separator-theme').remove();
}
if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) { if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) {
this.view.chStatusbar.$el.remove(); this.view.chStatusbar.$el.remove();
} }
@ -89,7 +93,7 @@ define([
'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'), 'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'),
'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'), 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'),
'rulers:change': _.bind(this.onChangeRulers, this), 'rulers:change': _.bind(this.onChangeRulers, this),
'notes:change': _.bind(this.onChangeNotes, this), 'notes:change': _.bind(this.onChangeNotes, this)
}, },
'Toolbar': { 'Toolbar': {
'view:compact': _.bind(function (toolbar, state) { 'view:compact': _.bind(function (toolbar, state) {
@ -150,24 +154,26 @@ define([
.on('combo:blur', _.bind(me.onComboBlur, me, false)); .on('combo:blur', _.bind(me.onComboBlur, me, false));
}); });
var menuItems = [], if (Common.UI.Themes.available()) {
currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); var menuItems = [],
for (var t in Common.UI.Themes.map()) { currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
menuItems.push({ for (var t in Common.UI.Themes.map()) {
value: t, menuItems.push({
caption: Common.UI.Themes.get(t).text, value: t,
checked: t === currentTheme, caption: Common.UI.Themes.get(t).text,
checkable: true, checked: t === currentTheme,
toggleGroup: 'interface-theme' checkable: true,
}); toggleGroup: 'interface-theme'
} });
}
if (menuItems.length) { if (menuItems.length) {
this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems}));
this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value; var value = item.value;
Common.UI.Themes.setTheme(value); Common.UI.Themes.setTheme(value);
}, this)); }, this));
}
} }
} }
}, },
@ -199,7 +205,7 @@ define([
}, },
onThemeChanged: function () { onThemeChanged: function () {
if (this.view) { if (this.view && Common.UI.Themes.available()) {
var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(),
menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme});
if ( !!menu_item ) { if ( !!menu_item ) {

View file

@ -199,7 +199,7 @@
<div class="group"> <div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span> <span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
</div> </div>
<div class="separator long"></div> <div class="separator long separator-theme"></div>
<div class="group small"> <div class="group small">
<div class="elset"> <div class="elset">
<span class="btn-slot text" id="slot-chk-notes"></span> <span class="btn-slot text" id="slot-chk-notes"></span>

View file

@ -195,6 +195,8 @@ define([
dataHintOffset: 'small' dataHintOffset: 'small'
}); });
this.lockedControls.push(this.chNotes); this.lockedControls.push(this.chNotes);
this.cmpEl = $host;
}, },
render: function (el) { render: function (el) {

View file

@ -261,8 +261,10 @@
window.frameEditorId = params["frameEditorId"]; window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"]; window.parentOrigin = params["parentOrigin"];
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>');
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>');
}
</script> </script>
<!-- debug begin --> <!-- debug begin -->

View file

@ -72,6 +72,7 @@
background-color: @highlight-button-pressed; background-color: @highlight-button-pressed;
> a { > a {
color: @text-normal-pressed-ie;
color: @text-normal-pressed; color: @text-normal-pressed;
} }
} }

View file

@ -84,6 +84,10 @@ define([
mode: mode, mode: mode,
compactToolbar: this.toolbar.toolbar.isCompactView compactToolbar: this.toolbar.toolbar.isCompactView
}); });
if (!Common.UI.Themes.available()) {
this.view.btnInterfaceTheme.$el.closest('.group').remove();
this.view.cmpEl.find('.separator-theme').remove();
}
if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) { if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) {
this.view.chStatusbar.$el.remove(); this.view.chStatusbar.$el.remove();
} }
@ -281,7 +285,7 @@ define([
}, },
onThemeChanged: function () { onThemeChanged: function () {
if (this.view) { if (this.view && Common.UI.Themes.available()) {
var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(), var current_theme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(),
menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme}); menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme});
if ( !!menu_item ) { if ( !!menu_item ) {

View file

@ -270,7 +270,7 @@
<div class="group"> <div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span> <span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
</div> </div>
<div class="separator long"></div> <div class="separator long separator-theme"></div>
<div class="group"> <div class="group">
<span class="btn-slot text x-huge" id="slot-btn-freeze"></span> <span class="btn-slot text x-huge" id="slot-btn-freeze"></span>
</div> </div>

View file

@ -264,7 +264,7 @@ define([
this.lockedControls.push(this.chToolbar); this.lockedControls.push(this.chToolbar);
$host.find('#slot-lbl-zoom').text(this.textZoom); $host.find('#slot-lbl-zoom').text(this.textZoom);
this.cmpEl = $host;
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
}, },
@ -312,26 +312,27 @@ define([
})); }));
me.btnFreezePanes.updateHint(me.tipFreeze); me.btnFreezePanes.updateHint(me.tipFreeze);
var menuItems = [], if (Common.UI.Themes.available()) {
currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); var menuItems = [],
for (var t in Common.UI.Themes.map()) { currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
menuItems.push({ for (var t in Common.UI.Themes.map()) {
value: t, menuItems.push({
caption: Common.UI.Themes.get(t).text, value: t,
checked: t === currentTheme, caption: Common.UI.Themes.get(t).text,
checkable: true, checked: t === currentTheme,
toggleGroup: 'interface-theme' checkable: true,
}); toggleGroup: 'interface-theme'
} });
}
if (menuItems.length) { if (menuItems.length) {
me.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); me.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems}));
me.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { me.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value; var value = item.value;
Common.UI.Themes.setTheme(value); Common.UI.Themes.setTheme(value);
}, me)); }, me));
}
} }
setEvents.call(me); setEvents.call(me);
}); });
}, },

View file

@ -268,8 +268,10 @@
window.frameEditorId = params["frameEditorId"]; window.frameEditorId = params["frameEditorId"];
window.parentOrigin = params["parentOrigin"]; window.parentOrigin = params["parentOrigin"];
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>');
document.write('<script src="../../../../sdkjs/vendor/string.js"><\/script>');
}
</script> </script>
<link rel="stylesheet" type="text/css" href="../../../../sdkjs/cell/css/main.css"/> <link rel="stylesheet" type="text/css" href="../../../../sdkjs/cell/css/main.css"/>

View file

@ -72,6 +72,7 @@
background-color: @highlight-button-pressed; background-color: @highlight-button-pressed;
> a { > a {
color: @text-normal-pressed-ie;
color: @text-normal-pressed; color: @text-normal-pressed;
} }
} }