Merge pull request #1241 from ONLYOFFICE/feature/bug-fixes

Feature/bug fixes
This commit is contained in:
maxkadushkin 2021-10-15 11:44:45 +03:00 committed by GitHub
commit 587f471e38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 307 additions and 178 deletions

View file

@ -9,14 +9,16 @@ import { idContextMenuElement } from '../../../../common/mobile/lib/view/Context
import { Device } from '../../../../common/mobile/utils/device';
import EditorUIController from '../lib/patch';
@inject ( stores => ({
@inject (stores => ({
isEdit: stores.storeAppOptions.isEdit,
canComments: stores.storeAppOptions.canComments,
canViewComments: stores.storeAppOptions.canViewComments,
canCoAuthoring: stores.storeAppOptions.canCoAuthoring,
users: stores.users,
isDisconnected: stores.users.isDisconnected,
storeSheets: stores.sheets
storeSheets: stores.sheets,
wsProps: stores.storeWorksheets.wsProps,
wsLock: stores.storeWorksheets.wsLock
}))
class ContextMenu extends ContextMenuController {
constructor(props) {

View file

@ -31,7 +31,8 @@ import { StatusbarController } from "./Statusbar";
"storeSpreadsheetSettings",
"storeSpreadsheetInfo",
"storeApplicationSettings",
"storeToolbarSettings"
"storeToolbarSettings",
"storeWorksheets"
)
class MainController extends Component {
constructor(props) {
@ -47,6 +48,9 @@ class MainController extends Component {
licenseType: false,
isDocModified: false
};
this.wsLockOptions = ['SelectLockedCells', 'SelectUnlockedCells', 'FormatCells', 'FormatColumns', 'FormatRows', 'InsertColumns', 'InsertRows', 'InsertHyperlinks', 'DeleteColumns',
'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios'];
this.defaultTitleText = __APP_TITLE_TEXT__;
@ -398,6 +402,43 @@ class MainController extends Component {
storeFocusObjects.setFunctionsDisabled(state === Asc.c_oAscCellEditorState.editText);
});
this.api.asc_registerCallback('asc_onChangeProtectWorksheet', this.onChangeProtectSheet.bind(this));
this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this));
}
onChangeProtectSheet() {
const storeWorksheets = this.props.storeWorksheets;
let {wsLock, wsProps} = this.getWSProps(true);
storeWorksheets.setWsLock(wsLock);
storeWorksheets.setWsProps(wsProps);
}
getWSProps(update) {
const storeAppOptions = this.props.storeAppOptions;
let wsProtection = {};
if (!storeAppOptions.config || !storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit) return;
if (update) {
let wsLock = !!this.api.asc_isProtectedSheet();
let wsProps = {};
if (wsLock) {
let props = this.api.asc_getProtectedSheet();
props && this.wsLockOptions.forEach(function(item){
wsProps[item] = props['asc_get' + item] ? props['asc_get' + item]() : false;
});
} else {
this.wsLockOptions.forEach(function(item){
wsProps[item] = false;
});
}
wsProtection = {wsLock, wsProps};
}
return wsProtection;
}
_onLongActionEnd(type, id) {

View file

@ -4,14 +4,18 @@ import { f7 } from 'framework7-react';
import { useTranslation } from 'react-i18next';
import ToolbarView from "../view/Toolbar";
const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetInfo', 'storeFocusObjects', 'storeToolbarSettings')(observer(props => {
const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetInfo', 'storeFocusObjects', 'storeToolbarSettings', 'storeWorksheets')(observer(props => {
const {t} = useTranslation();
const _t = t("Toolbar", { returnObjects: true });
const storeWorksheets = props.storeWorksheets;
const wsProps = storeWorksheets.wsProps;
const appOptions = props.storeAppOptions;
const isDisconnected = props.users.isDisconnected;
const storeFocusObjects = props.storeFocusObjects;
const focusOn = storeFocusObjects.focusOn;
const isObjectLocked = storeFocusObjects.isLocked;
const isEditCell = storeFocusObjects.isEditCell;
const editFormulaMode = storeFocusObjects.editFormulaMode;
@ -153,6 +157,8 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn
showEditDocument={showEditDocument}
onEditDocument={onEditDocument}
isDisconnected={isDisconnected}
wsProps={wsProps}
focusOn={focusOn}
/>
)
}));

