mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 08:48:49 +01:00
This commit is contained in:
parent
5204d8e74c
commit
f266eaa3e8
2 changed files with 11 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"htmlTip": "形成多个 HTML 块,为防止数据丢失请使用 <code class='fn__code'><div></code> 标签包裹",
|
||||
"katexMacros": "KaTex 宏定义",
|
||||
"katexMacrosTip": "请使用 JSON 对象格式(<code class='fn__code'>{}</code>)来包裹宏定义,例如 <code class='fn__code'>{ \"\\\\foo\": \"{x^2}\" }</code>",
|
||||
"systemLogTip": "系统日志中保存了程序运行记录,通过导出系统日志发送给开发者可以更好地帮助开发者诊断程序问题",
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import {linkMenu} from "../../menus/protyle";
|
|||
import {renderAssetsPreview} from "../../asset/renderAssets";
|
||||
import {electronUndo} from "../undo";
|
||||
import {previewTemplate} from "./util";
|
||||
import {showMessage} from "../../dialog/message";
|
||||
|
||||
export class Toolbar {
|
||||
public element: HTMLElement;
|
||||
|
|
@ -843,8 +844,8 @@ export class Toolbar {
|
|||
if (!renderElement.parentElement) {
|
||||
return;
|
||||
}
|
||||
const target = event.target as HTMLTextAreaElement;
|
||||
if (!this.subElement.querySelector('[data-type="refresh"]').classList.contains("block__icon--active")) {
|
||||
const target = event.target as HTMLTextAreaElement;
|
||||
if (type === "NodeHTMLBlock") {
|
||||
renderElement.querySelector("protyle-html").setAttribute("data-content", Lute.EscapeHTMLStr(target.value));
|
||||
} else {
|
||||
|
|
@ -867,6 +868,14 @@ export class Toolbar {
|
|||
}
|
||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
const newHTML = protyle.lute.SpinBlockDOM(nodeElement.outerHTML);
|
||||
// HTML 块中包含多个 <pre> 时只能保存第一个 https://github.com/siyuan-note/siyuan/issues/5732
|
||||
if (type === "NodeHTMLBlock") {
|
||||
const tempElement = document.createElement("template");
|
||||
tempElement.innerHTML = newHTML;
|
||||
if (tempElement.content.childElementCount > 1) {
|
||||
showMessage(window.siyuan.languages.htmlTip)
|
||||
}
|
||||
}
|
||||
updateTransaction(protyle, id, newHTML, html);
|
||||
html = newHTML;
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue