refactoring
This commit is contained in:
@@ -15,15 +15,17 @@ export default function (doc: Node): DecorationSet {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
[...node.text.matchAll(hexColor)].forEach(match => {
|
Array
|
||||||
const index = match.index || 0
|
.from(node.text.matchAll(hexColor))
|
||||||
|
.forEach(match => {
|
||||||
|
const index = match.index || 0
|
||||||
|
|
||||||
results.push({
|
results.push({
|
||||||
color: match[0],
|
color: match[0],
|
||||||
from: position + index,
|
from: position + index,
|
||||||
to: position + index + match[0].length,
|
to: position + index + match[0].length,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
results.forEach(issue => {
|
results.forEach(issue => {
|
||||||
|
|||||||
Reference in New Issue
Block a user