View file

@ -1,6 +1,7 @@
import React, {Component} from 'react';
import { f7 } from 'framework7-react';
import { withTranslation } from 'react-i18next';
import {observer, inject} from "mobx-react";
import AddSortAndFilter from '../../view/add/AddFilter';
@ -120,9 +121,10 @@ class AddFilterController extends Component {
onInsertSort={this.onInsertSort}
onInsertFilter={this.onInsertFilter}
isFilter={this.state.isFilter}
wsLock={this.props.storeWorksheets.wsLock}
/>
)
}
}
export default withTranslation()(AddFilterController);
export default inject("storeWorksheets")(observer(withTranslation()(AddFilterController)));

View file

@ -30,6 +30,7 @@ class AddOtherController extends Component {
return (
<AddOther closeModal={this.closeModal}
hideAddComment={this.hideAddComment}
wsProps={this.props.wsProps}
/>
)
}

View file

@ -88,6 +88,9 @@ class MainPage extends Component {
render() {
const appOptions = this.props.storeAppOptions;
const storeWorksheets = this.props.storeWorksheets;
const wsProps = storeWorksheets.wsProps;
const wsLock = storeWorksheets.wsLock;
const config = appOptions.config;
const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo));
@ -115,11 +118,11 @@ class MainPage extends Component {
<SearchSettings useSuspense={false} />
{
!this.state.editOptionsVisible ? null :
<EditOptions onclosed={this.handleOptionsViewClosed.bind(this, 'edit')} />
<EditOptions onclosed={this.handleOptionsViewClosed.bind(this, 'edit')} wsLock={wsLock} wsProps={wsProps} />
}
{
!this.state.addOptionsVisible ? null :
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')} showOptions={this.state.addShowOptions} />
<AddOptions onclosed={this.handleOptionsViewClosed.bind(this, 'add')} wsLock={wsLock} wsProps={wsProps} showOptions={this.state.addShowOptions} />
}
{
!this.state.settingsVisible ? null :
@ -145,4 +148,4 @@ class MainPage extends Component {
}
}
export default inject("storeAppOptions")(observer(MainPage));
export default inject("storeAppOptions", "storeWorksheets")(observer(MainPage));

View file

@ -38,6 +38,7 @@ export const stores = {
// storeImageSettings: new storeImageSettings(),
// storeTableSettings: new storeTableSettings()
storeComments: new storeComments(),
storeToolbarSettings: new storeToolbarSettings()
storeToolbarSettings: new storeToolbarSettings(),
storeWorksheets: new storeWorksheets()
};

View file

@ -36,7 +36,10 @@ export class storeWorksheets {
setWorksheetLocked: action,
isProtectedWorkbook: observable,
setProtectedWorkbook: action
setProtectedWorkbook: action,
wsProps: observable,
setWsProps: action
});
this.sheets = [];
}
@ -90,11 +93,21 @@ export class storeWorksheets {
let model = this.sheets[index];
if(model && model.locked !== locked)
model.locked = locked;
this.isWorkbookLocked = locked;
this.isWorksheetLocked = locked;
}
isProtectedWorkbook = false;
setProtectedWorkbook(value) {
this.isProtectedWorkbook = value;
}
wsProps = {};
setWsProps(value) {
this.wsProps = value;
}
wsLock;
setWsLock(value) {
this.wsLock = value;
}
}

View file

@ -5,12 +5,15 @@ import EditorUIController from '../lib/patch'
const ToolbarView = props => {
const isDisconnected = props.isDisconnected;
const wsProps = props.wsProps;
const focusOn = props.focusOn;
const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({
disabledUndo: !props.isCanUndo || isDisconnected,
disabledRedo: !props.isCanRedo || isDisconnected,
onUndoClick: props.onUndo,
onRedoClick: props.onRedo
}) : null;
return (
<Fragment>
<NavLeft>
@ -25,6 +28,8 @@ const ToolbarView = props => {
}
{props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({
disabled: props.disabledEditControls || props.disabledControls || isDisconnected,
wsProps,
focusOn,
onEditClick: () => props.openOptions('edit'),
onAddClick: () => props.openOptions('add')
})}

View file

@ -57,6 +57,9 @@ const routes = [
const AddLayoutNavbar = ({ tabs, inPopover }) => {
const isAndroid = Device.android;
if(!tabs.length) return null;
return (
<Navbar>
{tabs.length > 1 ?
@ -66,8 +69,7 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => {
<Icon slot="media" icon={item.icon}></Icon>
</Link>)}
{isAndroid && <span className='tab-link-highlight' style={{width: 100 / tabs.lenght + '%'}}></span>}
</div> :
<NavTitle>{ tabs[0].caption }</NavTitle>
</div> : <NavTitle>{tabs[0].caption}</NavTitle>
}
{ !inPopover && <NavRight><Link icon='icon-expand-down' popupClose=".add-popup"></Link></NavRight> }
</Navbar>
@ -75,6 +77,8 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => {
};
const AddLayoutContent = ({ tabs }) => {
if(!tabs.length) return null;
return (
<Tabs animated>
{tabs.map((item, index) =>
@ -89,50 +93,54 @@ const AddLayoutContent = ({ tabs }) => {
const AddTabs = props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const wsLock = props.wsLock;
const wsProps = props.wsProps;
const showPanels = props.showPanels;
const tabs = [];
if (!showPanels) {
tabs.push({
caption: _t.textChart,
id: 'add-chart',
icon: 'icon-add-chart',
component: <AddChartController/>
});
if(!wsProps.Objects) {
if (!showPanels) {
tabs.push({
caption: _t.textChart,
id: 'add-chart',
icon: 'icon-add-chart',
component: <AddChartController/>
});
}
if (!showPanels || showPanels === 'function') {
tabs.push({
caption: _t.textFunction,
id: 'add-function',
icon: 'icon-add-formula',
component: <AddFunctionController onOptionClick={props.onOptionClick}/>
});
}
if (!showPanels || showPanels.indexOf('shape') > 0) {
tabs.push({
caption: _t.textShape,
id: 'add-shape',
icon: 'icon-add-shape',
component: <AddShapeController/>
});
}
if (showPanels && showPanels.indexOf('image') !== -1) {
tabs.push({
caption: _t.textImage,
id: 'add-image',
icon: 'icon-add-image',
component: <AddImageController inTabs={true}/>
});
}
}
if (!showPanels || showPanels === 'function') {
tabs.push({
caption: _t.textFunction,
id: 'add-function',
icon: 'icon-add-formula',
component: <AddFunctionController onOptionClick={props.onOptionClick}/>
});
}
if (!showPanels || showPanels.indexOf('shape') > 0) {
tabs.push({
caption: _t.textShape,
id: 'add-shape',
icon: 'icon-add-shape',
component: <AddShapeController/>
});
}
if (showPanels && showPanels.indexOf('image') !== -1) {
tabs.push({
caption: _t.textImage,
id: 'add-image',
icon: 'icon-add-image',
component: <AddImageController inTabs={true}/>
});
}
if (!showPanels) {
if (!showPanels && (!wsProps.InsertHyperlinks || !wsProps.Objects || !wsProps.Sort)) {
tabs.push({
caption: _t.textOther,
id: 'add-other',
icon: 'icon-add-other',
component: <AddOtherController/>
component: <AddOtherController wsProps={wsProps} />
});
}
if ((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) {
if (((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) && !wsProps.InsertHyperlinks) {
tabs.push({
caption: _t.textAddLink,
id: 'add-link',
@ -140,6 +148,17 @@ const AddTabs = props => {
component: <AddLinkController/>
});
}
if(!tabs.length) {
if (Device.phone) {
f7.popup.close('.add-popup', false);
} else {
f7.popover.close('#add-popover', false);
}
return null;
}
return (
<View style={props.style} stackPages={true} routes={routes}>
<Page pageContent={false}>
@ -164,10 +183,10 @@ class AddView extends Component {
return (
show_popover ?
<Popover id="add-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => this.props.onclosed()}>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} inPopover={true} onOptionClick={this.onoptionclick} style={{height: '410px'}} showPanels={this.props.showPanels}/>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} wsLock={this.props.wsLock} wsProps={this.props.wsProps} inPopover={true} onOptionClick={this.onoptionclick} style={{height: '410px'}} showPanels={this.props.showPanels}/>
</Popover> :
<Popup className="add-popup" onPopupClosed={() => this.props.onclosed()}>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} onOptionClick={this.onoptionclick} showPanels={this.props.showPanels}/>
<AddTabs isAddShapeHyperlink={this.props.isAddShapeHyperlink} wsLock={this.props.wsLock} wsProps={this.props.wsProps} onOptionClick={this.onoptionclick} showPanels={this.props.showPanels}/>
</Popup>
)
}
@ -186,6 +205,7 @@ const Add = props => {
// component will unmount
}
});
const onviewclosed = () => {
if ( props.onclosed )
props.onclosed();
@ -221,6 +241,8 @@ const Add = props => {
onclosed={onviewclosed}
showPanels={options ? options.panels : undefined}
isAddShapeHyperlink = {isAddShapeHyperlink}
wsProps={props.wsProps}
wsLock={props.wsLock}
/>
};

View file

@ -6,6 +6,8 @@ const AddSortAndFilter = props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const isFilter = props.isFilter;
const wsLock = props.wsLock;
return (
<Page>
<Navbar title={_t.textSortAndFilter} backLink={_t.textBack}/>
@ -21,14 +23,16 @@ const AddSortAndFilter = props => {
</Row>
</ListItem>
</List>
<List>
<ListItem title={_t.textFilter}>
<Toggle checked={isFilter}
onToggleChange={(prev) => {
props.onInsertFilter(!prev);
}}/>
</ListItem>
</List>
{!wsLock &&
<List>
<ListItem title={_t.textFilter}>
<Toggle checked={isFilter}
onToggleChange={(prev) => {
props.onInsertFilter(!prev);
}}/>
</ListItem>
</List>
}
</Page>
)
};

View file

@ -6,23 +6,25 @@ const AddOther = props => {
const { t } = useTranslation();
const _t = t('View.Add', {returnObjects: true});
const hideAddComment = props.hideAddComment();
const wsProps = props.wsProps;
return (
<List>
<ListItem title={_t.textImage} link={'/add-image/'}>
<ListItem title={_t.textImage} className={wsProps.Objects && 'disabled'} link={'/add-image/'}>
<Icon slot="media" icon="icon-insimage"></Icon>
</ListItem>
{!hideAddComment && <ListItem title={_t.textComment} onClick={() => {
{(!hideAddComment && !wsProps.Objects) && <ListItem title={_t.textComment} onClick={() => {
props.closeModal();
Common.Notifications.trigger('addcomment');
}}>
<Icon slot="media" icon="icon-insert-comment"></Icon>
</ListItem>}
<ListItem title={_t.textLink} link={'/add-link/'}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
<ListItem title={_t.textSortAndFilter} link={'/add-sort-and-filter/'}>
<ListItem title={_t.textSortAndFilter} className={wsProps.Sort && 'disabled'} link={'/add-sort-and-filter/'}>
<Icon slot="media" icon="icon-sort"></Icon>
</ListItem>
<ListItem title={_t.textLink} className={wsProps.InsertHyperlinks && 'disabled'} link={'/add-link/'}>
<Icon slot="media" icon="icon-link"></Icon>
</ListItem>
</List>
)
};

View file

@ -290,6 +290,9 @@ const EditLayoutNavbar = ({ editors, inPopover }) => {
const isAndroid = Device.android;
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
if(!editors.length) return null;
return (
<Navbar>
{
@ -297,8 +300,7 @@ const EditLayoutNavbar = ({ editors, inPopover }) => {
<div className='tab-buttons tabbar'>
{editors.map((item, index) => <Link key={"sse-link-" + item.id} tabLink={"#" + item.id} tabLinkActive={index === 0}>{item.caption}</Link>)}
{isAndroid && <span className='tab-link-highlight' style={{width: 100 / editors.length + '%'}}></span>}
</div> :
<NavTitle>{ editors[0].caption }</NavTitle>
</div> : <NavTitle>{ editors[0].caption }</NavTitle>
}
{ !inPopover && <NavRight><Link icon='icon-expand-down' sheetClose></Link></NavRight> }
</Navbar>
@ -306,6 +308,8 @@ const EditLayoutNavbar = ({ editors, inPopover }) => {
};
const EditLayoutContent = ({ editors }) => {
if(!editors.length) return null;
if (editors.length > 1) {
return (
<Tabs animated>
@ -329,6 +333,8 @@ const EditTabs = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const store = props.storeFocusObjects;
const wsLock = props.wsLock;
const wsProps = props.wsProps;
const settings = !store.focusOn ? [] : (store.focusOn === 'obj' ? store.objects : store.selections);
let editors = [];
@ -345,41 +351,53 @@ const EditTabs = props => {
component: <EditCellController />
})
}
if (settings.indexOf('shape') > -1) {
editors.push({
caption: _t.textShape,
id: 'edit-shape',
component: <EditShapeController />
})
}
if (settings.indexOf('image') > -1) {
editors.push({
caption: _t.textImage,
id: 'edit-image',
component: <EditImageController />
})
}
if (settings.indexOf('text') > -1) {
editors.push({
caption: _t.textText,
id: 'edit-text',
component: <EditTextController />
})
}
if (settings.indexOf('chart') > -1) {
editors.push({
caption: _t.textChart,
id: 'edit-chart',
component: <EditChartController />
})
}
if (settings.indexOf('hyperlink') > -1 || (props.hyperinfo && props.isAddShapeHyperlink)) {
editors.push({
caption: _t.textHyperlink,
id: 'edit-link',
component: <EditLinkController />
})
if(!wsProps.Objects) {
if (settings.indexOf('shape') > -1) {
editors.push({
caption: _t.textShape,
id: 'edit-shape',
component: <EditShapeController />
})
}
if (settings.indexOf('image') > -1) {
editors.push({
caption: _t.textImage,
id: 'edit-image',
component: <EditImageController />
})
}
if (settings.indexOf('text') > -1) {
editors.push({
caption: _t.textText,
id: 'edit-text',
component: <EditTextController />
})
}
if (settings.indexOf('chart') > -1) {
editors.push({
caption: _t.textChart,
id: 'edit-chart',
component: <EditChartController />
})
}
if (settings.indexOf('hyperlink') > -1 || (props.hyperinfo && props.isAddShapeHyperlink)) {
editors.push({
caption: _t.textHyperlink,
id: 'edit-link',
component: <EditLinkController />
})
}
}
}
if(!editors.length) {
if (Device.phone) {
f7.sheet.close('#edit-sheet', false);
} else {
f7.popover.close('#edit-popover', false);
}
return null;
}
return (
@ -403,10 +421,10 @@ const EditView = props => {
return (
show_popover ?
<Popover id="edit-popover" className="popover__titled" closeByOutsideClick={false} onPopoverClosed={() => props.onClosed()}>
<EditTabsContainer isAddShapeHyperlink={props.isAddShapeHyperlink} hyperinfo={props.hyperinfo} inPopover={true} onOptionClick={onOptionClick} style={{height: '410px'}} />
<EditTabsContainer isAddShapeHyperlink={props.isAddShapeHyperlink} hyperinfo={props.hyperinfo} inPopover={true} wsLock={props.wsLock} wsProps={props.wsProps} onOptionClick={onOptionClick} style={{height: '410px'}} />
</Popover> :
<Sheet id="edit-sheet" push onSheetClosed={() => props.onClosed()}>
<EditTabsContainer isAddShapeHyperlink={props.isAddShapeHyperlink} hyperinfo={props.hyperinfo} onOptionClick={onOptionClick} />
<EditTabsContainer isAddShapeHyperlink={props.isAddShapeHyperlink} hyperinfo={props.hyperinfo} onOptionClick={onOptionClick} wsLock={props.wsLock} wsProps={props.wsProps} />
</Sheet>
)
};
@ -433,7 +451,7 @@ const EditOptions = props => {
const isAddShapeHyperlink = api.asc_canAddShapeHyperlink();
return (
<EditView usePopover={!Device.phone} onClosed={onviewclosed} isAddShapeHyperlink={isAddShapeHyperlink} hyperinfo={hyperinfo} />
<EditView usePopover={!Device.phone} onClosed={onviewclosed} isAddShapeHyperlink={isAddShapeHyperlink} hyperinfo={hyperinfo} wsLock={props.wsLock} wsProps={props.wsProps} />
)
};

View file

@ -11,6 +11,8 @@ const EditCell = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeCellSettings = props.storeCellSettings;
const storeWorksheets = props.storeWorksheets;
const wsProps = storeWorksheets.wsProps;
const cellStyles = storeCellSettings.cellStyles;
const styleName = storeCellSettings.styleName;
@ -40,79 +42,84 @@ const EditCell = props => {
onFontSize: props.onFontSize,
onFontClick: props.onFontClick
}}/>
<ListItem className='buttons'>
<Row>
<a className={'button' + (isBold ? ' active' : '')} onClick={() => {props.toggleBold(!isBold)}}><b>B</b></a>
<a className={'button' + (isItalic ? ' active' : '')} onClick={() => {props.toggleItalic(!isItalic)}}><i>I</i></a>
<a className={'button' + (isUnderline ? ' active' : '')} onClick={() => {props.toggleUnderline(!isUnderline)}} style={{textDecoration: "underline"}}>U</a>
</Row>
</ListItem>
<ListItem title={_t.textTextColor} link="/edit-cell-text-color/" routeProps={{
onTextColor: props.onTextColor
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-text-color">{fontColorPreview}</Icon> :
fontColorPreview
}
</ListItem>
<ListItem title={_t.textFillColor} link="/edit-cell-fill-color/" routeProps={{
onFillColor: props.onFillColor
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-fill-color">{fillColorPreview}</Icon> :
fillColorPreview
}
</ListItem>
<ListItem title={_t.textTextFormat} link="/edit-cell-text-format/" routeProps={{
onHAlignChange: props.onHAlignChange,
onVAlignChange: props.onVAlignChange,
onWrapTextChange: props.onWrapTextChange
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-text-align-left"></Icon> : null
}
</ListItem>
<ListItem title={_t.textTextOrientation} link="/edit-cell-text-orientation/" routeProps={{
onTextOrientationChange: props.onTextOrientationChange
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-text-orientation-horizontal"></Icon> : null
}
</ListItem>
<ListItem title={_t.textBorderStyle} link="/edit-cell-border-style/" routeProps={{
onBorderStyle: props.onBorderStyle
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-table-borders-all"></Icon> : null
}
</ListItem>
</List>
<List>
<ListItem title={_t.textFormat} link="/edit-format-cell/" routeProps={{
onCellFormat: props.onCellFormat,
onCurrencyCellFormat: props.onCurrencyCellFormat,
onAccountingCellFormat: props.onAccountingCellFormat,
dateFormats: props.dateFormats,
timeFormats: props.timeFormats
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-format-general"></Icon> : null
}
</ListItem>
</List>
<BlockTitle>{_t.textCellStyles}</BlockTitle>
{cellStyles.length ? (
<List className="cell-styles-list">
{cellStyles.map((elem, index) => {
return (
<ListItem key={index}
className={elem.name === styleName ? "item-theme active" : "item-theme"} onClick={() => props.onStyleClick(elem.name)}>
<div className='thumb' style={{backgroundImage: `url(${elem.image})`}}></div>
</ListItem>
)
})}
</List>
) : null}
{!wsProps.FormatCells &&
<>
<List>
<ListItem className='buttons'>
<Row>
<a className={'button' + (isBold ? ' active' : '')} onClick={() => {props.toggleBold(!isBold)}}><b>B</b></a>
<a className={'button' + (isItalic ? ' active' : '')} onClick={() => {props.toggleItalic(!isItalic)}}><i>I</i></a>
<a className={'button' + (isUnderline ? ' active' : '')} onClick={() => {props.toggleUnderline(!isUnderline)}} style={{textDecoration: "underline"}}>U</a>
</Row>
</ListItem>
<ListItem title={_t.textTextColor} link="/edit-cell-text-color/" routeProps={{
onTextColor: props.onTextColor
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-text-color">{fontColorPreview}</Icon> :
fontColorPreview
}
</ListItem>
<ListItem title={_t.textFillColor} link="/edit-cell-fill-color/" routeProps={{
onFillColor: props.onFillColor
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-fill-color">{fillColorPreview}</Icon> :
fillColorPreview
}
</ListItem>
<ListItem title={_t.textTextFormat} link="/edit-cell-text-format/" routeProps={{
onHAlignChange: props.onHAlignChange,
onVAlignChange: props.onVAlignChange,
onWrapTextChange: props.onWrapTextChange
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-text-align-left"></Icon> : null
}
</ListItem>
<ListItem title={_t.textTextOrientation} link="/edit-cell-text-orientation/" routeProps={{
onTextOrientationChange: props.onTextOrientationChange
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-text-orientation-horizontal"></Icon> : null
}
</ListItem>
<ListItem title={_t.textBorderStyle} link="/edit-cell-border-style/" routeProps={{
onBorderStyle: props.onBorderStyle
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-table-borders-all"></Icon> : null
}
</ListItem>
</List>
<List>
<ListItem title={_t.textFormat} link="/edit-format-cell/" routeProps={{
onCellFormat: props.onCellFormat,
onCurrencyCellFormat: props.onCurrencyCellFormat,
onAccountingCellFormat: props.onAccountingCellFormat,
dateFormats: props.dateFormats,
timeFormats: props.timeFormats
}}>
{!isAndroid ?
<Icon slot="media" icon="icon-format-general"></Icon> : null
}
</ListItem>
</List>
<BlockTitle>{_t.textCellStyles}</BlockTitle>
{cellStyles.length ? (
<List className="cell-styles-list">
{cellStyles.map((elem, index) => {
return (
<ListItem key={index}
className={elem.name === styleName ? "item-theme active" : "item-theme"} onClick={() => props.onStyleClick(elem.name)}>
<div className='thumb' style={{backgroundImage: `url(${elem.image})`}}></div>
</ListItem>
)
})}
</List>
) : null}
</>}
</List>
</Fragment>
)
};
@ -977,7 +984,7 @@ const PageTimeFormatCell = props => {
}
const PageEditCell = inject("storeCellSettings")(observer(EditCell));
const PageEditCell = inject("storeCellSettings", "storeWorksheets")(observer(EditCell));
const TextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageTextColorCell));
const FillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageFillColorCell));
const CustomTextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomTextColorCell));

View file

@ -197,6 +197,8 @@ const PageSpreadsheetSettings = props => {
const { t } = useTranslation();
const _t = t('View.Settings', {returnObjects: true});
const storeSpreadsheetSettings = props.storeSpreadsheetSettings;
const storeWorksheets = props.storeWorksheets;
const wsProps = storeWorksheets.wsProps;
const isPortrait = storeSpreadsheetSettings.isPortrait;
const isHideHeadings = storeSpreadsheetSettings.isHideHeadings;
const isHideGridlines = storeSpreadsheetSettings.isHideGridlines;
@ -253,7 +255,7 @@ const PageSpreadsheetSettings = props => {
</ListItem>
</List>
<List>
<ListItem title={_t.textColorSchemes} link="/color-schemes/" routeProps={{
<ListItem title={_t.textColorSchemes} className={wsProps.FormatCells ? 'disabled' : ''} link="/color-schemes/" routeProps={{
onColorSchemeChange: props.onColorSchemeChange,
initPageColorSchemes: props.initPageColorSchemes
}}></ListItem>
@ -264,7 +266,7 @@ const PageSpreadsheetSettings = props => {
const SpreadsheetFormats = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetFormats));
const SpreadsheetMargins = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetMargins));
const SpreadsheetSettings = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetSettings));
const SpreadsheetSettings = inject("storeSpreadsheetSettings", "storeWorksheets")(observer(PageSpreadsheetSettings));
const SpreadsheetColorSchemes = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetColorSchemes));
export {