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

Function buildDecorations

app/javascript/template_builder/dynamic_editor.js:531–549  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

529const variableHighlightKey = new PluginKey('variableHighlight')
530
531function buildDecorations (doc) {
532 const decorations = []
533 const regex = /\[\[[^\]]*\]\]/g
534
535 doc.descendants((node, pos) => {
536 if (!node.isText) return
537
538 let match
539
540 while ((match = regex.exec(node.text)) !== null) {
541 const from = pos + match.index
542 const to = from + match[0].length
543
544 decorations.push(Decoration.inline(from, to, { nodeName: 'dynamic-variable' }))
545 }
546 })
547
548 return DecorationSet.create(doc, decorations)
549}
550
551const VariableHighlight = Extension.create({
552 name: 'variableHighlight',

Callers 2

initFunction · 0.70
applyFunction · 0.70

Calls 1

createMethod · 0.45

Tested by

no test coverage detected