mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not replace in mentions and hashtags (#14260)
Watched words of type 'replace' or 'link' replaced the text inside mentions or hashtags too, which broke these. These types of watched words must skip any match that has an @ or # before it.
This commit is contained in:
@@ -119,6 +119,14 @@ export function setup(helper) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
matches[ln].index > 0 &&
|
||||
(text[matches[ln].index - 1] === "@" ||
|
||||
text[matches[ln].index - 1] === "#")
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (matches[ln].index > lastPos) {
|
||||
token = new state.Token("text", "", 0);
|
||||
token.content = text.slice(lastPos, matches[ln].index);
|
||||
|
||||
Reference in New Issue
Block a user