Customize toolbar using config

This commit is contained in:
Julia Radzhabova 2021-10-07 11:43:31 +03:00
parent 0bd401884e
commit 07171b4ee5
4 changed files with 40 additions and 8 deletions

View file

@ -143,6 +143,37 @@
reviewDisplay: 'original', // original for viewer, markup for editor
trackChanges: undefined // true/false - open editor with track changes mode on/off,
},
layout: {
toolbar: {
file: {
close: false / true,
advanced: false / true,
info: {
application: false/true
} / false / true
} / false / true,
home: {} / false / true,
insert: {} / false / true,
layout: {} / false / true,
references: {} / false / true,
collaboration: {} / false / true
},
leftMenu: {
navigation: false/true
},
rightMenu: {
},
statusBar: {
textLang: false/true
docLang: false/true
}
},
features: {
spellcheck: {
mode: false/true // значение при первом открытии редактора
change: false/true // показывать настройку или скрывать
} / false / true // если не объект, то как и раньше - значение при первом открытии редактора
},
chat: true,
comments: true,
zoom: 100,

View file

@ -99,7 +99,8 @@ define([
'<% if (typeof items[i] == "object") { %>' +
'<li class="ribtab' +
'<% if (items[i].haspanel===false) print(" x-lone") %>' +
'<% if (items[i].extcls) print(\' \' + items[i].extcls) %>">' +
'<% if (items[i].extcls) print(\' \' + items[i].extcls) %>"' +
'<% if (typeof items[i].layoutname == "string") print(" data-layout-name=" + \' \' + items[i].layoutname) + \' \' %>>' +
'<a data-tab="<%= items[i].action %>" data-title="<%= items[i].caption %>" data-hint="0" data-hint-direction="bottom" data-hint-offset="small"><%= items[i].caption %></a>' +
'</li>' +
'<% } %>' +
@ -316,7 +317,7 @@ define([
return config.tabs[index].action;
}
var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><a data-tab="<%= action %>" data-title="<%= caption %>" data-hint="0" data-hint-direction="bottom" data-hint-offset="small"><%= caption %></a></li>');
var _tabTemplate = _.template('<li class="ribtab" style="display: none;" <% if (typeof layoutname == "string") print(" data-layout-name=" + \' \' + layoutname) + \' \' %>><a data-tab="<%= action %>" data-title="<%= caption %>" data-hint="0" data-hint-direction="bottom" data-hint-offset="small"><%= caption %></a></li>');
config.tabs[after + 1] = tab;
var _after_action = _get_tab_action(after);

View file

@ -3184,7 +3184,7 @@ define([
me.toolbar.render(_.extend({isCompactView: compactview}, config));
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, layoutname: 'collaboration'};
var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel ) {
me.toolbar.addTab(tab, $panel, 5);

View file

@ -109,11 +109,11 @@ define([
Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template),
tabs: [
{caption: me.textTabFile, action: 'file', extcls: 'canedit', haspanel:false},
{caption: me.textTabHome, action: 'home', extcls: 'canedit'},
{caption: me.textTabInsert, action: 'ins', extcls: 'canedit'},
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit'},
{caption: me.textTabLinks, action: 'links', extcls: 'canedit'}
{caption: me.textTabFile, action: 'file', extcls: 'canedit', layoutname: 'file', haspanel:false},
{caption: me.textTabHome, action: 'home', extcls: 'canedit', layoutname: 'home'},
{caption: me.textTabInsert, action: 'ins', extcls: 'canedit', layoutname: 'insert'},
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit', layoutname: 'layout'},
{caption: me.textTabLinks, action: 'links', extcls: 'canedit', layoutname: 'references'}
]
}
);