Merge pull request #1301 from ONLYOFFICE/feature/Bug-53426

Bug 53426
This commit is contained in:
Julia Radzhabova 2021-11-10 21:31:22 +03:00 committed by GitHub
commit 7b59205e2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 167 additions and 6 deletions

View file

@ -71,7 +71,7 @@ define([
},
onRightMenuAfterRender: function(rightMenu) {
rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication();
rightMenu.imageSettings.application = rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication();
this._settings = [];
this._settings[Common.Utils.documentSettingsType.Paragraph] = {panelId: "id-paragraph-settings", panel: rightMenu.paragraphSettings,btn: rightMenu.btnText, hidden: 1, locked: false};

View file

@ -258,6 +258,14 @@ define([
checked: this._state.cropMode,
value: 0
},
{
caption: this.textCropToShape,
menu: new Common.UI.Menu({
menuAlign: 'tl-tl',
cls: 'menu-shapes menu-change-shape',
items: []
})
},
{
caption: this.textCropFill,
value: 1
@ -274,6 +282,7 @@ define([
this.btnCrop.on('click', _.bind(this.onCrop, this));
this.btnCrop.menu.on('item:click', _.bind(this.onCropMenu, this));
this.lockedControls.push(this.btnCrop);
this.btnChangeShape= this.btnCrop.menu.items[1];
this.btnSelectImage = new Common.UI.Button({
parentEl: $('#image-button-replace'),
@ -312,9 +321,49 @@ define([
createDelayedElements: function() {
this.createDelayedControls();
this.updateMetricUnit();
this.onApiAutoShapes();
this._initSettings = false;
},
onApiAutoShapes: function() {
var me = this;
var onShowBefore = function(menu) {
me.fillAutoShapes();
menu.off('show:before', onShowBefore);
};
me.btnChangeShape.menu.on('show:before', onShowBefore);
},
fillAutoShapes: function() {
var me = this,
recents = Common.localStorage.getItem('de-recent-shapes');
var menuitem = new Common.UI.MenuItem({
template: _.template('<div id="id-img-change-shape-menu" class="menu-insertshape"></div>'),
index: 0
});
me.btnChangeShape.menu.addItem(menuitem);
var shapePicker = new Common.UI.DataViewShape({
el: $('#id-img-change-shape-menu'),
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
groups: me.application.getCollection('ShapeGroups'),
parentMenu: me.btnChangeShape.menu,
restoreHeight: 640,
textRecentlyUsed: me.textRecentlyUsed,
recentShapes: recents ? JSON.parse(recents) : null,
isFromImage: true
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
me.api.ChangeShapeType(record.get('data').shapeType);
me.fireEvent('editcomplete', me);
}
if (e.type !== 'click')
me.btnCrop.menu.hide();
});
},
ChangeSettings: function(props) {
if (this._initSettings)
this.createDelayedElements();
@ -322,6 +371,7 @@ define([
this.disableControls(this._locked);
if (props ){
this._originalProps = new Asc.asc_CImgProperty(props);
var value = props.get_WrappingStyle();
@ -653,6 +703,8 @@ define([
textCrop: 'Crop',
textCropFill: 'Fill',
textCropFit: 'Fit',
textFromStorage: 'From Storage'
textCropToShape: 'Crop to shape',
textFromStorage: 'From Storage',
textRecentlyUsed: 'Recently Used'
}, DE.Views.ImageSettings || {}));
});

View file

@ -1894,6 +1894,7 @@
"DE.Views.ImageSettings.textCrop": "Crop",
"DE.Views.ImageSettings.textCropFill": "Fill",
"DE.Views.ImageSettings.textCropFit": "Fit",
"DE.Views.ImageSettings.textCropToShape": "Crop to shape",
"DE.Views.ImageSettings.textEdit": "Edit",
"DE.Views.ImageSettings.textEditObject": "Edit Object",
"DE.Views.ImageSettings.textFitMargins": "Fit to Margin",
@ -1908,6 +1909,7 @@
"DE.Views.ImageSettings.textHintFlipV": "Flip Vertically",
"DE.Views.ImageSettings.textInsert": "Replace Image",
"DE.Views.ImageSettings.textOriginalSize": "Actual Size",
"DE.Views.ImageSettings.textRecentlyUsed": "Recently Used",
"DE.Views.ImageSettings.textRotate90": "Rotate 90°",
"DE.Views.ImageSettings.textRotation": "Rotation",
"DE.Views.ImageSettings.textSize": "Size",

View file

@ -70,7 +70,7 @@ define([
},
onRightMenuAfterRender: function(rightMenu) {
rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication();
rightMenu.imageSettings.application = rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication();
this._settings = [];
this._settings[Common.Utils.documentSettingsType.Paragraph] = {panelId: "id-paragraph-settings", panel: rightMenu.paragraphSettings,btn: rightMenu.btnText, hidden: 1, locked: false};

View file

@ -182,6 +182,14 @@ define([
checked: this._state.cropMode,
value: 0
},
{
caption: this.textCropToShape,
menu: new Common.UI.Menu({
menuAlign: 'tl-tl',
cls: 'menu-shapes menu-change-shape',
items: []
})
},
{
caption: this.textCropFill,
value: 1
@ -198,6 +206,7 @@ define([
this.btnCrop.on('click', _.bind(this.onCrop, this));
this.btnCrop.menu.on('item:click', _.bind(this.onCropMenu, this));
this.lockedControls.push(this.btnCrop);
this.btnChangeShape= this.btnCrop.menu.items[1];
this.btnRotate270 = new Common.UI.Button({
parentEl: $('#image-button-270', this.$el),
@ -258,9 +267,50 @@ define([
createDelayedElements: function() {
this.createDelayedControls();
this.updateMetricUnit();
this.onApiAutoShapes();
this._initSettings = false;
},
onApiAutoShapes: function() {
var me = this;
var onShowBefore = function(menu) {
me.fillAutoShapes();
menu.off('show:before', onShowBefore);
};
me.btnChangeShape.menu.on('show:before', onShowBefore);
},
fillAutoShapes: function() {
var me = this,
recents = Common.localStorage.getItem('pe-recent-shapes');
var menuitem = new Common.UI.MenuItem({
template: _.template('<div id="id-img-change-shape-menu" class="menu-insertshape"></div>'),
index: 0
});
me.btnChangeShape.menu.addItem(menuitem);
var shapePicker = new Common.UI.DataViewShape({
el: $('#id-img-change-shape-menu'),
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
groups: me.application.getCollection('ShapeGroups'),
parentMenu: me.btnChangeShape.menu,
restoreHeight: 640,
textRecentlyUsed: me.textRecentlyUsed,
recentShapes: recents ? JSON.parse(recents) : null,
isFromImage: true
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
PE.getController('Toolbar').toolbar.cmbInsertShape.updateComboView(record);
me.api.ChangeShapeType(record.get('data').shapeType);
me.fireEvent('editcomplete', me);
}
if (e.type !== 'click')
me.btnCrop.menu.hide();
});
},
ChangeSettings: function(props) {
if (this._initSettings)
this.createDelayedElements();
@ -490,6 +540,8 @@ define([
textCropFill: 'Fill',
textCropFit: 'Fit',
textFitSlide: 'Fit to Slide',
textFromStorage: 'From Storage'
textCropToShape: 'Crop to shape',
textFromStorage: 'From Storage',
textRecentlyUsed: 'Recently Used'
}, PE.Views.ImageSettings || {}));
});

View file

@ -1442,6 +1442,7 @@
"PE.Views.ImageSettings.textCrop": "Crop",
"PE.Views.ImageSettings.textCropFill": "Fill",
"PE.Views.ImageSettings.textCropFit": "Fit",
"PE.Views.ImageSettings.textCropToShape": "Crop to shape",
"PE.Views.ImageSettings.textEdit": "Edit",
"PE.Views.ImageSettings.textEditObject": "Edit Object",
"PE.Views.ImageSettings.textFitSlide": "Fit to Slide",
@ -1456,6 +1457,7 @@
"PE.Views.ImageSettings.textHintFlipV": "Flip Vertically",
"PE.Views.ImageSettings.textInsert": "Replace Image",
"PE.Views.ImageSettings.textOriginalSize": "Actual Size",
"PE.Views.ImageSettings.textRecentlyUsed": "Recently Used",
"PE.Views.ImageSettings.textRotate90": "Rotate 90°",
"PE.Views.ImageSettings.textRotation": "Rotation",
"PE.Views.ImageSettings.textSize": "Size",

View file

@ -83,7 +83,7 @@ define([
},
onRightMenuAfterRender: function(rightMenu) {
rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication();
rightMenu.imageSettings.application = rightMenu.shapeSettings.application = rightMenu.textartSettings.application = this.getApplication();
this._settings = [];
this._settings[Common.Utils.documentSettingsType.Paragraph] = {panelId: "id-paragraph-settings", panel: rightMenu.paragraphSettings,btn: rightMenu.btnText, hidden: 1, locked: false};

View file

@ -239,6 +239,14 @@ define([
checked: this._state.cropMode,
value: 0
},
{
caption: this.textCropToShape,
menu: new Common.UI.Menu({
menuAlign: 'tl-tl',
cls: 'menu-shapes menu-change-shape',
items: []
})
},
{
caption: this.textCropFill,
value: 1
@ -255,6 +263,7 @@ define([
this.btnCrop.on('click', _.bind(this.onCrop, this));
this.btnCrop.menu.on('item:click', _.bind(this.onCropMenu, this));
this.lockedControls.push(this.btnCrop);
this.btnChangeShape= this.btnCrop.menu.items[1];
this.btnRotate270 = new Common.UI.Button({
parentEl: $('#image-button-270', me.$el),
@ -314,6 +323,7 @@ define([
createDelayedElements: function() {
this.createDelayedControls();
this.updateMetricUnit();
this.onApiAutoShapes();
this._initSettings = false;
},
@ -351,6 +361,45 @@ define([
}
},
onApiAutoShapes: function() {
var me = this;
var onShowBefore = function(menu) {
me.fillAutoShapes();
menu.off('show:before', onShowBefore);
};
me.btnChangeShape.menu.on('show:before', onShowBefore);
},
fillAutoShapes: function() {
var me = this,
recents = Common.localStorage.getItem('sse-recent-shapes');
var menuitem = new Common.UI.MenuItem({
template: _.template('<div id="id-img-change-shape-menu" class="menu-insertshape"></div>'),
index: 0
});
me.btnChangeShape.menu.addItem(menuitem);
var shapePicker = new Common.UI.DataViewShape({
el: $('#id-img-change-shape-menu'),
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
groups: me.application.getCollection('ShapeGroups'),
parentMenu: me.btnChangeShape.menu,
restoreHeight: 640,
textRecentlyUsed: me.textRecentlyUsed,
recentShapes: recents ? JSON.parse(recents) : null,
isFromImage: true
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
me.api.asc_changeShapeType(record.get('data').shapeType);
Common.NotificationCenter.trigger('edit:complete', me);
}
if (e.type !== 'click')
me.btnCrop.menu.hide();
});
},
ChangeSettings: function(props) {
if (this._initSettings)
this.createDelayedElements();
@ -583,6 +632,8 @@ define([
textCrop: 'Crop',
textCropFill: 'Fill',
textCropFit: 'Fit',
textFromStorage: 'From Storage'
textCropToShape: 'Crop to shape',
textFromStorage: 'From Storage',
textRecentlyUsed: 'Recently Used'
}, SSE.Views.ImageSettings || {}));
});

View file

@ -2413,6 +2413,7 @@
"SSE.Views.ImageSettings.textCrop": "Crop",
"SSE.Views.ImageSettings.textCropFill": "Fill",
"SSE.Views.ImageSettings.textCropFit": "Fit",
"SSE.Views.ImageSettings.textCropToShape": "Crop to shape",
"SSE.Views.ImageSettings.textEdit": "Edit",
"SSE.Views.ImageSettings.textEditObject": "Edit Object",
"SSE.Views.ImageSettings.textFlip": "Flip",
@ -2427,6 +2428,7 @@
"SSE.Views.ImageSettings.textInsert": "Replace Image",
"SSE.Views.ImageSettings.textKeepRatio": "Constant proportions",
"SSE.Views.ImageSettings.textOriginalSize": "Actual Size",
"SSE.Views.ImageSettings.textRecentlyUsed": "Recently Used",
"SSE.Views.ImageSettings.textRotate90": "Rotate 90°",
"SSE.Views.ImageSettings.textRotation": "Rotation",
"SSE.Views.ImageSettings.textSize": "Size",