mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Do not perform link lookup for replaced links (#14742)
A link that was added because a watched word was replaced could create a notice if the same link was present before.
This commit is contained in:
parent
efc23b6a8d
commit
148ee1d162
3 changed files with 11 additions and 0 deletions
|
@ -32,6 +32,8 @@ function findAllMatches(text, matchers) {
|
|||
}
|
||||
|
||||
export function setup(helper) {
|
||||
const opts = helper.getOptions();
|
||||
|
||||
helper.registerPlugin((md) => {
|
||||
const matchers = [];
|
||||
|
||||
|
@ -139,6 +141,9 @@ export function setup(helper) {
|
|||
if (htmlLinkLevel === 0 && state.md.validateLink(url)) {
|
||||
token = new state.Token("link_open", "a", 1);
|
||||
token.attrs = [["href", url]];
|
||||
if (opts.discourse.previewing) {
|
||||
token.attrs.push(["data-word", ""]);
|
||||
}
|
||||
token.level = level++;
|
||||
token.markup = "linkify";
|
||||
token.info = "auto";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue