Merge pull request #1930 from ONLYOFFICE/feature/fix-bugs

Feature/fix bugs
This commit is contained in:
maxkadushkin 2022-09-01 15:56:41 +03:00 committed by GitHub
commit 7a9b82681a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 113 additions and 90 deletions

View file

@ -129,14 +129,6 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
Common.Gateway.requestEditRights();
};
const turnOffViewerMode = () => {
const api = Common.EditorApi.get();
appOptions.changeViewerMode();
api.asc_removeRestriction(Asc.c_oAscRestrictionType.View)
api.asc_addRestriction(Asc.c_oAscRestrictionType.None);
}
const turnOnViewerMode = () => {
const api = Common.EditorApi.get();
@ -176,7 +168,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
onEditDocument={onEditDocument}
isDisconnected={isDisconnected}
isViewer={isViewer}
turnOffViewerMode={turnOffViewerMode}
// turnOffViewerMode={turnOffViewerMode}
turnOnViewerMode={turnOnViewerMode}
isMobileView={isMobileView}
changeMobileView={changeMobileView}

View file

@ -344,3 +344,12 @@
transition: opacity 300ms;
}
// FAB
.fab a {
background-color: @background-primary;
&:focus, &:focus-within, &:active, &.active-state {
background-color: @background-primary;
}
}

View file

@ -454,12 +454,12 @@
&.icon-mobile-view {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1V3.5C7 3.77614 6.77614 4 6.5 4H4V3H6V1H7ZM17 3.5V1H18V3H20V4H17.5C17.2239 4 17 3.77614 17 3.5ZM17 20.5V23H18V21H20V20H17.5C17.2239 20 17 20.2239 17 20.5ZM7 20.5V23H6V21H4V20H6.5C6.77614 20 7 20.2239 7 20.5ZM16 6H8C7.44772 6 7 6.44772 7 7V17C7 17.5523 7.44772 18 8 18H16C16.5523 18 17 17.5523 17 17V7C17 6.44772 16.5523 6 16 6ZM8 5C6.89543 5 6 5.89543 6 7V17C6 18.1046 6.89543 19 8 19H16C17.1046 19 18 18.1046 18 17V7C18 5.89543 17.1046 5 16 5H8ZM9 8.5C9 8.22386 9.22386 8 9.5 8H14.5C14.7761 8 15 8.22386 15 8.5C15 8.77614 14.7761 9 14.5 9H9.5C9.22386 9 9 8.77614 9 8.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12H14.5C14.7761 12 15 11.7761 15 11.5C15 11.2239 14.7761 11 14.5 11H9.5ZM9 14.5C9 14.2239 9.22386 14 9.5 14H14.5C14.7761 14 15 14.2239 15 14.5C15 14.7761 14.7761 15 14.5 15H9.5C9.22386 15 9 14.7761 9 14.5Z" fill="@{brandColor}"/></svg>');
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3ZM5 4C5 2.89543 5.89543 2 7 2H17C18.1046 2 19 2.89543 19 4V20C19 21.1046 18.1046 22 17 22H7C5.89543 22 5 21.1046 5 20V4ZM9.5 19C9.22386 19 9 19.2239 9 19.5C9 19.7761 9.22386 20 9.5 20H14.5C14.7761 20 15 19.7761 15 19.5C15 19.2239 14.7761 19 14.5 19H9.5Z" fill="@{brandColor}"/></svg>');
}
&.icon-standard-view {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3ZM5 4C5 2.89543 5.89543 2 7 2H17C18.1046 2 19 2.89543 19 4V20C19 21.1046 18.1046 22 17 22H7C5.89543 22 5 21.1046 5 20V4ZM9.5 19C9.22386 19 9 19.2239 9 19.5C9 19.7761 9.22386 20 9.5 20H14.5C14.7761 20 15 19.7761 15 19.5C15 19.2239 14.7761 19 14.5 19H9.5Z" fill="@{brandColor}"/></svg>');
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1V3.5C7 3.77614 6.77614 4 6.5 4H4V3H6V1H7ZM17 3.5V1H18V3H20V4H17.5C17.2239 4 17 3.77614 17 3.5ZM17 20.5V23H18V21H20V20H17.5C17.2239 20 17 20.2239 17 20.5ZM7 20.5V23H6V21H4V20H6.5C6.77614 20 7 20.2239 7 20.5ZM16 6H8C7.44772 6 7 6.44772 7 7V17C7 17.5523 7.44772 18 8 18H16C16.5523 18 17 17.5523 17 17V7C17 6.44772 16.5523 6 16 6ZM8 5C6.89543 5 6 5.89543 6 7V17C6 18.1046 6.89543 19 8 19H16C17.1046 19 18 18.1046 18 17V7C18 5.89543 17.1046 5 16 5H8ZM9 8.5C9 8.22386 9.22386 8 9.5 8H14.5C14.7761 8 15 8.22386 15 8.5C15 8.77614 14.7761 9 14.5 9H9.5C9.22386 9 9 8.77614 9 8.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12H14.5C14.7761 12 15 11.7761 15 11.5C15 11.2239 14.7761 11 14.5 11H9.5ZM9 14.5C9 14.2239 9.22386 14 9.5 14H14.5C14.7761 14 15 14.2239 15 14.5C15 14.7761 14.7761 15 14.5 15H9.5C9.22386 15 9 14.7761 9 14.5Z" fill="@{brandColor}"/></svg>');
}
// Comments

View file

@ -69,20 +69,15 @@
}
// Reader mode
&.icon-edit-mode {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M21.5002 6.3L23.0002 4.8C23.0002 4.8 22.8002 3.6 22.1002 2.9C21.4002 2.1 20.2002 2 20.2002 2L18.7002 3.5L21.5002 6.3ZM20.3 6.30001L7.1 19.4L5.6 17.9L18.8 4.80001L18.1 4.10001L4.5 17.7L4 21L1 21V22H23V21L4 21L7.3 20.5L20.9 6.90001L20.3 6.30001Z" fill="@{toolbar-icons}"/></svg>', @toolbar-icons);
}
&.icon-mobile-view {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1V3.5C7 3.77614 6.77614 4 6.5 4H4V3H6V1H7ZM17 3.5V1H18V3H20V4H17.5C17.2239 4 17 3.77614 17 3.5ZM17 20.5V23H18V21H20V20H17.5C17.2239 20 17 20.2239 17 20.5ZM7 20.5V23H6V21H4V20H6.5C6.77614 20 7 20.2239 7 20.5ZM16 6H8C7.44772 6 7 6.44772 7 7V17C7 17.5523 7.44772 18 8 18H16C16.5523 18 17 17.5523 17 17V7C17 6.44772 16.5523 6 16 6ZM8 5C6.89543 5 6 5.89543 6 7V17C6 18.1046 6.89543 19 8 19H16C17.1046 19 18 18.1046 18 17V7C18 5.89543 17.1046 5 16 5H8ZM9 8.5C9 8.22386 9.22386 8 9.5 8H14.5C14.7761 8 15 8.22386 15 8.5C15 8.77614 14.7761 9 14.5 9H9.5C9.22386 9 9 8.77614 9 8.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12H14.5C14.7761 12 15 11.7761 15 11.5C15 11.2239 14.7761 11 14.5 11H9.5ZM9 14.5C9 14.2239 9.22386 14 9.5 14H14.5C14.7761 14 15 14.2239 15 14.5C15 14.7761 14.7761 15 14.5 15H9.5C9.22386 15 9 14.7761 9 14.5Z" fill="@{toolbar-icons}"/></svg>', @toolbar-icons);
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3ZM5 4C5 2.89543 5.89543 2 7 2H17C18.1046 2 19 2.89543 19 4V20C19 21.1046 18.1046 22 17 22H7C5.89543 22 5 21.1046 5 20V4ZM9.5 19C9.22386 19 9 19.2239 9 19.5C9 19.7761 9.22386 20 9.5 20H14.5C14.7761 20 15 19.7761 15 19.5C15 19.2239 14.7761 19 14.5 19H9.5Z" fill="@{toolbar-icons}"/></svg>', @toolbar-icons);
}
&.icon-standard-view {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3ZM5 4C5 2.89543 5.89543 2 7 2H17C18.1046 2 19 2.89543 19 4V20C19 21.1046 18.1046 22 17 22H7C5.89543 22 5 21.1046 5 20V4ZM9.5 19C9.22386 19 9 19.2239 9 19.5C9 19.7761 9.22386 20 9.5 20H14.5C14.7761 20 15 19.7761 15 19.5C15 19.2239 14.7761 19 14.5 19H9.5Z" fill="@{toolbar-icons}"/></svg>', @toolbar-icons);
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1V3.5C7 3.77614 6.77614 4 6.5 4H4V3H6V1H7ZM17 3.5V1H18V3H20V4H17.5C17.2239 4 17 3.77614 17 3.5ZM17 20.5V23H18V21H20V20H17.5C17.2239 20 17 20.2239 17 20.5ZM7 20.5V23H6V21H4V20H6.5C6.77614 20 7 20.2239 7 20.5ZM16 6H8C7.44772 6 7 6.44772 7 7V17C7 17.5523 7.44772 18 8 18H16C16.5523 18 17 17.5523 17 17V7C17 6.44772 16.5523 6 16 6ZM8 5C6.89543 5 6 5.89543 6 7V17C6 18.1046 6.89543 19 8 19H16C17.1046 19 18 18.1046 18 17V7C18 5.89543 17.1046 5 16 5H8ZM9 8.5C9 8.22386 9.22386 8 9.5 8H14.5C14.7761 8 15 8.22386 15 8.5C15 8.77614 14.7761 9 14.5 9H9.5C9.22386 9 9 8.77614 9 8.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12H14.5C14.7761 12 15 11.7761 15 11.5C15 11.2239 14.7761 11 14.5 11H9.5ZM9 14.5C9 14.2239 9.22386 14 9.5 14H14.5C14.7761 14 15 14.2239 15 14.5C15 14.7761 14.7761 15 14.5 15H9.5C9.22386 15 9 14.7761 9 14.5Z" fill="@{toolbar-icons}"/></svg>', @toolbar-icons);
}
&.icon-back-reader-mode {
width: 24px;
@ -180,6 +175,11 @@
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3H17C17.5523 3 18 3.44772 18 4V20C18 20.5523 17.5523 21 17 21H7C6.44772 21 6 20.5523 6 20V4C6 3.44772 6.44772 3 7 3ZM5 4C5 2.89543 5.89543 2 7 2H17C18.1046 2 19 2.89543 19 4V20C19 21.1046 18.1046 22 17 22H7C5.89543 22 5 21.1046 5 20V4ZM9.5 19C9.22386 19 9 19.2239 9 19.5C9 19.7761 9.22386 20 9.5 20H14.5C14.7761 20 15 19.7761 15 19.5C15 19.2239 14.7761 19 14.5 19H9.5Z" fill="@{brandColor}"/></svg>', @brandColor);
}
&.icon-edit-mode {
width: 24px;
height: 24px;
.encoded-svg-mask('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M21.5002 6.3L23.0002 4.8C23.0002 4.8 22.8002 3.6 22.1002 2.9C21.4002 2.1 20.2002 2 20.2002 2L18.7002 3.5L21.5002 6.3ZM20.3 6.30001L7.1 19.4L5.6 17.9L18.8 4.80001L18.1 4.10001L4.5 17.7L4 21L1 21V22H23V21L4 21L7.3 20.5L20.9 6.90001L20.3 6.30001Z" fill="@{brandColor}"/></svg>', @brandColor);
}
// Edit
&.icon-text-align-left {

View file

@ -1,8 +1,7 @@
import React, { Component } from 'react';
import { CSSTransition } from 'react-transition-group';
import { f7, Link } from 'framework7-react';
import { Page, View, Navbar, Subnavbar, Icon } from 'framework7-react';
import { f7, Link, Fab, Icon, FabButtons, FabButton, Page, View, Navbar, Subnavbar } from 'framework7-react';
import { observer, inject } from "mobx-react";
import { withTranslation } from 'react-i18next';
import EditOptions from '../view/edit/Edit';
@ -98,93 +97,110 @@ class MainPage extends Component {
};
render() {
const { t } = this.props;
const appOptions = this.props.storeAppOptions;
const isMobileView = appOptions.isMobileView;
const config = appOptions.config;
turnOffViewerMode() {
const api = Common.EditorApi.get();
const appOptions = this.props.storeAppOptions;
let showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
if ( !Object.keys(config).length ) {
showLogo = !/&(?:logo)=/.test(window.location.search);
}
appOptions.changeViewerMode();
api.asc_removeRestriction(Asc.c_oAscRestrictionType.View)
api.asc_addRestriction(Asc.c_oAscRestrictionType.None);
};
const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo));
if ( $$('.skl-container').length ) {
$$('.skl-container').remove();
}
render() {
const { t } = this.props;
const appOptions = this.props.storeAppOptions;
const storeToolbarSettings = this.props.storeToolbarSettings;
const isDisconnected = this.props.users.isDisconnected;
const isViewer = appOptions.isViewer;
const isMobileView = appOptions.isMobileView;
const disabledControls = storeToolbarSettings.disabledControls;
const disabledSettings = storeToolbarSettings.disabledSettings;
const config = appOptions.config;
return (
<Page name="home" className={`editor${ showLogo ? ' page-with-logo' : ''}`}>
{/* Top Navbar */}
<Navbar id='editor-navbar' className={`main-navbar${showLogo ? ' navbar-with-logo' : ''}`}>
{showLogo && appOptions.canBranding !== undefined && <div className="main-logo" onClick={() => {
window.open(`${__PUBLISHER_URL__}`, "_blank");
}}><Icon icon="icon-logo"></Icon></div>}
<Subnavbar>
<Toolbar openOptions={this.handleClickToOpenOptions}
closeOptions={this.handleOptionsViewClosed}/>
<Search useSuspense={false}/>
</Subnavbar>
</Navbar>
let showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
if (!Object.keys(config).length) {
showLogo = !/&(?:logo)=/.test(window.location.search);
}
const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo));
if ($$('.skl-container').length) {
$$('.skl-container').remove();
}
return (
<Page name="home" className={`editor${showLogo ? ' page-with-logo' : ''}`}>
{/* Top Navbar */}
<Navbar id='editor-navbar' className={`main-navbar${showLogo ? ' navbar-with-logo' : ''}`}>
{showLogo && appOptions.canBranding !== undefined && <div className="main-logo" onClick={() => {
window.open(`${__PUBLISHER_URL__}`, "_blank");
}}><Icon icon="icon-logo"></Icon></div>}
<Subnavbar>
<Toolbar openOptions={this.handleClickToOpenOptions}
closeOptions={this.handleOptionsViewClosed}/>
<Search useSuspense={false}/>
</Subnavbar>
</Navbar>
{/* Page content */}
{/* Page content */}
<View id="editor_sdk">
</View>
<View id="editor_sdk">
</View>
{showPlaceholder ?
<div className="doc-placeholder-container">
<div className="doc-placeholder">
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
</div>
</div> : null
}
{showPlaceholder ?
<div className="doc-placeholder-container">
<div className="doc-placeholder">
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
</div>
</div> : null
}
{/* {
{/* {
Device.phone ? null : <SearchSettings />
} */}
<SearchSettings useSuspense={false} />
<SearchSettings useSuspense={false}/>
{
!this.state.editOptionsVisible ? null :
<EditOptions onclosed={this.handleOptionsViewClosed.bind(this, 'edit')} />
<EditOptions onclosed={this.handleOptionsViewClosed.bind(this, 'edit')}/>
}
{
!this.state.addOptionsVisible ? null :
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')}
showOptions={this.state.addShowOptions}/>
}
{/*onclosed={this.handleOptionsViewClosed.bind(this, 'settings')}*/}
{
!this.state.settingsVisible ? null :
<Settings openOptions={this.handleClickToOpenOptions.bind(this)} closeOptions={this.handleOptionsViewClosed.bind(this)} />
<Settings openOptions={this.handleClickToOpenOptions.bind(this)}
closeOptions={this.handleOptionsViewClosed.bind(this)}/>
}
{
!this.state.collaborationVisible ? null :
<Collaboration onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')} page={this.state.collaborationPage} />
<Collaboration onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')}
page={this.state.collaborationPage}/>
}
{
!this.state.navigationVisible ? null :
<NavigationController onclosed={this.handleOptionsViewClosed.bind(this, 'navigation')} />
!this.state.navigationVisible ? null :
<NavigationController onclosed={this.handleOptionsViewClosed.bind(this, 'navigation')}/>
}
{
<CSSTransition
@ -194,13 +210,20 @@ class MainPage extends Component {
mountOnEnter
unmountOnExit
>
<Snackbar text={isMobileView ? t("Toolbar.textSwitchedMobileView") : t("Toolbar.textSwitchedStandardView")} />
<Snackbar
text={isMobileView ? t("Toolbar.textSwitchedMobileView") : t("Toolbar.textSwitchedStandardView")}/>
</CSSTransition>
}
{appOptions.isDocReady && <ContextMenu openOptions={this.handleClickToOpenOptions.bind(this)} />}
</Page>
)
}
{isViewer && !disabledSettings && !disabledControls && !isDisconnected &&
<Fab position="right-bottom" slot="fixed" onClick={() => this.turnOffViewerMode()}>
<Icon icon="icon-edit-mode"/>
</Fab>
}
{appOptions.isDocReady && <ContextMenu openOptions={this.handleClickToOpenOptions.bind(this)}/>}
</Page>
)
}
}
export default withTranslation()(inject("storeAppOptions")(observer(MainPage)));
export default withTranslation()(inject("storeAppOptions", "storeToolbarSettings", "users")(observer(MainPage)));

View file

@ -61,7 +61,6 @@ const ToolbarView = props => {
onEditClick: e => props.openOptions('edit'),
onAddClick: e => props.openOptions('add')
})}
{isViewer && isAvailableExt && props.isEdit && <Link icon='icon-edit-mode' className={(props.disabledSettings || props.disabledControls || isDisconnected) && 'disabled'} href={false} onClick={() => props.turnOffViewerMode()}></Link>}
{Device.phone ? null : <Link className={(props.disabledControls || props.readerMode) && 'disabled'} icon='icon-search' searchbarEnable='.searchbar' href={false}></Link>}
{props.displayCollaboration && window.matchMedia("(min-width: 360px)").matches ? <Link className={props.disabledControls && 'disabled'} id='btn-coauth' href={false} icon='icon-collaboration' onClick={e => props.openOptions('coauth')}></Link> : null}
<Link className={(props.disabledSettings || props.disabledControls || isDisconnected) && 'disabled'} id='btn-settings' icon='icon-settings' href={false} onClick={e => props.openOptions('settings')}></Link>