mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-07-27 18:43:30 +08:00
added hyphenation toggle
This commit is contained in:
@ -749,6 +749,7 @@
|
||||
"textMargins": "Margins",
|
||||
"textMarginsH": "Top and bottom margins are too high for a given page height",
|
||||
"textMarginsW": "Left and right margins are too wide for a given page width",
|
||||
"textHyphenation": "Hyphenation",
|
||||
"textMobileView": "Mobile View",
|
||||
"textNavigation": "Navigation",
|
||||
"textNo": "No",
|
||||
|
||||
@ -12,6 +12,7 @@ class DocumentSettingsController extends Component {
|
||||
this.applyMargins = this.applyMargins.bind(this);
|
||||
this.onFormatChange = this.onFormatChange.bind(this);
|
||||
this.onColorSchemeChange = this.onColorSchemeChange.bind(this);
|
||||
this.onToggleHyphenation = this.onToggleHyphenation.bind(this);
|
||||
}
|
||||
|
||||
onPageOrientation (value){
|
||||
@ -98,6 +99,16 @@ class DocumentSettingsController extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
onToggleHyphenation(value) {
|
||||
const api = Common.EditorApi.get();
|
||||
const storeDocumentSettings = this.props.storeDocumentSettings;
|
||||
|
||||
if (api) {
|
||||
api.asc_setAutoHyphenation(value);
|
||||
storeDocumentSettings.setHyphenation(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Color Schemes
|
||||
|
||||
initPageColorSchemes() {
|
||||
@ -119,6 +130,7 @@ class DocumentSettingsController extends Component {
|
||||
applyMargins={this.applyMargins}
|
||||
onColorSchemeChange={this.onColorSchemeChange}
|
||||
initPageColorSchemes={this.initPageColorSchemes}
|
||||
onToggleHyphenation={this.onToggleHyphenation}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@ -7,19 +7,30 @@ export class storeDocumentSettings {
|
||||
widthDocument: observable,
|
||||
heightDocument: observable,
|
||||
allSchemes: observable,
|
||||
isHyphenation: observable,
|
||||
resetPortrait: action,
|
||||
changeDocSize: action,
|
||||
pageSizesIndex: computed,
|
||||
addSchemes: action
|
||||
addSchemes: action,
|
||||
setHyphenation: action
|
||||
});
|
||||
}
|
||||
|
||||
isPortrait = true;
|
||||
isHyphenation = false;
|
||||
|
||||
resetPortrait (isPortrait) {
|
||||
this.isPortrait = isPortrait === true;
|
||||
}
|
||||
|
||||
setHyphenation (value) {
|
||||
this.isHyphenation = value;
|
||||
}
|
||||
|
||||
getHyphenation () {
|
||||
return this.isHyphenation;
|
||||
}
|
||||
|
||||
//Document Formats
|
||||
|
||||
widthDocument;
|
||||
@ -60,7 +71,7 @@ export class storeDocumentSettings {
|
||||
];
|
||||
return pageSizes;
|
||||
}
|
||||
|
||||
|
||||
get pageSizesIndex () {
|
||||
let w = this.widthDocument;
|
||||
let h = this.heightDocument;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import React, {useState} from 'react';
|
||||
import {observer, inject} from "mobx-react";
|
||||
import {Page, Navbar, List, ListItem, BlockTitle, Segmented, Button, Icon} from 'framework7-react';
|
||||
import {Page, Navbar, List, ListItem, BlockTitle, Segmented, Button, Icon, Toggle} from 'framework7-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {Device} from '../../../../../common/mobile/utils/device';
|
||||
import { f7 } from 'framework7-react';
|
||||
@ -223,6 +223,8 @@ const PageDocumentSettings = props => {
|
||||
const pageSizesIndex = storeSettings.pageSizesIndex;
|
||||
const widthDoc = storeSettings.widthDocument;
|
||||
const heightDoc = storeSettings.heightDocument;
|
||||
|
||||
let isHyphenation = storeSettings.getHyphenation();
|
||||
let textFormat;
|
||||
let sizeW;
|
||||
let sizeH;
|
||||
@ -257,6 +259,11 @@ const PageDocumentSettings = props => {
|
||||
applyMargins: props.applyMargins
|
||||
}}></ListItem>
|
||||
</List>
|
||||
<List>
|
||||
<ListItem title={_t.textHyphenation}>
|
||||
<Toggle checked={isHyphenation} onToggleChange={() => {props.onToggleHyphenation(!isHyphenation)}}/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<List>
|
||||
<ListItem title={_t.textColorSchemes} link="/color-schemes/" routeProps={{
|
||||
onColorSchemeChange: props.onColorSchemeChange,
|
||||
|
||||
Reference in New Issue
Block a user