Skip to content

Commit

Permalink
Merge pull request #3022 from ONLYOFFICE/fix/bugfix
Browse files Browse the repository at this point in the history
[DE][PDF] Highlight current editing mode in menu
  • Loading branch information
JuliaRadzhabova authored May 31, 2024
2 parents fcdf351 + 34d8884 commit b701223
Show file tree
Hide file tree
Showing 259 changed files with 4,183 additions and 5,699 deletions.
65 changes: 50 additions & 15 deletions apps/common/main/lib/view/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,17 @@ define([
var me = this;
config = config || appConfig;
if (!me.btnPDFMode || !config) return;
me.btnPDFMode.setIconCls('toolbar__icon icon--inverse ' + (config.isPDFEdit ? 'btn-edit' : (config.isPDFAnnotate && config.canCoEditing ? 'btn-menu-comments' : 'btn-sheet-view')));
me.btnPDFMode.setCaption(config.isPDFEdit ? me.textEdit : (config.isPDFAnnotate && config.canCoEditing ? me.textComment : me.textView));
me.btnPDFMode.updateHint(config.isPDFEdit ? me.tipEdit : (config.isPDFAnnotate && config.canCoEditing ? me.tipComment : me.tipView));
var type = config.isPDFEdit ? 'edit' : (config.isPDFAnnotate && config.canCoEditing ? 'comment' : 'view'),
isEdit = config.isPDFEdit,
isComment = !isEdit && config.isPDFAnnotate && config.canCoEditing;
me.btnPDFMode.setIconCls('toolbar__icon icon--inverse ' + (isEdit ? 'btn-edit' : (isComment ? 'btn-menu-comments' : 'btn-sheet-view')));
me.btnPDFMode.setCaption(isEdit ? me.textEdit : (isComment ? me.textComment : me.textView));
me.btnPDFMode.updateHint(isEdit ? me.tipEdit : (isComment ? me.tipComment : me.tipView));
me.btnPDFMode.options.value = type;
if (me.btnPDFMode.menu && typeof me.btnPDFMode.menu === 'object') {
var item = _.find(me.btnPDFMode.menu.items, function(item) { return item.value == type; });
(item) ? item.setChecked(true) : this.btnPDFMode.menu.clearAll();
}
}

function changeDocMode(type, lockEditing) {
Expand All @@ -294,7 +302,12 @@ define([
this.btnDocMode.setIconCls('toolbar__icon icon--inverse ' + (isEdit ? 'btn-edit' : (isReview ? 'btn-ic-review' : 'btn-sheet-view')));
this.btnDocMode.setCaption(isEdit ? this.textEdit : isReview ? this.textReview : isViewForm ? this.textViewForm : this.textView);
this.btnDocMode.updateHint(isEdit ? this.tipDocEdit : isReview ? this.tipReview : isViewForm ? this.tipDocViewForm : this.tipDocView);
this.btnDocMode.options.value = type;
show && !this.btnDocMode.isVisible() && this.btnDocMode.setVisible(true);
if (this.btnDocMode.menu && typeof this.btnDocMode.menu === 'object') {
var item = _.find(this.btnDocMode.menu.items, function(item) { return item.value == type; });
(item) ? item.setChecked(true) : this.btnDocMode.menu.clearAll();
}
}

function onResize() {
Expand Down Expand Up @@ -573,76 +586,96 @@ define([
'<% if (options.description !== null) { %><label class="margin-left-10 description"><%= options.description %></label>' +
'<% } %></a>');
if (me.btnPDFMode) {
var arr = [];
var arr = [],
type = me.btnPDFMode.options.value;
appConfig.canPDFEdit && arr.push({
caption: me.textEdit,
iconCls : 'menu__icon btn-edit',
template: menuTemplate,
description: appConfig.canCoEditing ? me.textEditDesc : me.textEditDescNoCoedit,
value: 'edit'
value: 'edit',
checkable: true,
toggleGroup: 'docmode'
});
arr.push({
caption: appConfig.canCoEditing ? me.textComment : me.textView,
iconCls : 'menu__icon ' + (appConfig.canCoEditing ? 'btn-menu-comments' : 'btn-sheet-view'),
template: menuTemplate,
description: appConfig.canCoEditing ? me.textCommentDesc : me.textViewDescNoCoedit,
value: 'comment',
disabled: !appConfig.canPDFAnnotate
value: appConfig.canCoEditing ? 'comment' : 'view',
disabled: !appConfig.canPDFAnnotate,
checkable: true,
toggleGroup: 'docmode'
});
appConfig.canCoEditing && arr.push({
caption: me.textView,
iconCls : 'menu__icon btn-sheet-view',
template: menuTemplate,
description: me.textViewDesc,
value: 'view'
value: 'view',
checkable: true,
toggleGroup: 'docmode'
});
me.btnPDFMode.setMenu(new Common.UI.Menu({
cls: 'ppm-toolbar',
cls: 'ppm-toolbar select-checked-items',
style: 'width: 220px;',
menuAlign: 'tr-br',
items: arr
}));
me.btnPDFMode.menu.on('item:click', function (menu, item) {
Common.NotificationCenter.trigger('pdf:mode-apply', item.value);
});
var item = _.find(me.btnPDFMode.menu.items, function(item) { return item.value == type; });
item && item.setChecked(true);
} else if (me.btnDocMode) {
var arr = [];
var arr = [],
type = me.btnDocMode.options.value;
!appConfig.isReviewOnly && arr.push({
caption: me.textEdit,
iconCls : 'menu__icon btn-edit',
template: menuTemplate,
description: me.textDocEditDesc,
value: 'edit'
value: 'edit',
checkable: true,
toggleGroup: 'docmode'
});
appConfig.canReview && arr.push({
caption: me.textReview,
iconCls : 'menu__icon btn-ic-review',
template: menuTemplate,
description: me.textReviewDesc,
value: 'review'
value: 'review',
checkable: true,
toggleGroup: 'docmode'
});
appConfig.isPDFForm && appConfig.isFormCreator ? arr.push({
caption: me.textViewForm,
iconCls : 'menu__icon btn-sheet-view',
template: menuTemplate,
description: me.textDocViewFormDesc,
value: 'view-form'
value: 'view-form',
checkable: true,
toggleGroup: 'docmode'
}) : arr.push({
caption: me.textView,
iconCls : 'menu__icon btn-sheet-view',
template: menuTemplate,
description: me.textDocViewDesc,
value: 'view'
value: 'view',
checkable: true,
toggleGroup: 'docmode'
});
me.btnDocMode.setMenu(new Common.UI.Menu({
cls: 'ppm-toolbar',
cls: 'ppm-toolbar select-checked-items',
style: 'width: 220px;',
menuAlign: 'tr-br',
items: arr
}));
me.btnDocMode.menu.on('item:click', function (menu, item) {
Common.NotificationCenter.trigger('doc:mode-apply', item.value, true);
});
var item = _.find(me.btnDocMode.menu.items, function(item) { return item.value == type; });
item && item.setChecked(true);
}
if (appConfig.twoLevelHeader && !appConfig.compactHeader)
Common.NotificationCenter.on('window:resize', onResize);
Expand Down Expand Up @@ -905,6 +938,7 @@ define([
iconCls: 'toolbar__icon icon--inverse btn-sheet-view',
caption: me.textView,
menu: true,
value: 'view',
dataHint: '0',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
Expand All @@ -920,6 +954,7 @@ define([
menu: true,
visible: config.isReviewOnly || !config.canReview,
lock: [Common.enumLock.previewReviewMode, Common.enumLock.lostConnect, Common.enumLock.disableOnStart, Common.enumLock.docLockView, Common.enumLock.docLockComments, Common.enumLock.docLockForms, Common.enumLock.fileMenuOpened, Common.enumLock.changeModeLock],
value: config.isReviewOnly ? 'review' : 'edit',
dataHint: '0',
dataHintDirection: 'bottom',
dataHintOffset: 'big'
Expand Down
21 changes: 21 additions & 0 deletions apps/common/main/resources/less/toolbar.less
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,27 @@
}
}

.select-checked-items {
a.checked {
&:before {
display: none !important;
}
&, &:hover, &:focus {
background-color: @highlight-button-pressed-ie;
background-color: @highlight-button-pressed;
color: @text-normal-pressed-ie;
color: @text-normal-pressed;
label {
color: @text-normal-pressed-ie;
color: @text-normal-pressed;
}
}
.menu-item-icon {
background-position-x: -20px;
background-position-x: @button-small-active-icon-offset-x;
}
}
}
.item-databar {
.icon {
width: 25px;
Expand Down
4 changes: 2 additions & 2 deletions apps/documenteditor/forms/locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"DE.Controllers.ApplicationController.textLoadingDocument": "Dokument wird geladen...",
"DE.Controllers.ApplicationController.textNoLicenseTitle": "Lizenzlimit erreicht",
"DE.Controllers.ApplicationController.textOf": "von",
"DE.Controllers.ApplicationController.textRequired": "Füllen Sie alle erforderlichen Felder aus, um das Formular zu senden.",
"DE.Controllers.ApplicationController.textRequired": "Füllen Sie alle erforderlichen Felder aus, um das Formular abzusenden.",
"DE.Controllers.ApplicationController.textSaveAs": "Als PDF speichern",
"DE.Controllers.ApplicationController.textSaveAsDesktop": "Speichern als...",
"DE.Controllers.ApplicationController.textSubmited": "<b>Das Formular wurde erfolgreich abgesendet</b><br>Klicken Sie hier, um den Tipp auszublenden",
Expand Down Expand Up @@ -174,7 +174,7 @@
"DE.Views.ApplicationView.textPaste": "Einfügen",
"DE.Views.ApplicationView.textPrintSel": "Auswahl drucken",
"DE.Views.ApplicationView.textRedo": "Wiederholen",
"DE.Views.ApplicationView.textSubmit": "Senden",
"DE.Views.ApplicationView.textSubmit": "Ausfüllen & Absenden",
"DE.Views.ApplicationView.textUndo": "Rückgängig machen",
"DE.Views.ApplicationView.textZoom": "Zoom",
"DE.Views.ApplicationView.tipRedo": "Wiederholen",
Expand Down
6 changes: 3 additions & 3 deletions apps/documenteditor/forms/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"DE.Controllers.ApplicationController.textLoadingDocument": "Loading document",
"DE.Controllers.ApplicationController.textNoLicenseTitle": "License limit reached",
"DE.Controllers.ApplicationController.textOf": "of",
"DE.Controllers.ApplicationController.textRequired": "Fill all required fields to send form.",
"DE.Controllers.ApplicationController.textRequired": "To submit the form, you must fill in all required fields",
"DE.Controllers.ApplicationController.textSaveAs": "Save as PDF",
"DE.Controllers.ApplicationController.textSaveAsDesktop": "Save as...",
"DE.Controllers.ApplicationController.textSubmited": "<b>Form submitted successfully</b><br>Click to close the tip",
Expand Down Expand Up @@ -178,6 +178,7 @@
"DE.Views.ApplicationView.textUndo": "Undo",
"DE.Views.ApplicationView.textZoom": "Zoom",
"DE.Views.ApplicationView.tipRedo": "Redo",
"DE.Views.ApplicationView.tipSubmit": "Submit form",
"DE.Views.ApplicationView.tipUndo": "Undo",
"DE.Views.ApplicationView.txtDarkMode": "Dark mode",
"DE.Views.ApplicationView.txtDownload": "Download",
Expand All @@ -189,6 +190,5 @@
"DE.Views.ApplicationView.txtPrint": "Print",
"DE.Views.ApplicationView.txtSearch": "Find",
"DE.Views.ApplicationView.txtShare": "Share",
"DE.Views.ApplicationView.txtTheme": "Interface theme",
"DE.Views.ApplicationView.tipSubmit": "Submit form"
"DE.Views.ApplicationView.txtTheme": "Interface theme"
}
4 changes: 2 additions & 2 deletions apps/documenteditor/forms/locale/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"DE.Controllers.ApplicationController.textLoadingDocument": "Загрузка документа",
"DE.Controllers.ApplicationController.textNoLicenseTitle": "Лицензионное ограничение",
"DE.Controllers.ApplicationController.textOf": "из",
"DE.Controllers.ApplicationController.textRequired": "Заполните все обязательные поля для отправки формы.",
"DE.Controllers.ApplicationController.textRequired": "Чтобы отправить форму, заполните все обязательные поля",
"DE.Controllers.ApplicationController.textSaveAs": "Сохранить как PDF",
"DE.Controllers.ApplicationController.textSaveAsDesktop": "Сохранить как...",
"DE.Controllers.ApplicationController.textSubmited": "<b>Форма успешно отправлена</b><br>Нажмите, чтобы закрыть подсказку",
Expand Down Expand Up @@ -174,7 +174,7 @@
"DE.Views.ApplicationView.textPaste": "Вставить",
"DE.Views.ApplicationView.textPrintSel": "Напечатать выделенное",
"DE.Views.ApplicationView.textRedo": "Повторить",
"DE.Views.ApplicationView.textSubmit": "Отправить",
"DE.Views.ApplicationView.textSubmit": "Заполнить и отправить",
"DE.Views.ApplicationView.textUndo": "Отменить",
"DE.Views.ApplicationView.textZoom": "Масштаб",
"DE.Views.ApplicationView.tipRedo": "Повторить",
Expand Down
22 changes: 0 additions & 22 deletions apps/documenteditor/main/locale/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3433,28 +3433,6 @@
"DE.Views.Toolbar.txtMarginAlign": "محاذاة بالنسبة للهوامش",
"DE.Views.Toolbar.txtObjectsAlign": "قم بمحاذاة الكائنات المحددة",
"DE.Views.Toolbar.txtPageAlign": "محاذاة بالنسبة للصفحة",
"DE.Views.Toolbar.txtScheme1": "Office",
"DE.Views.Toolbar.txtScheme10": "الوسيط",
"DE.Views.Toolbar.txtScheme11": "Metro",
"DE.Views.Toolbar.txtScheme12": "Module",
"DE.Views.Toolbar.txtScheme13": "Opulent",
"DE.Views.Toolbar.txtScheme14": "Oriel",
"DE.Views.Toolbar.txtScheme15": "الأصل",
"DE.Views.Toolbar.txtScheme16": "paper",
"DE.Views.Toolbar.txtScheme17": "Solstice",
"DE.Views.Toolbar.txtScheme18": "Technic",
"DE.Views.Toolbar.txtScheme19": "Trek",
"DE.Views.Toolbar.txtScheme2": "تدرج الرمادي",
"DE.Views.Toolbar.txtScheme20": "Urban",
"DE.Views.Toolbar.txtScheme21": "Verve",
"DE.Views.Toolbar.txtScheme22": "New Office",
"DE.Views.Toolbar.txtScheme3": "Apex",
"DE.Views.Toolbar.txtScheme4": "هيئة",
"DE.Views.Toolbar.txtScheme5": "مدني",
"DE.Views.Toolbar.txtScheme6": "الالتقاء",
"DE.Views.Toolbar.txtScheme7": "Equity",
"DE.Views.Toolbar.txtScheme8": "تدفق",
"DE.Views.Toolbar.txtScheme9": "Foundry",
"DE.Views.ViewTab.textAlwaysShowToolbar": "أظهر دائما شريط الأدوات",
"DE.Views.ViewTab.textDarkDocument": "مستند داكن",
"DE.Views.ViewTab.textFitToPage": "ملائم للصفحة",
Expand Down
22 changes: 0 additions & 22 deletions apps/documenteditor/main/locale/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -2734,28 +2734,6 @@
"DE.Views.Toolbar.txtMarginAlign": "Kənara uyğun düzləndir",
"DE.Views.Toolbar.txtObjectsAlign": "Seçilmiş Elementləri Düzləndir",
"DE.Views.Toolbar.txtPageAlign": "Səhifəyə uyğun düzləndir",
"DE.Views.Toolbar.txtScheme1": "Ofis",
"DE.Views.Toolbar.txtScheme10": "Orta Qiymət",
"DE.Views.Toolbar.txtScheme11": "Metro",
"DE.Views.Toolbar.txtScheme12": "Modul",
"DE.Views.Toolbar.txtScheme13": "Zəngin",
"DE.Views.Toolbar.txtScheme14": "Oriel",
"DE.Views.Toolbar.txtScheme15": "Mənbə",
"DE.Views.Toolbar.txtScheme16": "Kağız",
"DE.Views.Toolbar.txtScheme17": "Gün dönümü",
"DE.Views.Toolbar.txtScheme18": "Texnika",
"DE.Views.Toolbar.txtScheme19": "Yürüş",
"DE.Views.Toolbar.txtScheme2": "Boz rəng çalarları",
"DE.Views.Toolbar.txtScheme20": "Şəhər",
"DE.Views.Toolbar.txtScheme21": "Enerji",
"DE.Views.Toolbar.txtScheme22": "Yeni Ofis",
"DE.Views.Toolbar.txtScheme3": "Apex",
"DE.Views.Toolbar.txtScheme4": "Aspekt",
"DE.Views.Toolbar.txtScheme5": "Mülki",
"DE.Views.Toolbar.txtScheme6": "Konkurs",
"DE.Views.Toolbar.txtScheme7": "Bərabərlik",
"DE.Views.Toolbar.txtScheme8": "Axın",
"DE.Views.Toolbar.txtScheme9": "Emalatxana",
"DE.Views.ViewTab.textInterfaceTheme": "İnterfeys mövzusu",
"DE.Views.ViewTab.tipInterfaceTheme": "İnterfeys mövzusu",
"DE.Views.WatermarkSettingsDialog.textAuto": "Avto",
Expand Down
22 changes: 0 additions & 22 deletions apps/documenteditor/main/locale/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -3287,28 +3287,6 @@
"DE.Views.Toolbar.txtMarginAlign": "Выраўнаваць адносна поля",
"DE.Views.Toolbar.txtObjectsAlign": "Выраўнаваць абраныя аб’екты",
"DE.Views.Toolbar.txtPageAlign": "Выраўнаваць адносна старонкі",
"DE.Views.Toolbar.txtScheme1": "Офіс",
"DE.Views.Toolbar.txtScheme10": "Звычайная",
"DE.Views.Toolbar.txtScheme11": "Метро",
"DE.Views.Toolbar.txtScheme12": "Модульная",
"DE.Views.Toolbar.txtScheme13": "Прывабная",
"DE.Views.Toolbar.txtScheme14": "Эркер",
"DE.Views.Toolbar.txtScheme15": "Зыходная",
"DE.Views.Toolbar.txtScheme16": "Папяровая",
"DE.Views.Toolbar.txtScheme17": "Сонцаварот",
"DE.Views.Toolbar.txtScheme18": "Тэхнічная",
"DE.Views.Toolbar.txtScheme19": "Трэк",
"DE.Views.Toolbar.txtScheme2": "Адценні шэрага",
"DE.Views.Toolbar.txtScheme20": "Гарадская",
"DE.Views.Toolbar.txtScheme21": "Яркая",
"DE.Views.Toolbar.txtScheme22": "Новая офісная",
"DE.Views.Toolbar.txtScheme3": "Апекс",
"DE.Views.Toolbar.txtScheme4": "Аспект",
"DE.Views.Toolbar.txtScheme5": "Афіцыйная",
"DE.Views.Toolbar.txtScheme6": "Адкрытая",
"DE.Views.Toolbar.txtScheme7": "Справядлівасць",
"DE.Views.Toolbar.txtScheme8": "Плаваючая",
"DE.Views.Toolbar.txtScheme9": "Ліцейня",
"DE.Views.ViewTab.textAlwaysShowToolbar": "Заўсёды паказваць панэль інструментаў",
"DE.Views.ViewTab.textDarkDocument": "Цёмны дакумент",
"DE.Views.ViewTab.textFitToPage": "Па памеры старонкі",
Expand Down
21 changes: 0 additions & 21 deletions apps/documenteditor/main/locale/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2187,27 +2187,6 @@
"DE.Views.Toolbar.txtMarginAlign": "Подравняване с марж",
"DE.Views.Toolbar.txtObjectsAlign": "Подравняване на избраните обекти",
"DE.Views.Toolbar.txtPageAlign": "Подравняване към страница",
"DE.Views.Toolbar.txtScheme1": "Офис",
"DE.Views.Toolbar.txtScheme10": "Медиана",
"DE.Views.Toolbar.txtScheme11": "Метро",
"DE.Views.Toolbar.txtScheme12": "Модул",
"DE.Views.Toolbar.txtScheme13": "Разкошен",
"DE.Views.Toolbar.txtScheme14": "Еркер",
"DE.Views.Toolbar.txtScheme15": "Произход",
"DE.Views.Toolbar.txtScheme16": "Хартия",
"DE.Views.Toolbar.txtScheme17": "Слънцестоене",
"DE.Views.Toolbar.txtScheme18": "Техника",
"DE.Views.Toolbar.txtScheme19": "Пътуване",
"DE.Views.Toolbar.txtScheme2": "Нюанси на сивото",
"DE.Views.Toolbar.txtScheme20": "Градски",
"DE.Views.Toolbar.txtScheme21": "Ентусиазъм",
"DE.Views.Toolbar.txtScheme3": "Връх",
"DE.Views.Toolbar.txtScheme4": "Аспект",
"DE.Views.Toolbar.txtScheme5": "Градски",
"DE.Views.Toolbar.txtScheme6": "Стечение",
"DE.Views.Toolbar.txtScheme7": "Справедливост",
"DE.Views.Toolbar.txtScheme8": "Поток",
"DE.Views.Toolbar.txtScheme9": "Леярна",
"DE.Views.ViewTab.textInterfaceTheme": "Тема на интерфейса",
"DE.Views.ViewTab.textOutline": "Заглавия",
"DE.Views.ViewTab.textRulers": "Владетели",
Expand Down
Loading

0 comments on commit b701223

Please sign in to comment.