diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 7cc53fe0c8..0c0db6b4f4 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -53,6 +53,7 @@ define([ var storeUsers, appConfig; var $userList, $panelUsers, $btnUsers, $btnUserName, $labelDocName; var _readonlyRights = false; + var isPDFEditor = !!window.PDFE; var templateUserItem = '
  • " class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">' + @@ -101,6 +102,9 @@ define([ '
    ' + '
    ' + '
    ' + + '
    ' + + '
    ' + + '
    ' + '
    ' + '
    ' + '
    ' + @@ -383,6 +387,43 @@ define([ if (me.btnSearch) me.btnSearch.updateHint(me.tipSearch + Common.Utils.String.platformKey('Ctrl+F')); + if (me.btnPDFMode) { + // me.btnPDFMode.updateHint(me.tipPDFMode); + var menuTemplate = _.template('
    ' + + '<% if (!_.isEmpty(iconCls)) { %>' + + '' + + '<% } %>' + + '<%= caption %>
    ' + + '<% if (options.description !== null) { %>' + + '<% } %>
    '); + me.btnPDFMode.setMenu(new Common.UI.Menu({ + cls: 'ppm-toolbar', + style: 'max-width: 220px;', + items: [ + { + caption: me.textEdit, + iconCls : 'menu__icon btn-edit', + template: menuTemplate, + description: me.textEditDesc, + value: 'edit' + }, + { + caption: me.textComment, + iconCls : 'menu__icon btn-menu-comments', + template: menuTemplate, + description: me.textCommentDesc, + value: 'comment' + }, + { + caption: me.textView, + iconCls : 'menu__icon btn-sheet-view', + template: menuTemplate, + description: me.textViewDesc, + value: 'view' + } + ] + })); + } if (appConfig.isEdit && !(appConfig.customization && appConfig.customization.compactHeader)) Common.NotificationCenter.on('window:resize', onResize); } @@ -586,7 +627,7 @@ define([ if ( config.canQuickPrint ) this.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-hbtn-print-quick'), undefined, 'bottom', 'big', 'Q'); - if ( config.canEdit && config.canRequestEditRights ) + if ( config.canEdit && config.canRequestEditRights && !isPDFEditor) this.btnEdit = createTitleButton('toolbar__icon icon--inverse btn-edit', $html.findById('#slot-hbtn-edit'), undefined, 'bottom', 'big'); } me.btnSearch.render($html.find('#slot-btn-search')); @@ -624,6 +665,20 @@ define([ $html.find('#slot-btn-share').hide(); } + if (isPDFEditor) { + me.btnPDFMode = new Common.UI.Button({ + cls: 'btn-header btn-header-pdf-mode no-caret', + iconCls: 'toolbar__icon icon--inverse ' + (config.isPDFEdit ? 'btn-edit' : (config.isPDFAnnotate ? 'btn-menu-comments' : 'btn-sheet-view')), + caption: config.isPDFEdit ? me.textEdit : (config.isPDFAnnotate ? me.textComment : me.textView), + menu: true, + dataHint: '0', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + me.btnPDFMode.render($html.find('#slot-btn-pdf-mode')); + } else + $html.find('#slot-btn-pdf-mode').hide(); + $userList = $html.find('.cousers-list'); $panelUsers = $html.find('.box-cousers'); $btnUsers = $panelUsers.find('> .btn-users'); @@ -938,7 +993,13 @@ define([ tipSearch: 'Search', textShare: 'Share', tipPrintQuick: 'Quick print', - textReadOnly: 'Read only' + textReadOnly: 'Read only', + textView: 'Viewing', + textComment: 'Commenting', + textEdit: 'Editing', + textViewDesc: 'All changes will be saved locally', + textCommentDesc: 'All changes will be saved to the file. Real time collaboration', + textEditDesc: 'All changes will be saved to the file. Real time collaboration' } }(), Common.Views.Header || {})) }); diff --git a/apps/common/main/resources/less/header.less b/apps/common/main/resources/less/header.less index 3e086fe61b..66e4baa80a 100644 --- a/apps/common/main/resources/less/header.less +++ b/apps/common/main/resources/less/header.less @@ -338,10 +338,11 @@ } } -.btn-header-share { +.btn-header-share, +.btn-header-pdf-mode { display: flex; align-items: center; - padding: 0 12px; + padding: 0 6px; width: auto; .caption { diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index f354784a0e..6cf4cf6f3e 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -568,7 +568,7 @@ } } - .btn-header, .btn-users, .btn-header-share { + .btn-header, .btn-users, .btn-header-share, .btn-header-pdf-mode { .icon { &.icon--inverse { background-position-x: 0 !important;