提交 6ffd4584 编写于 作者: J Johannes Rieken

append styles to the front if possible

上级 b5109cea
......@@ -179,7 +179,12 @@ export class HtmlPreviewPart extends BaseEditor {
// diff a little against the current input and the new state
const parser = new DOMParser();
const newDocument = parser.parseFromString(html, 'text/html');
newDocument.head.appendChild(Integration.defaultStyle(this._iFrameElement.parentElement));
const styleElement = Integration.defaultStyle(this._iFrameElement.parentElement);
if (newDocument.head.hasChildNodes()) {
newDocument.head.insertBefore(styleElement, newDocument.head.firstChild);
} else {
newDocument.head.appendChild(styleElement)
}
if (newDocument.head.innerHTML !== iFrameDocument.head.innerHTML) {
iFrameDocument.head.innerHTML = newDocument.head.innerHTML;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册