Commit 75c77dde authored by zhuyangbin's avatar zhuyangbin

udate

parent 57facb12
......@@ -110,6 +110,21 @@ const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef,
previewMth,
};
});
const hooks = {
'toggle-link': ({ href, target }) => {
if (href) {
href = href.indexOf('http') === 0 ? href : `http://${href}`;
return { href, target };
}
},
'set-image-link': (href) => {
if (href) {
href = href.indexOf('http') === 0 ? href : `http://${href}`;
return href;
}
},
};
return (
<div className={styles.box}>
<BraftEditor
......@@ -120,6 +135,7 @@ const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef,
extendControls={extendControls}
componentBelowControlBar={componentBelowControlBar()}
language={language}
hooks={hooks}
/>
<Preview cRef={previewRef} htmlStr={getHtml()} language={language} />
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment