Merge pull request #919 from ONLYOFFICE/feature/release-fixes

Feature/release fixes
This commit is contained in:
maxkadushkin 2021-06-09 19:20:29 +03:00 committed by GitHub
commit a707da477c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 141 additions and 94 deletions

View file

@ -51,6 +51,7 @@ class CommentsController extends Component {
this.usersStore = this.props.users;
this.appOptions = this.props.storeAppOptions;
this.storeComments = this.props.storeComments;
this.storeApplicationSettings = this.props.storeApplicationSettings;
Common.Notifications.on('engineCreated', api => {
api.asc_registerCallback('asc_onAddComment', this.addComment.bind(this));
@ -74,6 +75,8 @@ class CommentsController extends Component {
/** coauthoring begin **/
const isLiveCommenting = LocalStorage.getBool(`${window.editorType}-mobile-settings-livecomment`, true);
const resolved = LocalStorage.getBool(`${window.editorType}-settings-resolvedcomment`, true);
this.storeApplicationSettings.changeDisplayComments(isLiveCommenting);
this.storeApplicationSettings.changeDisplayResolved(resolved);
isLiveCommenting ? api.asc_showComments(resolved) : api.asc_hideComments();
/** coauthoring end **/
}
@ -98,6 +101,9 @@ class CommentsController extends Component {
}
removeComment (id) {
this.storeComments.removeComment(id);
if (this.storeComments.showComments.length < 1) {
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
}
}
removeComments (data) {
for (let i = 0; i < data.length; i++) {
@ -478,7 +484,6 @@ class ViewCommentsController extends Component {
}
deleteComment (comment) {
const api = Common.EditorApi.get();
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
comment && api.asc_removeComment(comment.uid);
}
deleteReply (comment, reply) {
@ -583,7 +588,7 @@ class ViewCommentsController extends Component {
}
}
const _CommentsController = inject('storeAppOptions', 'storeComments', 'users')(observer(CommentsController));
const _CommentsController = inject('storeAppOptions', 'storeComments', 'users', "storeApplicationSettings")(observer(CommentsController));
const _AddCommentController = inject('storeAppOptions', 'storeComments', 'users')(observer(AddCommentController));
const _EditCommentController = inject('storeComments', 'users')(observer(EditCommentController));
const _ViewCommentsController = inject('storeComments', 'users')(observer(withTranslation()(ViewCommentsController)));

View file

@ -39,6 +39,16 @@ export class storeComments {
});
}
removeShowComment(id) {
const index = this.showComments.findIndex((comment) => {
return comment.uid === id;
});
if (index !== -1) {
this.showComments.splice(index, 1);
}
}
addComment (comment) {
comment.groupName ? this.groupCollectionComments.push(comment) : this.collectionComments.push(comment);
}
@ -51,6 +61,7 @@ export class storeComments {
if (index !== -1) {
collection.splice(index, 1);
}
this.removeShowComment(id);
}
changeComment (id, changeComment) {

View file

@ -740,7 +740,6 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
const isAndroid = Device.android;
const viewMode = !storeAppOptions.canComments;
const comments = storeComments.showComments;
const [currentIndex, setCurrentIndex] = useState(0);
@ -760,13 +759,20 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
};
const onViewNextComment = () => {
if (currentIndex + 1 === comments.length) {
if (currentIndex + 1 >= comments.length) {
setCurrentIndex(0);
} else {
setCurrentIndex(currentIndex + 1);
}
};
if(!comment) {
if (comments.length > 0) {
onViewNextComment();
}
return null;
}
return (
<Fragment>
<Toolbar position='bottom'>
@ -779,77 +785,78 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
</div>
</Toolbar>
<div className='pages'>
<Page className='page-current-comment'>
<List className='comment-list'>
<ListItem>
<div slot='header' className='comment-header'>
<div className='left'>
{isAndroid && <div className='initials' style={{backgroundColor: `${comment.userColor ? comment.userColor : '#cfcfcf'}`}}>{comment.userInitials}</div>}
<div>
<div className='user-name'>{comment.userName}</div>
<div className='comment-date'>{comment.date}</div>
</div>
</div>
{!viewMode &&
<div className='right'>
<div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'} /></div>
<div className='comment-menu'
onClick={() => {openActionComment(true);}}
><Icon icon='icon-menu-comment'/></div>
</div>
}
</div>
<div slot='footer'>
{comment.quote && <div className='comment-quote'>{sliceQuote(comment.quote)}</div>}
<div className='comment-text'><pre>{pickLink(comment.comment)}</pre></div>
{comment.replies.length > 0 &&
<ul className='reply-list'>
{comment.replies.map((reply, indexReply) => {
return (
<li key={`reply-${indexReply}`}
className='reply-item'
>
<div className='item-content'>
<div className='item-inner'>
<div className='item-title'>
<div slot='header' className='reply-header'>
<div className='left'>
{isAndroid && <div className='initials' style={{backgroundColor: `${reply.userColor ? reply.userColor : '#cfcfcf'}`}}>{reply.userInitials}</div>}
<div>
<div className='user-name'>{reply.userName}</div>
<div className='reply-date'>{reply.date}</div>
</div>
</div>
{!viewMode &&
<div className='right'>
<div className='reply-menu'
onClick={() => {setReply(reply); openActionReply(true);}}
>
<Icon icon='icon-menu-comment'/>
</div>
</div>
}
</div>
<div slot='footer'>
<div className='reply-text'><pre>{pickLink(reply.reply)}</pre></div>
</div>
</div>
</div>
<Page className='page-current-comment'>
<List className='comment-list'>
<ListItem>
<div slot='header' className='comment-header'>
<div className='left'>
{isAndroid && <div className='initials' style={{backgroundColor: `${comment.userColor ? comment.userColor : '#cfcfcf'}`}}>{comment.userInitials}</div>}
<div>
<div className='user-name'>{comment.userName}</div>
<div className='comment-date'>{comment.date}</div>
</div>
</li>
)
})}
</ul>
}
</div>
</ListItem>
</List>
<CommentActions comment={comment} onCommentMenuClick={onCommentMenuClick} opened={commentActionsOpened} openActionComment={openActionComment}/>
<ReplyActions comment={comment} reply={reply} onCommentMenuClick={onCommentMenuClick} opened={replyActionsOpened} openActionReply={openActionReply}/>
</Page>
</div>
{!viewMode &&
<div className='right'>
<div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'} /></div>
<div className='comment-menu'
onClick={() => {openActionComment(true);}}
><Icon icon='icon-menu-comment'/></div>
</div>
}
</div>
<div slot='footer'>
{comment.quote && <div className='comment-quote'>{sliceQuote(comment.quote)}</div>}
<div className='comment-text'><pre>{pickLink(comment.comment)}</pre></div>
{comment.replies.length > 0 &&
<ul className='reply-list'>
{comment.replies.map((reply, indexReply) => {
return (
<li key={`reply-${indexReply}`}
className='reply-item'
>
<div className='item-content'>
<div className='item-inner'>
<div className='item-title'>
<div slot='header' className='reply-header'>
<div className='left'>
{isAndroid && <div className='initials' style={{backgroundColor: `${reply.userColor ? reply.userColor : '#cfcfcf'}`}}>{reply.userInitials}</div>}
<div>
<div className='user-name'>{reply.userName}</div>
<div className='reply-date'>{reply.date}</div>
</div>
</div>
{!viewMode &&
<div className='right'>
<div className='reply-menu'
onClick={() => {setReply(reply); openActionReply(true);}}
>
<Icon icon='icon-menu-comment'/>
</div>
</div>
}
</div>
<div slot='footer'>
<div className='reply-text'><pre>{pickLink(reply.reply)}</pre></div>
</div>
</div>
</div>
</div>
</li>
)
})}
</ul>
}
</div>
</ListItem>
</List>
<CommentActions comment={comment} onCommentMenuClick={onCommentMenuClick} opened={commentActionsOpened} openActionComment={openActionComment}/>
<ReplyActions comment={comment} reply={reply} onCommentMenuClick={onCommentMenuClick} opened={replyActionsOpened} openActionReply={openActionReply}/>
</Page>
</div>
</Fragment>
)
}));
const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment}) => {

View file

@ -11,7 +11,7 @@
&.icon-prev {
width: 20px;
height: 20px;
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{white}"><g><polygon points="5.1,10.9 13.9,2 16,4.1 9.2,11.1 16,17.9 13.9,20 5.1,11.2 5,11.1 "/></g></svg>');
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{themeColor}"><g><polygon points="5.1,10.9 13.9,2 16,4.1 9.2,11.1 16,17.9 13.9,20 5.1,11.2 5,11.1 "/></g></svg>');
&:after {
display: none;
}
@ -19,7 +19,7 @@
&.icon-next {
width: 20px;
height: 20px;
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{white}"><g><polygon points="16.9,10.9 8.1,2 6,4.1 12.8,11.1 6,17.9 8.1,20 16.9,11.2 17,11.1 "/></g></svg>');
.encoded-svg-background('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 22 22" fill="@{themeColor}"><g><polygon points="16.9,10.9 8.1,2 6,4.1 12.8,11.1 6,17.9 8.1,20 16.9,11.2 17,11.1 "/></g></svg>');
&:after {
display: none;
}

View file

@ -1,11 +1,13 @@
import React, { Component } from "react";
import { ApplicationSettings } from "../../view/settings/ApplicationSettings";
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
import {observer, inject} from "mobx-react";
class ApplicationSettingsController extends Component {
constructor(props) {
super(props);
this.switchDisplayComments = this.switchDisplayComments.bind(this);
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
}
setUnitMeasurement(value) {
@ -34,6 +36,8 @@ class ApplicationSettingsController extends Component {
switchDisplayComments(value) {
const api = Common.EditorApi.get();
this.props.storeAppOptions.changeCanViewComments(value);
if (!value) {
api.asc_hideComments();
this.switchDisplayResolved(value);
@ -42,6 +46,7 @@ class ApplicationSettingsController extends Component {
const resolved = LocalStorage.getBool("de-settings-resolvedcomment");
api.asc_showComments(resolved);
}
LocalStorage.setBool("de-mobile-settings-livecomment", value);
}
@ -73,4 +78,4 @@ class ApplicationSettingsController extends Component {
}
export default ApplicationSettingsController;
export default inject("storeAppOptions", "storeApplicationSettings")(observer(ApplicationSettingsController));

View file

@ -27,7 +27,12 @@ export class storeAppOptions {
}
isEdit = false;
canViewComments = false;
changeCanViewComments(value) {
this.canViewComments = value;
}
canReview = false;
canViewReview = false;

View file

@ -1,4 +1,5 @@
import {makeObservable, action, observable} from 'mobx';
import { LocalStorage } from '../../../../common/mobile/utils/LocalStorage';
export class storeApplicationSettings {
constructor() {
@ -24,8 +25,8 @@ export class storeApplicationSettings {
isSpellChecking = true;
isNonprintingCharacters = false;
isHiddenTableBorders = false;
isComments = true;
isResolvedComments = true;
isComments = false;
isResolvedComments = false;
macrosMode = 0;
changeUnitMeasurement(value) {

View file

@ -595,7 +595,6 @@ class MainController extends Component {
const buttons = [{
text: 'OK',
bold: true,
close: false,
onClick: () => {
const password = document.getElementById('modal-password').value;
this.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));

View file

@ -1,10 +1,12 @@
import React, { Component } from "react";
import { ApplicationSettings } from "../../view/settings/ApplicationSettings";
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
import {observer, inject} from "mobx-react";
class ApplicationSettingsController extends Component {
constructor(props) {
super(props);
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
}
setUnitMeasurement(value) {
@ -37,4 +39,4 @@ class ApplicationSettingsController extends Component {
}
export default ApplicationSettingsController;
export default inject("storeApplicationSettings")(observer(ApplicationSettingsController));

View file

@ -164,7 +164,8 @@
"errorFrmlMaxTextLength": "Text values in formulas are limited to 255 characters.<br>Use the CONCATENATE function or concatenation operator (&)",
"errorFrmlMaxLength": "You cannot add this formula as its length exceeded the allowed number of characters.<br>Please edit it and try again.",
"errorFrmlMaxReference": "You cannot enter this formula because it has too many values,<br>cell references, and/or names.",
"errorDataValidate":"The value you entered is not valid.<br>A user has restricted values that can be entered into this cell."
"errorDataValidate":"The value you entered is not valid.<br>A user has restricted values that can be entered into this cell.",
"errorLockedCellPivot": "You cannot change data inside a pivot table."
},
"ContextMenu": {
"menuViewComment": "View Comment",

View file

@ -166,6 +166,10 @@ const ErrorController = inject('storeAppOptions')(({storeAppOptions, LoadingDocu
case Asc.c_oAscError.ID.PasteMaxRangeError:
config.msg = _t.errorPasteMaxRange;
break;
case Asc.c_oAscError.ID.LockedCellPivot:
config.msg = _t.errorLockedCellPivot;
break;
case Asc.c_oAscError.ID.LockedAllError:
config.msg = _t.errorLockedAll;

View file

@ -1,15 +1,18 @@
import React, { Component } from "react";
import { ApplicationSettings } from "../../view/settings/ApplicationSettings";
import {observer, inject} from "mobx-react";
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
class ApplicationSettingsController extends Component {
constructor(props) {
super(props);
this.onFormulaLangChange = this.onFormulaLangChange.bind(this);
this.onChangeDisplayComments = this.onChangeDisplayComments.bind(this);
this.onRegSettings = this.onRegSettings.bind(this);
this.initRegSettings = this.initRegSettings.bind(this);
this.props.storeApplicationSettings.initRegData();
this.initRegSettings();
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
}
initRegSettings() {
@ -32,54 +35,54 @@ class ApplicationSettingsController extends Component {
onChangeDisplayComments(displayComments) {
const api = Common.EditorApi.get();
this.props.storeAppOptions.changeCanViewComments(displayComments);
if (!displayComments) {
api.asc_hideComments();
Common.localStorage.setBool("sse-settings-resolvedcomment", false);
LocalStorage.setBool("sse-settings-resolvedcomment", false);
} else {
let resolved = Common.localStorage.getBool("sse-settings-resolvedcomment");
let resolved = LocalStorage.getBool("sse-settings-resolvedcomment");
api.asc_showComments(resolved);
}
Common.localStorage.setBool("sse-mobile-settings-livecomment", displayComments);
LocalStorage.setBool("sse-mobile-settings-livecomment", displayComments);
}
onChangeDisplayResolved(value) {
const api = Common.EditorApi.get();
let displayComments = Common.localStorage.getBool("sse-mobile-settings-livecomment");
let displayComments = LocalStorage.getBool("sse-mobile-settings-livecomment");
if (displayComments) {
api.asc_showComments(value);
Common.localStorage.setBool("sse-settings-resolvedcomment", value);
LocalStorage.setBool("sse-settings-resolvedcomment", value);
}
}
clickR1C1Style(checked) {
const api = Common.EditorApi.get();
Common.localStorage.setBool('sse-settings-r1c1', checked);
LocalStorage.setBool('sse-settings-r1c1', checked);
api.asc_setR1C1Mode(checked);
}
unitMeasurementChange(value) {
value = value ? +value : Common.Utils.Metric.getDefaultMetric();
Common.Utils.Metric.setCurrentMetric(value);
Common.localStorage.setItem("se-mobile-settings-unit", value);
LocalStorage.setItem("sse-mobile-settings-unit", value);
}
onChangeMacrosSettings(value) {
Common.Utils.InternalSettings.set("sse-mobile-macros-mode", +value);
Common.localStorage.setItem("sse-mobile-macros-mode", +value);
LocalStorage.setItem("sse-mobile-macros-mode", +value);
}
onFormulaLangChange(value) {
Common.localStorage.setItem("sse-settings-func-lang", value);
LocalStorage.setItem("sse-settings-func-lang", value);
this.initRegSettings();
// SSE.getController('AddFunction').onDocumentReady();
}
onRegSettings(regCode) {
const api = Common.EditorApi.get();
Common.localStorage.setItem("sse-settings-regional", regCode);
LocalStorage.setItem("sse-settings-regional", regCode);
this.initRegSettings();
if (regCode!==null) api.asc_setLocale(+regCode);
}
@ -102,4 +105,4 @@ class ApplicationSettingsController extends Component {
}
export default inject("storeApplicationSettings")(observer(ApplicationSettingsController));
export default inject("storeApplicationSettings", "storeAppOptions")(observer(ApplicationSettingsController));

View file

@ -19,7 +19,11 @@ export class storeAppOptions {
isEdit = false;
config = {};
canViewComments = false;
changeCanViewComments(value) {
this.canViewComments = value;
}
lostEditingRights = false;
changeEditingRights (value) {

View file

@ -108,7 +108,7 @@ const EditLink = props => {
const valueRange = linkInfo.asc_getRange();
const [range, setRange] = useState(valueRange || '');
return (
<Fragment>
<List inlineLabels className='inputs-list'>
@ -159,7 +159,7 @@ const EditLink = props => {
</List>
<List className="buttons-list">
<ListButton title={_t.textEditLink}
className={`button-fill button-raised${(typeLink === 'ext' && link.length < 1 || typeLink === 'int' || range.length < 1 || !curSheet.length) && ' disabled'}`}
className={`button-fill button-raised ${(typeLink === 1 && !link.length) || (typeLink === 2 && (!range.length || !curSheet.length)) ? 'disabled' : ''}`}
onClick={() => {props.onEditLink(typeLink === 1 ?
{type: 1, url: link, text: stateDisplayText, tooltip: screenTip} :
{type: 2, url: range, sheet: curSheet, text: stateDisplayText, tooltip: screenTip})}}

View file

@ -185,7 +185,7 @@ const PageMacrosSettings = props => {
);
};
const ApplicationSettings = inject("storeApplicationSettings")(observer(PageApplicationSettings));
const ApplicationSettings = inject("storeApplicationSettings", "storeAppOptions")(observer(PageApplicationSettings));
const MacrosSettings = inject("storeApplicationSettings")(observer(PageMacrosSettings));
const RegionalSettings = inject("storeApplicationSettings")(observer(PageRegionalSettings));
const FormulaLanguage = inject("storeApplicationSettings")(observer(PageFormulaLanguage));