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, ...@@ -110,6 +110,21 @@ const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef,
previewMth, 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 ( return (
<div className={styles.box}> <div className={styles.box}>
<BraftEditor <BraftEditor
...@@ -120,6 +135,7 @@ const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef, ...@@ -120,6 +135,7 @@ const EditorDemo: React.FC<IProps> = ({ value, language = 'zh', onChange, cRef,
extendControls={extendControls} extendControls={extendControls}
componentBelowControlBar={componentBelowControlBar()} componentBelowControlBar={componentBelowControlBar()}
language={language} language={language}
hooks={hooks}
/> />
<Preview cRef={previewRef} htmlStr={getHtml()} language={language} /> <Preview cRef={previewRef} htmlStr={getHtml()} language={language} />
</div> </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