[DE] Use sdk events to display equation bar
This commit is contained in:
parent
be04262bf4
commit
c3d27b5711
|
@ -212,6 +212,8 @@ define([
|
||||||
this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this));
|
this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this));
|
||||||
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
|
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
|
||||||
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
|
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
|
||||||
|
this.api.asc_registerCallback('asc_onShowMathTrack', _.bind(this.onShowMathTrack, this));
|
||||||
|
this.api.asc_registerCallback('asc_onHideMathTrack', _.bind(this.onHideMathTrack, this));
|
||||||
}
|
}
|
||||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
|
||||||
|
@ -614,9 +616,9 @@ define([
|
||||||
|
|
||||||
onFocusObject: function(selectedElements) {
|
onFocusObject: function(selectedElements) {
|
||||||
var me = this,
|
var me = this,
|
||||||
currentMenu = me.documentHolder.currentMenu,
|
currentMenu = me.documentHolder.currentMenu;
|
||||||
docProtection = me.documentHolder._docProtection;
|
|
||||||
if (currentMenu && currentMenu.isVisible() && currentMenu !== me.documentHolder.hdrMenu){
|
if (currentMenu && currentMenu.isVisible() && currentMenu !== me.documentHolder.hdrMenu){
|
||||||
|
var docProtection = me.documentHolder._docProtection;
|
||||||
var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
|
var obj = (me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly)) ?
|
||||||
me.fillMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements);
|
me.fillMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
@ -626,6 +628,8 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.mode && this.mode.isEdit) {
|
||||||
var i = -1,
|
var i = -1,
|
||||||
in_equation = false,
|
in_equation = false,
|
||||||
locked = false;
|
locked = false;
|
||||||
|
@ -638,7 +642,11 @@ define([
|
||||||
value && (locked = locked || value.get_Locked());
|
value && (locked = locked || value.get_Locked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in_equation && me.mode.isEdit && !(me._isDisabled || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly) ? this.onEquationPanelShow(locked) : this.onEquationPanelHide();
|
if (in_equation) {
|
||||||
|
this._state.equationLocked = locked;
|
||||||
|
this.disableEquationBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDocumentWheel: function(event) {
|
handleDocumentWheel: function(event) {
|
||||||
|
@ -1513,6 +1521,7 @@ define([
|
||||||
SetDisabled: function(state, canProtect, fillFormMode) {
|
SetDisabled: function(state, canProtect, fillFormMode) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this.documentHolder.SetDisabled(state, canProtect, fillFormMode);
|
this.documentHolder.SetDisabled(state, canProtect, fillFormMode);
|
||||||
|
this.disableEquationBar();
|
||||||
},
|
},
|
||||||
|
|
||||||
onTextLanguage: function(langid) {
|
onTextLanguage: function(langid) {
|
||||||
|
@ -2323,7 +2332,11 @@ define([
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
onEquationPanelShow: function(disabled) {
|
onShowMathTrack: function(bounds) {
|
||||||
|
if (bounds[3] < 0) {
|
||||||
|
this.onHideMathTrack();
|
||||||
|
return;
|
||||||
|
}
|
||||||
var me = this,
|
var me = this,
|
||||||
documentHolder = me.documentHolder,
|
documentHolder = me.documentHolder,
|
||||||
eqContainer = documentHolder.cmpEl.find('#equation-container');
|
eqContainer = documentHolder.cmpEl.find('#equation-container');
|
||||||
|
@ -2378,7 +2391,7 @@ define([
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
cls: 'menu-shapes',
|
cls: 'menu-shapes',
|
||||||
value: i,
|
value: i,
|
||||||
// restoreHeight: equationGroup.get('groupHeight') ? parseInt(equationGroup.get('groupHeight')) : true,
|
restoreHeight: equationGroup.get('groupHeight') ? parseInt(equationGroup.get('groupHeight')) : true,
|
||||||
items: [
|
items: [
|
||||||
{ template: _.template('<div id="id-document-holder-btn-equation-menu-' + i +
|
{ template: _.template('<div id="id-document-holder-btn-equation-menu-' + i +
|
||||||
'" class="menu-shape" style="width:' + (equationGroup.get('groupWidth') + 8) + 'px; ' +
|
'" class="menu-shape" style="width:' + (equationGroup.get('groupWidth') + 8) + 'px; ' +
|
||||||
|
@ -2410,8 +2423,16 @@ define([
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var showPoint = [(me._Width - eqContainer.outerWidth())/2, 0];
|
var showPoint = [(bounds[0] + bounds[2])/2 - eqContainer.outerWidth()/2, bounds[1] - eqContainer.outerHeight() - 10];
|
||||||
eqContainer.css({left: showPoint[0], top : showPoint[1]});
|
if (!Common.Utils.InternalSettings.get("de-hidden-rulers")) {
|
||||||
|
showPoint = [showPoint[0] - 19, showPoint[1] - 26];
|
||||||
|
}
|
||||||
|
if (showPoint[1]<0) {
|
||||||
|
showPoint[1] = bounds[3] + 10;
|
||||||
|
!Common.Utils.InternalSettings.get("de-hidden-rulers") && (showPoint[1] -= 26);
|
||||||
|
}
|
||||||
|
eqContainer.css({left: showPoint[0], top : Math.min(this._Height - eqContainer.outerHeight(), Math.max(0, showPoint[1]))});
|
||||||
|
// menu.menuAlign = validation ? 'tr-br' : 'tl-bl';
|
||||||
if (eqContainer.is(':visible')) {
|
if (eqContainer.is(':visible')) {
|
||||||
if (me.equationSettingsBtn.menu.isVisible()) {
|
if (me.equationSettingsBtn.menu.isVisible()) {
|
||||||
me.equationSettingsBtn.menu.options.initMenu();
|
me.equationSettingsBtn.menu.options.initMenu();
|
||||||
|
@ -2420,19 +2441,29 @@ define([
|
||||||
} else {
|
} else {
|
||||||
eqContainer.show();
|
eqContainer.show();
|
||||||
}
|
}
|
||||||
me.equationBtns.forEach(function(item){
|
me.disableEquationBar();
|
||||||
item && item.setDisabled(!!disabled);
|
|
||||||
});
|
|
||||||
me.equationSettingsBtn.setDisabled(!!disabled);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onEquationPanelHide: function() {
|
onHideMathTrack: function() {
|
||||||
var eqContainer = this.documentHolder.cmpEl.find('#equation-container');
|
var eqContainer = this.documentHolder.cmpEl.find('#equation-container');
|
||||||
if (eqContainer.is(':visible')) {
|
if (eqContainer.is(':visible')) {
|
||||||
eqContainer.hide();
|
eqContainer.hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableEquationBar: function() {
|
||||||
|
var eqContainer = this.documentHolder.cmpEl.find('#equation-container'),
|
||||||
|
docProtection = this.documentHolder._docProtection,
|
||||||
|
disabled = this._isDisabled || this._state.equationLocked || docProtection.isReadOnly || docProtection.isFormsOnly || docProtection.isCommentsOnly;
|
||||||
|
|
||||||
|
if (eqContainer.length>0 && eqContainer.is(':visible')) {
|
||||||
|
this.equationBtns.forEach(function(item){
|
||||||
|
item && item.setDisabled(!!disabled);
|
||||||
|
});
|
||||||
|
this.equationSettingsBtn.setDisabled(!!disabled);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
convertEquation: function(menu, item, e) {
|
convertEquation: function(menu, item, e) {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
if (item.options.type=='input')
|
if (item.options.type=='input')
|
||||||
|
@ -2451,6 +2482,7 @@ define([
|
||||||
}
|
}
|
||||||
if (props && this.documentHolder) {
|
if (props && this.documentHolder) {
|
||||||
this.documentHolder._docProtection = props;
|
this.documentHolder._docProtection = props;
|
||||||
|
this.disableEquationBar();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -179,6 +179,7 @@
|
||||||
.separator {
|
.separator {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
z-index: @zindex-dropdown - 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-menu.list-settings-level {
|
.dropdown-menu.list-settings-level {
|
||||||
|
|
Loading…
Reference in a new issue