fix: heading line space
This commit is contained in:
1 parent
1cd1c717c0
commit
91a37c5652
4 files changed
+12
-9
No files matched your search
@@ -158,7 +158,7 @@
|
||||
});
|
||||
|
||||
// Must match line-height in editor.css (.paper .tiptap)
|
||||
const DEFAULT_LINE_HEIGHT = '1.5';
|
||||
const DEFAULT_LINE_HEIGHT = '1';
|
||||
const LINE_HEIGHTS = [
|
||||
{ value: '1', label: 'Single' },
|
||||
{ value: '1.15', label: '1.15' },
|
||||
|
||||
@@ -39,14 +39,14 @@ export const LineHeight = Extension.create({
|
||||
addCommands() {
|
||||
return {
|
||||
setLineHeight: (lineHeight: string) => ({ commands }) => {
|
||||
return this.options.types.every((type) =>
|
||||
commands.updateAttributes(type, { lineHeight })
|
||||
);
|
||||
return this.options.types
|
||||
.map((type) => commands.updateAttributes(type, { lineHeight }))
|
||||
.some((r) => r);
|
||||
},
|
||||
unsetLineHeight: () => ({ commands }) => {
|
||||
return this.options.types.every((type) =>
|
||||
commands.resetAttributes(type, 'lineHeight')
|
||||
);
|
||||
return this.options.types
|
||||
.map((type) => commands.resetAttributes(type, 'lineHeight'))
|
||||
.some((r) => r);
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ const CUST_P = '__cust_p__';
|
||||
const CUST_H = '__cust_h__';
|
||||
|
||||
const DEFAULT_FONT = 'Georgia'; // must match DEFAULT_EDITOR_FONT in ToolbarExpanded.svelte
|
||||
const DEFAULT_LINE_HEIGHT = 1; // must match line-height in editor.css (.paper .tiptap)
|
||||
|
||||
function hasCustomAttrs(attrs: TiptapNode['attrs']): boolean {
|
||||
if (!attrs) return false;
|
||||
@@ -177,6 +178,8 @@ export async function exportToOdt(editor: Editor): Promise<void> {
|
||||
const lhRaw = String(node.attrs.lineHeight);
|
||||
const lhNum = parseFloat(lhRaw);
|
||||
opts.lineHeight = isNaN(lhNum) ? lhRaw : lhNum;
|
||||
} else {
|
||||
opts.lineHeight = DEFAULT_LINE_HEIGHT;
|
||||
}
|
||||
const ta = node.attrs?.textAlign;
|
||||
if (ta === 'left' || ta === 'center' || ta === 'right' || ta === 'justify') {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
outline: none;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 1.05rem;
|
||||
line-height: 1.5;
|
||||
line-height: 1;
|
||||
color: var(--color-page-text);
|
||||
|
||||
/* Multi-page background: page surfaces separated by editor background */
|
||||
@@ -109,7 +109,7 @@
|
||||
.paper .tiptap h2,
|
||||
.paper .tiptap h3 {
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
line-height: 1;
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user