diff --git a/renderer/src/components/AudioRecorder/components/ReferenceSelector.js b/renderer/src/components/AudioRecorder/components/ReferenceSelector.js index be9e05d6b..2268d8382 100644 --- a/renderer/src/components/AudioRecorder/components/ReferenceSelector.js +++ b/renderer/src/components/AudioRecorder/components/ReferenceSelector.js @@ -3,7 +3,9 @@ import PropTypes from 'prop-types'; const AudioWaveform = dynamic(() => import('./WaveForm'), { ssr: false }); -export default function ReferenceSelector({ data, versepath, verse }) { +export default function ReferenceSelector({ + data, versepath, verse, font, fontSize, +}) { const path = require('path'); return (
@@ -21,7 +23,14 @@ export default function ReferenceSelector({ data, versepath, verse }) { {story.verseNumber}
-

+

1.3) ? 1.5 : '', + }} + > {story.verseText}

diff --git a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js index 274f4f5be..793151c69 100644 --- a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js +++ b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js @@ -31,7 +31,7 @@ const AudioEditor = ({ editor }) => { audioContent, audioPath, selectedFont, - fontSize, + editorFontSize, // eslint-disable-next-line no-unused-vars updateWave, // updateWave is used to update the waveform in the Editor after recording audio }, actions: { @@ -219,7 +219,7 @@ const AudioEditor = ({ editor }) => { verse={verse} location={audioPath} updateWave={updateWave} - fontSize={fontSize} + fontSize={editorFontSize} selectedFont={selectedFont} /> )} diff --git a/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js b/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js index 3dee90440..61bda0a19 100644 --- a/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js +++ b/renderer/src/components/EditorPage/ObsEditor/EditorPanel.js @@ -8,12 +8,13 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { const { state: { selectedFont, - fontSize, + editorFontSize, }, actions: { setSelectedStory, }, } = useContext(ReferenceContext); + const { states: { scrollLock } } = useContext(ProjectContext); const { t } = useTranslation(); const handleChange = (e) => { @@ -90,7 +91,7 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { className="flex-grow text-justify ml-2 p-2 text-xl" style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, + fontSize: `${editorFontSize}rem`, }} /> @@ -118,8 +119,8 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { onInput={(e) => handleAutoHeight(e)} style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, - lineHeight: (fontSize > 1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', }} /> @@ -140,8 +141,8 @@ const EditorPanel = ({ obsStory, storyUpdate }) => { className="flex-grow text-justify ml-2 p-2 text-sm" style={{ fontFamily: selectedFont || 'sans-serif', - fontSize: `${fontSize}rem`, - lineHeight: (fontSize > 1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', }} /> diff --git a/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js b/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js index 26e903744..9e3c0526b 100644 --- a/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js +++ b/renderer/src/components/EditorPage/ObsEditor/ObsEditor.js @@ -19,7 +19,11 @@ import { getDetails } from './utils/getDetails'; const ObsEditor = () => { const [mdData, setMdData] = useState(); const [directoryName, setDirectoryName] = useState(); - const { state: { obsNavigation, loadData }, actions: { setLoadData } } = useContext(ReferenceContext); + const { + state: { + obsNavigation, loadData, +}, actions: { setLoadData }, +} = useContext(ReferenceContext); const updateStory = (story) => { logger.debug('ObsEditor.js', 'In updateStory for upadting the story to the backend md file'); @@ -89,6 +93,7 @@ const ObsEditor = () => { ); localforage.setItem('projectmeta', value); // This func will update the scribe-setting.json file + // saveReferenceResource(selectedFont, editorFontSize); saveReferenceResource(); }); }); diff --git a/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js b/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js index ab236fddc..376ddb769 100644 --- a/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js +++ b/renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js @@ -18,14 +18,15 @@ const style = { fontStyle: 'italic', }, }; -const ReferenceObs = ({ stories, font, title }) => { +const ReferenceObs = ({ + stories, font, title, fontSize, +}) => { const [isLoading, setIsLoading] = useState(true); const [direction, setDirection] = useState('ltr'); const [networkState, setNetworkState] = useState({ online: true }); const { state: { selectedStory, - fontSize, }, actions: { setSelectedStory, diff --git a/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js b/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js index 9135e95c4..88700360a 100644 --- a/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js +++ b/renderer/src/components/EditorPage/ObsEditor/WebReferenceObs.js @@ -26,7 +26,7 @@ const ReferenceObs = ({ stories }) => { state: { selectedStory, selectedFont, - fontSize, + fontSize1: fontSize, }, actions: { setSelectedStory, diff --git a/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js b/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js index cda21beb9..e9be9002b 100644 --- a/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js +++ b/renderer/src/components/EditorPage/Reference/Audio/ReferenceAudio.js @@ -25,6 +25,8 @@ const ReferenceAudio = ({ chapter, verse, bookId, + font, + fontSize, }) => { const { actions: { @@ -227,6 +229,8 @@ const ReferenceAudio = ({ data={bookData} versepath={mp3Path} verse={verse} + font={font} + fontSize={fontSize} // goToVerse={{ // chapter: parseInt(chapter, 10), // verse: parseInt(verse, 10), diff --git a/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js b/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js index 5890d1168..6d97e2069 100644 --- a/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js +++ b/renderer/src/components/EditorPage/Reference/OBS/ObsResourceCard.js @@ -17,6 +17,7 @@ function ObsResourceCard({ isLoading, setIndex, font, + fontSize, }) { const { state: { filters, markdownView }, @@ -36,7 +37,12 @@ function ObsResourceCard({ itemIndex={index} setItemIndex={setIndex} /> -
+
1.3) ? 1.5 : '', + }} + > setIndex(v)} font={font} + fontSize={fontSize} /> ) : ); diff --git a/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js b/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js index 8c226d1f5..63654c297 100644 --- a/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js +++ b/renderer/src/components/EditorPage/Reference/OBS/ObsTwlCard.js @@ -23,6 +23,7 @@ function ObsTwlCard({ resourceId, offlineResource, font, + fontSize, ...props }) { const [index, setIndex] = useState(1); @@ -104,6 +105,7 @@ function ObsTwlCard({ index={index} setIndex={(v) => setIndex(v)} font={font} + fontSize={fontSize} /> ) : ( diff --git a/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js b/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js index 472e791c1..5ff7a6c7c 100644 --- a/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js +++ b/renderer/src/components/EditorPage/Reference/ReferenceBible/ReferenceBibleX.js @@ -13,6 +13,7 @@ const ReferenceBibleX = ({ refName, bookId, font, + fontSize, }) => { const { states: { @@ -47,6 +48,7 @@ const ReferenceBibleX = ({ refName, scrollLock, font, + fontSize, }; return ( <> diff --git a/renderer/src/components/EditorPage/Reference/ReferenceCard.js b/renderer/src/components/EditorPage/Reference/ReferenceCard.js index c3de35bb1..e3b93af7e 100644 --- a/renderer/src/components/EditorPage/Reference/ReferenceCard.js +++ b/renderer/src/components/EditorPage/Reference/ReferenceCard.js @@ -15,6 +15,7 @@ const ReferenceCard = ({ font, setResetTrigger, resetTrigger, + fontSize, }) => { const { state: { @@ -43,7 +44,12 @@ const ReferenceCard = ({ setItemIndex={setItemIndex} /> )} -
+
1.3) ? 1.5 : '', + }} + > { const { state: { @@ -40,6 +40,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'twl': @@ -56,6 +57,7 @@ const TranslationHelps = ({ owner="test_org" server="https://git.door43.org" font={font} + fontSize={fontSize} /> ); case 'twlm': @@ -72,6 +74,7 @@ const TranslationHelps = ({ owner={owner} server="https://git.door43.org" font={font} + fontSize={fontSize} /> ); case 'tq': @@ -90,6 +93,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'tw': @@ -106,6 +110,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'ta': @@ -123,6 +128,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'bible': @@ -135,6 +141,7 @@ const TranslationHelps = ({ chapter={chapter} verse={verse} font={font} + fontSize={fontSize} /> ); case 'obs': @@ -147,6 +154,7 @@ const TranslationHelps = ({ chapter={chapter} verse={verse} font={font} + fontSize={fontSize} /> ); case 'obs-tn': @@ -163,6 +171,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'obs-tq': @@ -179,6 +188,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); case 'obs-twlm': @@ -195,6 +205,7 @@ const TranslationHelps = ({ server="https://git.door43.org" offlineResource={offlineResource} font={font} + fontSize={fontSize} /> ); default: diff --git a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js index 1b15f9323..425db8547 100644 --- a/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js +++ b/renderer/src/components/EditorPage/Reference/TranslationHelpsCard.js @@ -32,6 +32,7 @@ export default function TranslationHelpsCard({ viewMode, offlineResource, font, + fontSize, }) { const [offlineItems, setOfflineItems] = useState([]); const [offlineItemsDisable, setOfflineItemsDisable] = useState(false); @@ -271,6 +272,7 @@ export default function TranslationHelpsCard({ selectedQuote={selectedQuote} setQuote={setQuote} font={font} + fontSize={fontSize} setResetTrigger={setResetTrigger} resetTrigger={resetTrigger} /> 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..a4900eb6f 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, + handleEditorFontSize, + editorFontSize, } = props; + const { t } = useTranslation(); + const { states: { scrollLock }, actions: { setScrollLock }, } = useContext(ProjectContext); + const handleFontSize = (status) => { + if (status === 'dec' && editorFontSize > 0.70) { + handleEditorFontSize(editorFontSize - 0.2); + } + if (status === 'inc' && editorFontSize < 2) { + handleEditorFontSize(editorFontSize + 0.2); + } + }; + return (
-
+
Editor
+ + +
{ setSelectedBook(bookId.toUpperCase()); diff --git a/renderer/src/components/EditorPage/TextEditor/index.jsx b/renderer/src/components/EditorPage/TextEditor/index.jsx index c2e35b7b0..21d261959 100644 --- a/renderer/src/components/EditorPage/TextEditor/index.jsx +++ b/renderer/src/components/EditorPage/TextEditor/index.jsx @@ -28,8 +28,10 @@ export default function TextEditor() { const { usfmData, bookAvailable } = useReadUsfmFile(); const { - state: { bookId, selectedFont }, - actions: { handleSelectedFont, onChangeChapter, onChangeVerse }, + state: { bookId, selectedFont, editorFontSize }, + actions: { + handleSelectedFont, onChangeChapter, onChangeVerse, handleEditorFontSize, + }, } = useContext(ReferenceContext); const { @@ -59,7 +61,7 @@ export default function TextEditor() { useEffect(() => { onChangeChapter(chapterNumber, 1); onChangeVerse(verseNumber, 1); - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [chapterNumber, verseNumber]); const { catalog } = useCatalog({ proskomma, stateId, verbose }); @@ -94,6 +96,7 @@ export default function TextEditor() { ...perfState, ...actions, ...perfActions, + editorFontSize, selectedFont, chapterNumber, verseNumber, @@ -101,6 +104,7 @@ export default function TextEditor() { bookName, bookChange, bookAvailable, + handleEditorFontSize, setBookChange, setChapterNumber, setVerseNumber, diff --git a/renderer/src/components/MenuDropdown/MenuDropdown.js b/renderer/src/components/MenuDropdown/MenuDropdown.js index b46e21be0..bbcf91959 100644 --- a/renderer/src/components/MenuDropdown/MenuDropdown.js +++ b/renderer/src/components/MenuDropdown/MenuDropdown.js @@ -14,7 +14,7 @@ import { } from 'font-detect-rhl'; export default function MenuDropdown({ - selectedFont, setSelectedFont, buttonStyle, + selectedFont, setSelectedFont, buttonStyle, showIcon = true, }) { const detectedFonts = useDetectFonts({ fonts: fontsArray }); const [query, setQuery] = useState(''); @@ -37,12 +37,16 @@ export default function MenuDropdown({ { + if (isElectron()) { + setEditorFontSize(currentFontSize); + // INFO : implement a debounce for this call if needed + saveReferenceResource(selectedFont, currentFontSize); + } + }; + useEffect(() => { localforage.getItem('currentProject').then(async (projectName) => { if (projectName) { @@ -108,17 +121,20 @@ export default function ReferenceContextProvider({ children }) { setBookmarksVerses(resources.project?.textTranslation.bookMarks); setProjectScriptureDir(resources.project?.textTranslation?.scriptDirection?.toUpperCase()); setSelectedFont(resources.project?.textTranslation?.font); + setEditorFontSize(resources.project?.textTranslation?.fontSize || 1); break; case 'textStories': setBookmarksVerses(resources.project?.textStories.bookMarks); setProjectScriptureDir(resources.project?.textStories?.scriptDirection?.toUpperCase()); setObsNavigation(resources.project?.textStories.navigation ? resources.project?.textStories.navigation : '1'); setSelectedFont(resources.project?.textStories?.font); + setEditorFontSize(resources.project?.textStories?.fontSize); break; case 'audioTranslation': setBookmarksVerses(resources.project?.audioTranslation.bookMarks); setProjectScriptureDir(resources.project?.audioTranslation?.scriptDirection?.toUpperCase()); setSelectedFont(resources.project?.audioTranslation?.font); + setEditorFontSize(resources.project?.audioTranslation?.fontSize || 1); break; default: break; @@ -196,7 +212,11 @@ export default function ReferenceContextProvider({ children }) { font2, font3, font4, - fontSize, + fontSize1, + fontSize2, + fontSize3, + fontSize4, + editorFontSize, layout, row, refernceLoading, @@ -229,6 +249,7 @@ export default function ReferenceContextProvider({ children }) { onChangeChapter, onChangeVerse, applyBooksFilter, + handleEditorFontSize, setAnchorEl, handleClick, setRefName, @@ -244,7 +265,11 @@ export default function ReferenceContextProvider({ children }) { setFont2, setFont3, setFont4, - setFontsize, + setEditorFontSize, + setFontsize1, + setFontsize2, + setFontsize3, + setFontsize4, setLayout, setRow, setRefernceLoading, diff --git a/renderer/src/core/burrito/importBurrito.js b/renderer/src/core/burrito/importBurrito.js index c85f14110..334a53436 100644 --- a/renderer/src/core/burrito/importBurrito.js +++ b/renderer/src/core/burrito/importBurrito.js @@ -394,6 +394,11 @@ const importBurrito = async (filePath, currentUser, updateBurritoVersion, concat } else { setting.font = (setting.project[metadata.type.flavorType.flavor.name].font) ? (setting.project[metadata.type.flavorType.flavor.name].font) : ''; } + if (!setting.project[metadata.type.flavorType.flavor.name]?.fontSize) { + setting.project[metadata.type.flavorType.flavor.name].fontSize = 1; + } else { + setting.fontSize = (setting.project[metadata.type.flavorType.flavor.name]?.fontSize) ? (setting.project[metadata.type.flavorType.flavor.name].fontSize) : 1; + } settings = setting; } settings.project[metadata.type.flavorType.flavor.name].lastSeen = moment().format(); diff --git a/renderer/src/core/editor/fetchSettingsResourceHistory.js b/renderer/src/core/editor/fetchSettingsResourceHistory.js index d6bc8d23e..0b052cf37 100644 --- a/renderer/src/core/editor/fetchSettingsResourceHistory.js +++ b/renderer/src/core/editor/fetchSettingsResourceHistory.js @@ -116,6 +116,7 @@ export async function fetchSettingsResourceHistory( owner: '', offlineResource: { offline: false }, font: '', + fontSize: 1, } )); } else if (_columnnum === historyColumn && _rownum === '2') { @@ -134,6 +135,7 @@ export async function fetchSettingsResourceHistory( owner: '', offlineResource: { offline: false }, font: '', + fontSize: 1, } )); } @@ -158,6 +160,7 @@ export async function fetchSettingsResourceHistory( owner: _value?.owner, offlineResource: _value?.offline, font: _value?.font, + fontSize: _value?.fontSize || 1, }); } if (_rownum === '2') { @@ -170,6 +173,7 @@ export async function fetchSettingsResourceHistory( owner: _value?.owner, offlineResource: _value?.offline, font: _value?.font, + fontSize: _value?.fontSize || 1, }); } }, diff --git a/renderer/src/core/editor/saveSettingsResourceHistory.js b/renderer/src/core/editor/saveSettingsResourceHistory.js index f8d690a6c..7add2b54b 100644 --- a/renderer/src/core/editor/saveSettingsResourceHistory.js +++ b/renderer/src/core/editor/saveSettingsResourceHistory.js @@ -19,6 +19,8 @@ export async function saveSettingsResourceHistory( setReferenceColumnData2, setOpenResourceR1, setOpenResourceR2, + selectedFont, + editorFontSize, ) { logger.debug('SaveSettingsResourceHistory.js', 'In save reference hsotory func'); // removingSection : "1" and openResourceR2 :false and sectionPlaceholderNum: "1" -> reference 2 to reference 1 @@ -70,6 +72,7 @@ export async function saveSettingsResourceHistory( owner: referenceColumnData2?.owner, offlineResource: referenceColumnData2.offlineResource, font: referenceColumnData2?.font, + fontSize: referenceColumnData2?.fontSize || 1, } )); setReferenceColumnData2((prev) => ({ @@ -81,6 +84,7 @@ export async function saveSettingsResourceHistory( owner: '', offlineResource: { offline: false }, font: '', + fontSize: 1, } )); setOpenResourceR1(false); @@ -95,6 +99,7 @@ export async function saveSettingsResourceHistory( navigation: { book: '1TI', chapter: '1' }, offline: referenceToUse.offlineResource, font: referenceToUse?.font, + fontSize: referenceToUse?.fontSize || 1, }, }; } @@ -111,6 +116,7 @@ export async function saveSettingsResourceHistory( navigation: { book: '1TI', chapter: '1' }, offline: referenceColumnData1.offlineResource, font: referenceColumnData1?.font, + fontSize: referenceColumnData1?.fontSize || 1, }, 2: { resouceId: referenceColumnData2?.selectedResource, @@ -120,6 +126,7 @@ export async function saveSettingsResourceHistory( navigation: { book: '1TI', chapter: '1' }, offline: referenceColumnData2.offlineResource, font: referenceColumnData2?.font, + fontSize: referenceColumnData2?.fontSize || 1, }, }; } @@ -139,7 +146,7 @@ export async function saveSettingsResourceHistory( setRemovingSection(); setAddingSection(); localforage.setItem('projectmeta', value).then(() => { - saveReferenceResource(); + saveReferenceResource(selectedFont, editorFontSize); resolve(); }); } diff --git a/renderer/src/core/projects/updateAgSettings.js b/renderer/src/core/projects/updateAgSettings.js index 0c27d716f..3b9b20104 100644 --- a/renderer/src/core/projects/updateAgSettings.js +++ b/renderer/src/core/projects/updateAgSettings.js @@ -12,7 +12,7 @@ import { // const newPath = require('../../../../supabase').newPath // } -export const updateAgSettings = async (username, projectName, data, font) => { +export const updateAgSettings = async (username, projectName, data, font, fontSize = 1) => { logger.debug('updateAgSettings.js', 'In updateAgSettings'); const newpath = localStorage.getItem('userPath'); const fs = window.require('fs'); @@ -31,10 +31,15 @@ export const updateAgSettings = async (username, projectName, data, font) => { if (!setting.project[data.type.flavorType.flavor.name].font) { setting.project[data.type.flavorType.flavor.name].font = font || ''; } + if (!setting.project[data.type.flavorType.flavor.name].fontSize) { + setting.project[data.type.flavorType.flavor.name].fontSize = fontSize || 1; + } } const savedFont = JSON.stringify(setting.project[data.type.flavorType.flavor.name].font); + const savedFontSize = JSON.stringify(setting.project[data.type.flavorType.flavor.name].fontSize); setting.project[data.type.flavorType.flavor.name] = data.project[data.type.flavorType.flavor.name]; setting.project[data.type.flavorType.flavor.name].font = font || JSON.parse(savedFont); + setting.project[data.type.flavorType.flavor.name].fontSize = fontSize || JSON.parse(savedFontSize); logger.debug('updateAgSettings.js', `Updating the ${environment.PROJECT_SETTING_FILE}`); await fs.writeFileSync(folder, JSON.stringify(setting)); }; @@ -57,6 +62,11 @@ export const updateWebAgSettings = async (username, projectName, data) => { } else { setting.project[data.type.flavorType.flavor.name].font = (setting.project[data.type.flavorType.flavor.name].font) ? (setting.project[data.type.flavorType.flavor.name].font) : ''; } + if (!setting.project[data.type.flavorType.flavor.name].fontSize) { + setting.project[data.type.flavorType.flavor.name].fontSize = 1; + } else { + setting.project[data.type.flavorType.flavor.name].fontSize = (setting.project[data.type.flavorType.flavor.name].fontSize) ? (setting.project[data.type.flavorType.flavor.name].fontSize) : 1; + } } await sbStorageUpload(folder, JSON.stringify(setting), { // cacheControl: '3600', @@ -64,7 +74,7 @@ export const updateWebAgSettings = async (username, projectName, data) => { }); }; -export const saveReferenceResource = (font = '') => { +export const saveReferenceResource = (font = '', fontSize = 1) => { logger.debug('updateAgSettings.js', 'In saveReferenceResource for saving the reference data'); localforage.getItem('currentProject').then(async (projectName) => { const _projectname = await splitStringByLastOccurance(projectName, '_'); @@ -78,7 +88,7 @@ export const saveReferenceResource = (font = '') => { if (id[0] === _projectname[1]) { localforage.getItem('userProfile').then(async (value) => { if (isElectron()) { - await updateAgSettings(value?.username, projectName, resources, font); + await updateAgSettings(value?.username, projectName, resources, font, fontSize); } else { await updateWebAgSettings(value?.user?.email, projectName, resources); } diff --git a/renderer/src/layouts/editor/EditorSection.js b/renderer/src/layouts/editor/EditorSection.js index 0632a539d..5e8c30690 100644 --- a/renderer/src/layouts/editor/EditorSection.js +++ b/renderer/src/layouts/editor/EditorSection.js @@ -40,6 +40,8 @@ export default function EditorSection({ setAddingSection, font, setFont, + fontSize, + setFontsize, }) { const [openResourcePopUp, setOpenResourcePopUp] = useState(false); const [openModal, setOpenModal] = useState(false); @@ -47,7 +49,6 @@ export default function EditorSection({ const { t } = useTranslation(); const { state: { - fontSize, layout, openResource1, openResource2, @@ -131,6 +132,15 @@ export default function EditorSection({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [openResourcePopUp, title]); + const handleFontSize = (status) => { + if (status === 'dec' && fontSize > 0.70) { + setFontsize(fontSize - 0.2); + } + if (status === 'inc' && fontSize < 2) { + setFontsize(fontSize + 0.2); + } + }; + const addRow = () => { if (sectionNum >= 0 && sectionNum < 2) { setSectionNum(sectionNum + 1); @@ -224,7 +234,10 @@ export default function EditorSection({ /> )} -
+
{title}
@@ -233,14 +246,20 @@ export default function EditorSection({ {scrollLock && title ? ( <> {CustomNavigation} -
+
{title}
) : (
-
+
{title}
@@ -248,10 +267,40 @@ export default function EditorSection({ )} )} -
+
+ + + {/* */}
@@ -183,8 +220,8 @@ export default function Editor({
1.3) ? 1.5 : '', + fontSize: `${editorFontSize}rem`, + lineHeight: (editorFontSize > 1.3) ? 1.5 : '', direction: `${projectScriptureDir === 'RTL' ? 'rtl' : 'auto'}`, }} aria-label="editor" diff --git a/renderer/src/util/createAudioVersification.js b/renderer/src/util/createAudioVersification.js index 5c59234b8..aec228e76 100644 --- a/renderer/src/util/createAudioVersification.js +++ b/renderer/src/util/createAudioVersification.js @@ -77,6 +77,7 @@ export const createAudioVersification = ( refResources: call === 'edit' ? currentBurrito.project.audioTranslation.refResources : [], bookMarks: call === 'edit' ? currentBurrito.project.audioTranslation.bookMarks : [], font: '', + fontSize: 1, }, }, sync: { services: { door43: [] } }, diff --git a/renderer/src/util/createObsContent.js b/renderer/src/util/createObsContent.js index b0a140d51..680d32b1a 100644 --- a/renderer/src/util/createObsContent.js +++ b/renderer/src/util/createObsContent.js @@ -192,6 +192,7 @@ export const createObsContent = ( refResources: call === 'edit' ? currentBurrito.project.textStories.refResources : [], bookMarks: call === 'edit' ? currentBurrito.project.textStories.bookMarks : [], font: '', + fontSize: 1, }, }, sync: { services: { door43: [] } }, @@ -372,6 +373,7 @@ export const createObsContent = ( }, sync: { services: { door43: [] } }, font: '', + fontSize: 1, }; const stat = await uploadFileToSupabase(`${supabasePath}/${environment.PROJECT_SETTING_FILE}`, JSON.stringify(settings)); ingredients[path.join('ingredients', environment.PROJECT_SETTING_FILE)] = { diff --git a/renderer/src/util/createVersificationUSFM.js b/renderer/src/util/createVersificationUSFM.js index 5280d62c4..42fa89978 100644 --- a/renderer/src/util/createVersificationUSFM.js +++ b/renderer/src/util/createVersificationUSFM.js @@ -162,6 +162,7 @@ export const createVersificationUSFM = ( refResources: call === 'edit' ? currentBurrito.project?.textTranslation.refResources : [], bookMarks: call === 'edit' ? currentBurrito.project?.textTranslation.bookMarks : [], font: '', + fontSize: 1, }, }, sync: { services: { door43: [] } }, @@ -347,6 +348,7 @@ export const createWebVersificationUSFM = async ( }, sync: { services: { door43: [] } }, font: '', + fontSize: 1, }; if (call === 'edit') { settings.sync = currentBurrito?.sync;