Skip to content

Commit

Permalink
fix(commands): update commonmark to select link instead of text
Browse files Browse the repository at this point in the history
See https://meta.stackoverflow.com/a/423576/5541798  for more context about this change
  • Loading branch information
giamir committed Apr 6, 2023
1 parent 1073c64 commit 608562a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/commonmark/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,8 @@ export function insertCommonmarkLinkCommand(
if (state.selection.empty) {
return insertRawText(
"[text](" + dummyLink + ")",
1,
5,
7, // length of "[text](" before the dummyLink
7 + dummyLink.length,
state,
dispatch
);
Expand Down
2 changes: 1 addition & 1 deletion test/commonmark/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ some text`;
expect(state).transactionSuccess(
commands.insertCommonmarkLinkCommand,
"[text](http://localhost)",
"text"
"http://localhost"
);
});

Expand Down

0 comments on commit 608562a

Please sign in to comment.