diff --git a/src/App.svelte b/src/App.svelte index 01751f7..6b2004c 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -838,6 +838,7 @@ {zoom} onZoom={setZoom} onDebugDump={import.meta.env.DEV ? handleDebugDump : undefined} + bind:tabIntervalCm bind:pageMargins bind:pageOrientation bind:pageFormat diff --git a/src/lib/components/ParagraphDialog.svelte b/src/lib/components/ParagraphDialog.svelte new file mode 100644 index 0000000..c0699c4 --- /dev/null +++ b/src/lib/components/ParagraphDialog.svelte @@ -0,0 +1,213 @@ + + + (open = false)} onclick={(e) => e.target === dialogEl && (open = false)} aria-label={t().paragraphDialog.title}> +
+

{t().paragraphDialog.title}

+ +
+ + +
+ + {#if pane === 'indents'} + + +
+ + + + + + +
+ + + {:else} +
+ {#each FLOW as f} + + {/each} +
+

{t().paragraphDialog.flowHint}

+ {/if} + +
+ + + +
+
+
+ + diff --git a/src/lib/components/TabsDialog.svelte b/src/lib/components/TabsDialog.svelte new file mode 100644 index 0000000..30d5865 --- /dev/null +++ b/src/lib/components/TabsDialog.svelte @@ -0,0 +1,170 @@ + + + (open = false)} onclick={(e) => e.target === dialogEl && (open = false)} aria-label={t().tabsDialog.title}> +
+

{t().tabsDialog.title}

+ +
+ {#if stops.length === 0} +

{t().tabsDialog.none}

+ {/if} + {#each stops as s (s.pos)} +
+ {fmt(s.pos)} cm + + + +
+ {/each} +
+ +
+ e.key === 'Enter' && add()} /> + + + +
+ + + +
+ + +
+
+
+ + diff --git a/src/lib/components/ribbon/Ribbon.svelte b/src/lib/components/ribbon/Ribbon.svelte index 52e159a..186eff9 100644 --- a/src/lib/components/ribbon/Ribbon.svelte +++ b/src/lib/components/ribbon/Ribbon.svelte @@ -13,6 +13,8 @@ import TableTabs from './tabs/TableTabs.svelte'; import FrameTabs from './tabs/FrameTabs.svelte'; import UiLanguagePicker from '../UiLanguagePicker.svelte'; + import ParagraphDialog from '../ParagraphDialog.svelte'; + import TabsDialog from '../TabsDialog.svelte'; import { clickOutside, isMenuOpen, toggleMenu, closeMenu } from './menu.svelte'; import { t } from '../../i18n/i18n.svelte'; import { withShortcut } from '../../i18n/shortcut'; @@ -24,6 +26,7 @@ import type { PageFormat } from '../../storage/pageFormat'; import type { HfZone } from '../../storage/headerFooter'; import type { DocumentLanguage } from '../../storage/documentLanguage'; + import { DEFAULT_TAB_INTERVAL_CM } from '../../storage/tabInterval'; let { editor, @@ -37,6 +40,7 @@ zoom = 100, onZoom, onDebugDump, + tabIntervalCm = $bindable(DEFAULT_TAB_INTERVAL_CM), pageMargins = $bindable(DEFAULT_MARGINS), pageOrientation = $bindable('portrait'), pageFormat = $bindable('A4'), @@ -63,6 +67,7 @@ zoom?: number; onZoom?: (value: number) => void; onDebugDump?: () => void; + tabIntervalCm?: number; pageMargins?: PageMargins; pageOrientation?: Orientation; pageFormat?: PageFormat; @@ -122,6 +127,8 @@ }); let docNameSizerWidth = $state(0); + let paragraphDialogOpen = $state(false); + let tabsDialogOpen = $state(false); function run(fn?: () => void) { closeMenu(); @@ -254,11 +261,11 @@
{#if tab === 'home'} - + (paragraphDialogOpen = true)} /> {:else if tab === 'insert'} {:else if tab === 'layout'} - + (paragraphDialogOpen = true)} /> {:else if tab === 'references'} {:else if tab === 'review'} @@ -272,6 +279,7 @@ {editor} which={tab === 'pictureFormat' ? 'picture' : 'shape'} wrap={(frameAttrs?.wrap ?? 'inline') as never} + alt={(frameAttrs?.alt ?? '') as string} shapeKind={frameAttrs?.shapeKind as never} fillColor={frameAttrs?.fillColor as string | null} strokeColor={frameAttrs?.strokeColor as string | null} @@ -279,6 +287,9 @@ /> {/if}
+ + (tabsDialogOpen = true)} /> + diff --git a/src/lib/components/ribbon/tabs/HomeTab.svelte b/src/lib/components/ribbon/tabs/HomeTab.svelte index b7e7d90..a8692fd 100644 --- a/src/lib/components/ribbon/tabs/HomeTab.svelte +++ b/src/lib/components/ribbon/tabs/HomeTab.svelte @@ -25,12 +25,13 @@ import { withShortcut } from '../../../i18n/shortcut'; import { shortcutHint, type ShortcutId } from '../../../editor/shortcuts'; - let { editor, tick, showFormattingMarks = $bindable(false), onManageStyles, onFind }: { + let { editor, tick, showFormattingMarks = $bindable(false), onManageStyles, onFind, onParagraphDialog }: { editor: Editor | null; tick: number; showFormattingMarks?: boolean; onManageStyles?: (family: StyleFamily) => void; onFind?: (mode: 'find' | 'replace') => void; + onParagraphDialog?: () => void; } = $props(); let sheet = $derived(styleSheet()); @@ -240,7 +241,7 @@
- +
diff --git a/src/lib/components/ribbon/tabs/LayoutTab.svelte b/src/lib/components/ribbon/tabs/LayoutTab.svelte index 8d0dc12..383848e 100644 --- a/src/lib/components/ribbon/tabs/LayoutTab.svelte +++ b/src/lib/components/ribbon/tabs/LayoutTab.svelte @@ -17,6 +17,7 @@ pageMargins = $bindable(DEFAULT_MARGINS), pageOrientation = $bindable('portrait'), pageFormat = $bindable('A4'), + onParagraphDialog, }: { editor: Editor | null; tick: number; @@ -24,6 +25,7 @@ pageMargins?: PageMargins; pageOrientation?: Orientation; pageFormat?: PageFormat; + onParagraphDialog?: () => void; } = $props(); const FORMATS = Object.keys(PAGE_FORMAT_CM) as PageFormat[]; @@ -195,7 +197,7 @@ - +