🐛 card 转义

This commit is contained in:
Vanessa 2023-04-13 18:57:26 +08:00
parent 78ee4baefb
commit 6fc15a3b6a
2 changed files with 2 additions and 2 deletions

View file

@ -114,7 +114,7 @@ export const makeCard = (ids: string[]) => {
event.preventDefault();
break;
} else if (type === "delete") {
confirmDialog(window.siyuan.languages.confirm, `${window.siyuan.languages.confirmDelete} <b>${target.parentElement.getAttribute("data-name")}</b>?`, () => {
confirmDialog(window.siyuan.languages.confirm, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(target.parentElement.getAttribute("data-name"))}</b>?`, () => {
fetchPost("/api/riff/removeRiffDeck", {
deckID: target.parentElement.getAttribute("data-id"),
}, () => {

View file

@ -363,7 +363,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
}
const newElement = genEmptyElement(false, false);
const selectNode = range.extractContents();
if (selectNode.firstChild.nodeType !== 3 && selectNode.firstChild.textContent === "") {
if (selectNode.firstChild && selectNode.firstChild.nodeType !== 3 && selectNode.firstChild.textContent === "") {
// 回车移除空元素 https://github.com/siyuan-note/insider/issues/480
selectNode.firstChild.after(document.createElement("wbr"));
selectNode.firstChild.remove();