[PE] Show View tab in view/commenting mode

This commit is contained in:
Julia Radzhabova 2022-02-07 19:01:03 +03:00
parent f2531c0ad7
commit 633b44b7bd
6 changed files with 101 additions and 79 deletions

View file

@ -1255,12 +1255,10 @@ define([
reviewController = application.getController('Common.Controllers.ReviewChanges');
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.document});
if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode)
var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api);
if (!this.appOptions.isEdit) return;
var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api);
if (this.appOptions.isEdit) { // set api events for toolbar in the Restricted Editing mode)
var rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts');

View file

@ -2502,10 +2502,6 @@ define([
Array.prototype.push.apply(me.toolbar.lockControls,transitController.getView().getButtons());
Array.prototype.push.apply(me.toolbar.slideOnlyControls,transitController.getView().getButtons());
var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons());
var animationController = me.getApplication().getController('Animation');
animationController.setApi(me.api).setConfig({toolbar: me,mode:config}).createToolbarPanel();
@ -2533,6 +2529,15 @@ define([
}
}
}
tab = {caption: me.toolbar.textTabView, action: 'view', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-view', dataHintTitle: 'W'};
var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
$panel = viewtab.createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 6);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));
}
},
onAppReady: function (config) {

View file

@ -63,6 +63,7 @@ define([
};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this));
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
},
setApi: function (api) {
@ -70,6 +71,8 @@ define([
this.api = api;
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onZoomChange, this));
this.api.asc_registerCallback('asc_onNotesShow', _.bind(this.onNotesShow, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
}
return this;
},
@ -82,21 +85,6 @@ define([
mode: mode,
compactToolbar: this.toolbar.toolbar.isCompactView
});
if (mode.canBrandingExt && mode.customization && mode.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) {
this.view.chStatusbar.$el.remove();
}
if (!mode.isEdit) { // if view tab will be visible in view/restricted-editing mode
this.view.chToolbar.hide();
var me = this;
Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){
if ((action=='plugins' || action=='review') && visible) {
me.view.chToolbar.show();
}
}, this));
this.view.chRulers.hide();
}
this.addListeners({
'ViewTab': {
@ -122,6 +110,10 @@ define([
this.view && this.view.SetDisabled(state);
},
createToolbarPanel: function() {
return this.view.getPanel();
},
getView: function(name) {
return !name && this.view ?
this.view : Backbone.Controller.prototype.getView.call(this, name);
@ -131,6 +123,10 @@ define([
this.SetDisabled(true);
},
onDocumentReady: function() {
Common.Utils.lockControls(Common.enumLock.disableOnStart, false, {array: this.view.lockedControls});
},
onZoomChange: function (percent, type) {
if (this._state.zoom_type !== type) {
this.view.btnFitToSlide.toggle(type == 2, true);
@ -155,6 +151,22 @@ define([
accept();
})).then(function () {
me.view.setEvents();
if (config.canBrandingExt && config.customization && config.customization.statusBar === false || !Common.UI.LayoutManager.isElementVisible('statusBar')) {
me.view.chStatusbar.$el.remove();
if (!config.isEdit) {
var slotChkNotes = me.view.chNotes.$el,
groupRulers = slotChkNotes.closest('.group'),
groupToolbar = me.view.chToolbar.$el.closest('.group');
groupToolbar.find('.elset')[1].append(slotChkNotes[0]);
groupRulers.remove();
me.view.$el.find('.separator-rulers').remove();
}
} else if (!config.isEdit) {
me.view.chRulers.hide();
}
me.view.cmbZoom.on('selected', _.bind(me.onSelectedZoomValue, me))
.on('changed:before',_.bind(me.onZoomChanged, me, true))
.on('changed:after', _.bind(me.onZoomChanged, me, false))

View file

@ -178,46 +178,6 @@
</div>
</div>
</section>
<section class="panel" data-tab="view">
<div class="group small">
<div class="elset" style="display: flex;">
<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>
</div>
<div class="elset" style="text-align: center;">
<span class="btn-slot text" id="slot-lbl-zoom" style="font-size: 11px;text-align: center;margin-top: 4px;"></span>
</div>
</div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-btn-fts" style="font-size: 11px;text-align: center;"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-btn-ftw" style="font-size: 11px;text-align: center;"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-notes"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-chk-rulers"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-toolbar"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-chk-statusbar"></span>
</div>
</div>
</section>
<section id="animation-panel" class="panel" data-tab="animate">
<div class="group flex small" id="animation-field-effects" style="width: 700px; max-width: 700px; min-width: 210px;" data-group-width="700px"></div>
<div class="group small">

View file

@ -150,9 +150,8 @@ define([
{caption: me.textTabHome, action: 'home', extcls: 'canedit', dataHintTitle: 'H'},
{caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'},
{caption: me.textTabTransitions, action: 'transit', extcls: 'canedit', dataHintTitle: 'N'},
{caption: me.textTabAnimation, action: 'animate', extcls: 'canedit', dataHintTitle: 'A'},
undefined, undefined,
{caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'}
{caption: me.textTabAnimation, action: 'animate', extcls: 'canedit', dataHintTitle: 'A'}
// undefined, undefined, undefined,
]
}
);

View file

@ -46,6 +46,47 @@ define([
'use strict';
PE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){
var template =
'<section class="panel" data-tab="view">' +
'<div class="group small">' +
'<div class="elset" style="display: flex;">' +
'<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>' +
'</div>' +
'<div class="elset" style="text-align: center;">' +
'<span class="btn-slot text" id="slot-lbl-zoom" style="font-size: 11px;text-align: center;margin-top: 4px;"></span>' +
'</div>' +
'</div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-fts" style="font-size: 11px;text-align: center;"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-btn-ftw" style="font-size: 11px;text-align: center;"></span>' +
'</div>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group">' +
'<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>' +
'</div>' +
'<div class="separator long"></div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-notes"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-rulers"></span>' +
'</div>' +
'</div>' +
'<div class="separator long separator-rulers"></div>' +
'<div class="group small">' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-toolbar"></span>' +
'</div>' +
'<div class="elset">' +
'<span class="btn-slot text" id="slot-chk-statusbar"></span>' +
'</div>' +
'</div>' +
'</section>';
return {
options: {},
@ -81,11 +122,9 @@ define([
this.lockedControls = [];
var me = this,
$host = me.toolbar.$el;
var me = this;
this.cmbZoom = new Common.UI.ComboBox({
el: $host.find('#slot-field-zoom'),
cls: 'input-group-nr',
menuStyle: 'min-width: 55px;',
editable: true,
@ -109,10 +148,7 @@ define([
this.cmbZoom.setValue(100);
this.lockedControls.push(this.cmbZoom);
$host.find('#slot-lbl-zoom').text(this.textZoom);
this.btnFitToSlide = new Common.UI.Button({
parentEl: $host.find('#slot-btn-fts'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-zoomtoslide',
caption: this.textFitToSlide,
@ -126,7 +162,6 @@ define([
this.lockedControls.push(this.btnFitToSlide);
this.btnFitToWidth = new Common.UI.Button({
parentEl: $host.find('#slot-btn-ftw'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-zoomtowidth',
caption: this.textFitToWidth,
@ -140,7 +175,6 @@ define([
this.lockedControls.push(this.btnFitToWidth);
this.btnInterfaceTheme = new Common.UI.Button({
parentEl: $host.find('#slot-btn-interface-theme'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon day',
caption: this.textInterfaceTheme,
@ -153,7 +187,6 @@ define([
this.lockedControls.push(this.btnInterfaceTheme);
this.chStatusbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-statusbar'),
labelText: this.textStatusBar,
value: !Common.localStorage.getBool("pe-hidden-status"),
lock: [_set.disableOnStart],
@ -164,7 +197,6 @@ define([
this.lockedControls.push(this.chStatusbar);
this.chToolbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-toolbar'),
labelText: this.textAlwaysShowToolbar,
value: !options.compactToolbar,
lock: [_set.disableOnStart],
@ -175,7 +207,6 @@ define([
this.lockedControls.push(this.chToolbar);
this.chRulers = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-rulers'),
labelText: this.textRulers,
value: !Common.Utils.InternalSettings.get("pe-hidden-rulers"),
lock: [_set.disableOnStart],
@ -186,7 +217,6 @@ define([
this.lockedControls.push(this.chRulers);
this.chNotes = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-notes'),
labelText: this.textNotes,
value: !Common.localStorage.getBool('pe-hidden-notes', this.appConfig.customization && this.appConfig.customization.hideNotes===true),
lock: [_set.disableOnStart],
@ -198,9 +228,27 @@ define([
},
render: function (el) {
if ( el ) el.html( this.getPanel() );
return this;
},
getPanel: function () {
this.$el = $(_.template(template)( {} ));
var $host = this.$el;
this.cmbZoom.render($host.find('#slot-field-zoom'));
$host.find('#slot-lbl-zoom').text(this.textZoom);
this.btnFitToSlide.render($host.find('#slot-btn-fts'));
this.btnFitToWidth.render($host.find('#slot-btn-ftw'));
this.btnInterfaceTheme.render($host.find('#slot-btn-interface-theme'));
this.chStatusbar.render($host.find('#slot-chk-statusbar'));
this.chToolbar.render($host.find('#slot-chk-toolbar'));
this.chRulers.render($host.find('#slot-chk-rulers'));
this.chNotes.render($host.find('#slot-chk-notes'));
return this.$el;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this);
this.fireEvent('show', this);