mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Fixed AdminX HTML editor always making forms dirty (#17741)
refs https://github.com/TryGhost/Product/issues/3545
This commit is contained in:
parent
f1266c6b9f
commit
b6b50a388e
1 changed files with 8 additions and 1 deletions
|
@ -120,6 +120,13 @@ const KoenigWrapper: React.FC<HtmlEditorProps & { editor: EditorResource }> = ({
|
|||
MINIMAL_NODES: koenig.MINIMAL_TRANSFORMERS
|
||||
};
|
||||
|
||||
const handleSetHtml = (html: string) => {
|
||||
// Koenig sends this event on load without changing the value, so this prevents forms from being marked as unsaved
|
||||
if (html !== value) {
|
||||
onChange?.(html);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<koenig.KoenigComposer
|
||||
nodes={koenig[nodes || 'DEFAULT_NODES']}
|
||||
|
@ -135,7 +142,7 @@ const KoenigWrapper: React.FC<HtmlEditorProps & { editor: EditorResource }> = ({
|
|||
singleParagraph={true}
|
||||
onBlur={onBlur}
|
||||
>
|
||||
<koenig.HtmlOutputPlugin html={value} setHtml={onChange} />
|
||||
<koenig.HtmlOutputPlugin html={value} setHtml={handleSetHtml} />
|
||||
</koenig.KoenigComposableEditor>
|
||||
</koenig.KoenigComposer>
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue