fix: the empty document's placeholder follows the UI language
The body said "Start typing…" in every language while the header and footer zones were localized; switching the language now redraws it.
This commit is contained in:
1 parent
9335f392ce
commit
bc8f8d89d1
4 files changed
+11
-1
No files matched your search
@@ -1134,6 +1134,13 @@ import { EMPTY_PAGE_DECOR, type PageDecor } from '../storage/pageDecor';
|
||||
waitForSettled();
|
||||
});
|
||||
|
||||
// The placeholder is a decoration, redrawn only by a view update; the UI language
|
||||
// switching is not one, so give it a push.
|
||||
$effect(() => {
|
||||
t();
|
||||
editor?.view.updateState(editor.view.state);
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
// Start with empty history lists — loaded content is not an undoable edit.
|
||||
resetHistoryLog();
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Table, TableHeader, TableCell } from '@tiptap/extension-table';
|
||||
import { ResizableTableRow } from './extensions/tableRow';
|
||||
import History from '@tiptap/extension-history';
|
||||
import Placeholder from '@tiptap/extension-placeholder';
|
||||
import { t } from '../i18n/i18n.svelte';
|
||||
|
||||
import { PageBreaks } from './extensions/pageBreaks';
|
||||
import { LineHeight } from './extensions/lineHeight';
|
||||
@@ -224,7 +225,7 @@ export const extensions = [
|
||||
// and the user can keep writing below a table at the document's end.
|
||||
TrailingNode,
|
||||
History,
|
||||
Placeholder.configure({ placeholder: 'Start typing…' }),
|
||||
Placeholder.configure({ placeholder: () => t().app.startTyping }),
|
||||
// No defaultAlignment: it would put textAlign:'left' on every block, and that inline
|
||||
// style beats the paragraph style's alignment. Unset = follow the style; an explicit
|
||||
// 'left' stays direct formatting that overrides it, as in Word/LibreOffice.
|
||||
|
||||
@@ -1035,6 +1035,7 @@ const de: Messages = {
|
||||
app: {
|
||||
documentName: 'Dokumentname',
|
||||
untitled: 'Unbenanntes Dokument',
|
||||
startTyping: 'Hier tippen…',
|
||||
newDocument: 'Neues Dokument',
|
||||
open: 'Öffnen…',
|
||||
save: '.odt speichern',
|
||||
|
||||
@@ -1041,6 +1041,7 @@ const en = {
|
||||
app: {
|
||||
documentName: 'Document name',
|
||||
untitled: 'Untitled document',
|
||||
startTyping: 'Start typing…',
|
||||
newDocument: 'New document',
|
||||
open: 'Open…',
|
||||
save: 'Save .odt',
|
||||
|
||||
Reference in new issue
Block a user