mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-24 09:16:09 +01:00
This commit is contained in:
parent
91349bd2e8
commit
a3dad54fdd
2 changed files with 4 additions and 3 deletions
|
|
@ -1095,15 +1095,17 @@ export class Toolbar {
|
|||
}
|
||||
let inlineLastNode: Element;
|
||||
if (types.includes("NodeHTMLBlock")) {
|
||||
// 需 div 包裹,否则行内元素会解析错误 https://github.com/siyuan-note/siyuan/issues/6764
|
||||
let html = textElement.value;
|
||||
if (html) {
|
||||
// 需 div 包裹,否则行内元素会解析错误 https://github.com/siyuan-note/siyuan/issues/6764
|
||||
if (!html.startsWith("<div>\n")) {
|
||||
html = `<div>\n${html}`;
|
||||
}
|
||||
if (!html.endsWith("\n</div>")) {
|
||||
html = `${html}\n</div>`;
|
||||
}
|
||||
// 需移除换行 https://github.com/siyuan-note/siyuan/issues/7921
|
||||
html = html.replace(/\n\n/g, "\n");
|
||||
}
|
||||
renderElement.querySelector("protyle-html").setAttribute("data-content", Lute.EscapeHTMLStr(html));
|
||||
} else if (isInlineMemo) {
|
||||
|
|
|
|||
3
app/stage/protyle/js/protyle-html.js
vendored
3
app/stage/protyle/js/protyle-html.js
vendored
|
|
@ -13,8 +13,7 @@ class ProtyleHtml extends HTMLElement {
|
|||
|
||||
attributeChangedCallback (name, oldValue, newValue) {
|
||||
if (name === 'data-content') {
|
||||
const dataContent = Lute.UnEscapeHTMLStr(
|
||||
this.getAttribute('data-content'))
|
||||
const dataContent = Lute.UnEscapeHTMLStr(this.getAttribute('data-content'))
|
||||
this.display.innerHTML = dataContent
|
||||
|
||||
const el = document.createElement('div')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue