[DE] Caption Dialog (add Insert Caption in context menu)

This commit is contained in:
Julia Svinareva 2019-09-21 11:52:21 +03:00
parent ab44158ee6
commit c983cd662c

View file

@ -1908,6 +1908,19 @@ define([
me.fireEvent('editcomplete', me); me.fireEvent('editcomplete', me);
}, },
onInsertCaption: function() {
var me = this;
(new DE.Views.CaptionDialog({
isObject: true,
handler: function (result, settings) {
if (result == 'ok') {
me.api.asc_AddObjectCaption(settings);
}
me.fireEvent('editcomplete', me);
}
})).show();
},
onContinueNumbering: function(item, e) { onContinueNumbering: function(item, e) {
this.api.asc_ContinueNumbering(); this.api.asc_ContinueNumbering();
this.fireEvent('editcomplete', this); this.fireEvent('editcomplete', this);
@ -2052,6 +2065,16 @@ define([
createDelayedElements: function() { createDelayedElements: function() {
var me = this; var me = this;
var menuInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
}).on('click', _.bind(me.onInsertCaption, me));
var menuInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' });
var menuEquationInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
}).on('click', _.bind(me.onInsertCaption, me));
var menuEquationInsertCaptionSeparator = new Common.UI.MenuItem({ caption: '--' });
var menuImageAlign = new Common.UI.MenuItem({ var menuImageAlign = new Common.UI.MenuItem({
caption : me.textAlign, caption : me.textAlign,
menu : (function(){ menu : (function(){
@ -2572,6 +2595,8 @@ define([
menuSignatureEditSign.cmpEl.attr('data-value', signGuid); // sign menuSignatureEditSign.cmpEl.attr('data-value', signGuid); // sign
menuSignatureEditSetup.cmpEl.attr('data-value', signGuid); // edit signature settings menuSignatureEditSetup.cmpEl.attr('data-value', signGuid); // edit signature settings
} }
menuInsertCaptionSeparator.setVisible(!value.imgProps.isShape);
}, },
items: [ items: [
menuImgCut, menuImgCut,
@ -2587,6 +2612,8 @@ define([
me.menuImageWrap, me.menuImageWrap,
menuImgRotate, menuImgRotate,
{ caption: '--' }, { caption: '--' },
menuInsertCaption,
menuInsertCaptionSeparator,
me.menuImgCrop, me.menuImgCrop,
me.menuOriginalSize, me.menuOriginalSize,
menuImgReplace, menuImgReplace,
@ -2601,6 +2628,10 @@ define([
/* table menu*/ /* table menu*/
var menuTableInsertCaption = new Common.UI.MenuItem({
caption : me.txtInsertCaption
}).on('click', _.bind(me.onInsertCaption, me));
var mnuTableMerge = new Common.UI.MenuItem({ var mnuTableMerge = new Common.UI.MenuItem({
caption : me.mergeCellsText caption : me.mergeCellsText
}).on('click', function(item) { }).on('click', function(item) {
@ -3226,6 +3257,8 @@ define([
menuTableCellAlign, menuTableCellAlign,
menuTableDirection, menuTableDirection,
{ caption: '--' }, { caption: '--' },
menuTableInsertCaption,
{ caption: '--' },
menuTableAdvanced, menuTableAdvanced,
{ caption: '--' }, { caption: '--' },
/** coauthoring begin **/ /** coauthoring begin **/
@ -3678,6 +3711,8 @@ define([
} else } else
me.clearEquationMenu(true, 13); me.clearEquationMenu(true, 13);
menuEquationSeparator.setVisible(isEquation && eqlen>0); menuEquationSeparator.setVisible(isEquation && eqlen>0);
menuEquationInsertCaption.setVisible(isEquation);
menuEquationInsertCaptionSeparator.setVisible(isEquation);
menuFrameAdvanced.setVisible(value.paraProps.value.get_FramePr() !== undefined); menuFrameAdvanced.setVisible(value.paraProps.value.get_FramePr() !== undefined);
@ -3740,6 +3775,8 @@ define([
menuParaCopy, menuParaCopy,
menuParaPaste, menuParaPaste,
menuParaPrint, menuParaPrint,
menuEquationInsertCaptionSeparator,
menuEquationInsertCaption,
{ caption: '--' }, { caption: '--' },
menuEquationSeparator, menuEquationSeparator,
menuParaRemoveControl, menuParaRemoveControl,
@ -4159,7 +4196,8 @@ define([
toDictionaryText: 'Add to Dictionary', toDictionaryText: 'Add to Dictionary',
txtPrintSelection: 'Print Selection', txtPrintSelection: 'Print Selection',
textCells: 'Cells', textCells: 'Cells',
textSeveral: 'Several Rows/Columns' textSeveral: 'Several Rows/Columns',
txtInsertCaption: 'Insert Caption'
}, DE.Views.DocumentHolder || {})); }, DE.Views.DocumentHolder || {}));
}); });