[PE][SSE] Use sdk events to display equation bar
This commit is contained in:
parent
98684a0c8b
commit
a50f6d8674
|
@ -221,6 +221,8 @@ define([
|
||||||
me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Video, _.bind(me.onClickPlaceholder, me, AscCommon.PlaceholderButtonType.Video));
|
me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Video, _.bind(me.onClickPlaceholder, me, AscCommon.PlaceholderButtonType.Video));
|
||||||
me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Audio, _.bind(me.onClickPlaceholder, me, AscCommon.PlaceholderButtonType.Audio));
|
me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Audio, _.bind(me.onClickPlaceholder, me, AscCommon.PlaceholderButtonType.Audio));
|
||||||
me.api.asc_registerCallback('asc_onTrackGuide', _.bind(me.onTrackGuide, me));
|
me.api.asc_registerCallback('asc_onTrackGuide', _.bind(me.onTrackGuide, me));
|
||||||
|
me.api.asc_registerCallback('asc_onShowMathTrack', _.bind(me.onShowMathTrack, me));
|
||||||
|
me.api.asc_registerCallback('asc_onHideMathTrack', _.bind(me.onHideMathTrack, me));
|
||||||
}
|
}
|
||||||
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect, me));
|
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect, me));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
|
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
|
||||||
|
@ -628,22 +630,28 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var i = -1,
|
|
||||||
in_equation = false,
|
if (this.mode && this.mode.isEdit) {
|
||||||
locked = false;
|
var i = -1,
|
||||||
while (++i < selectedElements.length) {
|
in_equation = false,
|
||||||
var type = selectedElements[i].get_ObjectType();
|
locked = false;
|
||||||
if (type === Asc.c_oAscTypeSelectElement.Math) {
|
while (++i < selectedElements.length) {
|
||||||
in_equation = true;
|
var type = selectedElements[i].get_ObjectType();
|
||||||
} else if (type === Asc.c_oAscTypeSelectElement.Slide) {
|
if (type === Asc.c_oAscTypeSelectElement.Math) {
|
||||||
var value = selectedElements[i].get_ObjectValue();
|
in_equation = true;
|
||||||
value && (locked = locked || value.get_LockDelete());
|
} else if (type === Asc.c_oAscTypeSelectElement.Slide) {
|
||||||
} else if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
|
var value = selectedElements[i].get_ObjectValue();
|
||||||
var value = selectedElements[i].get_ObjectValue();
|
value && (locked = locked || value.get_LockDelete());
|
||||||
value && (locked = locked || value.get_Locked());
|
} else if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
|
||||||
|
var value = selectedElements[i].get_ObjectValue();
|
||||||
|
value && (locked = locked || value.get_Locked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_equation) {
|
||||||
|
this._state.equationLocked = locked;
|
||||||
|
this.disableEquationBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in_equation && me.mode.isEdit && !me._isDisabled ? this.onEquationPanelShow(locked) : this.onEquationPanelHide();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDocumentWheel: function(event){
|
handleDocumentWheel: function(event){
|
||||||
|
@ -2239,7 +2247,11 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
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');
|
||||||
|
@ -2294,7 +2306,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; ' +
|
||||||
|
@ -2325,8 +2337,12 @@ 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 (showPoint[1]<0) {
|
||||||
|
showPoint[1] = bounds[3] + 10;
|
||||||
|
}
|
||||||
|
eqContainer.css({left: showPoint[0], top : Math.min(me._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();
|
||||||
|
@ -2335,19 +2351,28 @@ 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'),
|
||||||
|
disabled = this._isDisabled || this._state.equationLocked;
|
||||||
|
|
||||||
|
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')
|
||||||
|
@ -2360,6 +2385,7 @@ define([
|
||||||
SetDisabled: function(state) {
|
SetDisabled: function(state) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this.documentHolder.SetDisabled(state);
|
this.documentHolder.SetDisabled(state);
|
||||||
|
this.disableEquationBar();
|
||||||
},
|
},
|
||||||
|
|
||||||
editComplete: function() {
|
editComplete: function() {
|
||||||
|
|
|
@ -384,6 +384,8 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onUpdateExternalReference', _.bind(this.onUpdateExternalReference, this));
|
this.api.asc_registerCallback('asc_onUpdateExternalReference', _.bind(this.onUpdateExternalReference, this));
|
||||||
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, this));
|
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, 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_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
|
this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
|
||||||
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
|
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
|
||||||
|
@ -1989,20 +1991,25 @@ define([
|
||||||
|
|
||||||
if (!this.mouse.isLeftButtonDown) return;
|
if (!this.mouse.isLeftButtonDown) return;
|
||||||
|
|
||||||
var selectedObjects = this.api.asc_getGraphicObjectProps(),
|
if (this.permissions && this.permissions.isEdit) {
|
||||||
i = -1,
|
var selectedObjects = this.api.asc_getGraphicObjectProps(),
|
||||||
in_equation = false,
|
i = -1,
|
||||||
locked = false;
|
in_equation = false,
|
||||||
while (++i < selectedObjects.length) {
|
locked = false;
|
||||||
var type = selectedObjects[i].asc_getObjectType();
|
while (++i < selectedObjects.length) {
|
||||||
if (type === Asc.c_oAscTypeSelectElement.Math) {
|
var type = selectedObjects[i].asc_getObjectType();
|
||||||
in_equation = true;
|
if (type === Asc.c_oAscTypeSelectElement.Math) {
|
||||||
} else if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
|
in_equation = true;
|
||||||
var value = selectedObjects[i].asc_getObjectValue();
|
} else if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
|
||||||
value && (locked = locked || value.asc_getLocked());
|
var value = selectedObjects[i].asc_getObjectValue();
|
||||||
|
value && (locked = locked || value.asc_getLocked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_equation) {
|
||||||
|
this._state.equationLocked = locked;
|
||||||
|
this.disableEquationBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in_equation && this.permissions.isEdit && !this._isDisabled ? this.onEquationPanelShow(locked) : this.onEquationPanelHide();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fillMenuProps: function(cellinfo, showMenu, event){
|
fillMenuProps: function(cellinfo, showMenu, event){
|
||||||
|
@ -2448,6 +2455,7 @@ define([
|
||||||
documentHolder.menuParagraphVAlign.setVisible(false); // убрать после того, как заголовок можно будет растягивать по вертикали!!
|
documentHolder.menuParagraphVAlign.setVisible(false); // убрать после того, как заголовок можно будет растягивать по вертикали!!
|
||||||
documentHolder.menuParagraphDirection.setVisible(false); // убрать после того, как заголовок можно будет растягивать по вертикали!!
|
documentHolder.menuParagraphDirection.setVisible(false); // убрать после того, как заголовок можно будет растягивать по вертикали!!
|
||||||
documentHolder.pmiTextAdvanced.setVisible(false);
|
documentHolder.pmiTextAdvanced.setVisible(false);
|
||||||
|
documentHolder.menuParagraphEquation.setVisible(false);
|
||||||
documentHolder.textInShapeMenu.items[9].setVisible(false);
|
documentHolder.textInShapeMenu.items[9].setVisible(false);
|
||||||
documentHolder.menuParagraphBullets.setVisible(false);
|
documentHolder.menuParagraphBullets.setVisible(false);
|
||||||
documentHolder.textInShapeMenu.items[3].setVisible(false);
|
documentHolder.textInShapeMenu.items[3].setVisible(false);
|
||||||
|
@ -4303,7 +4311,11 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
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');
|
||||||
|
@ -4392,8 +4404,12 @@ define([
|
||||||
if (!me.tooltips.coauth.XY)
|
if (!me.tooltips.coauth.XY)
|
||||||
me.onDocumentResize();
|
me.onDocumentResize();
|
||||||
|
|
||||||
var showPoint = [(me.tooltips.coauth.apiWidth - 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 (showPoint[1]<0) {
|
||||||
|
showPoint[1] = bounds[3] + 10;
|
||||||
|
}
|
||||||
|
eqContainer.css({left: showPoint[0], top : Math.min(me.tooltips.coauth.apiHeight - 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();
|
||||||
|
@ -4402,19 +4418,28 @@ 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'),
|
||||||
|
disabled = this._isDisabled || this._state.equationLocked;
|
||||||
|
|
||||||
|
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')
|
||||||
|
@ -4447,6 +4472,7 @@ define([
|
||||||
SetDisabled: function(state, canProtect) {
|
SetDisabled: function(state, canProtect) {
|
||||||
this._isDisabled = state;
|
this._isDisabled = state;
|
||||||
this._canProtect = canProtect;
|
this._canProtect = canProtect;
|
||||||
|
this.disableEquationBar();
|
||||||
},
|
},
|
||||||
|
|
||||||
guestText : 'Guest',
|
guestText : 'Guest',
|
||||||
|
|
Loading…
Reference in a new issue