feat: fix signature editor init and expand README
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 18s
- Pass initialContent prop to WysiwygEditor instead of imperative setContent to ensure mail signature loads correctly on mount - Rewrite README to reflect full project scope (scanner inbox, email import, postprocessing rules, label printing, OIDC auth) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ export interface WysiwygEditorHandle {
|
||||
|
||||
interface WysiwygEditorProps {
|
||||
minHeight?: number;
|
||||
initialContent?: string;
|
||||
}
|
||||
|
||||
function ToolBtn({
|
||||
@@ -69,14 +70,14 @@ const HEADING_OPTIONS = [
|
||||
];
|
||||
|
||||
export const WysiwygEditor = forwardRef<WysiwygEditorHandle, WysiwygEditorProps>(
|
||||
({ minHeight = 200 }, ref) => {
|
||||
({ minHeight = 200, initialContent }, ref) => {
|
||||
const editor = useEditor({
|
||||
extensions: [
|
||||
StarterKit,
|
||||
Underline,
|
||||
TextAlign.configure({ types: ['heading', 'paragraph'] }),
|
||||
],
|
||||
content: '',
|
||||
content: initialContent ?? '',
|
||||
});
|
||||
|
||||
useImperativeHandle(
|
||||
|
||||
@@ -68,6 +68,7 @@ function MailSettingsTab() {
|
||||
const [testing, setTesting] = useState(false);
|
||||
const [testResult, setTestResult] = useState<{ ok: boolean; error?: string } | null>(null);
|
||||
const [passSet, setPassSet] = useState(false);
|
||||
const [signatureHtml, setSignatureHtml] = useState<string | null>(null);
|
||||
const editorRef = useRef<WysiwygEditorHandle>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -81,9 +82,7 @@ function MailSettingsTab() {
|
||||
smtpFromName: data.smtpFromName ?? '',
|
||||
});
|
||||
setPassSet(data.smtpPassSet);
|
||||
if (data.mailSignatureHtml) {
|
||||
editorRef.current?.setContent(data.mailSignatureHtml);
|
||||
}
|
||||
setSignatureHtml(data.mailSignatureHtml ?? null);
|
||||
}).catch(() => {
|
||||
message.error('Einstellungen konnten nicht geladen werden');
|
||||
}).finally(() => setLoading(false));
|
||||
@@ -167,7 +166,7 @@ function MailSettingsTab() {
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="Signatur">
|
||||
<WysiwygEditor ref={editorRef} minHeight={180} />
|
||||
<WysiwygEditor ref={editorRef} initialContent={signatureHtml ?? ''} minHeight={180} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
|
||||
Reference in New Issue
Block a user