feat: add increase/decrease text size buttons
This commit is contained in:
1 parent
5b11cdf3f6
commit
308a80867c
4 files changed
+28
-1
No files matched your search
@@ -20,6 +20,7 @@
|
||||
import { DEFAULT_HF_DISTANCES, clampHfDistance, type HfDistances } from '../storage/headerFooter';
|
||||
import { blockFontSize, coversWholeBlock, DEFAULT_FONT_SIZE, FONT_SIZES, type SizedBlock } from '../utils/fontSize';
|
||||
import { listContext } from '../editor/extensions/indent';
|
||||
import { stepFontSize } from '../editor/extensions/shortcuts';
|
||||
import { findColumns, DEFAULT_COLUMN_GAP_CM } from '../editor/extensions/columns';
|
||||
import { t } from '../i18n/i18n.svelte';
|
||||
import { shortcutHint, type ShortcutId } from '../editor/shortcuts';
|
||||
@@ -1089,6 +1090,27 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="toolbar-group">
|
||||
<button
|
||||
onclick={() => editor && stepFontSize(editor, 1)}
|
||||
title={`${t().toolbarExpanded.growFont} (${shortcutHint('fontGrow')})`}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<text x="5" y="14" text-anchor="middle" font-size="15" font-family="sans-serif" fill="currentColor">A</text>
|
||||
<path d="M12.5 12V5m0 0L10.5 7m2-2l2 2" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
onclick={() => editor && stepFontSize(editor, -1)}
|
||||
title={`${t().toolbarExpanded.shrinkFont} (${shortcutHint('fontShrink')})`}
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<text x="5" y="14" text-anchor="middle" font-size="11" font-family="sans-serif" fill="currentColor">A</text>
|
||||
<path d="M12.5 5v7m0 0l-2-2m2 2l2-2" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-separator"></div>
|
||||
|
||||
<div class="toolbar-group">
|
||||
|
||||
@@ -33,7 +33,8 @@ function currentSizePt(editor: Editor): number {
|
||||
}
|
||||
|
||||
// Word's Ctrl+Shift+> / <: jump to the next size on the toolbar's ladder.
|
||||
function stepFontSize(editor: Editor, dir: 1 | -1): boolean {
|
||||
// Also the grow/shrink toolbar buttons.
|
||||
export function stepFontSize(editor: Editor, dir: 1 | -1): boolean {
|
||||
const cur = currentSizePt(editor);
|
||||
const ladder = dir > 0 ? FONT_SIZES : [...FONT_SIZES].reverse();
|
||||
const next = ladder.find((s) => (dir > 0 ? s > cur : s < cur));
|
||||
|
||||
@@ -112,6 +112,8 @@ const de: Messages = {
|
||||
loadAllFonts: 'Alle installierten Schriften laden',
|
||||
fontSize: 'Schriftgröße',
|
||||
fontSizeList: 'Schriftgrößenliste',
|
||||
growFont: 'Schrift vergrößern',
|
||||
shrinkFont: 'Schrift verkleinern',
|
||||
fontColor: 'Schriftfarbe',
|
||||
chooseFontColor: 'Schriftfarbe wählen',
|
||||
highlightColor: 'Hervorhebungsfarbe',
|
||||
|
||||
@@ -116,6 +116,8 @@ const en = {
|
||||
loadAllFonts: 'Load all installed fonts',
|
||||
fontSize: 'Font size',
|
||||
fontSizeList: 'Font size list',
|
||||
growFont: 'Increase font size',
|
||||
shrinkFont: 'Decrease font size',
|
||||
fontColor: 'Font color',
|
||||
chooseFontColor: 'Choose font color',
|
||||
highlightColor: 'Highlight color',
|
||||
|
||||
Reference in new issue
Block a user