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-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">
|
|
|
|
|
<option value="Alegreya Sans">Alegreya Sans</option>
|
|
|
|
|
<option value="Arial">Arial</option>
|
|
|
|
|
<option value="Georgia">Georgia</option>
|
|
|
|
|
<option value="Helvetica">Helvetica</option>
|
|
|
|
|
<option value="Times New Roman">Times New Roman</option>
|
|
|
|
|
</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-04 16:21:50 +01:00
|
|
|
<div class="settings-subsection">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label>Graisse</label>
|
2025-12-03 15:20:49 +01:00
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === '200' }"
|
|
|
|
|
@click="weight = '200'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
200
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === '300' }"
|
|
|
|
|
@click="weight = '300'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
300
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === '400' }"
|
|
|
|
|
@click="weight = '400'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
400
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === '600' }"
|
|
|
|
|
@click="weight = '600'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
600
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === '800' }"
|
|
|
|
|
@click="weight = '800'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
800
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === 'normal' }"
|
|
|
|
|
@click="weight = 'normal'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
normal
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: weight === 'bold' }"
|
|
|
|
|
@click="weight = 'bold'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
bold
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
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>
|
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
|
|
|
<div class="input-with-unit">
|
2025-12-03 15:20:49 +01:00
|
|
|
<input
|
2025-12-04 16:21:50 +01:00
|
|
|
id="text-size-range"
|
|
|
|
|
type="range"
|
|
|
|
|
v-model.number="fontSize.value"
|
|
|
|
|
min="8"
|
|
|
|
|
max="72"
|
|
|
|
|
step="1"
|
|
|
|
|
/>
|
|
|
|
|
<input
|
2025-12-03 15:20:49 +01:00
|
|
|
type="number"
|
2025-12-04 16:21:50 +01:00
|
|
|
v-model.number="fontSize.value"
|
|
|
|
|
min="8"
|
|
|
|
|
max="72"
|
|
|
|
|
step="1"
|
|
|
|
|
class="size-input"
|
2025-12-03 15:20:49 +01:00
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: fontSize.unit === 'px' }"
|
|
|
|
|
@click="fontSize.unit = 'px'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
px
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: fontSize.unit === 'em' }"
|
|
|
|
|
@click="fontSize.unit = 'em'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
em
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: fontSize.unit === 'rem' }"
|
|
|
|
|
@click="fontSize.unit = 'rem'"
|
|
|
|
|
>
|
|
|
|
|
rem
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-04 16:21:50 +01:00
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
|
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">
|
|
|
|
|
<option value="left">Gauche</option>
|
|
|
|
|
<option value="center">Centre</option>
|
|
|
|
|
<option value="right">Droite</option>
|
|
|
|
|
<option value="justify">Justifié</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<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"
|
|
|
|
|
v-model="color.value"
|
|
|
|
|
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"
|
|
|
|
|
v-model="background.value"
|
|
|
|
|
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-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="margin-outer">Marges extérieures</label>
|
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
|
|
|
<div class="input-with-unit">
|
2025-12-03 15:20:49 +01:00
|
|
|
<input
|
2025-12-04 16:21:50 +01:00
|
|
|
id="margin-outer"
|
2025-12-03 15:20:49 +01:00
|
|
|
type="number"
|
2025-12-04 16:21:50 +01:00
|
|
|
v-model.number="marginOuter.value"
|
2025-12-03 15:20:49 +01:00
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: marginOuter.unit === 'mm' }"
|
|
|
|
|
@click="marginOuter.unit = 'mm'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: marginOuter.unit === 'px' }"
|
|
|
|
|
@click="marginOuter.unit = 'px'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
class="collapse-toggle"
|
|
|
|
|
:class="{ expanded: marginOuterExpanded }"
|
|
|
|
|
@click="marginOuterExpanded = !marginOuterExpanded"
|
|
|
|
|
title="Réglages détaillés"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
2025-12-04 16:21:50 +01:00
|
|
|
▶
|
2025-12-03 15:20:49 +01:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-04 16:21:50 +01:00
|
|
|
<div v-if="marginOuterExpanded" class="subsection collapsed-section">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-outer-top">Haut</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-outer-top"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginOuterDetailed.top.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.top.unit === 'mm' }"
|
|
|
|
|
@click="marginOuterDetailed.top.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.top.unit === 'px' }"
|
|
|
|
|
@click="marginOuterDetailed.top.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-04 16:21:50 +01:00
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-outer-bottom">Bas</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-outer-bottom"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginOuterDetailed.bottom.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.bottom.unit === 'mm' }"
|
|
|
|
|
@click="marginOuterDetailed.bottom.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.bottom.unit === 'px' }"
|
|
|
|
|
@click="marginOuterDetailed.bottom.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-outer-left">Gauche</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-outer-left"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginOuterDetailed.left.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.left.unit === 'mm' }"
|
|
|
|
|
@click="marginOuterDetailed.left.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.left.unit === 'px' }"
|
|
|
|
|
@click="marginOuterDetailed.left.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-outer-right">Droite</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-outer-right"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginOuterDetailed.right.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.right.unit === 'mm' }"
|
|
|
|
|
@click="marginOuterDetailed.right.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginOuterDetailed.right.unit === 'px' }"
|
|
|
|
|
@click="marginOuterDetailed.right.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-04 16:21:50 +01:00
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
|
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="margin-inner">Marges intérieures</label>
|
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
|
|
|
<div class="input-with-unit">
|
2025-12-03 15:20:49 +01:00
|
|
|
<input
|
2025-12-04 16:21:50 +01:00
|
|
|
id="margin-inner"
|
2025-12-03 15:20:49 +01:00
|
|
|
type="number"
|
2025-12-04 16:21:50 +01:00
|
|
|
v-model.number="marginInner.value"
|
2025-12-03 15:20:49 +01:00
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: marginInner.unit === 'mm' }"
|
|
|
|
|
@click="marginInner.unit = 'mm'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
2025-12-04 16:21:50 +01:00
|
|
|
:class="{ active: marginInner.unit === 'px' }"
|
|
|
|
|
@click="marginInner.unit = 'px'"
|
2025-12-03 15:20:49 +01:00
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-12-04 16:21:50 +01:00
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="collapse-toggle"
|
|
|
|
|
:class="{ expanded: marginInnerExpanded }"
|
|
|
|
|
@click="marginInnerExpanded = !marginInnerExpanded"
|
|
|
|
|
title="Réglages détaillés"
|
|
|
|
|
>
|
|
|
|
|
▶
|
|
|
|
|
</button>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-04 16:21:50 +01:00
|
|
|
<div v-if="marginInnerExpanded" class="subsection collapsed-section">
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-inner-top">Haut</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-inner-top"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginInnerDetailed.top.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.top.unit === 'mm' }"
|
|
|
|
|
@click="marginInnerDetailed.top.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.top.unit === 'px' }"
|
|
|
|
|
@click="marginInnerDetailed.top.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-inner-bottom">Bas</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-inner-bottom"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginInnerDetailed.bottom.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.bottom.unit === 'mm' }"
|
|
|
|
|
@click="marginInnerDetailed.bottom.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.bottom.unit === 'px' }"
|
|
|
|
|
@click="marginInnerDetailed.bottom.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-inner-left">Gauche</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-inner-left"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginInnerDetailed.left.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.left.unit === 'mm' }"
|
|
|
|
|
@click="marginInnerDetailed.left.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.left.unit === 'px' }"
|
|
|
|
|
@click="marginInnerDetailed.left.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="field">
|
|
|
|
|
<label for="margin-inner-right">Droite</label>
|
|
|
|
|
<div class="input-with-unit">
|
|
|
|
|
<input
|
|
|
|
|
id="margin-inner-right"
|
|
|
|
|
type="number"
|
|
|
|
|
v-model.number="marginInnerDetailed.right.value"
|
|
|
|
|
min="0"
|
|
|
|
|
/>
|
|
|
|
|
<div class="unit-toggle">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.right.unit === 'mm' }"
|
|
|
|
|
@click="marginInnerDetailed.right.unit = 'mm'"
|
|
|
|
|
>
|
|
|
|
|
mm
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
:class="{ active: marginInnerDetailed.right.unit === 'px' }"
|
|
|
|
|
@click="marginInnerDetailed.right.unit = 'px'"
|
|
|
|
|
>
|
|
|
|
|
px
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-12-03 15:20:49 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2025-12-04 16:21:50 +01:00
|
|
|
import { ref, watch, onMounted } from 'vue';
|
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
|
|
|
import { useStylesheetStore } from '../../stores/stylesheet';
|
2025-12-04 16:21:50 +01:00
|
|
|
import Coloris from '@melloware/coloris';
|
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
|
|
|
|
|
|
|
|
const stylesheetStore = useStylesheetStore();
|
|
|
|
|
|
|
|
|
|
let isUpdatingFromStore = false;
|
|
|
|
|
let updateTimer = null;
|
2025-12-05 16:18:31 +01:00
|
|
|
let isSyncingFromSimple = false; // Flag to prevent detailed watchers from triggering when syncing from simple field
|
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
|
|
|
|
|
|
|
|
const debouncedUpdate = (callback) => {
|
|
|
|
|
clearTimeout(updateTimer);
|
|
|
|
|
updateTimer = setTimeout(callback, 1000);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const immediateUpdate = (callback) => {
|
|
|
|
|
callback();
|
|
|
|
|
};
|
2025-12-03 15:20:49 +01:00
|
|
|
|
|
|
|
|
// Font
|
|
|
|
|
const font = ref('Alegreya Sans');
|
|
|
|
|
const italic = ref(false);
|
|
|
|
|
|
|
|
|
|
// Weight
|
|
|
|
|
const weight = ref('400');
|
|
|
|
|
|
|
|
|
|
// Font size
|
|
|
|
|
const fontSize = ref({
|
|
|
|
|
value: 23,
|
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
|
|
|
unit: 'px',
|
2025-12-03 15:20:49 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Alignment
|
|
|
|
|
const alignment = ref('left');
|
|
|
|
|
|
|
|
|
|
// Color
|
|
|
|
|
const color = ref({
|
|
|
|
|
value: 'rgb(250, 250, 250)',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Background
|
|
|
|
|
const background = ref({
|
|
|
|
|
value: 'transparent',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Margin outer
|
|
|
|
|
const marginOuter = ref({
|
2025-12-05 16:18:31 +01:00
|
|
|
value: 0,
|
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
|
|
|
unit: 'mm',
|
2025-12-03 15:20:49 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const marginOuterExpanded = ref(false);
|
|
|
|
|
|
|
|
|
|
const marginOuterDetailed = ref({
|
2025-12-05 16:18:31 +01:00
|
|
|
top: { value: 0, unit: 'mm' },
|
|
|
|
|
bottom: { value: 24, unit: 'mm' },
|
|
|
|
|
left: { value: 0, unit: 'mm' },
|
|
|
|
|
right: { value: 0, unit: 'mm' },
|
2025-12-03 15:20:49 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Margin inner
|
|
|
|
|
const marginInner = ref({
|
2025-12-05 16:18:31 +01:00
|
|
|
value: 0,
|
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
|
|
|
unit: 'mm',
|
2025-12-03 15:20:49 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const marginInnerExpanded = ref(false);
|
|
|
|
|
|
|
|
|
|
const marginInnerDetailed = ref({
|
2025-12-05 16:18:31 +01:00
|
|
|
top: { value: 0, unit: 'mm' },
|
|
|
|
|
bottom: { value: 0, unit: 'mm' },
|
|
|
|
|
left: { value: 0, unit: 'mm' },
|
|
|
|
|
right: { 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:18:31 +01:00
|
|
|
// Update functions
|
|
|
|
|
const updateBodyStyle = (property, value) => {
|
|
|
|
|
const currentBlock = stylesheetStore.extractBlock('body') || createBodyRule();
|
|
|
|
|
|
|
|
|
|
if (currentBlock.includes(`${property}:`)) {
|
|
|
|
|
// Update existing property
|
|
|
|
|
const updatedBlock = currentBlock.replace(
|
|
|
|
|
new RegExp(`(${property}:\\s*)[^;]+`, 'i'),
|
|
|
|
|
`$1${value}`
|
|
|
|
|
);
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
// Add new property
|
|
|
|
|
const updatedBlock = currentBlock.replace(
|
|
|
|
|
/(\s*})$/,
|
|
|
|
|
` ${property}: ${value};\n$1`
|
|
|
|
|
);
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const updateParagraphStyle = (property, value) => {
|
|
|
|
|
const currentBlock = stylesheetStore.extractBlock('p') || createParagraphRule();
|
|
|
|
|
|
|
|
|
|
if (currentBlock.includes(`${property}:`)) {
|
|
|
|
|
// Update existing property
|
|
|
|
|
const updatedBlock = currentBlock.replace(
|
|
|
|
|
new RegExp(`(${property}:\\s*)[^;]+`, 'i'),
|
|
|
|
|
`$1${value}`
|
|
|
|
|
);
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
// Add new property
|
|
|
|
|
const updatedBlock = currentBlock.replace(
|
|
|
|
|
/(\s*})$/,
|
|
|
|
|
` ${property}: ${value};\n$1`
|
|
|
|
|
);
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Remove detailed margin properties (margin-top, margin-right, etc.)
|
|
|
|
|
const removeDetailedMargins = () => {
|
|
|
|
|
let currentBlock = stylesheetStore.extractBlock('p');
|
|
|
|
|
if (!currentBlock) return;
|
|
|
|
|
|
|
|
|
|
let updatedBlock = currentBlock;
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*margin-top:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*margin-right:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*margin-bottom:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*margin-left:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
|
|
|
|
|
if (updatedBlock !== currentBlock) {
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Remove detailed padding properties (padding-top, padding-right, etc.)
|
|
|
|
|
const removeDetailedPadding = () => {
|
|
|
|
|
let currentBlock = stylesheetStore.extractBlock('p');
|
|
|
|
|
if (!currentBlock) return;
|
|
|
|
|
|
|
|
|
|
let updatedBlock = currentBlock;
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*padding-top:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*padding-right:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*padding-bottom:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
updatedBlock = updatedBlock.replace(/\s*padding-left:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
|
|
|
|
|
if (updatedBlock !== currentBlock) {
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Remove shorthand margin property
|
|
|
|
|
const removeShorthandMargin = () => {
|
|
|
|
|
let currentBlock = stylesheetStore.extractBlock('p');
|
|
|
|
|
if (!currentBlock) return;
|
|
|
|
|
|
|
|
|
|
let updatedBlock = currentBlock.replace(/\s*margin:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
|
|
|
|
|
if (updatedBlock !== currentBlock) {
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Remove shorthand padding property
|
|
|
|
|
const removeShorthandPadding = () => {
|
|
|
|
|
let currentBlock = stylesheetStore.extractBlock('p');
|
|
|
|
|
if (!currentBlock) return;
|
|
|
|
|
|
|
|
|
|
let updatedBlock = currentBlock.replace(/\s*padding:\s*[^;]+;\n?/gi, '');
|
|
|
|
|
|
|
|
|
|
if (updatedBlock !== currentBlock) {
|
|
|
|
|
stylesheetStore.content = stylesheetStore.content.replace(
|
|
|
|
|
currentBlock,
|
|
|
|
|
updatedBlock
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const createBodyRule = () => {
|
|
|
|
|
stylesheetStore.content += '\n\nbody {\n}\n';
|
|
|
|
|
return 'body {\n}';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const createParagraphRule = () => {
|
|
|
|
|
stylesheetStore.content += '\n\np {\n}\n';
|
|
|
|
|
return 'p {\n}';
|
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
// Watchers - Immediate updates for select/buttons/checkboxes
|
|
|
|
|
watch(font, () => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
|
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
// TODO: implement font update when fonts are available
|
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:18:31 +01:00
|
|
|
watch(italic, (newValue) => {
|
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;
|
|
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
updateBodyStyle('font-style', newValue ? '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:18:31 +01:00
|
|
|
watch(weight, (newValue) => {
|
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;
|
|
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
updateParagraphStyle('font-weight', newValue);
|
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-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:18:31 +01:00
|
|
|
watch(alignment, (newValue) => {
|
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;
|
|
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
updateBodyStyle('text-align', newValue);
|
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:18:31 +01:00
|
|
|
// Font size - immediate for both value and unit (applied to paragraphs)
|
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
|
|
|
watch(
|
|
|
|
|
() => fontSize.value.value,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
immediateUpdate(() => {
|
|
|
|
|
updateParagraphStyle('font-size', `${fontSize.value.value}${fontSize.value.unit}`);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => fontSize.value.unit,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
|
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
updateParagraphStyle('font-size', `${fontSize.value.value}${fontSize.value.unit}`);
|
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:18:31 +01:00
|
|
|
// Color - immediate update for Coloris
|
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
|
|
|
watch(
|
|
|
|
|
() => color.value.value,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
immediateUpdate(() => {
|
|
|
|
|
updateBodyStyle('color', color.value.value);
|
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:18:31 +01:00
|
|
|
// Background - immediate update for Coloris
|
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
|
|
|
watch(
|
|
|
|
|
() => background.value.value,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
immediateUpdate(() => {
|
|
|
|
|
updateBodyStyle('background', background.value.value);
|
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:18:31 +01:00
|
|
|
// Margin outer - debounced for value, immediate for unit (applied to paragraphs)
|
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
|
|
|
watch(
|
|
|
|
|
() => marginOuter.value.value,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
|
|
|
|
// Update all detailed values to match the simple value
|
|
|
|
|
isSyncingFromSimple = true;
|
|
|
|
|
marginOuterDetailed.value.top.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.right.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.bottom.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.left.value = marginOuter.value.value;
|
|
|
|
|
isSyncingFromSimple = false;
|
|
|
|
|
|
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
|
|
|
debouncedUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeDetailedMargins(); // Remove detailed properties first
|
|
|
|
|
updateParagraphStyle('margin', `${marginOuter.value.value}${marginOuter.value.unit}`);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => marginOuter.value.unit,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
|
|
|
|
// Update all detailed units to match the simple unit
|
|
|
|
|
isSyncingFromSimple = true;
|
|
|
|
|
marginOuterDetailed.value.top.unit = marginOuter.value.unit;
|
|
|
|
|
marginOuterDetailed.value.right.unit = marginOuter.value.unit;
|
|
|
|
|
marginOuterDetailed.value.bottom.unit = marginOuter.value.unit;
|
|
|
|
|
marginOuterDetailed.value.left.unit = marginOuter.value.unit;
|
|
|
|
|
isSyncingFromSimple = false;
|
|
|
|
|
|
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
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeDetailedMargins(); // Remove detailed properties first
|
|
|
|
|
updateParagraphStyle('margin', `${marginOuter.value.value}${marginOuter.value.unit}`);
|
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:18:31 +01:00
|
|
|
// Margin outer detailed - debounced for values, immediate for units (applied to paragraphs)
|
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
|
|
|
watch(
|
|
|
|
|
() => [
|
|
|
|
|
marginOuterDetailed.value.top.value,
|
|
|
|
|
marginOuterDetailed.value.bottom.value,
|
|
|
|
|
marginOuterDetailed.value.left.value,
|
|
|
|
|
marginOuterDetailed.value.right.value,
|
|
|
|
|
],
|
|
|
|
|
() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
if (isUpdatingFromStore || !marginOuterExpanded.value || isSyncingFromSimple) return;
|
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
|
|
|
debouncedUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeShorthandMargin(); // Remove shorthand property first
|
|
|
|
|
updateParagraphStyle('margin-top', `${marginOuterDetailed.value.top.value}${marginOuterDetailed.value.top.unit}`);
|
|
|
|
|
updateParagraphStyle('margin-bottom', `${marginOuterDetailed.value.bottom.value}${marginOuterDetailed.value.bottom.unit}`);
|
|
|
|
|
updateParagraphStyle('margin-left', `${marginOuterDetailed.value.left.value}${marginOuterDetailed.value.left.unit}`);
|
|
|
|
|
updateParagraphStyle('margin-right', `${marginOuterDetailed.value.right.value}${marginOuterDetailed.value.right.unit}`);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => [
|
|
|
|
|
marginOuterDetailed.value.top.unit,
|
|
|
|
|
marginOuterDetailed.value.bottom.unit,
|
|
|
|
|
marginOuterDetailed.value.left.unit,
|
|
|
|
|
marginOuterDetailed.value.right.unit,
|
|
|
|
|
],
|
|
|
|
|
() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
if (isUpdatingFromStore || !marginOuterExpanded.value || isSyncingFromSimple) return;
|
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
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeShorthandMargin(); // Remove shorthand property first
|
|
|
|
|
updateParagraphStyle('margin-top', `${marginOuterDetailed.value.top.value}${marginOuterDetailed.value.top.unit}`);
|
|
|
|
|
updateParagraphStyle('margin-bottom', `${marginOuterDetailed.value.bottom.value}${marginOuterDetailed.value.bottom.unit}`);
|
|
|
|
|
updateParagraphStyle('margin-left', `${marginOuterDetailed.value.left.value}${marginOuterDetailed.value.left.unit}`);
|
|
|
|
|
updateParagraphStyle('margin-right', `${marginOuterDetailed.value.right.value}${marginOuterDetailed.value.right.unit}`);
|
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:18:31 +01:00
|
|
|
// Margin inner - debounced for value, immediate for unit (applied to paragraphs)
|
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
|
|
|
watch(
|
|
|
|
|
() => marginInner.value.value,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
|
|
|
|
// Update all detailed values to match the simple value
|
|
|
|
|
isSyncingFromSimple = true;
|
|
|
|
|
marginInnerDetailed.value.top.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.right.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.bottom.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.left.value = marginInner.value.value;
|
|
|
|
|
isSyncingFromSimple = false;
|
|
|
|
|
|
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
|
|
|
debouncedUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeDetailedPadding(); // Remove detailed properties first
|
|
|
|
|
updateParagraphStyle('padding', `${marginInner.value.value}${marginInner.value.unit}`);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => marginInner.value.unit,
|
|
|
|
|
() => {
|
|
|
|
|
if (isUpdatingFromStore) return;
|
2025-12-05 16:18:31 +01:00
|
|
|
|
|
|
|
|
// Update all detailed units to match the simple unit
|
|
|
|
|
isSyncingFromSimple = true;
|
|
|
|
|
marginInnerDetailed.value.top.unit = marginInner.value.unit;
|
|
|
|
|
marginInnerDetailed.value.right.unit = marginInner.value.unit;
|
|
|
|
|
marginInnerDetailed.value.bottom.unit = marginInner.value.unit;
|
|
|
|
|
marginInnerDetailed.value.left.unit = marginInner.value.unit;
|
|
|
|
|
isSyncingFromSimple = false;
|
|
|
|
|
|
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
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeDetailedPadding(); // Remove detailed properties first
|
|
|
|
|
updateParagraphStyle('padding', `${marginInner.value.value}${marginInner.value.unit}`);
|
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:18:31 +01:00
|
|
|
// Margin inner detailed - debounced for values, immediate for units (applied to paragraphs)
|
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
|
|
|
watch(
|
|
|
|
|
() => [
|
|
|
|
|
marginInnerDetailed.value.top.value,
|
|
|
|
|
marginInnerDetailed.value.bottom.value,
|
|
|
|
|
marginInnerDetailed.value.left.value,
|
|
|
|
|
marginInnerDetailed.value.right.value,
|
|
|
|
|
],
|
|
|
|
|
() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
if (isUpdatingFromStore || !marginInnerExpanded.value || isSyncingFromSimple) return;
|
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
|
|
|
debouncedUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeShorthandPadding(); // Remove shorthand property first
|
|
|
|
|
updateParagraphStyle('padding-top', `${marginInnerDetailed.value.top.value}${marginInnerDetailed.value.top.unit}`);
|
|
|
|
|
updateParagraphStyle('padding-bottom', `${marginInnerDetailed.value.bottom.value}${marginInnerDetailed.value.bottom.unit}`);
|
|
|
|
|
updateParagraphStyle('padding-left', `${marginInnerDetailed.value.left.value}${marginInnerDetailed.value.left.unit}`);
|
|
|
|
|
updateParagraphStyle('padding-right', `${marginInnerDetailed.value.right.value}${marginInnerDetailed.value.right.unit}`);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => [
|
|
|
|
|
marginInnerDetailed.value.top.unit,
|
|
|
|
|
marginInnerDetailed.value.bottom.unit,
|
|
|
|
|
marginInnerDetailed.value.left.unit,
|
|
|
|
|
marginInnerDetailed.value.right.unit,
|
|
|
|
|
],
|
|
|
|
|
() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
if (isUpdatingFromStore || !marginInnerExpanded.value || isSyncingFromSimple) return;
|
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
|
|
|
immediateUpdate(() => {
|
2025-12-05 16:18:31 +01:00
|
|
|
removeShorthandPadding(); // Remove shorthand property first
|
|
|
|
|
updateParagraphStyle('padding-top', `${marginInnerDetailed.value.top.value}${marginInnerDetailed.value.top.unit}`);
|
|
|
|
|
updateParagraphStyle('padding-bottom', `${marginInnerDetailed.value.bottom.value}${marginInnerDetailed.value.bottom.unit}`);
|
|
|
|
|
updateParagraphStyle('padding-left', `${marginInnerDetailed.value.left.value}${marginInnerDetailed.value.left.unit}`);
|
|
|
|
|
updateParagraphStyle('padding-right', `${marginInnerDetailed.value.right.value}${marginInnerDetailed.value.right.unit}`);
|
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:18:31 +01:00
|
|
|
// Toggle expanded state - sync values when expanding
|
|
|
|
|
watch(marginOuterExpanded, (newValue) => {
|
|
|
|
|
if (newValue) {
|
|
|
|
|
// When expanding, copy simple value to all detailed fields
|
|
|
|
|
marginOuterDetailed.value.top.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.top.unit = marginOuter.value.unit;
|
|
|
|
|
marginOuterDetailed.value.bottom.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.bottom.unit = marginOuter.value.unit;
|
|
|
|
|
marginOuterDetailed.value.left.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.left.unit = marginOuter.value.unit;
|
|
|
|
|
marginOuterDetailed.value.right.value = marginOuter.value.value;
|
|
|
|
|
marginOuterDetailed.value.right.unit = marginOuter.value.unit;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
watch(marginInnerExpanded, (newValue) => {
|
|
|
|
|
if (newValue) {
|
|
|
|
|
// When expanding, copy simple value to all detailed fields
|
|
|
|
|
marginInnerDetailed.value.top.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.top.unit = marginInner.value.unit;
|
|
|
|
|
marginInnerDetailed.value.bottom.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.bottom.unit = marginInner.value.unit;
|
|
|
|
|
marginInnerDetailed.value.left.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.left.unit = marginInner.value.unit;
|
|
|
|
|
marginInnerDetailed.value.right.value = marginInner.value.value;
|
|
|
|
|
marginInnerDetailed.value.right.unit = marginInner.value.unit;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-04 16:21:50 +01:00
|
|
|
onMounted(() => {
|
|
|
|
|
Coloris.init();
|
|
|
|
|
Coloris({
|
|
|
|
|
themeMode: 'dark',
|
|
|
|
|
alpha: true,
|
|
|
|
|
format: 'auto',
|
|
|
|
|
formatToggle: true,
|
|
|
|
|
swatches: [
|
|
|
|
|
'#000000',
|
|
|
|
|
'#FFFFFF',
|
|
|
|
|
'#FF0000',
|
|
|
|
|
'#00FF00',
|
|
|
|
|
'#0000FF',
|
|
|
|
|
'transparent',
|
|
|
|
|
],
|
|
|
|
|
});
|
2025-12-05 16:18:31 +01:00
|
|
|
|
|
|
|
|
// Sync initial values from stylesheet
|
|
|
|
|
syncFromStore();
|
2025-12-04 16:21:50 +01:00
|
|
|
});
|
2025-12-05 16:18:31 +01:00
|
|
|
|
|
|
|
|
// Sync values from store to form fields
|
|
|
|
|
const syncFromStore = () => {
|
|
|
|
|
isUpdatingFromStore = true;
|
|
|
|
|
|
|
|
|
|
const bodyBlock = stylesheetStore.extractBlock('body');
|
|
|
|
|
const paragraphBlock = stylesheetStore.extractBlock('p');
|
|
|
|
|
|
|
|
|
|
// Extract from body block (italic, alignment, color, background)
|
|
|
|
|
if (bodyBlock) {
|
|
|
|
|
// Extract font-style (italic)
|
|
|
|
|
const fontStyleMatch = bodyBlock.match(/font-style:\s*([^;]+)/i);
|
|
|
|
|
if (fontStyleMatch) {
|
|
|
|
|
italic.value = fontStyleMatch[1].trim() === 'italic';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract text-align
|
|
|
|
|
const textAlignMatch = bodyBlock.match(/text-align:\s*([^;]+)/i);
|
|
|
|
|
if (textAlignMatch) {
|
|
|
|
|
alignment.value = textAlignMatch[1].trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract color
|
|
|
|
|
const colorMatch = bodyBlock.match(/color:\s*([^;]+)/i);
|
|
|
|
|
if (colorMatch) {
|
|
|
|
|
color.value.value = colorMatch[1].trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract background
|
|
|
|
|
const backgroundMatch = bodyBlock.match(/background:\s*([^;]+)/i);
|
|
|
|
|
if (backgroundMatch) {
|
|
|
|
|
background.value.value = backgroundMatch[1].trim();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract from paragraph block (weight, size, margins, padding)
|
|
|
|
|
if (paragraphBlock) {
|
|
|
|
|
// Extract font-weight
|
|
|
|
|
const fontWeightMatch = paragraphBlock.match(/font-weight:\s*([^;]+)/i);
|
|
|
|
|
if (fontWeightMatch) {
|
|
|
|
|
weight.value = fontWeightMatch[1].trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract font-size
|
|
|
|
|
const fontSizeMatch = paragraphBlock.match(/font-size:\s*([0-9.]+)(px|em|rem)/i);
|
|
|
|
|
if (fontSizeMatch) {
|
|
|
|
|
fontSize.value.value = parseFloat(fontSizeMatch[1]);
|
|
|
|
|
fontSize.value.unit = fontSizeMatch[2];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract margin (simple or detailed)
|
|
|
|
|
const marginMatch = paragraphBlock.match(/margin:\s*([^;]+)/i);
|
|
|
|
|
const marginTopMatch = paragraphBlock.match(/margin-top:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
|
|
|
|
|
if (marginTopMatch) {
|
|
|
|
|
// Has detailed margins (margin-top, margin-right, etc.)
|
|
|
|
|
const marginBottomMatch = paragraphBlock.match(/margin-bottom:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
const marginLeftMatch = paragraphBlock.match(/margin-left:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
const marginRightMatch = paragraphBlock.match(/margin-right:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
|
|
|
|
|
if (marginTopMatch) {
|
|
|
|
|
marginOuterDetailed.value.top.value = parseFloat(marginTopMatch[1]);
|
|
|
|
|
marginOuterDetailed.value.top.unit = marginTopMatch[2];
|
|
|
|
|
}
|
|
|
|
|
if (marginBottomMatch) {
|
|
|
|
|
marginOuterDetailed.value.bottom.value = parseFloat(marginBottomMatch[1]);
|
|
|
|
|
marginOuterDetailed.value.bottom.unit = marginBottomMatch[2];
|
|
|
|
|
}
|
|
|
|
|
if (marginLeftMatch) {
|
|
|
|
|
marginOuterDetailed.value.left.value = parseFloat(marginLeftMatch[1]);
|
|
|
|
|
marginOuterDetailed.value.left.unit = marginLeftMatch[2];
|
|
|
|
|
}
|
|
|
|
|
if (marginRightMatch) {
|
|
|
|
|
marginOuterDetailed.value.right.value = parseFloat(marginRightMatch[1]);
|
|
|
|
|
marginOuterDetailed.value.right.unit = marginRightMatch[2];
|
|
|
|
|
}
|
|
|
|
|
} else if (marginMatch) {
|
|
|
|
|
// Has shorthand margin - check if it's 1 value or 4 values
|
|
|
|
|
const marginValue = marginMatch[1].trim();
|
|
|
|
|
|
|
|
|
|
// Check for 4-value format: "0mm 0mm 24mm 0mm" (top right bottom left)
|
|
|
|
|
const fourValueMatch = marginValue.match(/^([0-9.]+)(mm|px)\s+([0-9.]+)(mm|px)\s+([0-9.]+)(mm|px)\s+([0-9.]+)(mm|px)$/i);
|
|
|
|
|
|
|
|
|
|
if (fourValueMatch) {
|
|
|
|
|
// Parse 4-value format and store in detailed margins
|
|
|
|
|
marginOuterDetailed.value.top.value = parseFloat(fourValueMatch[1]);
|
|
|
|
|
marginOuterDetailed.value.top.unit = fourValueMatch[2];
|
|
|
|
|
marginOuterDetailed.value.right.value = parseFloat(fourValueMatch[3]);
|
|
|
|
|
marginOuterDetailed.value.right.unit = fourValueMatch[4];
|
|
|
|
|
marginOuterDetailed.value.bottom.value = parseFloat(fourValueMatch[5]);
|
|
|
|
|
marginOuterDetailed.value.bottom.unit = fourValueMatch[6];
|
|
|
|
|
marginOuterDetailed.value.left.value = parseFloat(fourValueMatch[7]);
|
|
|
|
|
marginOuterDetailed.value.left.unit = fourValueMatch[8];
|
|
|
|
|
} else {
|
|
|
|
|
// Single value format: "10mm"
|
|
|
|
|
const singleValueMatch = marginValue.match(/^([0-9.]+)(mm|px)$/i);
|
|
|
|
|
if (singleValueMatch) {
|
|
|
|
|
marginOuter.value.value = parseFloat(singleValueMatch[1]);
|
|
|
|
|
marginOuter.value.unit = singleValueMatch[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Extract padding (simple or detailed)
|
|
|
|
|
const paddingMatch = paragraphBlock.match(/padding:\s*([^;]+)/i);
|
|
|
|
|
const paddingTopMatch = paragraphBlock.match(/padding-top:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
|
|
|
|
|
if (paddingTopMatch) {
|
|
|
|
|
// Has detailed padding (padding-top, padding-right, etc.)
|
|
|
|
|
const paddingBottomMatch = paragraphBlock.match(/padding-bottom:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
const paddingLeftMatch = paragraphBlock.match(/padding-left:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
const paddingRightMatch = paragraphBlock.match(/padding-right:\s*([0-9.]+)(mm|px)/i);
|
|
|
|
|
|
|
|
|
|
if (paddingTopMatch) {
|
|
|
|
|
marginInnerDetailed.value.top.value = parseFloat(paddingTopMatch[1]);
|
|
|
|
|
marginInnerDetailed.value.top.unit = paddingTopMatch[2];
|
|
|
|
|
}
|
|
|
|
|
if (paddingBottomMatch) {
|
|
|
|
|
marginInnerDetailed.value.bottom.value = parseFloat(paddingBottomMatch[1]);
|
|
|
|
|
marginInnerDetailed.value.bottom.unit = paddingBottomMatch[2];
|
|
|
|
|
}
|
|
|
|
|
if (paddingLeftMatch) {
|
|
|
|
|
marginInnerDetailed.value.left.value = parseFloat(paddingLeftMatch[1]);
|
|
|
|
|
marginInnerDetailed.value.left.unit = paddingLeftMatch[2];
|
|
|
|
|
}
|
|
|
|
|
if (paddingRightMatch) {
|
|
|
|
|
marginInnerDetailed.value.right.value = parseFloat(paddingRightMatch[1]);
|
|
|
|
|
marginInnerDetailed.value.right.unit = paddingRightMatch[2];
|
|
|
|
|
}
|
|
|
|
|
} else if (paddingMatch) {
|
|
|
|
|
// Has shorthand padding - check if it's 1 value or 4 values
|
|
|
|
|
const paddingValue = paddingMatch[1].trim();
|
|
|
|
|
|
|
|
|
|
// Check for 4-value format: "0mm 0mm 0mm 0mm" (top right bottom left)
|
|
|
|
|
const fourValueMatch = paddingValue.match(/^([0-9.]+)(mm|px)\s+([0-9.]+)(mm|px)\s+([0-9.]+)(mm|px)\s+([0-9.]+)(mm|px)$/i);
|
|
|
|
|
|
|
|
|
|
if (fourValueMatch) {
|
|
|
|
|
// Parse 4-value format and store in detailed padding
|
|
|
|
|
marginInnerDetailed.value.top.value = parseFloat(fourValueMatch[1]);
|
|
|
|
|
marginInnerDetailed.value.top.unit = fourValueMatch[2];
|
|
|
|
|
marginInnerDetailed.value.right.value = parseFloat(fourValueMatch[3]);
|
|
|
|
|
marginInnerDetailed.value.right.unit = fourValueMatch[4];
|
|
|
|
|
marginInnerDetailed.value.bottom.value = parseFloat(fourValueMatch[5]);
|
|
|
|
|
marginInnerDetailed.value.bottom.unit = fourValueMatch[6];
|
|
|
|
|
marginInnerDetailed.value.left.value = parseFloat(fourValueMatch[7]);
|
|
|
|
|
marginInnerDetailed.value.left.unit = fourValueMatch[8];
|
|
|
|
|
} else {
|
|
|
|
|
// Single value format: "10mm"
|
|
|
|
|
const singleValueMatch = paddingValue.match(/^([0-9.]+)(mm|px)$/i);
|
|
|
|
|
if (singleValueMatch) {
|
|
|
|
|
marginInner.value.value = parseFloat(singleValueMatch[1]);
|
|
|
|
|
marginInner.value.unit = singleValueMatch[2];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isUpdatingFromStore = false;
|
|
|
|
|
};
|
2025-12-03 15:20:49 +01:00
|
|
|
</script>
|