2025-12-03 15:20:49 +01:00
|
|
|
<template>
|
|
|
|
|
<section class="settings-section">
|
|
|
|
|
<h2>Réglage du texte</h2>
|
|
|
|
|
<p class="infos">
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
Ces réglages s'appliquent à l'ensemble des éléments du document. Vous
|
|
|
|
|
pouvez modifier ensuite les éléments indépendamment.
|
2025-12-03 15:20:49 +01:00
|
|
|
</p>
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Police -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="text-font">Police</label>
|
|
|
|
|
<div class="field-with-option">
|
|
|
|
|
<select id="text-font" v-model="font">
|
2025-12-05 16:30:44 +01:00
|
|
|
<option v-for="f in fonts" :key="f" :value="f">{{ f }}</option>
|
2025-12-04 16:21:50 +01:00
|
|
|
</select>
|
|
|
|
|
<div class="field-checkbox">
|
|
|
|
|
<input id="text-italic" type="checkbox" v-model="italic" />
|
|
|
|
|
<label for="text-italic">Italique</label>
|
|
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Graisse -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>Graisse</label>
|
2025-12-05 16:30:44 +01:00
|
|
|
<UnitToggle v-model="weight" :units="weights" />
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Taille du texte -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
2025-12-03 15:20:49 +01:00
|
|
|
<div class="field">
|
2025-12-04 16:21:50 +01:00
|
|
|
<label for="text-size-range">Taille du texte</label>
|
2025-12-05 16:30:44 +01:00
|
|
|
<InputWithUnit
|
|
|
|
|
v-model="fontSize"
|
|
|
|
|
:units="['px', 'em', 'rem']"
|
|
|
|
|
:min="8"
|
|
|
|
|
:max="72"
|
|
|
|
|
showRange
|
|
|
|
|
/>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
2025-12-04 16:21:50 +01:00
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Alignement -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
2025-12-03 15:20:49 +01:00
|
|
|
<div class="field">
|
2025-12-04 16:21:50 +01:00
|
|
|
<label for="text-alignment">Alignement</label>
|
|
|
|
|
<select id="text-alignment" v-model="alignment">
|
2025-12-05 16:30:44 +01:00
|
|
|
<option v-for="a in alignments" :key="a.value" :value="a.value">
|
|
|
|
|
{{ a.label }}
|
|
|
|
|
</option>
|
2025-12-04 16:21:50 +01:00
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Couleurs -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="text-color">Couleur</label>
|
|
|
|
|
<div class="input-with-color">
|
2025-12-03 15:20:49 +01:00
|
|
|
<input
|
2025-12-04 16:21:50 +01:00
|
|
|
id="text-color"
|
|
|
|
|
type="text"
|
2025-12-05 16:30:44 +01:00
|
|
|
v-model="color"
|
2025-12-04 16:21:50 +01:00
|
|
|
class="color-input"
|
|
|
|
|
data-coloris
|
2025-12-03 15:20:49 +01:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="field">
|
2025-12-04 16:21:50 +01:00
|
|
|
<label for="text-background">Arrière-plan</label>
|
|
|
|
|
<div class="input-with-color">
|
2025-12-03 15:20:49 +01:00
|
|
|
<input
|
2025-12-04 16:21:50 +01:00
|
|
|
id="text-background"
|
|
|
|
|
type="text"
|
2025-12-05 16:30:44 +01:00
|
|
|
v-model="background"
|
2025-12-04 16:21:50 +01:00
|
|
|
class="color-input"
|
|
|
|
|
data-coloris
|
2025-12-03 15:20:49 +01:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-04 16:21:50 +01:00
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Marges extérieures -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
2025-12-05 16:30:44 +01:00
|
|
|
<MarginEditor
|
|
|
|
|
id="margin-outer"
|
|
|
|
|
label="Marges extérieures"
|
|
|
|
|
v-model:simple="marginOuter"
|
|
|
|
|
v-model:detailed="marginOuterDetailed"
|
|
|
|
|
@change="handleMarginOuterChange"
|
|
|
|
|
/>
|
2025-12-04 16:21:50 +01:00
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
<!-- Marges intérieures -->
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
2025-12-05 16:30:44 +01:00
|
|
|
<MarginEditor
|
|
|
|
|
id="margin-inner"
|
|
|
|
|
label="Marges intérieures"
|
|
|
|
|
v-model:simple="marginInner"
|
|
|
|
|
v-model:detailed="marginInnerDetailed"
|
|
|
|
|
@change="handleMarginInnerChange"
|
|
|
|
|
/>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-12-04 16:21:50 +01:00
|
|
|
import { ref, watch, onMounted } from 'vue';
|
|
|
|
|
import Coloris from '@melloware/coloris';
|
2025-12-05 16:30:44 +01:00
|
|
|
import UnitToggle from '../ui/UnitToggle.vue';
|
|
|
|
|
import InputWithUnit from '../ui/InputWithUnit.vue';
|
|
|
|
|
import MarginEditor from '../ui/MarginEditor.vue';
|
|
|
|
|
import { useCssUpdater } from '../../composables/useCssUpdater';
|
|
|
|
|
import { useCssSync } from '../../composables/useCssSync';
|
|
|
|
|
|
|
|
|
|
const { updateStyle, setMargin, setDetailedMargins, setPadding, setDetailedPadding } = useCssUpdater();
|
|
|
|
|
const { extractValue, extractNumericValue, extractSpacing } = useCssSync();
|
|
|
|
|
|
|
|
|
|
// Constants
|
|
|
|
|
const fonts = ['Alegreya Sans', 'Arial', 'Georgia', 'Helvetica', 'Times New Roman'];
|
|
|
|
|
const weights = ['200', '300', '400', '600', '800', 'normal', 'bold'];
|
|
|
|
|
const alignments = [
|
|
|
|
|
{ value: 'left', label: 'Gauche' },
|
|
|
|
|
{ value: 'center', label: 'Centre' },
|
|
|
|
|
{ value: 'right', label: 'Droite' },
|
|
|
|
|
{ value: 'justify', label: 'Justifié' }
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// State
|
2025-12-03 15:20:49 +01:00
|
|
|
const font = ref('Alegreya Sans');
|
|
|
|
|
const italic = ref(false);
|
|
|
|
|
const weight = ref('400');
|
2025-12-05 16:30:44 +01:00
|
|
|
const fontSize = ref({ value: 16, unit: 'px' });
|
2025-12-03 15:20:49 +01:00
|
|
|
const alignment = ref('left');
|
2025-12-05 16:30:44 +01:00
|
|
|
const color = ref('rgb(0, 0, 0)');
|
|
|
|
|
const background = ref('transparent');
|
2025-12-03 15:20:49 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const marginOuter = ref({ value: 0, unit: 'mm' });
|
2025-12-03 15:20:49 +01:00
|
|
|
const marginOuterDetailed = ref({
|
2025-12-05 16:18:31 +01:00
|
|
|
top: { value: 0, unit: 'mm' },
|
|
|
|
|
right: { value: 0, unit: 'mm' },
|
2025-12-05 16:30:44 +01:00
|
|
|
bottom: { value: 24, unit: 'mm' },
|
|
|
|
|
left: { value: 0, unit: 'mm' }
|
2025-12-03 15:20:49 +01:00
|
|
|
});
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const marginInner = ref({ value: 0, unit: 'mm' });
|
2025-12-03 15:20:49 +01:00
|
|
|
const marginInnerDetailed = ref({
|
2025-12-05 16:18:31 +01:00
|
|
|
top: { value: 0, unit: 'mm' },
|
|
|
|
|
right: { value: 0, unit: 'mm' },
|
2025-12-05 16:30:44 +01:00
|
|
|
bottom: { value: 0, unit: 'mm' },
|
|
|
|
|
left: { value: 0, unit: 'mm' }
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
});
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
let isUpdatingFromStore = false;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Watchers for body styles
|
|
|
|
|
watch(italic, (val) => {
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:30:44 +01:00
|
|
|
updateStyle('body', 'font-style', val ? 'italic' : 'normal');
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
});
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
watch(alignment, (val) => {
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:30:44 +01:00
|
|
|
updateStyle('body', 'text-align', val);
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
});
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
watch(color, (val) => {
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:30:44 +01:00
|
|
|
updateStyle('body', 'color', val);
|
2025-12-03 15:20:49 +01:00
|
|
|
});
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
watch(background, (val) => {
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:30:44 +01:00
|
|
|
updateStyle('body', 'background', val);
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
});
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Watchers for paragraph styles
|
|
|
|
|
watch(weight, (val) => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
|
|
|
|
updateStyle('p', 'font-weight', val);
|
|
|
|
|
});
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
watch(fontSize, (val) => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
|
|
|
|
updateStyle('p', 'font-size', `${val.value}${val.unit}`);
|
|
|
|
|
}, { deep: true });
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Margin/Padding handlers
|
|
|
|
|
const handleMarginOuterChange = ({ type, simple, detailed }) => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
|
|
|
|
if (type === 'simple') {
|
|
|
|
|
setMargin('p', simple.value, simple.unit);
|
|
|
|
|
} else {
|
|
|
|
|
setDetailedMargins('p', detailed.top, detailed.right, detailed.bottom, detailed.left);
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
}
|
2025-12-05 16:30:44 +01:00
|
|
|
};
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const handleMarginInnerChange = ({ type, simple, detailed }) => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
|
|
|
|
if (type === 'simple') {
|
|
|
|
|
setPadding('p', simple.value, simple.unit);
|
|
|
|
|
} else {
|
|
|
|
|
setDetailedPadding('p', detailed.top, detailed.right, detailed.bottom, detailed.left);
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
}
|
2025-12-05 16:30:44 +01:00
|
|
|
};
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Sync from store
|
|
|
|
|
const syncFromStore = () => {
|
|
|
|
|
isUpdatingFromStore = true;
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Body styles
|
|
|
|
|
const fontStyle = extractValue('body', 'font-style');
|
|
|
|
|
if (fontStyle) italic.value = fontStyle === 'italic';
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const textAlign = extractValue('body', 'text-align');
|
|
|
|
|
if (textAlign) alignment.value = textAlign;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const colorVal = extractValue('body', 'color');
|
|
|
|
|
if (colorVal) color.value = colorVal;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const bgVal = extractValue('body', 'background');
|
|
|
|
|
if (bgVal) background.value = bgVal;
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Paragraph styles
|
|
|
|
|
const fontWeight = extractValue('p', 'font-weight');
|
|
|
|
|
if (fontWeight) weight.value = fontWeight;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
const fontSizeVal = extractNumericValue('p', 'font-size', ['px', 'em', 'rem']);
|
|
|
|
|
if (fontSizeVal) fontSize.value = fontSizeVal;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Margins
|
|
|
|
|
const margins = extractSpacing('p', 'margin');
|
|
|
|
|
if (margins) {
|
|
|
|
|
if (margins.simple) {
|
|
|
|
|
marginOuter.value = margins.simple;
|
|
|
|
|
} else if (margins.detailed) {
|
|
|
|
|
marginOuterDetailed.value = margins.detailed;
|
|
|
|
|
}
|
refactor: optimize EditorPanel updates with selective debouncing
Implement immediate vs debounced updates based on input type to improve
UX responsiveness while preventing excessive re-renders.
Update strategy:
- Immediate (0ms): select, buttons, checkboxes, color picker
- Debounced (1s): text inputs, number inputs, range sliders
Changes:
- PageSettings.vue: Split watchers for margin values/units and background
value/format. Extract update logic into reusable functions.
- TextSettings.vue: Add comprehensive watcher system with selective
debouncing for all settings (font, size, color, margins, etc.)
This ensures button clicks (unit toggles, format switches) apply instantly
while typed values (numbers, text) batch updates to reduce CSS re-parsing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 14:03:40 +01:00
|
|
|
}
|
2025-12-04 16:21:50 +01:00
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
// Padding
|
|
|
|
|
const padding = extractSpacing('p', 'padding');
|
|
|
|
|
if (padding) {
|
|
|
|
|
if (padding.simple) {
|
|
|
|
|
marginInner.value = padding.simple;
|
|
|
|
|
} else if (padding.detailed) {
|
|
|
|
|
marginInnerDetailed.value = padding.detailed;
|
|
|
|
|
}
|
2025-12-05 16:18:31 +01:00
|
|
|
}
|
|
|
|
|
|
2025-12-05 16:30:44 +01:00
|
|
|
isUpdatingFromStore = false;
|
|
|
|
|
};
|
2025-12-05 16:18:31 +01:00
|
|
|
|
2025-12-04 16:21:50 +01:00
|
|
|
onMounted(() => {
|
|
|
|
|
Coloris.init();
|
|
|
|
|
Coloris({
|
|
|
|
|
themeMode: 'dark',
|
|
|
|
|
alpha: true,
|
|
|
|
|
format: 'auto',
|
|
|
|
|
formatToggle: true,
|
2025-12-05 16:30:44 +01:00
|
|
|
swatches: ['#000000', '#FFFFFF', '#FF0000', '#00FF00', '#0000FF', 'transparent']
|
2025-12-04 16:21:50 +01:00
|
|
|
});
|
2025-12-05 16:18:31 +01:00
|
|
|
syncFromStore();
|
2025-12-04 16:21:50 +01:00
|
|
|
});
|
2025-12-03 15:20:49 +01:00
|
|
|
</script>
|