diff --git a/components/braftEditor/index.tsx b/components/braftEditor/index.tsx index c58627d78c261a4a6aaea25c0d43e9a3683aab78..28fd4600693c105208f5faa404b9ecd64503c90e 100644 --- a/components/braftEditor/index.tsx +++ b/components/braftEditor/index.tsx @@ -110,6 +110,21 @@ const EditorDemo: React.FC = ({ 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 (
= ({ value, language = 'zh', onChange, cRef, extendControls={extendControls} componentBelowControlBar={componentBelowControlBar()} language={language} + hooks={hooks} />