This repository was archived by the owner on Jan 20, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export default class MarkdownPaste extends Extension {
3333 return true ;
3434 }
3535
36- // Is this link embedable ? Create an embed!
36+ // Is this link embeddable ? Create an embed!
3737 const { embeds } = this . editor . props ;
3838
3939 if ( embeds ) {
@@ -49,10 +49,22 @@ export default class MarkdownPaste extends Extension {
4949 }
5050 }
5151 }
52+
53+ // well, it's not an embed and there is no text selected – so just
54+ // go ahead and insert the link directly
55+ const transaction = view . state . tr
56+ . insertText ( text , state . selection . from , state . selection . to )
57+ . addMark (
58+ state . selection . from ,
59+ state . selection . to + text . length ,
60+ state . schema . marks . link . create ( { href : text } )
61+ ) ;
62+ view . dispatch ( transaction ) ;
63+ return true ;
5264 }
5365
54- // otherwise, if we have html then fallback to the default HTML
55- // parser behavior that comes with Prosemirror.
66+ // otherwise, if we have html on the clipboard then fallback to the
67+ // default HTML parser behavior that comes with Prosemirror.
5668 if ( text . length === 0 || html ) return false ;
5769
5870 event . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments