Fix: Markdown Nodes Inherit inline styles
This commit is contained in:
@@ -573,6 +573,12 @@ export function applyMarkdownToNode(node: Node) {
|
||||
if (markdown !== text) {
|
||||
const span = document.createElement('span');
|
||||
span.innerHTML = markdown;
|
||||
|
||||
// inherit inline style from the parent node
|
||||
const parentStyle = (node.parentNode as HTMLElement).style;
|
||||
for(let i=0;i<parentStyle.length;i++){
|
||||
span.style.setProperty(parentStyle[i], parentStyle.getPropertyValue(parentStyle[i]))
|
||||
}
|
||||
(node as Element)?.replaceWith(span);
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user