mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-25 10:59:28 +08:00
Fix dock/undock plugins
This commit is contained in:
@ -773,12 +773,12 @@ define([
|
||||
var langName = plugin.get_Name(lang);
|
||||
var isCanDocked = variation.get_IsCanDocked();
|
||||
var dockedPosition = this.getPluginDockedPosition(plugin.get_Guid());
|
||||
var menu = this.isPDFEditor ? 'left' : (variation.get_Type() == Asc.PluginType.PanelRight ? 'right' : 'left');
|
||||
var menu = this.isPDFEditor ? 'left' : (variation.get_Type() === Asc.PluginType.PanelRight ? 'right' : 'left');
|
||||
var isInsideMode = variation.get_InsideMode();
|
||||
|
||||
if(isCanDocked) {
|
||||
isInsideMode = dockedPosition === Asc.PluginType.Panel || dockedPosition === Asc.PluginType.PanelRight;
|
||||
menu = isInsideMode ? dockedPosition : menu;
|
||||
menu = isInsideMode ? (dockedPosition === Asc.PluginType.PanelRight ? 'right' : 'left') : menu;
|
||||
}
|
||||
|
||||
!menu && (menu = 'left');
|
||||
@ -1230,7 +1230,7 @@ define([
|
||||
help && window.open(help, '_blank');
|
||||
},
|
||||
'docked': function(frameId){
|
||||
me.triggerDockedEvent(frameId);
|
||||
me.triggerDockedEvent(frameId, isPanel ? variation.type : 'panel'); // if the initial state of plugin is 'panelRight'/'panel' - move to corresponding panel, otherwise move to left panel
|
||||
setTimeout(function () {
|
||||
me.customPluginsDlg[frameId].close();
|
||||
me.onPluginPanelShow(frameId, variation, lang);
|
||||
@ -1250,10 +1250,11 @@ define([
|
||||
}
|
||||
},
|
||||
|
||||
triggerDockedEvent: function(frameId) {
|
||||
triggerDockedEvent: function(frameId, placement) {
|
||||
$('#' + frameId)[0].contentWindow.postMessage(JSON.stringify({
|
||||
type: 'plugin_docked',
|
||||
frameId: frameId
|
||||
frameId: frameId,
|
||||
placement: placement
|
||||
}), "*");
|
||||
},
|
||||
|
||||
@ -1343,7 +1344,7 @@ define([
|
||||
});
|
||||
this.viewPlugins.customPluginPanels[frameId].on('render:after', _.bind(this.onAfterRender, this, this.viewPlugins.customPluginPanels[frameId], frameId, isActivated));
|
||||
this.viewPlugins.customPluginPanels[frameId].on('docked', _.bind(function(frameId) {
|
||||
this.triggerDockedEvent(frameId);
|
||||
this.triggerDockedEvent(frameId, 'window');
|
||||
setTimeout( _.bind(function() {
|
||||
this.onPluginWindowClose(frameId);
|
||||
this.onPluginWindowShow(frameId, variation);
|
||||
|
||||
@ -215,9 +215,12 @@ define([], function () {
|
||||
var iconCls = 'btn-promote';
|
||||
btn = $('<div id="' + btnId + '" class="tool custom toolbar__icon ' + iconCls + '"></div>');
|
||||
btn.on('click', _.bind(function() {
|
||||
var tip = btn.data('bs.tooltip');
|
||||
if (tip) tip.dontShow = true;
|
||||
this.fireEvent('docked', this.frameId);
|
||||
}, this));
|
||||
header.append(btn);
|
||||
btn.tooltip({title: this.textDock, placement: 'cursor', zIndex: parseInt(this.$window.css('z-index')) + 10});
|
||||
}
|
||||
btn.show();
|
||||
header.removeClass('hidden');
|
||||
@ -249,6 +252,7 @@ define([], function () {
|
||||
this.frame && (this.frame.style.pointerEvents = enable ? "" : "none");
|
||||
},
|
||||
|
||||
textLoading : 'Loading'
|
||||
textLoading : 'Loading',
|
||||
textDock: 'Pin plugin'
|
||||
}, Common.Views.PluginDlg || {}));
|
||||
});
|
||||
@ -91,15 +91,20 @@ define([], function () {
|
||||
|
||||
showDockedButton: function() {
|
||||
var header = this.$el.find('.current-plugin-header .tools'),
|
||||
btnId = 'id-pluginpnl-docked',
|
||||
btn = header.find('#' + btnId);
|
||||
btnCls = 'plugin-undock',
|
||||
btn = header.find('.' + btnCls);
|
||||
if (btn.length < 1) {
|
||||
var iconCls = 'btn-demote';
|
||||
btn = $('<div id="' + btnId + '" class="tool custom toolbar__icon ' + iconCls + '"></div>');
|
||||
btn.on('click', _.bind(function() {
|
||||
btn = $('<div class="' + btnCls + '"></div>');
|
||||
header.append(btn);
|
||||
var btnUndock = new Common.UI.Button({
|
||||
parentEl: this.$el.find('.' + btnCls),
|
||||
cls: 'btn-toolbar',
|
||||
iconCls: 'toolbar__icon btn-demote',
|
||||
hint: this.textUndock
|
||||
});
|
||||
btnUndock.on('click', _.bind(function() {
|
||||
this.fireEvent('docked', this.iframePlugin.id);
|
||||
}, this));
|
||||
header.append(btn);
|
||||
}
|
||||
btn.show();
|
||||
header.removeClass('hidden');
|
||||
@ -155,7 +160,8 @@ define([], function () {
|
||||
},
|
||||
|
||||
textClosePanel: 'Close plugin',
|
||||
textLoading: 'Loading'
|
||||
textLoading: 'Loading',
|
||||
textUndock: 'Unpin plugin'
|
||||
|
||||
}, Common.Views.PluginPanel || {}));
|
||||
});
|
||||
@ -113,24 +113,8 @@
|
||||
}
|
||||
|
||||
& > * {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
&:not(:first-child) {
|
||||
.margin-right-2();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.custom {
|
||||
border-radius: 1px;
|
||||
&:hover {
|
||||
background-color: @highlight-button-hover-ie;
|
||||
background-color: @highlight-button-hover;
|
||||
}
|
||||
&:active {
|
||||
background-color: @highlight-button-pressed-ie;
|
||||
background-color: @highlight-button-pressed;
|
||||
background-position-x: @button-small-active-icon-offset-x;;
|
||||
.margin-right-4();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,8 +642,10 @@
|
||||
"Common.Views.PasswordDialog.txtRepeat": "Repeat password",
|
||||
"Common.Views.PasswordDialog.txtTitle": "Set password",
|
||||
"Common.Views.PasswordDialog.txtWarning": "Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place.",
|
||||
"Common.Views.PluginDlg.textDock": "Pin plugin",
|
||||
"Common.Views.PluginDlg.textLoading": "Loading",
|
||||
"Common.Views.PluginPanel.textClosePanel": "Close plugin",
|
||||
"Common.Views.PluginPanel.textUndock": "Unpin plugin",
|
||||
"Common.Views.PluginPanel.textLoading": "Loading",
|
||||
"Common.Views.Plugins.groupCaption": "Plugins",
|
||||
"Common.Views.Plugins.strPlugins": "Plugins",
|
||||
|
||||
@ -270,8 +270,10 @@
|
||||
"Common.Views.PasswordDialog.txtRepeat": "Repeat password",
|
||||
"Common.Views.PasswordDialog.txtTitle": "Set password",
|
||||
"Common.Views.PasswordDialog.txtWarning": "Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place.",
|
||||
"Common.Views.PluginDlg.textDock": "Pin plugin",
|
||||
"Common.Views.PluginDlg.textLoading": "Loading",
|
||||
"Common.Views.PluginPanel.textClosePanel": "Close plugin",
|
||||
"Common.Views.PluginPanel.textUndock": "Unpin plugin",
|
||||
"Common.Views.PluginPanel.textLoading": "Loading",
|
||||
"Common.Views.Plugins.groupCaption": "Plugins",
|
||||
"Common.Views.Plugins.strPlugins": "Plugins",
|
||||
|
||||
@ -745,8 +745,10 @@
|
||||
"Common.Views.PasswordDialog.txtRepeat": "Repeat password",
|
||||
"Common.Views.PasswordDialog.txtTitle": "Set password",
|
||||
"Common.Views.PasswordDialog.txtWarning": "Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place.",
|
||||
"Common.Views.PluginDlg.textDock": "Pin plugin",
|
||||
"Common.Views.PluginDlg.textLoading": "Loading",
|
||||
"Common.Views.PluginPanel.textClosePanel": "Close plugin",
|
||||
"Common.Views.PluginPanel.textUndock": "Unpin plugin",
|
||||
"Common.Views.PluginPanel.textLoading": "Loading",
|
||||
"Common.Views.Plugins.groupCaption": "Plugins",
|
||||
"Common.Views.Plugins.strPlugins": "Plugins",
|
||||
|
||||
@ -584,8 +584,10 @@
|
||||
"Common.Views.PasswordDialog.txtRepeat": "Repeat password",
|
||||
"Common.Views.PasswordDialog.txtTitle": "Set password",
|
||||
"Common.Views.PasswordDialog.txtWarning": "Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place.",
|
||||
"Common.Views.PluginDlg.textDock": "Pin plugin",
|
||||
"Common.Views.PluginDlg.textLoading": "Loading",
|
||||
"Common.Views.PluginPanel.textClosePanel": "Close plugin",
|
||||
"Common.Views.PluginPanel.textUndock": "Unpin plugin",
|
||||
"Common.Views.PluginPanel.textLoading": "Loading",
|
||||
"Common.Views.Plugins.groupCaption": "Plugins",
|
||||
"Common.Views.Plugins.strPlugins": "Plugins",
|
||||
|
||||
@ -114,8 +114,10 @@
|
||||
"Common.Views.OpenDialog.txtProtected": "Once you enter the password and open the file, the current password to the file will be reset.",
|
||||
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
||||
"Common.Views.OpenDialog.txtTitleProtected": "Protected file",
|
||||
"Common.Views.PluginDlg.textDock": "Pin plugin",
|
||||
"Common.Views.PluginDlg.textLoading": "Loading",
|
||||
"Common.Views.PluginPanel.textClosePanel": "Close plugin",
|
||||
"Common.Views.PluginPanel.textUndock": "Unpin plugin",
|
||||
"Common.Views.PluginPanel.textLoading": "Loading",
|
||||
"Common.Views.Plugins.groupCaption": "Plugins",
|
||||
"Common.Views.Plugins.strPlugins": "Plugins",
|
||||
|
||||
Reference in New Issue
Block a user