Merge remote-tracking branch 'remotes/origin/develop' into feature/word-formulas

This commit is contained in:
SergeyLuzyanin 2018-11-23 11:35:26 +03:00
commit 9d4f6905aa
23 changed files with 183 additions and 114 deletions

View file

@ -8,6 +8,8 @@
* Add customization parameter 'hideRightMenu' for hiding right panel on first loading (bug #39096)
### Document Editor
* Search selected text
* Add blank page
### Spreadsheet Editor
* Set print area

View file

@ -52,6 +52,7 @@ define([
Common.Collections.Comments = Backbone.Collection.extend({
model: Common.Models.Comment,
groups: null,
clearEditing: function () {
this.each(function(comment) {

View file

@ -132,7 +132,8 @@ define([
};
ButtonsArray.prototype.setDisabled = function(disable) {
if ( _disabled != disable ) {
// if ( _disabled != disable ) //bug when disable buttons outside the group
{
_disabled = disable;
this.forEach( function(button) {

View file

@ -88,7 +88,7 @@ define([
var _template_tabs =
'<section class="tabs">' +
'<a class="scroll left"><i class="icon">&lt;</i></a>' +
'<a class="scroll left"></a>' +
'<ul>' +
'<% for(var i in items) { %>' +
'<li class="ribtab' +
@ -98,7 +98,7 @@ define([
'</li>' +
'<% } %>' +
'</ul>' +
'<a class="scroll right"><i class="icon">&gt;</i></a>' +
'<a class="scroll right"></a>' +
'</section>';
this.$layout = $(options.template({

View file

@ -150,6 +150,8 @@ define([
this.popoverComments.comparator = function (collection) { return collection.get('time'); };
}
this.groupCollection = [];
this.view = this.createView('Common.Views.Comments', { store: this.collection });
this.view.render();
@ -229,12 +231,12 @@ define([
this.api.asc_removeComment(id);
}
},
onResolveComment: function (uid, id) {
onResolveComment: function (uid) {
var t = this,
reply = null,
addReply = null,
ascComment = buildCommentData(), // new asc_CCommentData(null),
comment = t.findComment(uid, id);
comment = t.findComment(uid);
if (_.isUndefined(uid)) {
uid = comment.get('uid');
@ -279,7 +281,7 @@ define([
onShowComment: function (id, selected) {
if (this.previewmode) return;
var comment = this.findComment(id, undefined);
var comment = this.findComment(id);
if (comment) {
if (null !== comment.get('quote')) {
if (this.api) {
@ -596,47 +598,40 @@ define([
if (filter) {
if (!this.view.isVisible()) {
this.view.needUpdateFilter = filter;
this.filter = {
property : filter.property,
value : filter.value
};
return;
applyOnly = true;
}
this.view.needUpdateFilter = false;
this.filter = filter;
this.filter = {
property : filter.property,
value : filter.value
};
var me = this,
comments = [];
this.filter.forEach(function(item){
if (!me.groupCollection[item])
me.groupCollection[item] = new Backbone.Collection([], { model: Common.Models.Comment});
comments = comments.concat(me.groupCollection[item].models);
});
this.collection.reset(comments);
this.collection.groups = this.filter;
if (!applyOnly) {
if (this.getPopover()) {
this.getPopover().hide();
}
}
this.view.needUpdateFilter = false;
var t = this, endComment = null;
this.collection.each(function (model) {
var prop = model.get(t.filter.property);
if (prop) {
model.set('hide', (null === prop.match(t.filter.value)), {silent: !!applyOnly});
var end = true;
for (var i = this.collection.length - 1; i >= 0; --i) {
if (end) {
this.collection.at(i).set('last', true, {silent: true});
} else {
if (this.collection.at(i).get('last')) {
this.collection.at(i).set('last', false, {silent: true});
}
}
end = false;
}
if (model.get('last')) {
model.set('last', false, {silent:!!applyOnly});
}
if (!model.get('hide')) {
endComment = model;
}
});
if (endComment) {
endComment.set('last', true, {silent: !!applyOnly});
}
if (!applyOnly)
this.view.render();
this.view.update();
}
}
},
onAppAddComment: function (sender, to_doc) {
@ -644,12 +639,23 @@ define([
this.addDummyComment();
},
addCommentToGroupCollection: function(comment) {
var groupname = comment.get('groupName');
if (!this.groupCollection[groupname])
this.groupCollection[groupname] = new Backbone.Collection([], { model: Common.Models.Comment});
this.groupCollection[groupname].push(comment);
},
// SDK
onApiAddComment: function (id, data) {
var comment = this.readSDKComment(id, data);
if (comment) {
this.collection.push(comment);
if (comment.get('groupName')) {
this.addCommentToGroupCollection(comment);
(_.indexOf(this.collection.groups, comment.get('groupName'))>-1) && this.collection.push(comment);
} else
this.collection.push(comment);
this.updateComments(true);
@ -668,12 +674,20 @@ define([
onApiAddComments: function (data) {
for (var i = 0; i < data.length; ++i) {
var comment = this.readSDKComment(data[i].asc_getId(), data[i]);
this.collection.push(comment);
comment.get('groupName') ? this.addCommentToGroupCollection(comment) : this.collection.push(comment);
}
this.updateComments(true);
},
onApiRemoveComment: function (id, silentUpdate) {
for (var name in this.groupCollection) {
var store = this.groupCollection[name],
model = store.findWhere({uid: id});
if (model) {
store.remove(model);
break;
}
}
if (this.collection.length) {
var model = this.collection.findWhere({uid: id});
if (model) {
@ -717,7 +731,7 @@ define([
replies = null,
repliesCount = 0,
dateReply = null,
comment = this.findComment(id);
comment = this.findComment(id) || this.findCommentInGroup(id);
if (comment) {
t = this;
@ -776,7 +790,7 @@ define([
}
},
onApiLockComment: function (id,userId) {
var cur = this.findComment(id),
var cur = this.findComment(id) || this.findCommentInGroup(id),
user = null;
if (cur) {
@ -792,7 +806,7 @@ define([
}
},
onApiUnLockComment: function (id) {
var cur = this.findComment(id);
var cur = this.findComment(id) || this.findCommentInGroup(id);
if (cur) {
cur.set('lock', false);
this.getPopover() && this.getPopover().loadText();
@ -999,11 +1013,6 @@ define([
// internal
updateComments: function (needRender, disableSort) {
if (needRender && !this.view.isVisible()) {
this.view.needRender = needRender;
return;
}
var me = this;
me.updateCommentsTime = new Date();
if (me.timerUpdateComments===undefined)
@ -1017,6 +1026,12 @@ define([
},
updateCommentsView: function (needRender, disableSort) {
if (needRender && !this.view.isVisible()) {
this.view.needRender = needRender;
this.onUpdateFilter(this.filter, true);
return;
}
var i, end = true;
if (_.isUndefined(disableSort)) {
@ -1024,6 +1039,8 @@ define([
}
if (needRender) {
this.onUpdateFilter(this.filter, true);
for (i = this.collection.length - 1; i >= 0; --i) {
if (end) {
this.collection.at(i).set('last', true, {silent: true});
@ -1035,24 +1052,25 @@ define([
end = false;
}
this.onUpdateFilter(this.filter, true);
this.view.render();
this.view.needRender = false;
}
this.view.update();
},
findComment: function (uid, id) {
if (_.isUndefined(uid)) {
return this.collection.findWhere({id: id});
}
findComment: function (uid) {
return this.collection.findWhere({uid: uid});
},
findPopupComment: function (id) {
return this.popoverComments.findWhere({id: id});
},
findCommentInGroup: function (id) {
for (var name in this.groupCollection) {
var store = this.groupCollection[name],
model = store.findWhere({uid: id});
if (model) return model;
}
},
closeEditing: function (id) {
var t = this;
@ -1117,8 +1135,21 @@ define([
// helpers
onUpdateUsers: function() {
var users = this.userCollection;
this.collection.each(function (model) {
var users = this.userCollection,
hasGroup = false;
for (var name in this.groupCollection) {
hasGroup = true;
this.groupCollection[name].each(function (model) {
var user = users.findOriginalUser(model.get('userid'));
model.set('usercolor', (user) ? user.get('color') : null, {silent: true});
model.get('replys').forEach(function (reply) {
user = users.findOriginalUser(reply.get('userid'));
reply.set('usercolor', (user) ? user.get('color') : null, {silent: true});
});
});
}
!hasGroup && this.collection.each(function (model) {
var user = users.findOriginalUser(model.get('userid'));
model.set('usercolor', (user) ? user.get('color') : null, {silent: true});
@ -1135,7 +1166,8 @@ define([
readSDKComment: function (id, data) {
var date = (data.asc_getOnlyOfficeTime()) ? new Date(this.stringOOToLocalDate(data.asc_getOnlyOfficeTime())) :
((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())));
var user = this.userCollection.findOriginalUser(data.asc_getUserId());
var user = this.userCollection.findOriginalUser(data.asc_getUserId()),
groupname = id.match(/^(doc|sheet[0-9]+)_/);
var comment = new Common.Models.Comment({
uid : id,
userid : data.asc_getUserId(),
@ -1155,7 +1187,8 @@ define([
showReplyInPopover : false,
hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false),
scope : this.view,
editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)
editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId),
groupName : (groupname && groupname.length>1) ? groupname[1] : null
});
if (comment) {
var replies = this.readSDKReplies(data);

View file

@ -87,10 +87,10 @@
'<div class="box">',
'<div class="input-row">',
'<span class="btn-placeholder" id="search-placeholder-btn-options"></span>',
'<input type="text" id="sd-text-search" class="form-control" maxlength="100" placeholder="'+this.textSearchStart+'">',
'<input type="text" id="sd-text-search" class="form-control" maxlength="255" placeholder="'+this.textSearchStart+'">',
'</div>',
'<div class="input-row">',
'<input type="text" id="sd-text-replace" class="form-control" maxlength="100" placeholder="'+this.textReplaceDef+'">',
'<input type="text" id="sd-text-replace" class="form-control" maxlength="255" placeholder="'+this.textReplaceDef+'">',
'</div>',
'<div class="input-row">',
'<label class="link" id="search-label-replace" result="replaceshow">'+this.txtBtnReplace+'</label>',
@ -176,12 +176,14 @@
return this;
},
show: function(mode) {
show: function(mode, text) {
Common.UI.Window.prototype.show.call(this);
!this.mode && !mode && (mode = 'search');
if (mode && this.mode != mode) this.setMode(mode);
text && this.setSearchText(text);
if (this.options.markresult && this.miHighlight.checked) {
this.fireEvent('search:highlight', [this, true]);
}
@ -271,6 +273,10 @@
}
},
setSearchText: function(value) {
this.txtSearch && this.txtSearch.val(value);
},
onShowReplace: function(e) {
this.setMode((this.mode=='replace') ? 'search' : 'replace');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

@ -108,20 +108,46 @@
.scroll {
line-height: @height-tabs;
min-width: 20px;
text-align: center;
z-index: 1;
cursor: pointer;
color: #fff;
position: relative;
display: flex;
align-items: center;
&:hover {
text-decoration: none;
}
&:not(:hover) {
&:after {
opacity: .8;
}
}
&.left{
box-shadow: 5px 0 20px 5px @tabs-bg-color
box-shadow: 5px 0 20px 5px @tabs-bg-color;
&:after {
transform: rotate(135deg);
margin-left: 8px;
}
}
&.right{
box-shadow: -5px 0 20px 5px @tabs-bg-color
box-shadow: -5px 0 20px 5px @tabs-bg-color;
&:after {
transform: rotate(-45deg);
margin-left: 4px;
}
}
@arrow-length: 8px;
&:after {
content: ' ';
width: @arrow-length;
height: @arrow-length;
border: solid white;
border-width: 0 2px 2px 0;
}
}
}
@ -323,4 +349,5 @@
.button-normal-icon(btn-controls, 54, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-select-pivot', 55, @toolbar-big-icon-size);
.button-normal-icon(~'x-huge .btn-bookmarks', 56, @toolbar-big-icon-size);
.button-normal-icon(btn-print-area, 56, @toolbar-big-icon-size);
.button-normal-icon(btn-blankpage, 57, @toolbar-big-icon-size);
.button-normal-icon(btn-print-area, 58, @toolbar-big-icon-size);

View file

@ -535,9 +535,10 @@ define([
var mode = this.mode.isEdit ? (action || undefined) : 'no-replace';
if (this.dlgSearch.isVisible()) {
this.dlgSearch.setMode(mode);
this.dlgSearch.setSearchText(this.api.asc_GetSelectedText());
this.dlgSearch.focus();
} else {
this.dlgSearch.show(mode);
this.dlgSearch.show(mode, this.api.asc_GetSelectedText());
}
} else this.dlgSearch['hide']();
},

View file

@ -312,6 +312,7 @@ define([
toolbar.btnEditHeader.menu.on('item:click', _.bind(this.onEditHeaderFooterClick, this));
toolbar.mnuPageNumCurrentPos.on('click', _.bind(this.onPageNumCurrentPosClick, this));
toolbar.mnuInsertPageCount.on('click', _.bind(this.onInsertPageCountClick, this));
toolbar.btnBlankPage.on('click', _.bind(this.onBtnBlankPageClick, this));
toolbar.listStyles.on('click', _.bind(this.onListStyleSelect, this));
toolbar.listStyles.on('contextmenu', _.bind(this.onListStyleContextMenu, this));
toolbar.styleMenu.on('hide:before', _.bind(this.onListStyleBeforeHide, this));
@ -746,6 +747,7 @@ define([
var in_footnote = this.api.asc_IsCursorInFootnote();
need_disable = paragraph_locked || header_locked || in_header || in_image || in_equation && !btn_eq_state || in_footnote || in_control;
toolbar.btnsPageBreak.setDisabled(need_disable);
toolbar.btnBlankPage.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_equation || control_plain;
toolbar.btnInsertShape.setDisabled(need_disable);
@ -1856,6 +1858,14 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Page Number');
},
onBtnBlankPageClick: function(btn) {
if (this.api)
this.api.asc_AddBlankPage();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Blank Page');
},
onListStyleSelect: function(combo, record) {
this._state.prstyle = undefined;
if (this.api)

View file

@ -81,6 +81,7 @@
</section>
<section class="panel" data-tab="ins">
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-blankpage"></span>
<span class="btn-slot text x-huge btn-pagebreak"></span>
<span class="btn-slot text x-huge" id="slot-btn-editheader"></span>
</div>

View file

@ -560,6 +560,14 @@ define([
this.paragraphControls.push(this.mnuInsertPageCount);
this.toolbarControls.push(this.btnEditHeader);
this.btnBlankPage = new Common.UI.Button({
id: 'id-toolbar-btn-blankpage',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'btn-blankpage',
caption: me.capBtnBlankPage
});
this.paragraphControls.push(this.btnBlankPage);
this.btnInsertShape = new Common.UI.Button({
id: 'tlbtn-insertshape',
cls: 'btn-toolbar x-huge icon-top',
@ -1295,6 +1303,7 @@ define([
_injectComponent('#slot-btn-controls', this.btnContentControls);
_injectComponent('#slot-btn-columns', this.btnColumns);
_injectComponent('#slot-btn-editheader', this.btnEditHeader);
_injectComponent('#slot-btn-blankpage', this.btnBlankPage);
_injectComponent('#slot-btn-insshape', this.btnInsertShape);
_injectComponent('#slot-btn-insequation', this.btnInsertEquation);
_injectComponent('#slot-btn-pageorient', this.btnPageOrient);
@ -1538,6 +1547,7 @@ define([
this.btnInsertText.updateHint(this.tipInsertText);
this.btnInsertTextArt.updateHint(this.tipInsertTextArt);
this.btnEditHeader.updateHint(this.tipEditHeader);
this.btnBlankPage.updateHint(this.tipBlankPage);
this.btnInsertShape.updateHint(this.tipInsertShape);
this.btnInsertEquation.updateHint(this.tipInsertEquation);
this.btnDropCap.updateHint(this.tipDropCap);
@ -2372,7 +2382,9 @@ define([
tipControls: 'Insert content control',
mniHighlightControls: 'Highlight settings',
textNoHighlight: 'No highlighting',
mniImageFromStorage: 'Image from Storage'
mniImageFromStorage: 'Image from Storage',
capBtnBlankPage: 'Blank Page',
tipBlankPage: 'Insert blank page'
}
})(), DE.Views.Toolbar || {}));
});

View file

@ -1976,5 +1976,7 @@
"DE.Views.Toolbar.txtScheme7": "Equity",
"DE.Views.Toolbar.txtScheme8": "Flow",
"DE.Views.Toolbar.txtScheme9": "Foundry",
"DE.Views.Toolbar.capBtnBlankPage": "Blank Page",
"DE.Views.Toolbar.tipBlankPage": "Insert blank page",
"DE.Views.Toolbar.mniImageFromStorage": "Image from Storage"
}

View file

@ -108,6 +108,7 @@ require([
docInfo.put_Options(data.options);
docInfo.put_Token(data.token);
docInfo.put_Permissions( data.permissions);
window.document.title = 'Presenter View' + (data.title ? (' - ' + data.title) : '');
}
api.preloadReporter(data);

View file

@ -109,6 +109,7 @@ require([
docInfo.put_Options(data.options);
docInfo.put_Token(data.token);
docInfo.put_Permissions( data.permissions);
window.document.title = 'Presenter View' + (data.title ? (' - ' + data.title) : '');
}
api.preloadReporter(data);

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html style="width:100%; height:100%;overflow: hidden;">
<head>
<title>ONLYOFFICE Presentation Editor</title>
<title>Presenter View</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="description" content="" />

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html style="width:100%; height:100%;overflow: hidden;">
<head>
<title>ONLYOFFICE Presentation Editor</title>
<title>Presenter View</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
<meta name="description" content="" />

View file

@ -151,11 +151,14 @@ define([
if (this.mode.canComments) {
this.api.asc_registerCallback('asc_onAddComment', _.bind(this.onApiAddComment, this));
this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this));
var collection = this.getApplication().getCollection('Common.Collections.Comments');
for (var i = 0; i < collection.length; ++i) {
if (collection.at(i).get('userid') !== this.mode.user.id) {
this.leftMenu.markCoauthOptions('comments', true);
break;
var comments = this.getApplication().getController('Common.Controllers.Comments').groupCollection;
for (var name in comments) {
var collection = comments[name];
for (var i = 0; i < collection.length; ++i) {
if (collection.at(i).get('userid') !== this.mode.user.id) {
this.leftMenu.markCoauthOptions('comments', true);
break;
}
}
}
}

View file

@ -718,9 +718,7 @@ define([
if (window.styles_loaded || me.appOptions.isEditDiagram || me.appOptions.isEditMailMerge) {
clearInterval(timer_sl);
Common.NotificationCenter.trigger('comments:updatefilter',
{property: 'uid',
value: new RegExp('^(doc_|sheet' + me.api.asc_getActiveWorksheetId() + '_)')});
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + me.api.asc_getActiveWorksheetId()]);
documentHolderView.createDelayedElements();
toolbarController.createDelayedElements();
@ -1619,14 +1617,8 @@ define([
if (!this.appOptions.isEditMailMerge && !this.appOptions.isEditDiagram && window.editor_elements_prepared) {
this.application.getController('Statusbar').selectTab(index);
if (this.appOptions.isEdit && !this.dontCloseDummyComment) {
Common.NotificationCenter.trigger('comments:updatefilter',
{
property: 'uid',
value: new RegExp('^(doc_|sheet' + this.api.asc_getWorksheetId(index) + '_)')
},
false // hide popover
);
if (this.appOptions.canComments && !this.dontCloseDummyComment) {
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getWorksheetId(index)], false ); // hide popover
}
}
},

View file

@ -384,9 +384,7 @@ define([
if (!_.isUndefined(silent)) {
me.api.asc_showWorksheet(items[index].inindex);
Common.NotificationCenter.trigger('comments:updatefilter',
{property: 'uid',
value: new RegExp('^(doc_|sheet' + this.api.asc_getActiveWorksheetId() + '_)')});
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()]);
if (!_.isUndefined(destPos)) {
me.api.asc_moveWorksheet(items.length === destPos ? wc : items[destPos].inindex);
@ -418,12 +416,7 @@ define([
this.api.asc_closeCellEditor();
this.api.asc_addWorksheet(this.createSheetName());
Common.NotificationCenter.trigger('comments:updatefilter',
{property: 'uid',
value: new RegExp('^(doc_|sheet' + this.api.asc_getActiveWorksheetId() + '_)')
},
false // hide popover
);
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover
}
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
},

View file

@ -2825,17 +2825,6 @@ define([
// });
},
onSheetChanged: function() {
if (this.api) {
var params = this.api.asc_getSheetViewSettings();
var menu = this.getMenuHideOptions();
if (menu) {
menu.items.getAt(3).setChecked(!params.asc_getShowRowColHeaders());
menu.items.getAt(4).setChecked(!params.asc_getShowGridLines());
}
}
},
_disableEditOptions: function(seltype, coauth_disable) {
if (this.api.isCellEdited) return true;
if (this.api.isRangeSelection) return true;

View file

@ -358,7 +358,7 @@ define([
me.fireEvent('sheet:changed', [me, sindex]);
me.fireEvent('sheet:updateColors', [true]);
Common.NotificationCenter.trigger('comments:updatefilter', {property: 'uid', value: new RegExp('^(doc_|sheet' + me.api.asc_getActiveWorksheetId() + '_)')}, false);
Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + me.api.asc_getActiveWorksheetId()], false);
}
},
@ -409,13 +409,7 @@ define([
this.fireEvent('sheet:changed', [this, tab.sheetindex]);
this.fireEvent('sheet:updateColors', [true]);
Common.NotificationCenter.trigger('comments:updatefilter',
{
property: 'uid',
value: new RegExp('^(doc_|sheet' + this.api.asc_getActiveWorksheetId() + '_)')
},
false // hide popover
);
// Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover
},
onTabMenu: function (o, index, tab) {