correction page margins
This commit is contained in:
parent
3ae2d0e310
commit
59f6716121
3 changed files with 32 additions and 50 deletions
|
|
@ -290,14 +290,7 @@ watch([customWidth, customHeight], () => {
|
|||
|
||||
const updateMargins = () => {
|
||||
const marginValue = `${margins.value.top.value}${margins.value.top.unit} ${margins.value.right.value}${margins.value.right.unit} ${margins.value.bottom.value}${margins.value.bottom.unit} ${margins.value.left.value}${margins.value.left.unit}`;
|
||||
|
||||
const currentBlock = stylesheetStore.extractBlock('@page');
|
||||
const updatedBlock = currentBlock.replace(
|
||||
/(margin:\s*)[^;]+/,
|
||||
`$1${marginValue}`
|
||||
);
|
||||
|
||||
stylesheetStore.replaceBlock(currentBlock, updatedBlock);
|
||||
stylesheetStore.updateProperty('@page', 'margin', marginValue, '');
|
||||
};
|
||||
|
||||
// Watch margin values (number inputs) with debounce
|
||||
|
|
@ -330,22 +323,7 @@ watch(
|
|||
|
||||
const updateBackground = () => {
|
||||
if (!background.value.value) return;
|
||||
|
||||
const currentBlock = stylesheetStore.extractBlock('@page');
|
||||
|
||||
if (currentBlock.includes('background:')) {
|
||||
const updatedBlock = currentBlock.replace(
|
||||
/(background:\s*)[^;]+/,
|
||||
`$1${background.value.value}`
|
||||
);
|
||||
stylesheetStore.replaceBlock(currentBlock, updatedBlock);
|
||||
} else {
|
||||
const updatedBlock = currentBlock.replace(
|
||||
/(\s*})$/,
|
||||
` background: ${background.value.value};\n$1`
|
||||
);
|
||||
stylesheetStore.replaceBlock(currentBlock, updatedBlock);
|
||||
}
|
||||
stylesheetStore.updateProperty('@page', 'background', background.value.value, '');
|
||||
};
|
||||
|
||||
// Watch background value (text input) with debounce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue