diff --git a/src/App.svelte b/src/App.svelte index cfeba9c..10535c1 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -832,9 +832,9 @@ bind:chromeMode bind:documentName bind:showFormattingMarks - {pageMargins} - {pageOrientation} - {pageFormat} + bind:pageMargins + bind:pageOrientation + bind:pageFormat {hfActive} onManageStyles={openStyleManager} onManageTableStyles={() => openStyleManager('table')} diff --git a/src/lib/components/ribbon/Ribbon.svelte b/src/lib/components/ribbon/Ribbon.svelte index 5df2e92..c75029c 100644 --- a/src/lib/components/ribbon/Ribbon.svelte +++ b/src/lib/components/ribbon/Ribbon.svelte @@ -5,6 +5,7 @@ import HistoryButton from '../HistoryButton.svelte'; import HomeTab from './tabs/HomeTab.svelte'; import InsertTab from './tabs/InsertTab.svelte'; + import LayoutTab from './tabs/LayoutTab.svelte'; import UiLanguagePicker from '../UiLanguagePicker.svelte'; import { clickOutside, isMenuOpen, toggleMenu, closeMenu } from './menu.svelte'; import { t } from '../../i18n/i18n.svelte'; @@ -12,7 +13,7 @@ import { shortcutHint } from '../../editor/shortcuts'; import type { ChromeMode, ThemeMode } from '../../storage/theme'; import type { StyleFamily } from '../../styles/styleSheet'; - import type { PageMargins } from '../../storage/pageMargins'; + import { DEFAULT_MARGINS, type PageMargins } from '../../storage/pageMargins'; import type { Orientation } from '../../storage/pageOrientation'; import type { PageFormat } from '../../storage/pageFormat'; import type { HfZone } from '../../storage/headerFooter'; @@ -23,9 +24,9 @@ chromeMode = $bindable('ribbon'), documentName = $bindable(''), showFormattingMarks = $bindable(false), - pageMargins, - pageOrientation, - pageFormat, + pageMargins = $bindable(DEFAULT_MARGINS), + pageOrientation = $bindable('portrait'), + pageFormat = $bindable('A4'), hfActive = null, onManageStyles, onManageTableStyles, @@ -43,9 +44,9 @@ chromeMode?: ChromeMode; documentName?: string; showFormattingMarks?: boolean; - pageMargins: PageMargins; - pageOrientation: Orientation; - pageFormat: PageFormat; + pageMargins?: PageMargins; + pageOrientation?: Orientation; + pageFormat?: PageFormat; hfActive?: HfZone | null; onManageStyles?: (family: StyleFamily) => void; onManageTableStyles?: (family: StyleFamily) => void; @@ -204,6 +205,8 @@ {:else if tab === 'insert'} + {:else if tab === 'layout'} + {/if} diff --git a/src/lib/components/ribbon/icons.ts b/src/lib/components/ribbon/icons.ts index bddbbf4..d930b91 100644 --- a/src/lib/components/ribbon/icons.ts +++ b/src/lib/components/ribbon/icons.ts @@ -57,6 +57,10 @@ export const STROKED = { find: ['M7.25 12.5a5.25 5.25 0 1 0 0-10.5 5.25 5.25 0 0 0 0 10.5z', 'M11.2 11.2 14 14'], replace: ['M2 4.5h6.5M2 4.5 4 2.5M2 4.5l2 2', 'M14 11.5H7.5M14 11.5l-2-2M14 11.5l-2 2'], + margins: ['M1.75 1.75h12.5v12.5H1.75z', 'M4.5 1.75v12.5M11.5 1.75v12.5', 'M1.75 4.5h12.5M1.75 11.5h12.5'], + orientation: ['M2.5 2h7v12h-7z', 'M11 6.5h3v6h-3z'], + pageSize: ['M2.5 1.75h11v12.5h-11z', 'M5 5h6M5 8h6M5 11h4'], + columns: ['M2 2.5h4.5v11H2zM9.5 2.5H14v11H9.5z'], image: ['M2 3.25h12v9.5H2z', 'M2 10.5 5.75 7l3 2.75L11 7.5l3 3', 'M10.6 6.4a1.1 1.1 0 1 0 0-2.2 1.1 1.1 0 0 0 0 2.2z'], textBox: ['M1.75 4h12.5v8H1.75z', 'M5 6.5h6M5 9h4'], link: ['M6.6 9.4 9.4 6.6', 'M7.4 4.4 9 2.8a2.7 2.7 0 0 1 3.8 3.8l-1.6 1.6', 'M8.6 11.6 7 13.2a2.7 2.7 0 0 1-3.8-3.8l1.6-1.6'], diff --git a/src/lib/components/ribbon/tabs/LayoutTab.svelte b/src/lib/components/ribbon/tabs/LayoutTab.svelte new file mode 100644 index 0000000..8d0dc12 --- /dev/null +++ b/src/lib/components/ribbon/tabs/LayoutTab.svelte @@ -0,0 +1,274 @@ + + + +
+ toggleMenu('margins')} onCaret={() => toggleMenu('margins')} /> + {#if isMenuOpen('margins')} + + {/if} +
+ +
+ toggleMenu('orientation')} onCaret={() => toggleMenu('orientation')} /> + {#if isMenuOpen('orientation')} + + {/if} +
+ +
+ toggleMenu('pageFormat')} onCaret={() => toggleMenu('pageFormat')} /> + {#if isMenuOpen('pageFormat')} + + {/if} +
+ +
+ toggleMenu('columns')} + onCaret={() => toggleMenu('columns')} + /> + {#if isMenuOpen('columns')} + + {/if} +
+ +
+ toggleMenu('breaks')} + onCaret={() => toggleMenu('breaks')} + /> + {#if isMenuOpen('breaks')} + + {/if} +
+
+ +
+ + + +
+ + + + +
+
+ + diff --git a/src/lib/i18n/locales/de.ts b/src/lib/i18n/locales/de.ts index d6c4031..f780134 100644 --- a/src/lib/i18n/locales/de.ts +++ b/src/lib/i18n/locales/de.ts @@ -470,6 +470,7 @@ const de: Messages = { headerFooter: 'Kopf- und Fußzeile', text: 'Text', symbols: 'Symbole', + pageSetup: 'Seite einrichten', editing: 'Bearbeiten', }, case: { @@ -500,6 +501,20 @@ const de: Messages = { table: 'Tabelle', dateTime: 'Datum & Uhrzeit', symbol: 'Symbol', + margins: 'Seitenränder', + size: 'Größe', + breaks: 'Umbrüche', + sectionBreak: 'Abschnittsumbruch', + sectionBreakHint: 'Beginnt eine eigene Kopf- und Fußzeile', + indentLeft: 'Einzug links', + indentRight: 'Einzug rechts', + spaceBefore: 'Abstand davor', + spaceAfter: 'Abstand danach', + marginPresets: { + normal: 'Normal', + narrow: 'Schmal', + wide: 'Breit', + }, chrome: { title: 'Symbolleisten-Stil', ribbon: 'Menüband', diff --git a/src/lib/i18n/locales/en.ts b/src/lib/i18n/locales/en.ts index 46d793a..f07bad6 100644 --- a/src/lib/i18n/locales/en.ts +++ b/src/lib/i18n/locales/en.ts @@ -474,6 +474,7 @@ const en = { headerFooter: 'Header & Footer', text: 'Text', symbols: 'Symbols', + pageSetup: 'Page Setup', editing: 'Editing', }, case: { @@ -504,6 +505,20 @@ const en = { table: 'Table', dateTime: 'Date & time', symbol: 'Symbol', + margins: 'Margins', + size: 'Size', + breaks: 'Breaks', + sectionBreak: 'Section break', + sectionBreakHint: 'Starts its own header and footer', + indentLeft: 'Indent left', + indentRight: 'Indent right', + spaceBefore: 'Space before', + spaceAfter: 'Space after', + marginPresets: { + normal: 'Normal', + narrow: 'Narrow', + wide: 'Wide', + }, chrome: { title: 'Toolbar style', ribbon: 'Ribbon',