Merge pull request #260 from ONLYOFFICE/feature/compatible-features

Feature/compatible features
This commit is contained in:
Julia Radzhabova 2019-11-01 13:05:57 +03:00 committed by GitHub
commit ac1ed98c99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 8 deletions

View file

@ -129,7 +129,8 @@
toolbarNoTabs: false,
toolbarHideFileName: false,
reviewDisplay: 'original',
spellcheck: true
spellcheck: true,
compatibleFeatures: false
},
plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],

View file

@ -559,9 +559,13 @@ define([
add = $('.new-comment-ct', this.el),
to = $('.add-link-ct', this.el),
msgs = $('.messages-ct', this.el);
msgs.toggleClass('stretch', !mode.canComments);
if (!mode.canComments) {
add.hide(); to.hide();
msgs.toggleClass('stretch', !mode.canComments || mode.compatibleFeatures);
if (!mode.canComments || mode.compatibleFeatures) {
if (mode.compatibleFeatures) {
add.remove(); to.remove();
} else {
add.hide(); to.hide();
}
this.layout.changeLayout([{el: msgs[0], rely: false, stretch: true}]);
} else {
var container = $('#comments-box', this.el),

View file

@ -352,6 +352,7 @@ define([
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.canRequestMailMergeRecipients = this.editorConfig.canRequestMailMergeRecipients;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -653,7 +653,8 @@ define([
var i = -1, type,
paragraph_locked = false,
header_locked = false,
image_locked = false;
image_locked = false,
in_image = false;
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
@ -663,11 +664,15 @@ define([
} else if (type === Asc.c_oAscTypeSelectElement.Header) {
header_locked = selectedObjects[i].get_ObjectValue().get_Locked();
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
in_image = true;
image_locked = selectedObjects[i].get_ObjectValue().get_Locked();
}
}
var need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked;
if (this.mode.compatibleFeatures) {
need_disable = need_disable || in_image;
}
if ( this.btnsComment && this.btnsComment.length > 0 )
this.btnsComment.setDisabled(need_disable);
},
@ -829,6 +834,9 @@ define([
toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined);
need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked;
if (this.mode.compatibleFeatures) {
need_disable = need_disable || in_image;
}
if ( this.btnsComment && this.btnsComment.length > 0 )
this.btnsComment.setDisabled(need_disable);

View file

@ -1995,10 +1995,13 @@ define([
this.viewModeMenu = new Common.UI.Menu({
initMenu: function (value) {
var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties())),
isInShape = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ShapeProperties())),
signGuid = (value.imgProps && value.imgProps.value && me.mode.isSignatureSupport) ? value.imgProps.value.asc_getSignatureId() : undefined,
signProps = (signGuid) ? me.api.asc_getSignatureSetup(signGuid) : null,
isInSign = !!signProps && me._canProtect,
canComment = !isInChart && me.api.can_AddQuotedComment() !== false && me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled;
if (me.mode.compatibleFeatures)
canComment = canComment && !isInShape;
menuViewUndo.setVisible(me.mode.canCoAuthoring && me.mode.canComments && !me._isDisabled);
menuViewUndo.setDisabled(!me.api.asc_getCanUndo() && !me._isDisabled);
@ -3625,8 +3628,11 @@ define([
text = me.api.can_AddHyperlink();
}
/** coauthoring begin **/
menuCommentSeparatorPara.setVisible(!isInChart && me.api.can_AddQuotedComment()!==false && me.mode.canCoAuthoring && me.mode.canComments);
menuAddCommentPara.setVisible(!isInChart && me.api.can_AddQuotedComment()!==false && me.mode.canCoAuthoring && me.mode.canComments);
var isVisible = !isInChart && me.api.can_AddQuotedComment()!==false && me.mode.canCoAuthoring && me.mode.canComments;
if (me.mode.compatibleFeatures)
isVisible = isVisible && !isInShape;
menuCommentSeparatorPara.setVisible(isVisible);
menuAddCommentPara.setVisible(isVisible);
menuAddCommentPara.setDisabled(value.paraProps && value.paraProps.locked === true);
/** coauthoring end **/

View file

@ -319,6 +319,7 @@ define([
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header');
appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -335,6 +335,7 @@ define([
this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify;
this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs;
this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage;
this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures;
this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')

View file

@ -2420,7 +2420,8 @@ define([
toolbar.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down);
}
toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()),
toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.toolbar.mode.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment });
toolbar.lockToolbar(SSE.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader});