mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-21 22:44:06 +01:00
This commit is contained in:
parent
edc6ad2d50
commit
84c65c564a
2 changed files with 9 additions and 6 deletions
|
|
@ -1019,7 +1019,14 @@ export class Toolbar {
|
|||
}
|
||||
let inlineLastNode: Element;
|
||||
if (types.includes("NodeHTMLBlock")) {
|
||||
renderElement.querySelector("protyle-html").setAttribute("data-content", Lute.EscapeHTMLStr(textElement.value));
|
||||
// 需 div 包裹,否则行内元素会解析错误 https://github.com/siyuan-note/siyuan/issues/6764
|
||||
let html = textElement.value;
|
||||
if (!html.startsWith("<div>\n")) {
|
||||
html = `<div>
|
||||
${html}
|
||||
</div>`;
|
||||
}
|
||||
renderElement.querySelector("protyle-html").setAttribute("data-content", Lute.EscapeHTMLStr(html));
|
||||
} else if (isInlineMemo) {
|
||||
let inlineMemoElements;
|
||||
if (updateElements) {
|
||||
|
|
|
|||
6
app/stage/protyle/js/protyle-html.js
vendored
6
app/stage/protyle/js/protyle-html.js
vendored
|
|
@ -15,11 +15,7 @@ class ProtyleHtml extends HTMLElement {
|
|||
if (name === 'data-content') {
|
||||
const dataContent = Lute.UnEscapeHTMLStr(
|
||||
this.getAttribute('data-content'))
|
||||
if (dataContent.startsWith('<div')) {
|
||||
this.display.innerHTML = dataContent
|
||||
} else {
|
||||
this.display.innerHTML = `<div>${dataContent}</div>`
|
||||
}
|
||||
this.display.innerHTML = dataContent
|
||||
|
||||
const el = document.createElement('div')
|
||||
el.innerHTML = dataContent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue