diff --git a/src/examples/diff-source.tsx b/src/examples/diff-source.tsx index 7ee0d329..270e2375 100644 --- a/src/examples/diff-source.tsx +++ b/src/examples/diff-source.tsx @@ -16,3 +16,20 @@ export function GetMarkdownInSourceMode() { ) } + +export function ChangeDiffMakrkdown() { + const ref = useRef(null) + const [diffMarkdown, setDiffMarkdown] = React.useState('foo') + return ( +
+ + console.log('change', md)} + markdown="Hello world" + plugins={[diffSourcePlugin({ viewMode: 'diff', diffMarkdown })]} + /> + +
+ ) +} diff --git a/src/plugins/diff-source/index.tsx b/src/plugins/diff-source/index.tsx index 53d932f7..a0b843b6 100644 --- a/src/plugins/diff-source/index.tsx +++ b/src/plugins/diff-source/index.tsx @@ -56,6 +56,9 @@ export const [ ] = realmPlugin({ id: 'diff-source', systemSpec: diffSourceSystem, + applyParamsToSystem: (r, params?: DiffSourcePluginParams) => { + r.pubKey('diffMarkdown', params?.diffMarkdown || '') + }, init(r, params?: DiffSourcePluginParams) { r.pubKey('diffMarkdown', params?.diffMarkdown || '')