[DE] Add crop for images and shapes to context menu
This commit is contained in:
parent
d16f15ac54
commit
3fbf4713e8
|
@ -1531,6 +1531,7 @@ define([
|
||||||
this.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
this.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
||||||
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, this));
|
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, this));
|
||||||
this.api.asc_registerCallback('asc_onRulerDblClick', _.bind(this.onRulerDblClick, this));
|
this.api.asc_registerCallback('asc_onRulerDblClick', _.bind(this.onRulerDblClick, this));
|
||||||
|
this.api.asc_registerCallback('asc_ChangeCropState', _.bind(this.onChangeCropState, this));
|
||||||
}
|
}
|
||||||
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, this));
|
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, this));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, this));
|
Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, this));
|
||||||
|
@ -1549,13 +1550,6 @@ define([
|
||||||
|
|
||||||
this.mode = {};
|
this.mode = {};
|
||||||
this.setMode = function(m) {
|
this.setMode = function(m) {
|
||||||
if (this.api && m.isEdit) {
|
|
||||||
this.api.asc_registerCallback('asc_onImgWrapStyleChanged', _.bind(this.onImgWrapStyleChanged, this));
|
|
||||||
this.api.asc_registerCallback('asc_onDialogAddHyperlink', onDialogAddHyperlink);
|
|
||||||
this.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart);
|
|
||||||
this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.mode = m;
|
this.mode = m;
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
!(this.mode.canCoAuthoring && this.mode.canComments)
|
!(this.mode.canCoAuthoring && this.mode.canComments)
|
||||||
|
@ -1603,6 +1597,10 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChangeCropState: function(state) {
|
||||||
|
this.menuImgCrop.menu.items[0].setChecked(state, true);
|
||||||
|
},
|
||||||
|
|
||||||
onApiParagraphStyleChange: function(name) {
|
onApiParagraphStyleChange: function(name) {
|
||||||
window.currentStyleName = name;
|
window.currentStyleName = name;
|
||||||
},
|
},
|
||||||
|
@ -2383,6 +2381,29 @@ define([
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.menuImgCrop = new Common.UI.MenuItem({
|
||||||
|
caption : me.textCrop,
|
||||||
|
menu : new Common.UI.Menu({
|
||||||
|
menuAlign: 'tl-tr',
|
||||||
|
items: [
|
||||||
|
new Common.UI.MenuItem({
|
||||||
|
caption: this.textCrop,
|
||||||
|
checkable: true,
|
||||||
|
allowDepress: true,
|
||||||
|
value : 0
|
||||||
|
}).on('click', _.bind(me.onImgCrop, me)),
|
||||||
|
new Common.UI.MenuItem({
|
||||||
|
caption: this.textCropFill,
|
||||||
|
value : 1
|
||||||
|
}).on('click', _.bind(me.onImgCrop, me)),
|
||||||
|
new Common.UI.MenuItem({
|
||||||
|
caption: this.textCropFit,
|
||||||
|
value : 2
|
||||||
|
}).on('click', _.bind(me.onImgCrop, me))
|
||||||
|
]
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
this.pictureMenu = new Common.UI.Menu({
|
this.pictureMenu = new Common.UI.Menu({
|
||||||
initMenu: function(value){
|
initMenu: function(value){
|
||||||
if (_.isUndefined(value.imgProps))
|
if (_.isUndefined(value.imgProps))
|
||||||
|
@ -2453,10 +2474,14 @@ define([
|
||||||
if (menuImgRotate.isVisible())
|
if (menuImgRotate.isVisible())
|
||||||
menuImgRotate.setDisabled(islocked);
|
menuImgRotate.setDisabled(islocked);
|
||||||
|
|
||||||
|
me.menuImgCrop.setVisible(me.api.asc_canEditCrop());
|
||||||
|
if (me.menuImgCrop.isVisible())
|
||||||
|
me.menuImgCrop.setDisabled(islocked);
|
||||||
|
|
||||||
if (menuChartEdit.isVisible())
|
if (menuChartEdit.isVisible())
|
||||||
menuChartEdit.setDisabled(islocked || value.imgProps.value.get_SeveralCharts());
|
menuChartEdit.setDisabled(islocked || value.imgProps.value.get_SeveralCharts());
|
||||||
|
|
||||||
me.pictureMenu.items[15].setVisible(menuChartEdit.isVisible());
|
me.pictureMenu.items[16].setVisible(menuChartEdit.isVisible());
|
||||||
|
|
||||||
me.menuOriginalSize.setDisabled(islocked || value.imgProps.value.get_ImageUrl()===null || value.imgProps.value.get_ImageUrl()===undefined);
|
me.menuOriginalSize.setDisabled(islocked || value.imgProps.value.get_ImageUrl()===null || value.imgProps.value.get_ImageUrl()===undefined);
|
||||||
menuImageAdvanced.setDisabled(islocked);
|
menuImageAdvanced.setDisabled(islocked);
|
||||||
|
@ -2506,6 +2531,7 @@ define([
|
||||||
me.menuImageWrap,
|
me.menuImageWrap,
|
||||||
menuImgRotate,
|
menuImgRotate,
|
||||||
{ caption: '--' },
|
{ caption: '--' },
|
||||||
|
me.menuImgCrop,
|
||||||
me.menuOriginalSize,
|
me.menuOriginalSize,
|
||||||
menuImgReplace,
|
menuImgReplace,
|
||||||
menuChartEdit,
|
menuChartEdit,
|
||||||
|
@ -3769,6 +3795,17 @@ define([
|
||||||
this.fireEvent('editcomplete', this);
|
this.fireEvent('editcomplete', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onImgCrop: function(item) {
|
||||||
|
if (item.value == 1) {
|
||||||
|
this.api.asc_cropFill();
|
||||||
|
} else if (item.value == 2) {
|
||||||
|
this.api.asc_cropFit();
|
||||||
|
} else {
|
||||||
|
item.checked ? this.api.asc_startEditCrop() : this.api.asc_endEditCrop();
|
||||||
|
}
|
||||||
|
this.fireEvent('editcomplete', this);
|
||||||
|
},
|
||||||
|
|
||||||
focus: function() {
|
focus: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
_.defer(function(){ me.cmpEl.focus(); }, 50);
|
_.defer(function(){ me.cmpEl.focus(); }, 50);
|
||||||
|
@ -3983,7 +4020,10 @@ define([
|
||||||
textRotate90: 'Rotate 90° Clockwise',
|
textRotate90: 'Rotate 90° Clockwise',
|
||||||
textFlipV: 'Flip Vertically',
|
textFlipV: 'Flip Vertically',
|
||||||
textFlipH: 'Flip Horizontally',
|
textFlipH: 'Flip Horizontally',
|
||||||
textRotate: 'Rotate'
|
textRotate: 'Rotate',
|
||||||
|
textCrop: 'Crop',
|
||||||
|
textCropFill: 'Fill',
|
||||||
|
textCropFit: 'Fit'
|
||||||
|
|
||||||
}, DE.Views.DocumentHolder || {}));
|
}, DE.Views.DocumentHolder || {}));
|
||||||
});
|
});
|
|
@ -73,7 +73,8 @@ define([
|
||||||
Height: 0,
|
Height: 0,
|
||||||
FromGroup: false,
|
FromGroup: false,
|
||||||
DisabledControls: false,
|
DisabledControls: false,
|
||||||
isOleObject: false
|
isOleObject: false,
|
||||||
|
cropMode: false
|
||||||
};
|
};
|
||||||
this.lockedControls = [];
|
this.lockedControls = [];
|
||||||
this._locked = false;
|
this._locked = false;
|
||||||
|
@ -234,6 +235,7 @@ define([
|
||||||
split: true,
|
split: true,
|
||||||
enableToggle: true,
|
enableToggle: true,
|
||||||
allowDepress: true,
|
allowDepress: true,
|
||||||
|
pressed: this._state.cropMode,
|
||||||
width: 100,
|
width: 100,
|
||||||
menu : new Common.UI.Menu({
|
menu : new Common.UI.Menu({
|
||||||
style : 'min-width: 100px;',
|
style : 'min-width: 100px;',
|
||||||
|
@ -242,6 +244,7 @@ define([
|
||||||
caption: this.textCrop,
|
caption: this.textCrop,
|
||||||
checkable: true,
|
checkable: true,
|
||||||
allowDepress: true,
|
allowDepress: true,
|
||||||
|
checked: this._state.cropMode,
|
||||||
value: 0
|
value: 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -265,6 +268,9 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
_changeCropState: function(state) {
|
_changeCropState: function(state) {
|
||||||
|
this._state.cropMode = state;
|
||||||
|
|
||||||
|
if (!this.btnCrop) return;
|
||||||
this.btnCrop.toggle(state, true);
|
this.btnCrop.toggle(state, true);
|
||||||
this.btnCrop.menu.items[0].setChecked(state, true);
|
this.btnCrop.menu.items[0].setChecked(state, true);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1265,6 +1265,9 @@
|
||||||
"DE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
"DE.Views.DocumentHolder.txtUngroup": "Ungroup",
|
||||||
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
|
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
|
||||||
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
|
||||||
|
"DE.Views.DocumentHolder.textCrop": "Crop",
|
||||||
|
"DE.Views.DocumentHolder.textCropFill": "Fill",
|
||||||
|
"DE.Views.DocumentHolder.textCropFit": "Fit",
|
||||||
"DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel",
|
"DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel",
|
||||||
"DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok",
|
"DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok",
|
||||||
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
|
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
|
||||||
|
|
Loading…
Reference in a new issue