diff --git a/src/components/editor/TextSettings.vue b/src/components/editor/TextSettings.vue index 8169702..de0152e 100644 --- a/src/components/editor/TextSettings.vue +++ b/src/components/editor/TextSettings.vue @@ -452,6 +452,11 @@ const updateMarginInnerUnit = (unit) => { }; // Watchers for body styles +watch(font, (val) => { + if (isUpdatingFromStore) return; + updateStyle('body', 'font-family', `"${val}"`); +}); + watch(italic, (val) => { if (isUpdatingFromStore) return; updateStyle('body', 'font-style', val ? 'italic' : 'normal'); diff --git a/src/composables/useCssUpdater.js b/src/composables/useCssUpdater.js index 2eb6018..10f071f 100644 --- a/src/composables/useCssUpdater.js +++ b/src/composables/useCssUpdater.js @@ -14,13 +14,13 @@ export function useCssUpdater() { new RegExp(`(${property}:\\s*)[^;]+`, 'i'), `$1${value}` ); - store.content = store.content.replace(currentBlock, updatedBlock); + store.replaceBlock(currentBlock, updatedBlock); } else { const updatedBlock = currentBlock.replace( /(\s*})$/, ` ${property}: ${value};\n$1` ); - store.content = store.content.replace(currentBlock, updatedBlock); + store.replaceBlock(currentBlock, updatedBlock); } }; @@ -37,7 +37,7 @@ export function useCssUpdater() { ); if (updatedBlock !== currentBlock) { - store.content = store.content.replace(currentBlock, updatedBlock); + store.replaceBlock(currentBlock, updatedBlock); } }; @@ -57,7 +57,7 @@ export function useCssUpdater() { } if (updatedBlock !== currentBlock) { - store.content = store.content.replace(currentBlock, updatedBlock); + store.replaceBlock(currentBlock, updatedBlock); } }; @@ -65,7 +65,7 @@ export function useCssUpdater() { * Create a new CSS rule for a selector */ const createRule = (selector) => { - store.content += `\n\n${selector} {\n}\n`; + store.customCss += `\n\n${selector} {\n}\n`; return `${selector} {\n}`; };