MCPcopy Create free account
hub / github.com/docusealco/docuseal / buildDecorations

Function buildDecorations

app/javascript/elements/html_editor.js:336–355  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

334 })
335
336 const buildDecorations = (doc) => {
337 const decorations = []
338 const regex = /\{\{?[a-zA-Z0-9_.-]+\}\}?/g
339
340 doc.descendants((node, pos) => {
341 if (!node.isText) return
342
343 let match
344
345 while ((match = regex.exec(node.text)) !== null) {
346 decorations.push(
347 Decoration.inline(pos + match.index, pos + match.index + match[0].length, {
348 class: 'variable-highlight'
349 })
350 )
351 }
352 })
353
354 return DecorationSet.create(doc, decorations)
355 }
356
357 const VariableHighlight = Extension.create({
358 name: 'variableHighlight',

Callers 4

initFunction · 0.70
applyFunction · 0.70
initMethod · 0.70
applyMethod · 0.70

Calls 1

createMethod · 0.45

Tested by

no test coverage detected