[PE] toolbar's new view

This commit is contained in:
Maxim Kadushkin 2017-04-20 16:34:39 +03:00
parent c618f0978f
commit a578e3c31e
16 changed files with 2301 additions and 2186 deletions

View file

@ -61,7 +61,7 @@ define([
'Common.Views.Chat': {
'hide': _.bind(this.onHideChat, this)
},
'Statusbar': {
'Common.Views.Header': {
'click:users': _.bind(this.clickStatusbarUsers, this)
},
'LeftMenu': {
@ -83,7 +83,9 @@ define([
'recent:open': _.bind(this.onOpenRecent, this)
},
'Toolbar': {
'file:settings': _.bind(this.clickToolbarSettings,this)
'file:settings': _.bind(this.clickToolbarSettings,this),
'file:open': this.clickToolbarTab.bind(this, 'file'),
'file:close': this.clickToolbarTab.bind(this, 'other')
},
'SearchDialog': {
'hide': _.bind(this.onSearchDlgHide, this),
@ -216,16 +218,12 @@ define([
if (close_menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
this.menuExpand(this.leftMenu.btnFile, 'files', false);
}
},
clickSaveAsFormat: function(menu, format) {
this.api.asc_DownloadAs(format);
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
this.menuExpand(this.leftMenu.btnFile, 'files', false);
},
applySettings: function(menu) {
@ -242,12 +240,9 @@ define([
value = Common.localStorage.getItem("pe-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
value = Common.localStorage.getItem("pe-settings-showsnaplines");
this.api.put_ShowSnapLines(value===null || parseInt(value) == 1);
this.api.put_ShowSnapLines( Common.localStorage.getBool("pe-settings-showsnaplines") );
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
this.menuExpand(this.leftMenu.btnFile, 'files', false);
},
onCreateNew: function(menu, type) {
@ -260,16 +255,12 @@ define([
if (menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
this.menuExpand(this.leftMenu.btnFile, 'files', false);
}
},
onOpenRecent: function(menu, url) {
if (menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
this.menuExpand(this.leftMenu.btnFile, 'files', false);
}
var recentDocPage = window.open(url);
@ -280,15 +271,18 @@ define([
},
clickToolbarSettings: function(obj) {
if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == 'opts')
this.leftMenu.close();
else
this.leftMenu.showMenu('file:opts');
this.leftMenu.showMenu('file:opts');
},
clickToolbarTab: function (tab, e) {
if (tab == 'file')
this.leftMenu.menuFile.show(); else
this.leftMenu.menuFile.hide();
},
/** coauthoring begin **/
clickStatusbarUsers: function() {
this.leftMenu.btnFile.panel.panels['rights'].changeAccessRights();
this.leftMenu.menuFile.panels['rights'].changeAccessRights();
},
onHideChat: function() {
@ -384,7 +378,7 @@ define([
},
menuFilesHide: function(obj) {
$(this.leftMenu.btnFile.el).blur();
// $(this.leftMenu.btnFile.el).blur();
},
/** coauthoring begin **/
@ -431,12 +425,11 @@ define([
case 'search':
if ((!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) {
Common.UI.Menu.Manager.hideAll();
var full_menu_pressed = (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed);
var full_menu_pressed = this.leftMenu.btnAbout.pressed;
this.showSearchDlg(true);
this.leftMenu.btnSearch.toggle(true,true);
this.leftMenu.btnFile.toggle(false);
this.leftMenu.btnAbout.toggle(false);
full_menu_pressed && this.menuExpand(this.leftMenu.btnFile, 'files', false);
full_menu_pressed && this.menuExpand(this.leftMenu.btnAbout, 'files', false);
}
return false;
case 'save':
@ -463,6 +456,12 @@ define([
return false;
case 'escape':
// if (!this.leftMenu.isOpened()) return true;
// TODO:
if ( this.leftMenu.menuFile.isVisible() ) {
this.leftMenu.menuFile.hide();
return false;
}
var statusbar = PE.getController('Statusbar');
var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]');
if (menu_opened.length) {
@ -476,7 +475,8 @@ define([
return false;
}
}
if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
if ( this.leftMenu.btnAbout.pressed || this.leftMenu.btnPlugins.pressed ||
$(e.target).parents('#left-menu').length ) {
this.leftMenu.close();
Common.NotificationCenter.trigger('layout:changed', 'leftmenu');

View file

@ -427,8 +427,8 @@ define([
case Asc.c_oAscAsyncAction['ForceSaveButton']:
clearTimeout(this._state.timerSave);
force = true;
title = this.saveTitleText;
text = this.saveTextText;
// title = this.saveTitleText;
// text = this.saveTextText;
break;
case Asc.c_oAscAsyncAction['ForceSaveTimeout']:
@ -503,8 +503,10 @@ define([
if (!this.isShowOpenDialog)
this.loadMask.show();
}
else {
} else
if ( action.id == Asc.c_oAscAsyncAction.Save ) {
appHeader.setSaveStatus('begin');
} else {
this.getApplication().getController('Statusbar').setStatusCaption(text, force);
}
},
@ -529,6 +531,8 @@ define([
me._isDocReady = true;
Common.NotificationCenter.trigger('app:ready', me.appOptions);
me.api.SetDrawingFreeze(false);
me.hidePreloader();
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
@ -577,6 +581,7 @@ define([
Common.localStorage.setItem("pe-settings-showsnaplines", me.api.get_ShowSnapLines() ? 1 : 0);
var application = me.getApplication();
var toolbarController = application.getController('Toolbar'),
statusbarController = application.getController('Statusbar'),
documentHolderController = application.getController('DocumentHolder'),
@ -753,16 +758,18 @@ define([
this.updatePlugins(this.plugins, true);
this.applyModeCommonElements();
this.applyModeEditorElements();
this.api.asc_setViewMode(!this.appOptions.isEdit);
if ( this.appOptions.isEdit ) {
this.applyModeEditorElements();
} else {
Common.NotificationCenter.trigger('app:face', this.appOptions);
this.api.asc_LoadDocument();
if (!this.appOptions.isEdit) {
this.hidePreloader();
this.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
}
this.api.asc_setViewMode(!this.appOptions.isEdit);
this.api.asc_LoadDocument();
},
applyModeCommonElements: function() {
@ -868,6 +875,8 @@ define([
if (me.stackLongActions.exist({id: ApplyEditRights, type: Asc.c_oAscAsyncActionType['BlockInteraction']})) {
me.onLongActionEnd(Asc.c_oAscAsyncActionType['BlockInteraction'], ApplyEditRights);
} else if (!this._isDocReady) {
Common.NotificationCenter.trigger('app:face', me.appOptions);
me.hidePreloader();
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
}
@ -1128,6 +1137,8 @@ define([
this.updateWindowTitle();
this.api.isDocumentModified() && appHeader.setSaveStatus('changed');
var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar');
if (toolbarView) {
var isSyncButton = $('.btn-icon', toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
@ -1358,12 +1369,8 @@ define([
return;
var me = this,
shapegrouparray = [],
shapeStore = this.getCollection('ShapeGroups');
shapegrouparray = [];
shapeStore.reset();
var groupscount = groupNames.length;
_.each(groupNames, function(groupName, index){
var store = new Backbone.Collection([], {
model: PE.Models.ShapeModel
@ -1391,11 +1398,7 @@ define([
});
});
shapeStore.add(shapegrouparray);
setTimeout(function(){
me.getApplication().getController('Toolbar').fillAutoShapes();
}, 50);
this.getCollection('ShapeGroups').reset(shapegrouparray);
},
fillLayoutsStore: function(layouts){
@ -1440,10 +1443,6 @@ define([
});
artStore.reset(arr);
setTimeout(function(){
me.getApplication().getController('Toolbar').fillTextArt();
}, 50);
setTimeout(function(){
me.getApplication().getController('RightMenu').fillTextArt();
}, 50);
@ -1503,11 +1502,11 @@ define([
},
onMeta: function(meta) {
var app = this.getApplication(),
filemenu = app.getController('LeftMenu').getView('LeftMenu').getMenu('file');
appHeader.setDocumentCaption(meta.title);
this.updateWindowTitle(true);
this.document.title = meta.title;
var filemenu = this.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file');
filemenu.loadDocument({doc:this.document});
filemenu.panels['info'].updateInfo(this.document);
Common.Gateway.metaChange(meta);
@ -1760,8 +1759,6 @@ define([
criticalErrorExtText: 'Press "Ok" to to back to document list.',
openTitleText: 'Opening Document',
openTextText: 'Opening document...',
saveTitleText: 'Saving Document',
saveTextText: 'Saving document...',
loadFontsTitleText: 'Loading Data',
loadFontsTextText: 'Loading data...',
loadImagesTitleText: 'Loading Images',
@ -1888,7 +1885,6 @@ define([
errorAccessDeny: 'You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.',
titleServerVersion: 'Editor updated',
errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.',
textChangesSaved: 'All changes saved',
errorBadImageUrl: 'Image url is incorrect'
}
})(), PE.Controllers.Main || {}))

View file

@ -72,9 +72,7 @@ define([
},
onLaunch: function() {
this.statusbar = this.createView('Statusbar', {
storeUsers: this.getApplication().getCollection('Common.Collections.Users')
}).render();
this.statusbar = this.createView('Statusbar', {}).render();
this.statusbar.$el.css('z-index', 1);
this.bindViewEvents(this.statusbar, this.events);

View file

@ -114,7 +114,16 @@ define([
this.addListeners({
'Toolbar': {
'changecompact' : this.onChangeCompactView
'view:compact' : this.onChangeCompactView,
'insert:image' : this.onInsertImageClick.bind(this),
'insert:text' : this.onInsertText.bind(this),
'insert:textart' : this.onInsertTextart.bind(this),
'insert:shape' : this.onInsertShape.bind(this)
},
'FileMenu': {
'filemenu:hide': function () {
this.toolbar.setTab('');
}.bind(this)
}
});
@ -128,15 +137,17 @@ define([
btn_id = cmp.closest('.btn-group').attr('id');
if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) {
if ( me.toolbar.btnInsertText.pressed && btn_id != me.toolbar.btnInsertText.id ||
me.toolbar.btnInsertShape.pressed && btn_id != me.toolbar.btnInsertShape.id ) {
if ( me.toolbar.btnsInsertText.pressed && !me.toolbar.btnsInsertText.contains(btn_id) ||
me.toolbar.btnsInsertShape.pressed && !me.toolbar.btnsInsertShape.contains(btn_id) )
{
me._isAddingShape = false;
me._addAutoshape(false);
me.toolbar.btnInsertShape.toggle(false, true);
me.toolbar.btnInsertText.toggle(false, true);
me.toolbar.btnsInsertShape.toggle(false, true);
me.toolbar.btnsInsertText.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
} else if ( me.toolbar.btnInsertShape.pressed && btn_id == me.toolbar.btnInsertShape.id) {
} else
if ( me.toolbar.btnsInsertShape.pressed && me.toolbar.btnsInsertShape.contains(btn_id) ) {
_.defer(function(){
me.api.StartAddShape('', false);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
@ -148,11 +159,11 @@ define([
this.onApiEndAddShape = function() {
this.toolbar.fireEvent('insertshape', this.toolbar);
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
if ( this.toolbar.btnsInsertShape.pressed )
this.toolbar.btnsInsertShape.toggle(false, true);
if (this.toolbar.btnInsertText.pressed)
this.toolbar.btnInsertText.toggle(false, true);
if ( this.toolbar.btnsInsertText.pressed )
this.toolbar.btnsInsertText.toggle(false, true);
$(document.body).off('mouseup', checkInsertAutoshape);
};
@ -175,6 +186,18 @@ define([
this.toolbar = this.createView('Toolbar');
// this.toolbar.on('render:after', _.bind(this.onToolbarAfterRender, this));
var me = this;
Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me));
Common.NotificationCenter.on('app:face', me.onAppShowed.bind(me));
PE.getCollection('Common.Collections.TextArt').bind({
reset: me.onResetTextArt.bind(this)
});
PE.getCollection('ShapeGroups').bind({
reset: me.onResetAutoshapes.bind(this)
});
},
onToolbarAfterRender: function(toolbar) {
@ -182,8 +205,6 @@ define([
* UI Events
*/
toolbar.btnNewDocument.on('click', _.bind(this.onNewDocument, this));
toolbar.btnOpenDocument.on('click', _.bind(this.onOpenDocument, this));
toolbar.btnAddSlide.on('click', _.bind(this.onBtnAddSlide, this));
toolbar.mnuAddSlidePicker.on('item:click', _.bind(this.onAddSlide, this));
if (toolbar.mnuChangeSlidePicker)
@ -231,10 +252,6 @@ define([
toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlinkClick, this));
toolbar.mnuTablePicker.on('select', _.bind(this.onTablePickerSelect, this));
toolbar.btnInsertTable.menu.on('item:click', _.bind(this.onInsertTableClick, this));
toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageClick, this));
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
toolbar.btnInsertText.menu.on('item:click', _.bind(this.onInsertTextClick, this));
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
toolbar.btnClearStyle.on('click', _.bind(this.onClearStyleClick, this));
toolbar.btnCopyStyle.on('toggle', _.bind(this.onCopyStyleToggle, this));
toolbar.btnAdvSettings.on('click', _.bind(this.onAdvSettingsClick, this));
@ -299,13 +316,9 @@ define([
},
onChangeCompactView: function(view, compact) {
Common.localStorage.setItem('pe-compact-toolbar', compact ? 1 : 0);
if (!compact && !this._state.changeslide_inited) {
this.toolbar.mnuChangeSlidePicker.on('item:click', _.bind(this.onChangeSlide, this));
}
this._state.changeslide_inited = true;
this.toolbar.setFolded(compact);
Common.localStorage.setBool('pe-compact-toolbar', compact);
Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
@ -552,10 +565,12 @@ define([
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: [
this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnCopy, this.toolbar.btnPaste,
this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertImage, this.toolbar.btnInsertChart,
this.toolbar.btnInsertText, this.toolbar.btnInsertShape, this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign,
this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertChart,
this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign,
this.toolbar.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme
]});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides,
{ array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape) });
}
},
@ -1312,19 +1327,16 @@ define([
}
},
onInsertImageClick: function(menu, item, e) {
if (item.value === 'file') {
this.toolbar.fireEvent('insertimage', this.toolbar);
onInsertImageClick: function(opts, e) {
var me = this;
if (opts === 'file') {
me.toolbar.fireEvent('insertimage', this.toolbar);
if (this.api)
this.api.asc_addImage();
me.api.asc_addImage();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Image');
} else {
var me = this;
(new Common.Views.ImageFromUrlDialog({
handler: function(result, value) {
if (result == 'ok') {
@ -1349,38 +1361,54 @@ define([
}
},
onBtnInsertTextClick: function(btn, e) {
if (this.api)
this._addAutoshape(btn.pressed, 'textRect');
onInsertText: function(status) {
if ( status == 'begin' ) {
this._addAutoshape(true, 'textRect');
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
if ( !this.toolbar.btnsInsertText.pressed )
this.toolbar.btnsInsertText.toggle(true, true);
} else
this._addAutoshape(false, 'textRect');
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
if ( this.toolbar.btnsInsertShape.pressed )
this.toolbar.btnsInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text');
},
onInsertTextClick: function(menu, item, e) {
if (item.value === 'text') {
if (this.api)
this._addAutoshape(true, 'textRect');
this.toolbar.btnInsertText.toggle(true, true);
onInsertShape: function (type) {
var me = this;
if ( type == 'menu:hide' ) {
if ( me.toolbar.btnsInsertShape.pressed && !me._isAddingShape ) {
me.toolbar.btnsInsertShape.toggle(false, true);
}
me._isAddingShape = false;
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
} else {
me._addAutoshape(true, type);
me._isAddingShape = true;
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text');
if ( me.toolbar.btnsInsertText.pressed )
me.toolbar.btnsInsertText.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Add Shape');
}
},
onInsertShapeHide: function(btn, e) {
if (this.toolbar.btnInsertShape.pressed && !this._isAddingShape) {
this.toolbar.btnInsertShape.toggle(false, true);
}
this._isAddingShape = false;
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
onInsertTextart: function (data) {
var me = this;
me.toolbar.fireEvent('inserttextart', me.toolbar);
me.api.AddTextArt(data);
if ( me.toolbar.btnsInsertShape.pressed )
me.toolbar.btnsInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
},
onClearStyleClick: function(btn, e) {
@ -1654,88 +1682,18 @@ define([
this._state.clrtext_asccolor = color;
},
fillAutoShapes: function() {
var me = this,
shapesStore = this.getApplication().getCollection('ShapeGroups');
for (var i = 0; i < shapesStore.length; i++) {
var shapeGroup = shapesStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: shapeGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-shapegroup' + i + '" class="menu-shape" style="width: ' + (shapeGroup.get('groupWidth') - 8) + 'px; margin-left: 5px;"></div>') }
]
})
});
me.toolbar.btnInsertShape.menu.addItem(menuItem);
var shapePicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-shapegroup' + i),
store: shapeGroup.get('groupStore'),
parentMenu: menuItem.menu,
showLast: false,
itemTemplate: _.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
me._addAutoshape(true, record.get('data').shapeType);
me._isAddingShape = true;
if (me.toolbar.btnInsertText.pressed) {
me.toolbar.btnInsertText.toggle(false, true);
}
if (e.type !== 'click')
me.toolbar.btnInsertShape.menu.hide();
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertShape);
Common.component.Analytics.trackEvent('ToolBar', 'Add Shape');
}
});
}
onResetAutoshapes: function () {
setTimeout(function () {
this.toolbar.updateAutoshapeMenu(PE.getCollection('ShapeGroups'));
}.bind(this), 0);
},
fillTextArt: function() {
var me = this;
if (this.toolbar.mnuTextArtPicker) {
var models = this.getApplication().getCollection('Common.Collections.TextArt').models,
count = this.toolbar.mnuTextArtPicker.store.length;
if (count>0 && count==models.length) {
var data = this.toolbar.mnuTextArtPicker.store.models;
_.each(models, function(template, index){
data[index].set('imageUrl', template.get('imageUrl'));
});
} else {
this.toolbar.mnuTextArtPicker.store.reset(models);
}
} else {
this.toolbar.mnuTextArtPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-insart'),
store: this.getApplication().getCollection('Common.Collections.TextArt'),
parentMenu: this.toolbar.mnuInsertTextArt.menu,
showLast: false,
itemTemplate: _.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>" style="width:50px;height:50px;"></div>')
});
this.toolbar.mnuTextArtPicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
me.toolbar.fireEvent('inserttextart', me.toolbar);
me.api.AddTextArt(record.get('data'));
if (me.toolbar.btnInsertShape.pressed)
me.toolbar.btnInsertShape.toggle(false, true);
if (e.type !== 'click')
me.toolbar.btnInsertText.menu.hide();
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertText);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
}
});
}
onResetTextArt: function (collection, opts) {
(new Promise(function (resolve, reject) {
resolve();
})).then(function () {
this.toolbar.updateTextartMenu(collection);
}.bind(this));
},
fillEquations: function() {
@ -1796,11 +1754,11 @@ define([
if (me.api) {
me.api.asc_AddMath(record.get('data').equationType);
if (me.toolbar.btnInsertText.pressed) {
me.toolbar.btnInsertText.toggle(false, true);
if (me.toolbar.btnsInsertText.pressed) {
me.toolbar.btnsInsertText.toggle(false, true);
}
if (me.toolbar.btnInsertShape.pressed) {
me.toolbar.btnInsertShape.toggle(false, true);
if (me.toolbar.btnsInsertShape.pressed) {
me.toolbar.btnsInsertShape.toggle(false, true);
}
if (e.type !== 'click')
@ -2074,6 +2032,61 @@ define([
this.onToolbarAfterRender(this.toolbar);
},
onAppShowed: function (config) {
var me = this;
var compactview = !config.isEdit;
if ( config.isEdit ) {
if ( Common.localStorage.itemExists("pe-compact-toolbar") ) {
compactview = Common.localStorage.getBool("pe-compact-toolbar");
} else
if ( config.customization && config.customization.compactToolbar )
compactview = true;
}
me.toolbar.render(_.extend({compactview: compactview}, config));
},
onAppReady: function (config) {
var me = this;
if ( config.canComments ) {
var _btnsComment = [];
var slots = me.toolbar.$el.find('.slot-comment');
slots.each(function(index, el) {
var _cls = 'btn-toolbar';
/x-huge/.test(el.className) && (_cls += ' x-huge icon-top');
var button = new Common.UI.Button({
cls: _cls,
iconCls: 'btn-menu-comments',
caption: 'Comment'
}).render( slots.eq(index) );
_btnsComment.push(button);
});
if ( _btnsComment.length ) {
var _comments = PE.getController('Common.Controllers.Comments').getView();
// Array.prototype.push.apply(me.toolbar.toolbarControls, _btnsComment);
_btnsComment.forEach(function (btn) {
btn.updateHint( _comments.textAddComment );
btn.on('click', function (btn, e) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar');
});
}, this);
}
}
(new Promise(function(accept) {
accept();
})).then(function () {
if ( config.isEdit ) {
me.toolbar.onAppReady(config);
}
});
},
textEmptyImgUrl : 'You need to specify image URL.',
textWarning : 'Warning',
textFontSizeErr : 'The entered value must be more than 0',

View file

@ -65,8 +65,25 @@ define([
// When controller is created let's setup view event listeners
initialize: function() {
var me = this;
// This most important part when we will tell our controller what events should be handled
this.addListeners({
'Toolbar': {
'render:before' : function (toolbar) {
toolbar.setExtra('right', me.header.getPanel('right'));
toolbar.setExtra('left', me.header.getPanel('left'));
},
'view:compact' : function (toolbar, state) {
me.viewport.vlayout.panels[0].height = state ? 40 : 40+67;
}
},
'Common.Views.Header': {
'go:back': function (opts) {
Common.NotificationCenter.trigger('goback', /new/.test(opts));
// Common.component.Analytics.trackEvent('Back to Folder');
}
},
// Events generated by main view
'Viewport': {
@ -84,8 +101,9 @@ define([
// Create and render main view
this.viewport = this.createView('Viewport').render();
this.header = this.createView('Common.Views.Header', {
headerCaption: 'Presentation Editor'
}).render();
headerCaption: 'Presentation Editor',
storeUsers: PE.getCollection('Common.Collections.Users')
});
this.docPreview = this.createView('DocumentPreview', {}).render();
Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this));
@ -96,8 +114,22 @@ define([
this.api.Resize();
Common.localStorage.setItem('pe-mainmenu-width',leftPanel.width());
}, this);
Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this));
},
onAppShowed: function (config) {
var me = this;
if ( !config.isEdit ||
( !Common.localStorage.itemExists("pe-compact-toolbar") &&
config.customization && config.customization.compactToolbar ))
{
me.viewport.vlayout.panels[0].height = 40;
}
},
onLayoutChanged: function(area) {
switch (area) {
default:

View file

@ -1,6 +1,5 @@
<div id="view-left-menu" class="tool-menu left">
<div class="tool-menu-btns">
<button id="left-btn-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon img-toolbarmenu btn-menu-file">&nbsp;</span></button>
<button id="left-btn-search" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-search">&nbsp;</i></button>
<button id="left-btn-thumbs" class="btn btn-category" content-target=""><i class="icon img-toolbarmenu btn-menu-thumbs">&nbsp;</i></button>
<!-- /** coauthoring begin **/ -->

View file

@ -1,211 +1,155 @@
<div class="toolbar" style="<%= isCompactView ? 'height: 41px;' : 'height: 67px;' %>">
<!---------------------->
<!--Short view toolbar-->
<!---------------------->
<div id="id-toolbar-short" style="<%= isCompactView ? 'display: table;' : 'display: none;' %> width: 100%;" >
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-addslide"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-preview"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-print"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-save"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row" style="width: 140px; margin-top: -1px;">
<span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-short-placeholder-field-fontname"></span>
<span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-short-placeholder-field-fontsize"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-bold"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-italic"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-underline"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fontcolor"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-halign"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-valign"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-markers"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-numbering"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-linespace"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-arrange-shape"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-align-shape"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertimage"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserttable"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertchart"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertshape"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserttext"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-copystyle"></span>
</div>
</div>
<div class="toolbar-group" style="width: 100%;"></div>
<div class="toolbar-group no-mask" style="padding-left:0;">
<div class="toolbar-row">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidebars"></span>
<div class="toolbar">
<section class="box-tabs">
<div class="extra left"></div>
<section class="tabs">
<a href="#" class="scroll left">
<i class="icon">&lt;</i>
</a>
<ul>
<% for(var i in tabs) { %>
<li class="ribtab<% if (tabs[i].extcls) print(' ' + tabs[i].extcls) %>">
<a data-tab="<%= tabs[i].action %>" data-title="<%= tabs[i].caption %>"><%= tabs[i].caption %></a>
</li>
<% } %>
<div class="marker"></div>
</ul>
<a href="#" class="scroll right">
<i class="icon">&gt;</i>
</a>
</section>
<div class="extra right"></div>
</section>
<section class="box-controls">
<section class="panel static">
<div class="group no-mask">
<div class="elset">
<span class="btn-slot" id="slot-btn-print"></span>
</div>
<div class="elset">
<span class="btn-slot" id="slot-btn-save"></span>
</div>
</div>
</div>
</div>
</div>
<!---------------------->
<!--Fully view toolbar-->
<!---------------------->
<div id="id-toolbar-full" style="<%= isCompactView ? 'display: none;' : 'display: table;' %> width: 100%;" >
<div class="toolbar-group toolbar-group-native">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-newdocument"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-opendocument"></span>
</div>
</div>
<div class="separator long toolbar-group-native"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder large split" id="id-toolbar-full-placeholder-btn-addslide"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-changeslide"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-preview"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-print"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-save"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-copy"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-paste"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row" style="width:202px;">
<span class="btn-placeholder" style="float: left; width: 148px;" id="id-toolbar-full-placeholder-field-fontname"></span>
<span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-full-placeholder-field-fontsize"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bold"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-italic"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-underline"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-strikeout"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fontcolor"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-superscript"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-subscript"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-markers"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-numbering"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-decoffset"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-incoffset"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-halign"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-valign"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-linespace"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertimage"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertchart"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserttext"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertequation"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserttable"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertshape"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-arrange-shape"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-shape"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clearstyle"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-copystyle"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-colorschemas"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-slidesize"></span>
</div>
</div>
<div class="toolbar-group" id="id-toolbar-full-placeholder-field-styles" style="width: 100%; min-width: 140px;">
</div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidebars"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-settings"></span>
</div>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<div class="elset">
<span class="btn-slot split" id="slot-btn-copy"></span>
<span class="btn-slot" id="slot-btn-paste"></span>
</div>
<div class="elset">
<span class="btn-slot split" id="slot-btn-undo"></span>
<span class="btn-slot" id="slot-btn-redo"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-addslide"></span>
</div>
<div class="group" style="display:none;"></div>
</section>
<section class="box-panels">
<section class="panel" data-tab="home">
<div class="group">
<div class="elset">
<span class="btn-slot split" id="slot-btn-changeslide"></span>
</div>
<div class="elset">
<span class="btn-slot" id="slot-btn-preview"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge slot-inserttext"></span>
<span class="btn-slot text x-huge slot-insertimg"></span>
<span class="btn-slot text x-huge slot-insertshape"></span>
</div>
<div class="group">
<div class="elset">
<span class="btn-slot split" id="slot-btn-arrange-shape"></span>
</div>
<div class="elset">
<span class="btn-slot split" id="slot-btn-align-shape"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<div class="elset" style="width:202px;">
<span class="btn-slot" style="float: left; width: 148px;" id="slot-field-fontname"></span>
<span class="btn-slot" style="float: left; width: 45px; margin-left: 2px;" id="slot-field-fontsize"></span>
</div>
<div class="elset">
<span class="btn-slot split" id="slot-btn-bold"></span>
<span class="btn-slot split" id="slot-btn-italic"></span>
<span class="btn-slot split" id="slot-btn-underline"></span>
<span class="btn-slot split" id="slot-btn-strikeout"></span>
<span class="btn-slot split" id="slot-btn-fontcolor"></span>
<span class="btn-slot split" id="slot-btn-superscript"></span>
<span class="btn-slot" id="slot-btn-subscript"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<div class="elset">
<span class="btn-slot split" id="slot-btn-markers"></span>
<span class="btn-slot split" id="slot-btn-numbering"></span>
<span class="btn-slot split" id="slot-btn-decoffset"></span>
<span class="btn-slot split" id="slot-btn-incoffset"></span>
</div>
<div class="elset">
<span class="btn-slot split" id="slot-btn-halign"></span>
<span class="btn-slot split" id="slot-btn-valign"></span>
<span class="btn-slot split" id="slot-btn-linespace"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<div class="elset">
<span class="btn-slot" id="slot-btn-clearstyle"></span>
</div>
<div class="elset">
<span class="btn-slot" id="slot-btn-copystyle"></span>
</div>
</div>
<div class="group">
<div class="elset">
<span class="btn-slot split" id="slot-btn-colorschemas"></span>
</div>
<div class="elset">
<span class="btn-slot split" id="slot-btn-slidesize"></span>
</div>
</div>
<div class="group" id="slot-field-styles" style="width: 100%; min-width: 140px;">
</div>
<div class="group no-mask">
<div class="elset">
<span class="btn-slot split" id="slot-btn-hidebars"></span>
</div>
<div class="elset">
<span class="btn-slot" id="slot-btn-settings"></span>
</div>
</div>
</section>
<section class="panel" data-tab="ins">
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-inserttable"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge slot-inserttext"></span>
<span class="btn-slot text x-huge slot-insertimg"></span>
<span class="btn-slot text x-huge slot-insertshape"></span>
<span class="btn-slot text x-huge" id="slot-btn-insertchart"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge slot-comment"></span>
<span class="btn-slot text x-huge" id="slot-btn-insertlink"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-insertequation"></span>
</div>
</section>
</section>
</section>
</div>

View file

@ -1,12 +1,13 @@
<div class="layout-region">
<div id="pe-preview" style="position:absolute; left: 0; top: 0; display:none; width:100%; height:100%; z-index: 1;"></div>
<section class="layout-ct">
<div id="file-menu-panel" class="toolbar-fullview-panel" style="display:none;"></div>
</section>
<div id="viewport-vbox-layout" class="layout-ct vbox">
<div id="header" class="layout-item"></div>
<div id="toolbar" class="layout-item"></div>
<div class="layout-item">
<div class="layout-item middle">
<div id="viewport-hbox-layout" class="layout-ct hbox">
<div id="left-menu" class="layout-item" style="width: 40px;"></div>
<div id="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="editor_sdk" class="layout-item"></div>
<div id="right-menu" class="layout-item"></div>

View file

@ -49,6 +49,7 @@ define([
PE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({
el: '#file-menu-panel',
options: {alias:'FileMenu'},
template: _.template(tpl),
@ -195,13 +196,11 @@ define([
panel = this.active || ((this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info');
this.$el.show();
this.selectMenu(panel);
if (this.mode.isEdit) PE.getController('Toolbar').DisableToolbar(true);
this.api.asc_enableKeyEvents(false);
},
hide: function() {
this.$el.hide();
if (this.mode.isEdit) PE.getController('Toolbar').DisableToolbar(false);
this.fireEvent('filemenu:hide', [this]);
this.api.asc_enableKeyEvents(true);
},
@ -312,6 +311,10 @@ define([
this.panels['info'].updateInfo(this.document);
},
isVisible: function () {
return !this.$el.is(':hidden');
},
btnSaveCaption : 'Save',
btnDownloadCaption : 'Download as...',
btnInfoCaption : 'Document Info...',

View file

@ -90,15 +90,6 @@ define([
el.html(this.template({
}));
this.btnFile = new Common.UI.Button({
action: 'file',
el: $('#left-btn-file'),
hint: this.tipFile + Common.Utils.String.platformKey('Alt+F'),
enableToggle: true,
disabled: true,
toggleGroup: 'leftMenuGroup'
});
this.btnSearch = new Common.UI.Button({
action: 'search',
el: $('#left-btn-search'),
@ -169,13 +160,10 @@ define([
this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this));
this.btnThumbs.on('click', _.bind(this.onBtnMenuClick, this));
this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this));
this.btnFile.on('toggle', _.bind(this.onBtnMenuToggle, this));
this.btnAbout.on('click', _.bind(this.onFullMenuClick, this));
this.btnFile.on('click', _.bind(this.onFullMenuClick, this));
var menuFile = new PE.Views.FileMenu({});
menuFile.options = {alias:'FileMenu'};
this.btnFile.panel = menuFile.render();
this.menuFile = new PE.Views.FileMenu({});
this.menuFile.render();
this.btnAbout.panel = (new Common.Views.About({el: $('#about-menu-panel'), appName: 'Presentation Editor'})).render();
return this;
@ -196,12 +184,11 @@ define([
},
onBtnMenuClick: function(btn, e) {
var full_menu_pressed = (this.btnFile.pressed || this.btnAbout.pressed);
if (this.btnFile.pressed) this.btnFile.toggle(false);
var full_menu_pressed = this.btnAbout.pressed;
if (this.btnAbout.pressed) this.btnAbout.toggle(false);
if (btn.options.action == 'search') {
full_menu_pressed && this.fireEvent('panel:show', [this.btnFile, 'files', false]);
full_menu_pressed && this.fireEvent('panel:show', [this.btnAbout, 'files', false]);
return;
} else
if (btn.options.action == 'thumbs') {
@ -282,7 +269,6 @@ define([
/** coauthoring end **/
close: function(menu) {
this.btnFile.toggle(false);
this.btnAbout.toggle(false);
this.btnThumbs.toggle(false);
this.$el.width(SCALE_MIN);
@ -308,7 +294,7 @@ define([
},
isOpened: function() {
var isopened = this.btnFile.pressed || this.btnSearch.pressed;
var isopened = this.btnSearch.pressed;
/** coauthoring begin **/
!isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed);
/** coauthoring end **/
@ -316,7 +302,6 @@ define([
},
disableMenu: function(menu, disable) {
this.btnFile.setDisabled(disable);
this.btnSearch.setDisabled(disable);
this.btnThumbs.setDisabled(disable);
this.btnAbout.setDisabled(disable);
@ -330,12 +315,8 @@ define([
showMenu: function(menu) {
var re = /^(\w+):?(\w*)$/.exec(menu);
if (re[1] == 'file' && this.btnFile.isVisible()) {
if (!this.btnFile.pressed) {
this.btnFile.toggle(true);
// this.onBtnMenuClick(this.btnFile);
}
this.btnFile.panel.show(re[2].length ? re[2] : undefined);
if ( re[1] == 'file' ) {
this.menuFile.show(re[2].length ? re[2] : undefined);
} else {
/** coauthoring begin **/
if (menu == 'chat') {
@ -362,7 +343,7 @@ define([
getMenu: function(type) {
switch (type) {
default: return null;
case 'file': return this.btnFile.panel;
case 'file': return this.menuFile;
case 'about': return this.btnAbout.panel;
}
},
@ -398,7 +379,6 @@ define([
/** coauthoring end **/
tipAbout : 'About',
tipSupport : 'Feedback & Support',
tipFile : 'File',
tipSearch : 'Search',
tipSlides: 'Slides',
tipPlugins : 'Plugins',

View file

@ -70,22 +70,7 @@ define([
el: '#statusbar',
template: _.template(template),
storeUsers: undefined,
tplUser: ['<li id="status-chat-user-<%= user.get("id") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">',
'<div class="color" style="background-color: <%= user.get("color") %>;" >',
'<label class="name"><%= scope.getUserName(user.get("username")) %></label>',
'</div>',
'</li>'].join(''),
templateUserList: _.template('<ul>' +
'<% _.each(users, function(item) { %>' +
'<%= _.template(usertpl, {user: item, scope: scope}) %>' +
'<% }); %>' +
'</ul>'),
events: {
},
events: {},
api: undefined,
pages: undefined,
@ -164,39 +149,6 @@ define([
this.zoomMenu.render($('.cnt-zoom',this.el));
this.zoomMenu.cmpEl.attr({tabindex: -1});
/** coauthoring begin **/
this.panelUsersList = $('#status-users-list', this.el);
this.storeUsers.bind({
add : _.bind(this._onAddUser, this),
change : _.bind(this._onUsersChanged, this),
reset : _.bind(this._onResetUsers, this)
});
this.panelUsers = $('#status-users-ct', this.el);
this.panelUsers.on('shown.bs.dropdown', function () {
me.panelUsersList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
var tip = me.panelUsersBlock.data('bs.tooltip');
if (tip) tip.hide();
});
this.panelUsersBlock = this.panelUsers.find('#status-users-block');
this.panelUsersBlock.tooltip({
title: this.tipAccessRights,
html: true,
placement: 'top'
});
this.panelUsersBlock.on('click', _.bind(this.onUsersClick, this));
this.lblUserCount = this.panelUsers.find('#status-users-count');
this.lblChangeRights = this.panelUsers.find('#status-change-rights');
this.lblChangeRights.on('click', _.bind(this.onUsersClick, this));
this.$el.find('#status-users-menu').on('click', function() {
return false;
});
/** coauthoring end **/
this.txtGoToPage = new Common.UI.InputField({
el : $('#status-goto-page'),
allowBlank : true,
@ -280,11 +232,6 @@ define([
if (this.api) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
/** coauthoring begin **/
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onApiUsersChanged, this));
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onApiUsersChanged, this));
/** coauthoring end **/
}
return this;
@ -294,8 +241,6 @@ define([
setMode: function(mode) {
this.mode = mode;
this.$el.find('.el-edit')[this.mode.isEdit?'show':'hide']();
this.lblChangeRights[(!this.mode.isOffline && this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length)?'show':'hide']();
this.panelUsers[(!this.mode.isOffline && this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length)?'show':'hide']();
},
setVisible: function(visible) {
@ -304,69 +249,6 @@ define([
: this.hide();
},
/** coauthoring begin **/
onUsersClick: function() {
this.panelUsers.removeClass('open');
this.fireEvent('click:users', this);
},
onApiUsersChanged: function(users) {
var length = 0;
_.each(users, function(item){
if (!item.asc_getView())
length++;
});
this.panelUsers[(length>1 || this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length)?'show':'hide']();
this.lblUserCount.css({
'font-size': (length > 1 ? '11px' : '14px'),
'font-weight': (length > 1 ? 'bold' : 'normal'),
'margin-top': (length > 1 ? '0' : '-1px')
});
this.lblUserCount.text(length > 1 ? length : '+');
$('#status-users-icon').css('margin-bottom', length > 1 ? '0' : '2px');
var usertip = this.panelUsersBlock.data('bs.tooltip');
if (usertip) {
usertip.options.title = (length > 1) ? this.tipViewUsers : this.tipAccessRights;
usertip.setContent();
}
(length > 1) ? this.panelUsersBlock.attr('data-toggle', 'dropdown') : this.panelUsersBlock.removeAttr('data-toggle');
this.panelUsersBlock.toggleClass('dropdown-toggle', length > 1);
(length > 1) ? this.panelUsersBlock.off('click') : this.panelUsersBlock.on('click', _.bind(this.onUsersClick, this));
},
_onAddUser: function(m, c, opts) {
if (this.panelUsersList) {
this.panelUsersList.find('ul').append(_.template(this.tplUser, {user: m, scope: this}));
this.panelUsersList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
}
},
_onUsersChanged: function(m) {
if (m.changed.online != undefined && this.panelUsersList) {
this.panelUsersList.find('#status-chat-user-'+ m.get('id'))[m.changed.online?'removeClass':'addClass']('offline');
this.panelUsersList.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true});
}
},
_onResetUsers: function(c, opts) {
if (this.panelUsersList) {
this.panelUsersList.html(this.templateUserList({users: c.models, usertpl: this.tplUser, scope: this}));
this.panelUsersList.scroller = new Common.UI.Scroller({
el : $('#status-users-list ul'),
useKeyboard : true,
minScrollbarLength : 40,
alwaysVisibleY: true
});
}
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(username);
},
/** coauthoring end **/
showStatusMessage: function(message) {
$('#status-label-action').text(message);
},
@ -377,9 +259,6 @@ define([
pageIndexText : 'Slide {0} of {1}',
goToPageText : 'Go to Slide',
tipUsers : 'Document is currently being edited by several users.',
tipMoreUsers : 'and %1 users.',
tipShowUsers : 'To see all users click the icon below.',
tipFitPage : 'Fit to Slide',
tipFitWidth : 'Fit to Width',
tipZoomIn : 'Zoom In',
@ -387,9 +266,7 @@ define([
tipZoomFactor : 'Magnification',
txtPageNumInvalid: 'Slide number invalid',
tipPreview : 'Start Slideshow',
tipAccessRights : 'Manage document access rights',
tipViewUsers : 'View users and manage document access rights',
txAccessRights : 'Change access rights'
tipAccessRights : 'Manage document access rights'
}, PE.Views.Statusbar || {}));
}
);

File diff suppressed because it is too large Load diff

View file

@ -87,15 +87,12 @@ define([
box: $container,
items: [{
el: items[0],
rely: true
height: Common.localStorage.getBool('pe-compact-toolbar') ? 40 : 40+67
}, {
el: items[1],
rely: true
}, {
el: items[2],
stretch: true
}, {
el: items[3],
el: items[2],
height: 25
}]
});
@ -126,17 +123,10 @@ define([
},
applyEditorMode: function() {
var me = this,
toolbarView = PE.getController('Toolbar').getView('Toolbar'),
rightMenuView = PE.getController('RightMenu').getView('RightMenu'),
statusBarView = PE.getController('Statusbar').getView('Statusbar');
PE.getController('RightMenu').getView('RightMenu').render();
me._toolbar = toolbarView.render(this.mode);
me._rightMenu = rightMenuView.render();
var value = Common.localStorage.getItem('pe-hidden-status');
if (value !== null && parseInt(value) == 1)
statusBarView.setVisible(false);
if ( Common.localStorage.getBool('pe-hidden-status') )
PE.getController('Statusbar').getView('Statusbar').setVisible(false);
},
setMode: function(mode, delay) {

View file

@ -78,10 +78,22 @@
"Common.Views.ExternalDiagramEditor.textClose": "Close",
"Common.Views.ExternalDiagramEditor.textSave": "Save & Exit",
"Common.Views.ExternalDiagramEditor.textTitle": "Chart Editor",
"Common.Views.Header.openNewTabText": "Open in New Tab",
"Common.Views.Header.textBack": "Go to Documents",
"del_Common.Views.Header.openNewTabText": "Open in New Tab",
"del_Common.Views.Header.textBack": "Go to Documents",
"del_Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE",
"del_Common.Views.Header.txtRename": "Rename",
"Common.Views.Header.itemBackNewTab": "Open in New Tab",
"Common.Views.Header.itemBackCurrTab": "Open in Current Tab",
"Common.Views.Header.textSaveBegin": "Saving...",
"Common.Views.Header.textSaveEnd": "All changes saved",
"Common.Views.Header.textSaveChanged": "Modified",
"Common.Views.Header.textSaveExpander": "All changes saved",
"Common.Views.Header.textBack": "Go to Documents",
"Common.Views.Header.txtHeaderDeveloper": "DEVELOPER MODE",
"Common.Views.Header.txtRename": "Rename",
"Common.Views.Header.txtAccessRights": "Change access rights",
"Common.Views.Header.tipAccessRights": "Manage document access rights",
"Common.Views.Header.labelCoUsersDescr": "Document is currently being edited by several users.",
"Common.Views.ImageFromUrlDialog.cancelButtonText": "Cancel",
"Common.Views.ImageFromUrlDialog.okButtonText": "OK",
"Common.Views.ImageFromUrlDialog.textUrl": "Paste an image URL:",
@ -166,8 +178,8 @@
"PE.Controllers.Main.saveErrorText": "An error has occurred while saving the file",
"PE.Controllers.Main.savePreparingText": "Preparing to save",
"PE.Controllers.Main.savePreparingTitle": "Preparing to save. Please wait...",
"PE.Controllers.Main.saveTextText": "Saving presentation...",
"PE.Controllers.Main.saveTitleText": "Saving Presentation",
"del_PE.Controllers.Main.saveTextText": "Saving presentation...",
"del_PE.Controllers.Main.saveTitleText": "Saving Presentation",
"PE.Controllers.Main.splitDividerErrorText": "The number of rows must be a divisor of %1.",
"PE.Controllers.Main.splitMaxColsErrorText": "The number of columns must be less than %1.",
"PE.Controllers.Main.splitMaxRowsErrorText": "The number of rows must be less than %1.",
@ -247,7 +259,7 @@
"PE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"PE.Controllers.Main.titleServerVersion": "Editor updated",
"PE.Controllers.Main.errorServerVersion": "The editor version has been updated. The page will be reloaded to apply the changes.",
"PE.Controllers.Main.textChangesSaved": "All changes saved",
"del_PE.Controllers.Main.textChangesSaved": "All changes saved",
"PE.Controllers.Main.errorBadImageUrl": "Image URL is incorrect",
"PE.Controllers.Statusbar.zoomText": "Zoom {0}%",
"PE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",
@ -870,7 +882,7 @@
"PE.Views.LeftMenu.tipAbout": "About",
"PE.Views.LeftMenu.tipChat": "Chat",
"PE.Views.LeftMenu.tipComments": "Comments",
"PE.Views.LeftMenu.tipFile": "File",
"del_PE.Views.LeftMenu.tipFile": "File",
"PE.Views.LeftMenu.tipPlugins": "Plugins",
"PE.Views.LeftMenu.tipSearch": "Search",
"PE.Views.LeftMenu.tipSlides": "Slides",
@ -1097,15 +1109,15 @@
"PE.Views.Statusbar.tipAccessRights": "Manage document access rights",
"PE.Views.Statusbar.tipFitPage": "Fit to Slide",
"PE.Views.Statusbar.tipFitWidth": "Fit to Width",
"PE.Views.Statusbar.tipMoreUsers": "and %1 users.",
"del_PE.Views.Statusbar.tipMoreUsers": "and %1 users.",
"PE.Views.Statusbar.tipPreview": "Start Slideshow",
"PE.Views.Statusbar.tipShowUsers": "To see all users click the icon below.",
"PE.Views.Statusbar.tipUsers": "Document is currently being edited by several users.",
"PE.Views.Statusbar.tipViewUsers": "View users and manage document access rights",
"del_PE.Views.Statusbar.tipShowUsers": "To see all users click the icon below.",
"del_PE.Views.Statusbar.tipUsers": "Document is currently being edited by several users.",
"del_PE.Views.Statusbar.tipViewUsers": "View users and manage document access rights",
"PE.Views.Statusbar.tipZoomFactor": "Magnification",
"PE.Views.Statusbar.tipZoomIn": "Zoom In",
"PE.Views.Statusbar.tipZoomOut": "Zoom Out",
"PE.Views.Statusbar.txAccessRights": "Change access rights",
"del_PE.Views.Statusbar.txAccessRights": "Change access rights",
"PE.Views.Statusbar.txtPageNumInvalid": "Invalid slide number",
"PE.Views.TableSettings.deleteColumnText": "Delete Column",
"PE.Views.TableSettings.deleteRowText": "Delete Row",
@ -1258,6 +1270,17 @@
"PE.Views.Toolbar.textTitleError": "Error",
"PE.Views.Toolbar.textUnderline": "Underline",
"PE.Views.Toolbar.textZoom": "Zoom",
"PE.Views.Toolbar.capInsertText": "Text Box",
"PE.Views.Toolbar.capInsertImage": "Picture",
"PE.Views.Toolbar.capInsertShape": "Shape",
"PE.Views.Toolbar.capInsertTable": "Table",
"PE.Views.Toolbar.capInsertChart": "Chart",
"PE.Views.Toolbar.capInsertHyperlink": "Hyperlink",
"PE.Views.Toolbar.capInsertEquation": "Equation",
"PE.Views.Toolbar.capAddSlide": "Add Slide",
"PE.Views.Toolbar.capTabFile": "File",
"PE.Views.Toolbar.capTabHome": "Home",
"PE.Views.Toolbar.capTabInsert": "Insert",
"PE.Views.Toolbar.tipAddSlide": "Add Slide",
"PE.Views.Toolbar.tipAdvSettings": "Advanced Settings",
"PE.Views.Toolbar.tipBack": "Back",
@ -1283,9 +1306,9 @@
"PE.Views.Toolbar.tipInsertText": "Insert Text",
"PE.Views.Toolbar.tipLineSpace": "Line Spacing",
"PE.Views.Toolbar.tipMarkers": "Bullets",
"PE.Views.Toolbar.tipNewDocument": "New Presentation",
"del_PE.Views.Toolbar.tipNewDocument": "New Presentation",
"PE.Views.Toolbar.tipNumbers": "Numbering",
"PE.Views.Toolbar.tipOpenDocument": "Open Presentation",
"del_PE.Views.Toolbar.tipOpenDocument": "Open Presentation",
"PE.Views.Toolbar.tipPaste": "Paste",
"PE.Views.Toolbar.tipPreview": "Start Slideshow",
"PE.Views.Toolbar.tipPrint": "Print",

View file

@ -111,6 +111,7 @@
@import "../../../../common/main/resources/less/common.less";
@import "../../../../common/main/resources/less/opendialog.less";
@import "../../../../common/main/resources/less/plugins.less";
@import "../../../../common/main/resources/less/toolbar.less";
// App
// --------------------------------------------------

View file

@ -1,72 +1,6 @@
.toolbar {
padding: 10px 0;
background-color: @gray-light;
.box-inner-shadow(0 -1px 0 @gray-dark);
.toolbar-group {
display: table-cell;
vertical-align: top;
white-space: nowrap;
padding-left: 12px;
&:last-child {
padding-right: 12px;
}
}
.toolbar-row {
height: 20px;
font-size: 0;
&:not(:first-child) {
margin-top: 6px;
}
}
.separator {
margin-left: 12px;
&.long {
height: 46px;
}
&.short {
height: 20px;
}
}
.btn-placeholder {
// background-color: red;
display: inline-block;
width: 20px;
height: 20px;
&:not(:first-child) {
margin-left: 1px;
}
&.large {
width: 31px;
height: 31px;
margin: 8px 0;
&.split {
width: 40px;
}
}
&.split {
width: 28px;
}
&.border {
border: 1px solid @gray;
.border-radius(1px);
width: 22px;
height: 22px;
}
}
z-index: 101;
&.masked {
.btn-toolbar.disabled .btn-icon:not(.btn-print):not(.btn-save):not(.btn-save-coauth):not(.btn-settings):not(.btn-hidebars) {
@ -323,7 +257,10 @@
.toolbar-btn-icon(btn-linespace, 36, @toolbar-icon-size);
.toolbar-btn-icon(btn-arrange-shape, 37, @toolbar-icon-size);
.toolbar-btn-icon(btn-align-shape, 38, @toolbar-icon-size);
.toolbar-btn-icon(btn-insertshape, 39, @toolbar-icon-size);
//.toolbar-btn-icon(btn-insertshape, 39, @toolbar-icon-size);
.button-normal-icon(btn-insertshape, 39, @toolbar-icon-size);
.toolbar-btn-icon(btn-inserttext, 40, @toolbar-icon-size);
.toolbar-btn-icon(btn-inserthyperlink, 41, @toolbar-icon-size);
.toolbar-btn-icon(btn-inserttable, 42, @toolbar-icon-size);
@ -338,6 +275,8 @@
.toolbar-btn-icon(btn-save-coauth, 69, @toolbar-icon-size);
.toolbar-btn-icon(btn-insertequation, 74, @toolbar-icon-size);
.button-otherstates-icon2(btn-toolbar, @toolbar-icon-size);
// add slide
.btn-toolbar .btn-addslide {background-position: 0 -120px;}
.btn-toolbar.active > .btn-addslide,
@ -383,7 +322,7 @@
border: none;
border-radius: 0;
padding: 3px 10px;
color: #ffffff;
color: #fff;
font: 11px arial;
white-space: nowrap;
letter-spacing: 1px;
@ -392,4 +331,4 @@
.item-equation {
border: 1px solid @gray;
.background-ximage('@{app-image-path}/toolbar/math.png', '@{app-image-path}/toolbar/math@2x.png', 1500px);
}
}