MCPcopy Create free account
hub / github.com/HubSpot/draft-convert / processInlineTag

Function processInlineTag

src/convertFromHTML.js:198–225  ·  view source on GitHub ↗
(tag, node, currentStyle)

Source from the content-addressed store, hash-verified

196}
197
198function processInlineTag(tag, node, currentStyle) {
199 const styleToCheck = inlineTags[tag];
200 if (styleToCheck) {
201 currentStyle = currentStyle.add(styleToCheck).toOrderedSet();
202 } else if (node instanceof HTMLElement) {
203 const htmlElement = node;
204 currentStyle = currentStyle
205 .withMutations(style => {
206 if (htmlElement.style.fontWeight === 'bold') {
207 style.add('BOLD');
208 }
209
210 if (htmlElement.style.fontStyle === 'italic') {
211 style.add('ITALIC');
212 }
213
214 if (htmlElement.style.textDecoration === 'underline') {
215 style.add('UNDERLINE');
216 }
217
218 if (htmlElement.style.textDecoration === 'line-through') {
219 style.add('STRIKETHROUGH');
220 }
221 })
222 .toOrderedSet();
223 }
224 return currentStyle;
225}
226
227function baseProcessInlineTag(tag, node, inlineStyles = OrderedSet()) {
228 return processInlineTag(tag, node, inlineStyles);

Callers 2

baseProcessInlineTagFunction · 0.85
genFragmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…