mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
🚨
This commit is contained in:
parent
a3c33565df
commit
30cb2390ae
3 changed files with 18 additions and 18 deletions
|
|
@ -180,7 +180,7 @@ export const initWindow = () => {
|
|||
|
||||
const winOnBlur = () => {
|
||||
document.body.classList.add("body--blur");
|
||||
}
|
||||
};
|
||||
|
||||
const winOnClose = (currentWindow: Electron.BrowserWindow, close = false) => {
|
||||
exportLayout(false, () => {
|
||||
|
|
@ -224,7 +224,7 @@ export const initWindow = () => {
|
|||
} else {
|
||||
document.getElementById("toolbar").style.paddingLeft = "0";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const winOnLeaveFullscreen = () => {
|
||||
if (isWindow()) {
|
||||
|
|
@ -232,7 +232,7 @@ export const initWindow = () => {
|
|||
} else {
|
||||
document.getElementById("toolbar").setAttribute("style", "");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const currentWindow = getCurrentWindow();
|
||||
currentWindow.on("focus", winOnFocus);
|
||||
|
|
|
|||
|
|
@ -205,10 +205,10 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
|
|||
protyle.hint.render(protyle);
|
||||
}
|
||||
hideElements(["gutter"], protyle);
|
||||
updateInput(html, protyle, id, type);
|
||||
updateInput(html, protyle, id);
|
||||
};
|
||||
|
||||
const updateInput = (html: string, protyle: IProtyle, id: string, type: string) => {
|
||||
const updateInput = (html: string, protyle: IProtyle, id: string) => {
|
||||
const tempElement = document.createElement("template");
|
||||
tempElement.innerHTML = html;
|
||||
const doOperations: IOperation[] = [];
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@ export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement:
|
|||
if (isDone) {
|
||||
blockElement.parentElement.classList.add("protyle-task--done");
|
||||
}
|
||||
blockElement.previousElementSibling.outerHTML = `<div class="protyle-action protyle-action--task" draggable="true"><svg><use xlink:href="#icon${isDone ? "C" : "Unc"}heck"></use></svg></div>`
|
||||
blockElement.previousElementSibling.outerHTML = `<div class="protyle-action protyle-action--task" draggable="true"><svg><use xlink:href="#icon${isDone ? "C" : "Unc"}heck"></use></svg></div>`;
|
||||
editElement.innerHTML = editElement.innerHTML.substring(contextStartIndex);
|
||||
updateTransaction(protyle, liElement.getAttribute("data-node-id"), liElement.outerHTML, oldHTML);
|
||||
focusByWbr(protyle.wysiwyg.element, range)
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
const id = blockElement.getAttribute("data-node-id")
|
||||
const id = blockElement.getAttribute("data-node-id");
|
||||
const newId = Lute.NewNodeID();
|
||||
const emptyId = Lute.NewNodeID();
|
||||
const liItemId = Lute.NewNodeID();
|
||||
|
|
@ -68,18 +68,18 @@ export const turnIntoTaskList = (protyle: IProtyle, type: string, blockElement:
|
|||
action: "delete",
|
||||
id: newId
|
||||
}]);
|
||||
blockElement.outerHTML = `<div data-subtype="t" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div data-marker="*" data-subtype="t" data-node-id="${liItemId}" data-type="NodeListItem" class="li${isDone ? " protyle-task--done" : ""}" updated="${liItemId.split("-")[0]}"><div class="protyle-action protyle-action--task" draggable="true"><svg><use xlink:href="#icon${isDone ? "C" : "Unc"}heck"></use></svg></div>${blockElement.outerHTML}<div class="protyle-attr" contenteditable="false"></div></div><div class="protyle-attr" contenteditable="false"></div></div>`
|
||||
focusByWbr(protyle.wysiwyg.element, range)
|
||||
blockElement.outerHTML = `<div data-subtype="t" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div data-marker="*" data-subtype="t" data-node-id="${liItemId}" data-type="NodeListItem" class="li${isDone ? " protyle-task--done" : ""}" updated="${liItemId.split("-")[0]}"><div class="protyle-action protyle-action--task" draggable="true"><svg><use xlink:href="#icon${isDone ? "C" : "Unc"}heck"></use></svg></div>${blockElement.outerHTML}<div class="protyle-attr" contenteditable="false"></div></div><div class="protyle-attr" contenteditable="false"></div></div>`;
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const headingTurnIntoList = (protyle: IProtyle, type: string, blockElement: HTMLElement, editElement: HTMLElement, range: Range) => {
|
||||
if (type === "NodeHeading" && ["* ", "- "].includes(editElement.innerHTML.substring(0, 2)) &&
|
||||
blockElement.parentElement.getAttribute("data-type") !== "NodeListItem") {
|
||||
const id = blockElement.getAttribute("data-node-id")
|
||||
const id = blockElement.getAttribute("data-node-id");
|
||||
const newId = Lute.NewNodeID();
|
||||
const emptyId = Lute.NewNodeID();
|
||||
const liItemId = Lute.NewNodeID();
|
||||
|
|
@ -113,9 +113,9 @@ export const headingTurnIntoList = (protyle: IProtyle, type: string, blockElemen
|
|||
action: "delete",
|
||||
id: newId
|
||||
}]);
|
||||
blockElement.outerHTML = `<div data-subtype="u" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div data-marker="${editElement.innerHTML.substring(0, 1)}" data-subtype="u" data-node-id="${liItemId}" data-type="NodeListItem" class="li" updated="${liItemId.split("-")[0]}"><div class="protyle-action" draggable="true"><svg><use xlink:href="#iconDot"></use></svg></div>${blockElement.outerHTML}<div class="protyle-attr" contenteditable="false"></div></div><div class="protyle-attr" contenteditable="false"></div></div>`
|
||||
focusByWbr(protyle.wysiwyg.element, range)
|
||||
return true
|
||||
blockElement.outerHTML = `<div data-subtype="u" data-node-id="${newId}" data-type="NodeList" class="list" updated="${newId.split("-")[0]}"><div data-marker="${editElement.innerHTML.substring(0, 1)}" data-subtype="u" data-node-id="${liItemId}" data-type="NodeListItem" class="li" updated="${liItemId.split("-")[0]}"><div class="protyle-action" draggable="true"><svg><use xlink:href="#iconDot"></use></svg></div>${blockElement.outerHTML}<div class="protyle-attr" contenteditable="false"></div></div><div class="protyle-attr" contenteditable="false"></div></div>`;
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue