feat(Link): do not insert http:// for links from buffer#1043
Open
saxumcordis wants to merge 2 commits intomainfrom
Open
feat(Link): do not insert http:// for links from buffer#1043saxumcordis wants to merge 2 commits intomainfrom
http:// for links from buffer#1043saxumcordis wants to merge 2 commits intomainfrom
Conversation
5cb3519 to
6e31caa
Compare
http:// for links from bufferhttp:// for links from buffer
makhnatkin
reviewed
Apr 2, 2026
| const view = new EditorView(null, {state}); | ||
| dispatchPasteEvent(view, {'text/plain': 'ya.ru'}); | ||
| expect(view.state.doc).toMatchNode(doc(p(lnkYa('ya.ru')))); | ||
| same('[ya.ru](ya.ru)', view.state.doc); |
Collaborator
There was a problem hiding this comment.
Currently, when inserting a link, it will be inserted with the protocol. After this fix, judging by the test, there won't be any protocol.
I suggest changing it to
same('[ya.ru](http://ya.ru)', view.state.doc);
| describe('linkifyRawHrefPlugin', () => { | ||
| it('uses raw hostname in href for pasted text with trailing words', () => { | ||
| const md = mdWithPlugin(); | ||
| expect(md.renderInline('ya.ru dasda')).toBe('<a href="ya.ru">ya.ru</a> dasda'); |
Collaborator
There was a problem hiding this comment.
If I understand correctly, the linkifyRawHrefPlugin was added to avoid adding the protocol when the user hasn't inserted it. In my opinion, the correct approach is to always use the protocol in the link itself, as before, but not display it in the text.
So, the plugin seems unnecessary
Contributor
Author
There was a problem hiding this comment.
What if i paste fdqn for ssh?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.