Merge pull request #1367 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2021-11-29 19:57:08 +03:00 committed by GitHub
commit 4afdde8879
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 29 deletions

View file

@ -875,18 +875,10 @@
path_type;
path += app + "/";
if (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') {
var canFillForms = !config.document.permissions
? true : (config.document.permissions.fillForms===undefined)
? (config.document.permissions.edit !== false) : config.document.permissions.fillForms;
path_type = (config.type === "mobile" || isSafari_mobile)
? "mobile" : (config.type === "embedded" || !canFillForms || config.editorConfig.mode === 'view')
? "embed" : "forms";
} else {
path_type = (config.type === "mobile" || isSafari_mobile)
? "mobile" : (config.type === "embedded")
? "embed" : "main";
}
path_type = (config.type === "mobile" || isSafari_mobile)
? "mobile" : (config.type === "embedded")
? "embed" : (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform')
? "forms" : "main";
path += path_type;
var index = "/index.html";

View file

@ -1,4 +1,4 @@
<svg width="440" height="40" viewBox="0 0 440 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg width="480" height="40" viewBox="0 0 480 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="icon-menu-sprite Embedded Viewer">
<g id="view-settings">
<path id="Vector" d="M17 26H3V27H17V26Z" fill="white"/>
@ -172,5 +172,17 @@
<g id="paste_2">
<path id="Union_30" fill-rule="evenodd" clip-rule="evenodd" d="M426 23H432V24H434C434.552 24 435 24.4477 435 25V27H434V25H432V26H426V25H424V32H426V33H424C423.448 33 423 32.5523 423 32V25C423 24.4477 423.448 24 424 24H426V23ZM436 36V29H428V36H436ZM428 28C427.448 28 427 28.4477 427 29V36C427 36.5523 427.448 37 428 37H436C436.552 37 437 36.5523 437 36V29C437 28.4477 436.552 28 436 28H428ZM429 31V30H435V31H429ZM435 32H429V33H435V32ZM429 35V34H435V35H429Z" fill="white"/>
</g>
<g id="redo">
<path id="Vector" d="M469.1 7C471.1 7 473.2 8.3 474.5 9.5L477 7V14H470L472.5 11.5C471.7 10.2 469.9 9.1 468.2 9.1C465.7 9.1 462.8 10.8 462.5 13.2C462.9 9.7 465.5 7 469.1 7Z" fill="black"/>
</g>
<g id="redo_2">
<path id="Vector_2" d="M469.1 27C471.1 27 473.2 28.3 474.5 29.5L477 27V34H470L472.5 31.5C471.7 30.2 469.9 29.1 468.2 29.1C465.7 29.1 462.8 30.8 462.5 33.2C462.9 29.7 465.5 27 469.1 27Z" fill="white"/>
</g>
<g id="undo">
<path id="Vector_3" d="M450.9 7C448.9 7 446.8 8.3 445.5 9.5L443 7V14H450L447.5 11.5C448.3 10.2 450.1 9.1 451.8 9.1C454.3 9.1 457.2 10.8 457.5 13.2C457.1 9.7 454.5 7 450.9 7Z" fill="black"/>
</g>
<g id="undo_2">
<path id="Vector_4" d="M450.9 27C448.9 27 446.8 28.3 445.5 29.5L443 27V34H450L447.5 31.5C448.3 30.2 450.1 29.1 451.8 29.1C454.3 29.1 457.2 30.8 457.5 33.2C457.1 29.7 454.5 27 450.9 27Z" fill="white"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -436,7 +436,7 @@
.svg-icon {
background: data-uri('../../../../common/forms/resources/img/icon-menu-sprite.svg') no-repeat;
background-size: @icon-width*22 @icon-height*2;
background-size: @icon-width*24 @icon-height*2;
&.download {
background-position: -@icon-width 0;
@ -512,6 +512,14 @@
background-position: -@icon-width*21 0;
background-position: -@icon-width*21 @icon-normal-top;
}
&.undo {
background-position: -@icon-width*22 0;
background-position: -@icon-width*22 @icon-normal-top;
}
&.redo {
background-position: -@icon-width*23 0;
background-position: -@icon-width*23 @icon-normal-top;
}
}
.btn {

View file

@ -489,7 +489,8 @@ define([
this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm;
var type = /^(?:(oform))$/.exec(this.document.fileType); // can fill forms only in oform format
this.appOptions.canFillForms = this.appOptions.canLicense && !!(type && typeof type[1] === 'string') && ((this.permissions.fillForms===undefined) ? (this.permissions.edit !== false) : this.permissions.fillForms) && (this.editorConfig.mode !== 'view');
this.appOptions.isOFORM = !!(type && typeof type[1] === 'string');
this.appOptions.canFillForms = this.appOptions.canLicense && this.appOptions.isOFORM && ((this.permissions.fillForms===undefined) ? (this.permissions.edit !== false) : this.permissions.fillForms) && (this.editorConfig.mode !== 'view');
this.api.asc_setViewMode(!this.appOptions.canFillForms);
this.appOptions.canBranding = params.asc_getCustomization();
@ -1172,6 +1173,9 @@ define([
this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this));
this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this));
this.api.asc_SetHighlightRequiredFields(true);
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control
}
if (this.editorConfig.mode !== 'view') // if want to open editor, but viewer is loaded
@ -1180,9 +1184,6 @@ define([
Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this));
Common.Gateway.on('downloadas', _.bind(this.onDownloadAs, this));
Common.Gateway.on('requestclose', _.bind(this.onRequestClose, this));
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control
this.attachUIEvents();
@ -1314,12 +1315,12 @@ define([
itemsCount--;
}
if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.canFillForms) {
if ( !this.embedConfig.saveUrl || !this.appOptions.canDownload || this.appOptions.isOFORM) {
menuItems[2].setVisible(false);
itemsCount--;
}
if ( !this.appOptions.canFillForms || !this.appOptions.canDownload) {
if ( !this.appOptions.isOFORM || !this.appOptions.canDownload) {
menuItems[3].setVisible(false);
menuItems[4].setVisible(false);
itemsCount -= 2;
@ -1355,7 +1356,7 @@ define([
Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this));
}
if ( !this.embedConfig.shareUrl || this.appOptions.canFillForms) {
if ( !this.embedConfig.shareUrl || this.appOptions.isOFORM) {
menuItems[8].setVisible(false);
itemsCount--;
}
@ -1365,12 +1366,12 @@ define([
itemsCount--;
}
if ( !this.embedConfig.embedUrl || this.appOptions.canFillForms) {
if ( !this.embedConfig.embedUrl || this.appOptions.isOFORM) {
menuItems[11].setVisible(false);
itemsCount--;
}
if ( !this.embedConfig.fullscreenUrl ) {
if ( !this.embedConfig.fullscreenUrl || this.appOptions.isOFORM) {
menuItems[12].setVisible(false);
itemsCount--;
}
@ -1573,9 +1574,12 @@ define([
var cancopy = this.api.can_CopyCut(),
disabled = menu_props.paraProps && menu_props.paraProps.locked || menu_props.headerProps && menu_props.headerProps.locked ||
menu_props.imgProps && (menu_props.imgProps.locked || menu_props.imgProps.content_locked);
this.textMenu.items[0].setDisabled(!cancopy); // copy
this.textMenu.items[1].setDisabled(disabled || !cancopy); // cut
this.textMenu.items[2].setDisabled(disabled) // paste;
this.textMenu.items[0].setDisabled(disabled || !this.api.asc_getCanUndo()); // undo
this.textMenu.items[1].setDisabled(disabled || !this.api.asc_getCanRedo()); // redo
this.textMenu.items[3].setDisabled(!cancopy); // copy
this.textMenu.items[4].setDisabled(disabled || !cancopy); // cut
this.textMenu.items[5].setDisabled(disabled) // paste;
this.showPopupMenu(this.textMenu, {}, event);
}
@ -1583,6 +1587,12 @@ define([
onContextMenuClick: function(menu, item, e) {
switch (item.value) {
case 'undo':
this.api && this.api.Undo();
break;
case 'redo':
this.api && this.api.Redo();
break;
case 'copy':
case 'cut':
case 'paste':

View file

@ -91,6 +91,9 @@ define([
return new Common.UI.Menu({
cls: 'shifted-right',
items: [
{ caption: this.textUndo, value: 'undo', iconCls: 'mi-icon svg-icon undo' },
{ caption: this.textRedo, value: 'redo', iconCls: 'mi-icon svg-icon redo' },
{ caption: '--' },
{ caption: this.textCut, value: 'cut', iconCls: 'mi-icon svg-icon cut' },
{ caption: this.textCopy, value: 'copy', iconCls: 'mi-icon svg-icon copy' },
{ caption: this.textPaste, value: 'paste', iconCls: 'mi-icon svg-icon paste' }
@ -114,7 +117,9 @@ define([
textCopy: 'Copy',
textPaste: 'Paste',
textPrintSel: 'Print Selection',
txtDarkMode: 'Dark mode'
txtDarkMode: 'Dark mode',
textUndo: 'Undo',
textRedo: 'Redo'
}, DE.Views.ApplicationView || {}));
});

View file

@ -132,5 +132,7 @@
"DE.Views.ApplicationView.txtFullScreen": "Full Screen",
"DE.Views.ApplicationView.txtPrint": "Print",
"DE.Views.ApplicationView.txtShare": "Share",
"DE.Views.ApplicationView.txtTheme": "Interface theme"
"DE.Views.ApplicationView.txtTheme": "Interface theme",
"DE.Views.ApplicationView.textUndo": "Undo",
"DE.Views.ApplicationView.textRedo": "Redo"
}

View file

@ -131,5 +131,7 @@
"DE.Views.ApplicationView.txtFullScreen": "Во весь экран",
"DE.Views.ApplicationView.txtPrint": "Печать",
"DE.Views.ApplicationView.txtShare": "Поделиться",
"DE.Views.ApplicationView.txtTheme": "Тема интерфейса"
"DE.Views.ApplicationView.txtTheme": "Тема интерфейса",
"DE.Views.ApplicationView.textUndo": "Отменить",
"DE.Views.ApplicationView.textRedo": "Повторить"
}