Skip to content

Commit

Permalink
Merge pull request 'fix/bug-68668' (#111) from fix/bug-68668 into hot…
Browse files Browse the repository at this point in the history
…fix/v8.2.1
  • Loading branch information
Julia Radzhabova committed Nov 6, 2024
2 parents 906c274 + 70b2943 commit 2bd3df2
Show file tree
Hide file tree
Showing 48 changed files with 287 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,13 @@ define([
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked)
return;
}
this.onShowImageActions(obj, x, y);
if (obj.pr && obj.pr.is_Signature()) { // select signature picture only from local file
me.api.asc_addImage(obj.pr);
setTimeout(function(){
me.api.asc_UncheckContentControlButtons();
}, 500);
} else
this.onShowImageActions(obj, x, y);
break;
case Asc.c_oAscContentControlSpecificType.DropDownList:
case Asc.c_oAscContentControlSpecificType.ComboBox:
Expand All @@ -1199,7 +1205,7 @@ define([
menuContainer = menu ? this.boxSdk.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null,
me = this;

this.internalFormObj = obj && obj.pr ? obj.pr.get_InternalId() : null;
this.internalFormObj = obj ? obj.pr : null;
this._fromShowContentControls = true;
Common.UI.Menu.Manager.hideAll();

Expand Down Expand Up @@ -1288,7 +1294,7 @@ define([
},

setImageUrl: function(url, token) {
this.api.asc_SetContentControlPictureUrl(url, this.internalFormObj && this.internalFormObj.pr ? this.internalFormObj.pr.get_InternalId() : null, token);
this.api.asc_SetContentControlPictureUrl(url, this.internalFormObj ? this.internalFormObj.get_InternalId() : null, token);
},

insertImage: function(data) { // gateway
Expand Down
106 changes: 102 additions & 4 deletions apps/documenteditor/main/app/controller/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ define([
if (this.mode.isEdit || this.mode.isRestrictedEdit && this.mode.canFillForms) {
this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this));
this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this));
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this));
Common.NotificationCenter.on('forms:image-select', _.bind(this.selectFormImage, this));// select from right pane
}
this.api.asc_registerCallback('onPluginContextMenu', _.bind(this.onPluginContextMenu, this));
this.documentHolder.setApi(this.api);
Expand Down Expand Up @@ -1757,11 +1759,13 @@ define([
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
} else if (obj.pr && obj.pr.is_Signature() || !me.mode.canSaveToFile) { // select picture for signature or in viewer only from local file
this.api.asc_addImage(obj.pr);
setTimeout(function(){
me.api.asc_UncheckContentControlButtons();
}, 500);
} else
this.api.asc_addImage(obj);
setTimeout(function(){
me.api.asc_UncheckContentControlButtons();
}, 500);
this.onShowImageActions(obj, x, y);
break;
case Asc.c_oAscContentControlSpecificType.DropDownList:
case Asc.c_oAscContentControlSpecificType.ComboBox:
Expand All @@ -1770,6 +1774,100 @@ define([
}
},

onShowImageActions: function(obj, x, y) {
var cmpEl = this.documentHolder.cmpEl,
menu = this.imageControlMenu,
menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null,
me = this;

this.internalFormObj = obj ? obj.pr : null;
this._fromShowContentControls = true;
Common.UI.Menu.Manager.hideAll();

if (!menu) {
this.imageControlMenu = menu = new Common.UI.Menu({
maxHeight: 207,
menuAlign: 'tl-bl',
items: [
{caption: this.documentHolder.mniImageFromFile, value: 0},
{caption: this.documentHolder.mniImageFromUrl, value: 1},
{caption: this.documentHolder.mniImageFromStorage, value: 2, visible: this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1}
]
});
menu.on('item:click', function(menu, item) {
setTimeout(function(){
me.onImageSelect(menu, item);
}, 1);
setTimeout(function(){
me.api.asc_UncheckContentControlButtons();
}, 500);
});

// Prepare menu container
if (!menuContainer || menuContainer.length < 1) {
menuContainer = $(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id));
cmpEl.append(menuContainer);
}

menu.render(menuContainer);
menu.cmpEl.attr({tabindex: "-1"});
menu.on('hide:after', function(){
if (!me._fromShowContentControls)
me.api.asc_UncheckContentControlButtons();
});
}
menuContainer.css({left: x, top : y});
menuContainer.attr('data-value', 'prevent-canvas-click');
this._preventClick = true;
menu.show();

_.delay(function() {
menu.cmpEl.focus();
}, 10);
this._fromShowContentControls = false;
},

selectFormImage: function(item, obj) {
this.internalFormObj = obj;
this.onImageSelect(null, item);
},

onImageSelect: function(menu, item) {
if (item.value==1) {
var me = this;
(new Common.Views.ImageFromUrlDialog({
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
me.setImageUrl(checkUrl);
}
}
}
me.fireEvent('editcomplete', me);
}
})).show();
} else if (item.value==2) {
Common.NotificationCenter.trigger('storage:image-load', 'control');
} else {
if (this._isFromFile) return;
this._isFromFile = true;
this.api.asc_addImage(this.internalFormObj);
this._isFromFile = false;
}
},

setImageUrl: function(url, token) {
this.api && this.api.asc_SetContentControlPictureUrl(url, this.internalFormObj ? this.internalFormObj.get_InternalId() : null, token);
},

