remove negative lookbehind for #656 and fix mention regex
This commit is contained in:
parent
32403d0c29
commit
f465c6d881
@ -188,14 +188,14 @@ export function MarkdownInput ({ label, topLevel, groupClassName, onChange, onKe
|
|||||||
|
|
||||||
let priorSpace = -1
|
let priorSpace = -1
|
||||||
for (let i = selectionStart - 1; i >= 0; i--) {
|
for (let i = selectionStart - 1; i >= 0; i--) {
|
||||||
if (/\s/.test(value[i])) {
|
if (/[^\w@]/.test(value[i])) {
|
||||||
priorSpace = i
|
priorSpace = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let nextSpace = value.length
|
let nextSpace = value.length
|
||||||
for (let i = selectionStart; i <= value.length; i++) {
|
for (let i = selectionStart; i <= value.length; i++) {
|
||||||
if (/\b/.test(value[i])) {
|
if (/[^\w]/.test(value[i])) {
|
||||||
nextSpace = i
|
nextSpace = i
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,9 @@ export const defaultCommentSort = (pinned, bio, createdAt) => {
|
|||||||
export const isJob = item => typeof item.maxBid !== 'undefined'
|
export const isJob = item => typeof item.maxBid !== 'undefined'
|
||||||
|
|
||||||
// a delete directive preceded by a non word character that isn't a backtick
|
// a delete directive preceded by a non word character that isn't a backtick
|
||||||
const deletePattern = /\B(?<!`)@delete\s+in\s+(\d+)\s+(second|minute|hour|day|week|month|year)s?/gi
|
const deletePattern = /\B@delete\s+in\s+(\d+)\s+(second|minute|hour|day|week|month|year)s?/gi
|
||||||
|
|
||||||
const deleteMentionPattern = /\B(?<!`)@delete/i
|
const deleteMentionPattern = /\B@delete/i
|
||||||
|
|
||||||
export const hasDeleteMention = (text) => deleteMentionPattern.test(text ?? '')
|
export const hasDeleteMention = (text) => deleteMentionPattern.test(text ?? '')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user