From ef5c5bf5e640e7bb0b6ff88ebc4a6c97f875cf79 Mon Sep 17 00:00:00 2001 From: Danis Date: Mon, 25 Aug 2025 19:11:05 +0400 Subject: [PATCH] added hyphenation toggle --- apps/documenteditor/mobile/locale/en.json | 1 + .../src/controller/settings/DocumentSettings.jsx | 12 ++++++++++++ .../mobile/src/store/documentSettings.js | 15 +++++++++++++-- .../mobile/src/view/settings/DocumentSettings.jsx | 9 ++++++++- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 64f149b69b..0f2339119f 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -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", diff --git a/apps/documenteditor/mobile/src/controller/settings/DocumentSettings.jsx b/apps/documenteditor/mobile/src/controller/settings/DocumentSettings.jsx index a336121173..a21ddf1d10 100644 --- a/apps/documenteditor/mobile/src/controller/settings/DocumentSettings.jsx +++ b/apps/documenteditor/mobile/src/controller/settings/DocumentSettings.jsx @@ -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} /> ) } diff --git a/apps/documenteditor/mobile/src/store/documentSettings.js b/apps/documenteditor/mobile/src/store/documentSettings.js index bd01303c4a..393f093f37 100644 --- a/apps/documenteditor/mobile/src/store/documentSettings.js +++ b/apps/documenteditor/mobile/src/store/documentSettings.js @@ -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; diff --git a/apps/documenteditor/mobile/src/view/settings/DocumentSettings.jsx b/apps/documenteditor/mobile/src/view/settings/DocumentSettings.jsx index cd9b45879b..c2c110e746 100644 --- a/apps/documenteditor/mobile/src/view/settings/DocumentSettings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/DocumentSettings.jsx @@ -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 }}> + + + {props.onToggleHyphenation(!isHyphenation)}}/> + +