insertImageFromStorage: function(data) {
if (data && data._urls && data.c=='control') {
this.setImageUrl(data._urls[0], data.token);
}
},

onApiLockDocumentProps: function() {
this._state.lock_doc = true;
},
Expand Down
2 changes: 2 additions & 0 deletions apps/documenteditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ define([
Common.NotificationCenter.on('leftmenu:save', _.bind(this.tryToSave, this));
this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled());
this.onBtnChangeState('redo:disabled', toolbar.btnRedo, toolbar.btnRedo.isDisabled());
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
},

attachUIEvents: function(toolbar) {
Expand Down Expand Up @@ -490,6 +491,7 @@ define([
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this));
this.api.asc_registerCallback('asc_onChangeViewerTargetType', _.bind(this.onChangeViewerTargetType, this));
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this));
}
}
this.api.asc_registerCallback('onPluginToolbarMenu', _.bind(this.onPluginToolbarMenu, this));
Expand Down
36 changes: 1 addition & 35 deletions apps/documenteditor/main/app/view/FormSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ define([
// this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this._onLineSpacing, this));
this.api.asc_registerCallback('asc_onUpdateOFormRoles', _.bind(this.onRefreshRolesList, this));
}
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this));
return this;
},

Expand Down Expand Up @@ -1152,41 +1151,8 @@ define([
this.fireEvent('editcomplete', this);
},

setImageUrl: function(url, token) {
this.api.asc_SetContentControlPictureUrl(url, this.internalId, token);
},

insertImageFromStorage: function(data) {
if (data && data._urls && data.c=='control') {
this.setImageUrl(data._urls[0], data.token);
}
},

onImageSelect: function(menu, item) {
if (item.value==1) {
var me = this;
(new Common.Views.ImageFromUrlDialog({
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
me.setImageUrl(checkUrl);
}
}
}
me.fireEvent('editcomplete', me);
}
})).show();
} else if (item.value==2) {
Common.NotificationCenter.trigger('storage:image-load', 'control');
} else {
if (this._isFromFile) return;
this._isFromFile = true;
if (this.api) this.api.asc_addImage(this._originalProps);
this.fireEvent('editcomplete', this);
this._isFromFile = false;
}
Common.NotificationCenter.trigger('forms:image-select', item, this._originalProps);
},

onColorBGSelect: function(btn, color) {
Expand Down
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "شبه شفاف",
"DE.Views.WatermarkSettingsDialog.textUnderline": "تحته خط",
"DE.Views.WatermarkSettingsDialog.tipFontName": "اسم الخط",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "حجم الخط"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "حجم الخط",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Yarım şəffaf",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Altından xətt çəkilmiş",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Şrift Adı",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Şrift Ölçüsü"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Şrift Ölçüsü",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Паўпразрысты",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Падкрэслены",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Назва шрыфту",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Памер шрыфту"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Памер шрыфту",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semitransparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Underline",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Font name",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Font size"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Font size",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semitransparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Subratllar",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Nom de la lletra",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Mida de la lletra"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Mida de la lletra",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Poloprůhledné",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Podtržené",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Název písma",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Velikost písma"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Velikost písma",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Halvgennemsigtig",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Understreg",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Skrifttypenavn",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Skriftstørrelse"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Skriftstørrelse",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Halbtransparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Unterstrichen",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Schriftartname",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Schriftgrad"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Schriftgrad",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Ημιδιαφανές",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Υπογράμμιση",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Όνομα γραμματοσειράς",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Μέγεθος γραμματοσειράς"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Μέγεθος γραμματοσειράς",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
3 changes: 3 additions & 0 deletions apps/documenteditor/main/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,9 @@
"DE.Views.DocumentHolder.unicodeText": "Unicode",
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
"DE.Views.DocumentHolder.vertAlignText": "Vertical alignment",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL",
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",
"DE.Views.DropcapSettingsAdvanced.strDropcap": "Drop cap",
"DE.Views.DropcapSettingsAdvanced.strMargins": "Margins",
Expand Down
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semitransparente",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Subrayado",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Nombre de la fuente",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Tamaño de la fuente"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Tamaño de la fuente",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Erdigardena",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Azpimarra",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Letra-tipoaren izena",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Letra-tamaina"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Letra-tamaina",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Läpikuultava",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Alleviivaus",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Fontti",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Fonttikoko"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Fonttikoko",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semi-transparent",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Souligné",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Nom de la police",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Taille de police"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Taille de police",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
5 changes: 4 additions & 1 deletion apps/documenteditor/main/locale/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,5 +3661,8 @@
"DE.Views.WatermarkSettingsDialog.textTransparency": "Semitransparente",
"DE.Views.WatermarkSettingsDialog.textUnderline": "Subliñado",
"DE.Views.WatermarkSettingsDialog.tipFontName": "Nome da fonte",
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Tamaño da fonte"
"DE.Views.WatermarkSettingsDialog.tipFontSize": "Tamaño da fonte",
"DE.Views.DocumentHolder.mniImageFromFile": "Image from File",
"DE.Views.DocumentHolder.mniImageFromStorage": "Image from Storage",
"DE.Views.DocumentHolder.mniImageFromUrl": "Image from URL"
}
Loading

0 comments on commit 2bd3df2

Please sign in to comment.