[DE] Fix Bug 46598

This commit is contained in:
Julia Radzhabova 2020-09-22 00:01:04 +03:00
parent 09eba3c88b
commit 44fa7b6462
3 changed files with 28 additions and 47 deletions

View file

@ -310,7 +310,7 @@ define([
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this)); toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
toolbar.btnDropCap.menu.on('item:click', _.bind(this.onDropCapSelect, this)); toolbar.btnDropCap.menu.on('item:click', _.bind(this.onDropCapSelect, this));
toolbar.btnContentControls.menu.on('item:click', _.bind(this.onControlsSelect, this)); toolbar.btnContentControls.menu.on('item:click', _.bind(this.onControlsSelect, this));
toolbar.mnuDropCapAdvanced.on('click', _.bind(this.onDropCapAdvancedClick, this)); toolbar.mnuDropCapAdvanced.on('click', _.bind(this.onDropCapAdvancedClick, this, false));
toolbar.btnColumns.menu.on('item:click', _.bind(this.onColumnsSelect, this)); toolbar.btnColumns.menu.on('item:click', _.bind(this.onColumnsSelect, this));
toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this)); toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this));
toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this)); toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this));
@ -394,6 +394,7 @@ define([
this.api.asc_registerCallback('asc_onTableEraseModeChanged', _.bind(this.onTableErase, this)); this.api.asc_registerCallback('asc_onTableEraseModeChanged', _.bind(this.onTableErase, this));
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this));
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this));
Common.NotificationCenter.on('dropcap:settings', _.bind(this.onDropCapAdvancedClick, this));
} else if (this.mode.isRestrictedEdit) { } else if (this.mode.isRestrictedEdit) {
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObjectRestrictedEdit, this)); this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObjectRestrictedEdit, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
@ -1742,11 +1743,11 @@ define([
this._state.dropcap = v; this._state.dropcap = v;
}, },
onDropCapAdvancedClick: function() { onDropCapAdvancedClick: function(isFrame) {
var win, props, text, var win, props, text,
me = this; me = this;
if (_.isUndefined(me.fontstore)) { if (!isFrame && _.isUndefined(me.fontstore)) {
me.fontstore = new Common.Collections.Fonts(); me.fontstore = new Common.Collections.Fonts();
var fonts = me.toolbar.cmbFontName.store.toJSON(); var fonts = me.toolbar.cmbFontName.store.toJSON();
var arr = []; var arr = [];
@ -1776,16 +1777,18 @@ define([
(new DE.Views.DropcapSettingsAdvanced({ (new DE.Views.DropcapSettingsAdvanced({
tableStylerRows: 2, tableStylerRows: 2,
tableStylerColumns: 1, tableStylerColumns: 1,
fontStore: me.fontstore, fontStore: !isFrame ? me.fontstore : null,
paragraphProps: props, paragraphProps: props,
borderProps: me.borderAdvancedProps, borderProps: me.borderAdvancedProps,
api: me.api, api: me.api,
isFrame: false, isFrame: !!isFrame,
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') { if (result == 'ok') {
me.borderAdvancedProps = value.borderProps; me.borderAdvancedProps = value.borderProps;
if (value.paragraphProps && value.paragraphProps.get_DropCap() === Asc.c_oAscDropCap.None) { if (value.paragraphProps &&
me.api.removeDropcap(true); ( !isFrame && value.paragraphProps.get_DropCap() === Asc.c_oAscDropCap.None ||
isFrame && value.paragraphProps.get_Wrap() === c_oAscFrameWrap.None)) {
me.api.removeDropcap(!isFrame);
} else } else
me.api.put_FramePr(value.paragraphProps); me.api.put_FramePr(value.paragraphProps);
} }

View file

@ -1657,43 +1657,8 @@ define([
} }
}, },
advancedFrameClick: function(item, e, eOpt){ advancedFrameClick: function(isFrame, item, e, eOpt){
var win, me = this; Common.NotificationCenter.trigger('dropcap:settings', isFrame);
if (me.api){
var selectedElements = me.api.getSelectedElements();
if (selectedElements && _.isArray(selectedElements)){
for (var i = selectedElements.length - 1; i >= 0; i--) {
var elType, elValue;
elType = selectedElements[i].get_ObjectType();
elValue = selectedElements[i].get_ObjectValue(); // заменить на свойства рамки
if (Asc.c_oAscTypeSelectElement.Paragraph == elType) {
win = new DE.Views.DropcapSettingsAdvanced({
tableStylerRows : 2,
tableStylerColumns : 1,
paragraphProps : elValue,
borderProps : me.borderAdvancedProps,
api : me.api,
isFrame : true,
handler: function(result, value) {
if (result == 'ok') {
me.borderAdvancedProps = value.borderProps;
if (value.paragraphProps && value.paragraphProps.get_Wrap() === c_oAscFrameWrap.None) {
me.api.removeDropcap(false);
} else
me.api.put_FramePr(value.paragraphProps);
}
me.fireEvent('editcomplete', me);
}
});
break;
}
}
}
}
if (win) {
win.show();
}
}, },
advancedTableClick: function(item, e, eOpt){ advancedTableClick: function(item, e, eOpt){
@ -3551,7 +3516,12 @@ define([
var menuFrameAdvanced = new Common.UI.MenuItem({ var menuFrameAdvanced = new Common.UI.MenuItem({
caption : me.advancedFrameText caption : me.advancedFrameText
}).on('click', _.bind(me.advancedFrameClick, me)); }).on('click', _.bind(me.advancedFrameClick, me, true));
var menuDropCapAdvanced = new Common.UI.MenuItem({
iconCls: 'menu__icon dropcap-intext',
caption : me.advancedDropCapText
}).on('click', _.bind(me.advancedFrameClick, me, false));
/** coauthoring begin **/ /** coauthoring begin **/
var menuCommentSeparatorPara = new Common.UI.MenuItem({ var menuCommentSeparatorPara = new Common.UI.MenuItem({
@ -3871,6 +3841,7 @@ define([
menuParagraphKeepLines.setDisabled(disabled); menuParagraphKeepLines.setDisabled(disabled);
menuParagraphAdvanced.setDisabled(disabled); menuParagraphAdvanced.setDisabled(disabled);
menuFrameAdvanced.setDisabled(disabled); menuFrameAdvanced.setDisabled(disabled);
menuDropCapAdvanced.setDisabled(disabled);
menuParagraphVAlign.setDisabled(disabled); menuParagraphVAlign.setDisabled(disabled);
menuParagraphDirection.setDisabled(disabled); menuParagraphDirection.setDisabled(disabled);
@ -3914,7 +3885,11 @@ define([
menuEquationInsertCaption.setVisible(isEquation); menuEquationInsertCaption.setVisible(isEquation);
menuEquationInsertCaptionSeparator.setVisible(isEquation); menuEquationInsertCaptionSeparator.setVisible(isEquation);
menuFrameAdvanced.setVisible(value.paraProps.value.get_FramePr() !== undefined); var frame_pr = value.paraProps.value.get_FramePr();
menuFrameAdvanced.setVisible(frame_pr !== undefined);
menuDropCapAdvanced.setVisible(frame_pr !== undefined);
if (frame_pr)
menuDropCapAdvanced.setIconCls(frame_pr.get_DropCap()===Asc.c_oAscDropCap.Drop ? 'menu__icon dropcap-intext' : 'menu__icon dropcap-inmargin');
menuStyleSeparator.setVisible(me.mode.canEditStyles && !isInChart); menuStyleSeparator.setVisible(me.mode.canEditStyles && !isInChart);
menuStyle.setVisible(me.mode.canEditStyles && !isInChart); menuStyle.setVisible(me.mode.canEditStyles && !isInChart);
@ -4009,6 +3984,7 @@ define([
menuParagraphDirection, menuParagraphDirection,
menuParagraphAdvanced, menuParagraphAdvanced,
menuFrameAdvanced, menuFrameAdvanced,
menuDropCapAdvanced,
/** coauthoring begin **/ /** coauthoring begin **/
menuCommentSeparatorPara, menuCommentSeparatorPara,
menuAddCommentPara, menuAddCommentPara,
@ -4569,7 +4545,8 @@ define([
textSeveral: 'Several Rows/Columns', textSeveral: 'Several Rows/Columns',
txtInsertCaption: 'Insert Caption', txtInsertCaption: 'Insert Caption',
txtEmpty: '(Empty)', txtEmpty: '(Empty)',
textFromStorage: 'From Storage' textFromStorage: 'From Storage',
advancedDropCapText: 'Drop Cap Settings'
}, DE.Views.DocumentHolder || {})); }, DE.Views.DocumentHolder || {}));
}); });

View file

@ -1234,6 +1234,7 @@
"DE.Views.DateTimeDialog.txtTitle": "Date & Time", "DE.Views.DateTimeDialog.txtTitle": "Date & Time",
"DE.Views.DocumentHolder.aboveText": "Above", "DE.Views.DocumentHolder.aboveText": "Above",
"DE.Views.DocumentHolder.addCommentText": "Add Comment", "DE.Views.DocumentHolder.addCommentText": "Add Comment",
"DE.Views.DocumentHolder.advancedDropCapText": "Drop Cap Settings",
"DE.Views.DocumentHolder.advancedFrameText": "Frame Advanced Settings", "DE.Views.DocumentHolder.advancedFrameText": "Frame Advanced Settings",
"DE.Views.DocumentHolder.advancedParagraphText": "Paragraph Advanced Settings", "DE.Views.DocumentHolder.advancedParagraphText": "Paragraph Advanced Settings",
"DE.Views.DocumentHolder.advancedTableText": "Table Advanced Settings", "DE.Views.DocumentHolder.advancedTableText": "Table Advanced Settings",