Preserve QWord page breaks in DOCX

This commit is contained in:
Курнат Андрей
2026-06-01 19:35:11 +03:00
parent a2de721fc4
commit 6204d59418
6 changed files with 134 additions and 17 deletions
+8
View File
@@ -14,6 +14,7 @@ import {
PaintBucket,
Pilcrow,
Save,
SeparatorHorizontal,
Strikethrough,
Type,
Underline
@@ -144,6 +145,10 @@ export function QWord({ document, onChange }: QWordProps) {
updateHtml();
}
function insertPageBreak() {
runCommand("insertHTML", '<span data-qoffice-page-break="true" contenteditable="false"></span><p><br></p>');
}
async function insertImage(file: File | undefined) {
if (!file) {
return;
@@ -278,6 +283,9 @@ export function QWord({ document, onChange }: QWordProps) {
<button type="button" onClick={insertLink} title="Вставить ссылку">
<Link size={16} />
</button>
<button type="button" onClick={insertPageBreak} title="Разрыв страницы" aria-label="Разрыв страницы">
<SeparatorHorizontal size={16} />
</button>
<button type="button" onClick={() => imageInputRef.current?.click()} title="Вставить изображение">
<ImageIcon size={16} />
</button>