Vanessa 2022-12-26 11:05:46 +08:00
parent 7d19a8e88c
commit 04ac712988
3 changed files with 16 additions and 8 deletions

View file

@ -32,6 +32,9 @@ export const makeCard = (nodeElement: Element[]) => {
let html = "";
const ids: string[] = [];
nodeElement.forEach(item => {
if (item.getAttribute("data-type") === "NodeThematicBreak") {
return;
}
ids.push(item.getAttribute("data-node-id"));
});
response.data.forEach((item: ICard) => {

View file

@ -1437,14 +1437,16 @@ export class Gutter {
}
}).element);
}
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.riffCard,
icon: "iconRiffCard",
click() {
makeCard([nodeElement]);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
if (type !== "NodeThematicBreak") {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.riffCard,
icon: "iconRiffCard",
click() {
makeCard([nodeElement]);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
let updateHTML = nodeElement.getAttribute("updated") || "";
if (updateHTML) {
updateHTML = `${window.siyuan.languages.modifiedAt} ${dayjs(updateHTML).format("YYYY-MM-DD HH:mm:ss")}<br>`;

View file

@ -446,6 +446,9 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b
return;
}
protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`).forEach(item => {
if (item.getAttribute("data-type") === "NodeThematicBreak") {
return;
}
Object.keys(data.old).forEach(key => {
item.removeAttribute(key);
});