Refactoring
This commit is contained in:
parent
42578be4d4
commit
8ed2c5cab2
|
@ -282,7 +282,7 @@ define([
|
|||
}
|
||||
var me = this;
|
||||
setTimeout(function(){
|
||||
me.documentHolder.fireEvent('editcomplete', me.documentHolder);
|
||||
view.fireEvent('editcomplete', view);
|
||||
}, 10);
|
||||
}, this));
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ define([
|
|||
}
|
||||
var me = this;
|
||||
setTimeout(function(){
|
||||
me.documentHolder.fireEvent('editcomplete', me.documentHolder);
|
||||
view.fireEvent('editcomplete', view);
|
||||
}, 10);
|
||||
}, this));
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ define([
|
|||
}
|
||||
var me = this;
|
||||
setTimeout(function(){
|
||||
me.documentHolder.fireEvent('editcomplete', me.documentHolder);
|
||||
view.fireEvent('editcomplete', view);
|
||||
}, 10);
|
||||
}, this));
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ define([
|
|||
menu.cmpEl.focus();
|
||||
}, 10);
|
||||
|
||||
me.currentMenu = menu;
|
||||
me.documentHolder.currentMenu = menu;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -513,8 +513,7 @@ define([
|
|||
fillViewMenuProps: function(selectedElements) {
|
||||
if (!selectedElements || !_.isArray(selectedElements)) return;
|
||||
|
||||
var me = this,
|
||||
documentHolder = this.documentHolder;
|
||||
var documentHolder = this.documentHolder;
|
||||
if (!documentHolder.viewModeMenu)
|
||||
documentHolder.createDelayedElementsViewer();
|
||||
var menu_props = {},
|
||||
|
@ -572,13 +571,14 @@ define([
|
|||
},
|
||||
|
||||
onFocusObject: function(selectedElements) {
|
||||
var me = this;
|
||||
if (me.currentMenu && me.currentMenu.isVisible() && me.currentMenu !== me.documentHolder.hdrMenu){
|
||||
var me = this,
|
||||
currentMenu = me.documentHolder.currentMenu;
|
||||
if (currentMenu && currentMenu.isVisible() && currentMenu !== me.documentHolder.hdrMenu){
|
||||
var obj = (me.mode.isEdit && !me._isDisabled) ? me.fillMenuProps(selectedElements) : me.fillViewMenuProps(selectedElements);
|
||||
if (obj) {
|
||||
if (obj.menu_to_show===me.currentMenu) {
|
||||
me.currentMenu.options.initMenu(obj.menu_props);
|
||||
me.currentMenu.alignPosition();
|
||||
if (obj.menu_to_show===currentMenu) {
|
||||
currentMenu.options.initMenu(obj.menu_props);
|
||||
currentMenu.alignPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -628,10 +628,10 @@ define([
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (me.currentMenu && me.currentMenu.isVisible()) {
|
||||
if (me.documentHolder.currentMenu && me.documentHolder.currentMenu.isVisible()) {
|
||||
if (key == Common.UI.Keys.UP ||
|
||||
key == Common.UI.Keys.DOWN) {
|
||||
$('ul.dropdown-menu', me.currentMenu.el).focus();
|
||||
$('ul.dropdown-menu', me.documentHolder.currentMenu.el).focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -792,7 +792,7 @@ define([
|
|||
: me.api.change_Hyperlink(props);
|
||||
}
|
||||
|
||||
me.fireEvent('editcomplete', me);
|
||||
me.documentHolder.fireEvent('editcomplete', me);
|
||||
};
|
||||
|
||||
text = me.api.can_AddHyperlink();
|
||||
|
@ -1433,663 +1433,7 @@ define([
|
|||
}
|
||||
}
|
||||
},
|
||||
/*
|
||||
addWordVariants: function(isParagraph) {
|
||||
var me = this,
|
||||
documentHolder = me.documentHolder;
|
||||
if (!documentHolder.textMenu || !documentHolder.textMenu.isVisible() && !documentHolder.tableMenu.isVisible()) return;
|
||||
|
||||
if (_.isUndefined(isParagraph)) {
|
||||
isParagraph = documentHolder.textMenu.isVisible();
|
||||
}
|
||||
|
||||
me.clearWordVariants(isParagraph);
|
||||
|
||||
var moreMenu = (isParagraph) ? documentHolder.menuSpellMorePara : documentHolder.menuSpellMoreTable;
|
||||
var spellMenu = (isParagraph) ? documentHolder.menuSpellPara : documentHolder.menuSpellTable;
|
||||
var arr = [],
|
||||
arrMore = [];
|
||||
var variants = me._currentSpellObj.get_Variants();
|
||||
|
||||
if (variants.length > 0) {
|
||||
moreMenu.setVisible(variants.length > 3);
|
||||
moreMenu.setDisabled(me._currentParaObjDisabled);
|
||||
|
||||
_.each(variants, function(variant, index) {
|
||||
var mnu = new Common.UI.MenuItem({
|
||||
caption : variant,
|
||||
spellword : true,
|
||||
disabled : me._currentParaObjDisabled
|
||||
}).on('click', function(item, e) {
|
||||
if (me.api) {
|
||||
me.api.asc_replaceMisspelledWord(item.caption, me._currentSpellObj);
|
||||
me.fireEvent('editcomplete', me);
|
||||
}
|
||||
});
|
||||
|
||||
(index < 3) ? arr.push(mnu) : arrMore.push(mnu);
|
||||
});
|
||||
|
||||
if (arr.length > 0) {
|
||||
if (isParagraph) {
|
||||
_.each(arr, function(variant, index){
|
||||
documentHolder.textMenu.insertItem(index, variant);
|
||||
})
|
||||
} else {
|
||||
_.each(arr, function(variant, index){
|
||||
documentHolder.menuSpellCheckTable.menu.insertItem(index, variant);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (arrMore.length > 0) {
|
||||
_.each(arrMore, function(variant, index){
|
||||
moreMenu.menu.addItem(variant);
|
||||
});
|
||||
}
|
||||
|
||||
spellMenu.setVisible(false);
|
||||
} else {
|
||||
moreMenu.setVisible(false);
|
||||
spellMenu.setVisible(true);
|
||||
spellMenu.setCaption(documentHolder.noSpellVariantsText, true);
|
||||
}
|
||||
},
|
||||
|
||||
clearWordVariants: function(isParagraph) {
|
||||
var me = this,
|
||||
documentHolder = me.documentHolder;
|
||||
var spellMenu = (isParagraph) ? documentHolder.textMenu : documentHolder.menuSpellCheckTable.menu;
|
||||
|
||||
for (var i = 0; i < spellMenu.items.length; i++) {
|
||||
if (spellMenu.items[i].options.spellword) {
|
||||
if (spellMenu.checkeditem == spellMenu.items[i]) {
|
||||
spellMenu.checkeditem = undefined;
|
||||
spellMenu.activeItem = undefined;
|
||||
}
|
||||
|
||||
spellMenu.removeItem(spellMenu.items[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
(isParagraph) ? documentHolder.menuSpellMorePara.menu.removeAll() : documentHolder.menuSpellMoreTable.menu.removeAll();
|
||||
|
||||
documentHolder.menuSpellMorePara.menu.checkeditem = undefined;
|
||||
documentHolder.menuSpellMorePara.menu.activeItem = undefined;
|
||||
documentHolder.menuSpellMoreTable.menu.checkeditem = undefined;
|
||||
documentHolder.menuSpellMoreTable.menu.activeItem = undefined;
|
||||
},
|
||||
|
||||
initEquationMenu: function() {
|
||||
var me = this.documentHolder; // view!!!
|
||||
if (!this._currentMathObj) return;
|
||||
var type = this._currentMathObj.get_Type(),
|
||||
value = this._currentMathObj,
|
||||
mnu, arr = [];
|
||||
|
||||
switch (type) {
|
||||
case Asc.c_oAscMathInterfaceType.Accent:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtRemoveAccentChar,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'remove_AccentCharacter'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.BorderBox:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtBorderProps,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
menu : new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
{
|
||||
caption: value.get_HideTop() ? me.txtAddTop : me.txtHideTop,
|
||||
equationProps: {type: type, callback: 'put_HideTop', value: !value.get_HideTop()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideBottom() ? me.txtAddBottom : me.txtHideBottom,
|
||||
equationProps: {type: type, callback: 'put_HideBottom', value: !value.get_HideBottom()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideLeft() ? me.txtAddLeft : me.txtHideLeft,
|
||||
equationProps: {type: type, callback: 'put_HideLeft', value: !value.get_HideLeft()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideRight() ? me.txtAddRight : me.txtHideRight,
|
||||
equationProps: {type: type, callback: 'put_HideRight', value: !value.get_HideRight()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideHor() ? me.txtAddHor : me.txtHideHor,
|
||||
equationProps: {type: type, callback: 'put_HideHor', value: !value.get_HideHor()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideVer() ? me.txtAddVer : me.txtHideVer,
|
||||
equationProps: {type: type, callback: 'put_HideVer', value: !value.get_HideVer()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideTopLTR() ? me.txtAddLT : me.txtHideLT,
|
||||
equationProps: {type: type, callback: 'put_HideTopLTR', value: !value.get_HideTopLTR()}
|
||||
},
|
||||
{
|
||||
caption: value.get_HideTopRTL() ? me.txtAddLB : me.txtHideLB,
|
||||
equationProps: {type: type, callback: 'put_HideTopRTL', value: !value.get_HideTopRTL()}
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Bar:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtRemoveBar,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'remove_Bar'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : (value.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top) ? me.txtUnderbar : me.txtOverbar,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_Pos', value: (value.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top) ? Asc.c_oAscMathInterfaceBarPos.Bottom : Asc.c_oAscMathInterfaceBarPos.Top}
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Script:
|
||||
var scripttype = value.get_ScriptType();
|
||||
if (scripttype == Asc.c_oAscMathInterfaceScript.PreSubSup) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtScriptsAfter,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_ScriptType', value: Asc.c_oAscMathInterfaceScript.SubSup}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtRemScripts,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_ScriptType', value: Asc.c_oAscMathInterfaceScript.None}
|
||||
});
|
||||
arr.push(mnu);
|
||||
} else {
|
||||
if (scripttype == Asc.c_oAscMathInterfaceScript.SubSup) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtScriptsBefore,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_ScriptType', value: Asc.c_oAscMathInterfaceScript.PreSubSup}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (scripttype == Asc.c_oAscMathInterfaceScript.SubSup || scripttype == Asc.c_oAscMathInterfaceScript.Sub ) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtRemSubscript,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_ScriptType', value: (scripttype == Asc.c_oAscMathInterfaceScript.SubSup) ? Asc.c_oAscMathInterfaceScript.Sup : Asc.c_oAscMathInterfaceScript.None }
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (scripttype == Asc.c_oAscMathInterfaceScript.SubSup || scripttype == Asc.c_oAscMathInterfaceScript.Sup ) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtRemSuperscript,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_ScriptType', value: (scripttype == Asc.c_oAscMathInterfaceScript.SubSup) ? Asc.c_oAscMathInterfaceScript.Sub : Asc.c_oAscMathInterfaceScript.None }
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Fraction:
|
||||
var fraction = value.get_FractionType();
|
||||
if (fraction==Asc.c_oAscMathInterfaceFraction.Skewed || fraction==Asc.c_oAscMathInterfaceFraction.Linear) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtFractionStacked,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_FractionType', value: Asc.c_oAscMathInterfaceFraction.Bar}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (fraction==Asc.c_oAscMathInterfaceFraction.Bar || fraction==Asc.c_oAscMathInterfaceFraction.Linear) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtFractionSkewed,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_FractionType', value: Asc.c_oAscMathInterfaceFraction.Skewed}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (fraction==Asc.c_oAscMathInterfaceFraction.Bar || fraction==Asc.c_oAscMathInterfaceFraction.Skewed) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtFractionLinear,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_FractionType', value: Asc.c_oAscMathInterfaceFraction.Linear}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (fraction==Asc.c_oAscMathInterfaceFraction.Bar || fraction==Asc.c_oAscMathInterfaceFraction.NoBar) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : (fraction==Asc.c_oAscMathInterfaceFraction.Bar) ? me.txtRemFractionBar : me.txtAddFractionBar,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_FractionType', value: (fraction==Asc.c_oAscMathInterfaceFraction.Bar) ? Asc.c_oAscMathInterfaceFraction.NoBar : Asc.c_oAscMathInterfaceFraction.Bar}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Limit:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : (value.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top) ? me.txtLimitUnder : me.txtLimitOver,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_Pos', value: (value.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top) ? Asc.c_oAscMathInterfaceLimitPos.Bottom : Asc.c_oAscMathInterfaceLimitPos.Top}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtRemLimit,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_Pos', value: Asc.c_oAscMathInterfaceLimitPos.None}
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Matrix:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.get_HidePlaceholder() ? me.txtShowPlaceholder : me.txtHidePlaceholder,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_HidePlaceholder', value: !value.get_HidePlaceholder()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.insertText,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
menu : new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
{
|
||||
caption: me.insertRowAboveText,
|
||||
equationProps: {type: type, callback: 'insert_MatrixRow', value: true}
|
||||
},
|
||||
{
|
||||
caption: me.insertRowBelowText,
|
||||
equationProps: {type: type, callback: 'insert_MatrixRow', value: false}
|
||||
},
|
||||
{
|
||||
caption: me.insertColumnLeftText,
|
||||
equationProps: {type: type, callback: 'insert_MatrixColumn', value: true}
|
||||
},
|
||||
{
|
||||
caption: me.insertColumnRightText,
|
||||
equationProps: {type: type, callback: 'insert_MatrixColumn', value: false}
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.deleteText,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
menu : new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
{
|
||||
caption: me.deleteRowText,
|
||||
equationProps: {type: type, callback: 'delete_MatrixRow'}
|
||||
},
|
||||
{
|
||||
caption: me.deleteColumnText,
|
||||
equationProps: {type: type, callback: 'delete_MatrixColumn'}
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtMatrixAlign,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
menu : new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
{
|
||||
caption: me.txtTop,
|
||||
checkable : true,
|
||||
checked : (value.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top),
|
||||
equationProps: {type: type, callback: 'put_MatrixAlign', value: Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}
|
||||
},
|
||||
{
|
||||
caption: me.centerText,
|
||||
checkable : true,
|
||||
checked : (value.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center),
|
||||
equationProps: {type: type, callback: 'put_MatrixAlign', value: Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}
|
||||
},
|
||||
{
|
||||
caption: me.txtBottom,
|
||||
checkable : true,
|
||||
checked : (value.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom),
|
||||
equationProps: {type: type, callback: 'put_MatrixAlign', value: Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtColumnAlign,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
menu : new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
{
|
||||
caption: me.leftText,
|
||||
checkable : true,
|
||||
checked : (value.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left),
|
||||
equationProps: {type: type, callback: 'put_ColumnAlign', value: Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}
|
||||
},
|
||||
{
|
||||
caption: me.centerText,
|
||||
checkable : true,
|
||||
checked : (value.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center),
|
||||
equationProps: {type: type, callback: 'put_ColumnAlign', value: Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}
|
||||
},
|
||||
{
|
||||
caption: me.rightText,
|
||||
checkable : true,
|
||||
checked : (value.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right),
|
||||
equationProps: {type: type, callback: 'put_ColumnAlign', value: Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.EqArray:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtInsertEqBefore,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'insert_Equation', value: true}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtInsertEqAfter,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'insert_Equation', value: false}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtDeleteEq,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'delete_Equation'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.alignmentText,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
menu : new Common.UI.Menu({
|
||||
cls: 'shifted-right',
|
||||
menuAlign: 'tl-tr',
|
||||
items : [
|
||||
{
|
||||
caption: me.txtTop,
|
||||
checkable : true,
|
||||
checked : (value.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top),
|
||||
equationProps: {type: type, callback: 'put_Align', value: Asc.c_oAscMathInterfaceEqArrayAlign.Top}
|
||||
},
|
||||
{
|
||||
caption: me.centerText,
|
||||
checkable : true,
|
||||
checked : (value.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center),
|
||||
equationProps: {type: type, callback: 'put_Align', value: Asc.c_oAscMathInterfaceEqArrayAlign.Center}
|
||||
},
|
||||
{
|
||||
caption: me.txtBottom,
|
||||
checkable : true,
|
||||
checked : (value.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom),
|
||||
equationProps: {type: type, callback: 'put_Align', value: Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}
|
||||
}
|
||||
]
|
||||
})
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.LargeOperator:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtLimitChange,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_LimitLocation', value: (value.get_LimitLocation() == Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr) ? Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup : Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}
|
||||
});
|
||||
arr.push(mnu);
|
||||
if (value.get_HideUpper() !== undefined) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.get_HideUpper() ? me.txtShowTopLimit : me.txtHideTopLimit,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_HideUpper', value: !value.get_HideUpper()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (value.get_HideLower() !== undefined) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.get_HideLower() ? me.txtShowBottomLimit : me.txtHideBottomLimit,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_HideLower', value: !value.get_HideLower()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Delimiter:
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtInsertArgBefore,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'insert_DelimiterArgument', value: true}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtInsertArgAfter,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'insert_DelimiterArgument', value: false}
|
||||
});
|
||||
arr.push(mnu);
|
||||
if (value.can_DeleteArgument()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtDeleteArg,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'delete_DelimiterArgument'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.has_Separators() ? me.txtDeleteCharsAndSeparators : me.txtDeleteChars,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'remove_DelimiterCharacters'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.get_HideOpeningBracket() ? me.txtShowOpenBracket : me.txtHideOpenBracket,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_HideOpeningBracket', value: !value.get_HideOpeningBracket()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.get_HideClosingBracket() ? me.txtShowCloseBracket : me.txtHideCloseBracket,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_HideClosingBracket', value: !value.get_HideClosingBracket()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtStretchBrackets,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
checkable : true,
|
||||
checked : value.get_StretchBrackets(),
|
||||
equationProps: {type: type, callback: 'put_StretchBrackets', value: !value.get_StretchBrackets()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtMatchBrackets,
|
||||
equation : true,
|
||||
disabled : (!value.get_StretchBrackets() || this._currentParaObjDisabled),
|
||||
checkable : true,
|
||||
checked : value.get_StretchBrackets() && value.get_MatchBrackets(),
|
||||
equationProps: {type: type, callback: 'put_MatchBrackets', value: !value.get_MatchBrackets()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.GroupChar:
|
||||
if (value.can_ChangePos()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : (value.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top) ? me.txtGroupCharUnder : me.txtGroupCharOver,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_Pos', value: (value.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top) ? Asc.c_oAscMathInterfaceGroupCharPos.Bottom : Asc.c_oAscMathInterfaceGroupCharPos.Top}
|
||||
});
|
||||
arr.push(mnu);
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtDeleteGroupChar,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_Pos', value: Asc.c_oAscMathInterfaceGroupCharPos.None}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
break;
|
||||
case Asc.c_oAscMathInterfaceType.Radical:
|
||||
if (value.get_HideDegree() !== undefined) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : value.get_HideDegree() ? me.txtShowDegree : me.txtHideDegree,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'put_HideDegree', value: !value.get_HideDegree()}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtDeleteRadical,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'remove_Radical'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
break;
|
||||
}
|
||||
if (value.can_IncreaseArgumentSize()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtIncreaseArg,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'increase_ArgumentSize'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (value.can_DecreaseArgumentSize()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtDecreaseArg,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'decrease_ArgumentSize'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (value.can_InsertManualBreak()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtInsertBreak,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'insert_ManualBreak'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (value.can_DeleteManualBreak()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtDeleteBreak,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'delete_ManualBreak'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
if (value.can_AlignToCharacter()) {
|
||||
mnu = new Common.UI.MenuItem({
|
||||
caption : me.txtAlignToChar,
|
||||
equation : true,
|
||||
disabled : this._currentParaObjDisabled,
|
||||
equationProps: {type: type, callback: 'align_ToCharacter'}
|
||||
});
|
||||
arr.push(mnu);
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
|
||||
addEquationMenu: function(isParagraph, insertIdx) {
|
||||
var me = this;
|
||||
if (_.isUndefined(isParagraph)) {
|
||||
isParagraph = me.documentHolder.textMenu.isVisible();
|
||||
}
|
||||
|
||||
me.clearEquationMenu(isParagraph, insertIdx);
|
||||
|
||||
var equationMenu = (isParagraph) ? me.documentHolder.textMenu : me.documentHolder.tableMenu,
|
||||
menuItems = me.initEquationMenu();
|
||||
|
||||
if (menuItems.length > 0) {
|
||||
_.each(menuItems, function(menuItem, index) {
|
||||
if (menuItem.menu) {
|
||||
_.each(menuItem.menu.items, function(item) {
|
||||
item.on('click', _.bind(me.equationCallback, me, item.options.equationProps));
|
||||
});
|
||||
} else
|
||||
menuItem.on('click', _.bind(me.equationCallback, me, menuItem.options.equationProps));
|
||||
equationMenu.insertItem(insertIdx, menuItem);
|
||||
insertIdx++;
|
||||
});
|
||||
}
|
||||
return menuItems.length;
|
||||
},
|
||||
|
||||
clearEquationMenu: function(isParagraph, insertIdx) {
|
||||
var equationMenu = (isParagraph) ? this.documentHolder.textMenu : this.documentHolder.tableMenu;
|
||||
for (var i = insertIdx; i < equationMenu.items.length; i++) {
|
||||
if (equationMenu.items[i].options.equation) {
|
||||
if (equationMenu.items[i].menu) {
|
||||
_.each(equationMenu.items[i].menu.items, function(item) {
|
||||
item.off('click');
|
||||
});
|
||||
} else
|
||||
equationMenu.items[i].off('click');
|
||||
equationMenu.removeItem(equationMenu.items[i]);
|
||||
i--;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
},
|
||||
*/
|
||||
equationCallback: function(eqProps) {
|
||||
if (eqProps) {
|
||||
var eqObj;
|
||||
|
|
|
@ -454,7 +454,8 @@ define([
|
|||
onShowTOCActions: function(obj, x, y) {
|
||||
var action = obj.button,
|
||||
menu = (action==AscCommon.CCButtonType.Toc) ? this.view.contentsUpdateMenu : this.view.contentsMenu,
|
||||
documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder,
|
||||
documentHolder = this.getApplication().getController('DocumentHolder'),
|
||||
documentHolderView = documentHolder.getView(),
|
||||
menuContainer = documentHolderView.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)),
|
||||
me = this;
|
||||
|
||||
|
@ -479,7 +480,7 @@ define([
|
|||
|
||||
menuContainer.css({left: x, top : y});
|
||||
menuContainer.attr('data-value', 'prevent-canvas-click');
|
||||
documentHolderView._preventClick = true;
|
||||
documentHolder._preventClick = true;
|
||||
menu.show();
|
||||
|
||||
menu.alignPosition();
|
||||
|
|
|
@ -75,6 +75,7 @@ define([
|
|||
this._currentSpellObj = undefined;
|
||||
this._currentParaObjDisabled = false;
|
||||
this._currLang = {};
|
||||
this._isDisabled = false;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
|
|
Loading…
Reference in a new issue