From a032f2e7e5030af47054abc1adb5443c1ad45772 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 9 Jan 2024 22:04:11 -0500 Subject: [PATCH] fix: Revert removal of protocol on pasted links (turns out folks didn't like this change) --- app/editor/extensions/PasteHandler.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/editor/extensions/PasteHandler.ts b/app/editor/extensions/PasteHandler.ts index dc64bbec1..bc99a252a 100644 --- a/app/editor/extensions/PasteHandler.ts +++ b/app/editor/extensions/PasteHandler.ts @@ -111,18 +111,17 @@ export default class PasteHandler extends Extension { const vscode = event.clipboardData.getData("vscode-editor-data"); function insertLink(href: string, title?: string) { - const normalized = href.replace(/^https?:\/\//, ""); // If it's not an embed and there is no text selected – just go ahead and insert the // link directly const transaction = view.state.tr .insertText( - title ?? normalized, + title ?? href, state.selection.from, state.selection.to ) .addMark( state.selection.from, - state.selection.to + (title ?? normalized).length, + state.selection.to + (title ?? href).length, state.schema.marks.link.create({ href }) ); view.dispatch(transaction);