From 5818a5983a1b33445da59f2c7a4644a1bc61f68d Mon Sep 17 00:00:00 2001 From: sijumoncy <72241997+sijumoncy@users.noreply.github.com> Date: Wed, 29 May 2024 09:20:54 +0530 Subject: [PATCH] general font change for all resource and editor seperate change option --- .../EditorPage/TextEditor/Editor.jsx | 6 +-- .../EditorPage/TextEditor/EditorMenuBar.jsx | 45 ++++++++++++++++++- .../TextEditor/ReferenceScribex.jsx | 12 ++--- .../EditorPage/TextEditor/index.jsx | 10 +++-- renderer/src/layouts/editor/SubMenuBar.js | 33 +++++++++----- renderer/src/modules/editor/Editor.js | 45 +++++++++++++++++-- 6 files changed, 122 insertions(+), 29 deletions(-) diff --git a/renderer/src/components/EditorPage/TextEditor/Editor.jsx b/renderer/src/components/EditorPage/TextEditor/Editor.jsx index 9423e062c..aed580380 100644 --- a/renderer/src/components/EditorPage/TextEditor/Editor.jsx +++ b/renderer/src/components/EditorPage/TextEditor/Editor.jsx @@ -39,7 +39,7 @@ export default function Editor(props) { const { state: { - chapter, selectedFont, fontSize, projectScriptureDir, + chapter, selectedFont, editorFontSize, projectScriptureDir, }, } = useContext(ReferenceContext); @@ -166,8 +166,8 @@ export default function Editor(props) { id="fulleditor" style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, - lineHeight: (fontSize > 1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', direction: `${projectScriptureDir === 'RTL' ? 'rtl' : 'auto'}`, }} className="border-l-2 border-r-2 border-secondary pb-16 overflow-auto h-full scrollbars-width leading-8" diff --git a/renderer/src/components/EditorPage/TextEditor/EditorMenuBar.jsx b/renderer/src/components/EditorPage/TextEditor/EditorMenuBar.jsx index 6cbaf96b7..49391c0fe 100644 --- a/renderer/src/components/EditorPage/TextEditor/EditorMenuBar.jsx +++ b/renderer/src/components/EditorPage/TextEditor/EditorMenuBar.jsx @@ -4,6 +4,7 @@ import { ProjectContext } from '@/components/context/ProjectContext'; import MenuDropdown from '@/components/MenuDropdown/MenuDropdown'; import { LockClosedIcon, BookmarkIcon, LockOpenIcon } from '@heroicons/react/24/outline'; // import BibleNavigationX from '@/components/EditorPage/TextEditor/BibleNavigationX'; +import { useTranslation } from 'react-i18next'; import BibleNavigationX from './BibleNavigationX'; import Buttons from './Buttons'; import InsertMenu from './InsertMenu'; @@ -17,16 +18,29 @@ export default function EditorMenuBar(props) { setVerseNumber, handleSelectedFont, setTriggerVerseInsert, + setEditorFontSize, + editorFontSize, } = props; + const { t } = useTranslation(); + const { states: { scrollLock }, actions: { setScrollLock }, } = useContext(ProjectContext); + const handleFontSize = (status) => { + if (status === 'dec' && editorFontSize > 0.70) { + setEditorFontSize(editorFontSize - 0.2); + } + if (status === 'inc' && editorFontSize < 2) { + setEditorFontSize(editorFontSize + 0.2); + } + }; + return (