mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
This commit is contained in:
@@ -3080,12 +3080,7 @@ export class WYSIWYG {
|
||||
} else {
|
||||
if (actionElement.classList.contains("protyle-action--task")) {
|
||||
if (!protyle.disabled) {
|
||||
const taskItemElement = actionElement.parentElement;
|
||||
const html = taskItemElement.outerHTML;
|
||||
toggleTaskListItem(taskItemElement);
|
||||
taskItemElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
taskItemElement.setAttribute(Constants.ATTRIBUTE_EDITING, "true");
|
||||
updateTransaction(protyle, taskItemElement, html);
|
||||
toggleTaskListItem(protyle, actionElement.parentElement);
|
||||
}
|
||||
} else if (window.siyuan.config.editor.listItemDotNumberClickFocus) {
|
||||
if (protyle.block.showAll && protyle.block.id === actionId) {
|
||||
|
||||
@@ -1712,10 +1712,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||
if (!taskItemElement) {
|
||||
return;
|
||||
}
|
||||
const html = taskItemElement.outerHTML;
|
||||
toggleTaskListItem(taskItemElement);
|
||||
taskItemElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
updateTransaction(protyle, taskItemElement, html);
|
||||
toggleTaskListItem(protyle, taskItemElement);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return;
|
||||
|
||||
@@ -58,7 +58,8 @@ export const updateListOrder = (listElement: Element, sIndex?: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const toggleTaskListItem = (taskItemElement: Element): void => {
|
||||
export const toggleTaskListItem = (protyle: IProtyle, taskItemElement: Element): void => {
|
||||
const html = taskItemElement.outerHTML;
|
||||
const marker = taskItemElement.getAttribute("data-task");
|
||||
const useElement = taskItemElement.querySelector("use");
|
||||
if (marker !== null && marker !== " ") {
|
||||
@@ -70,6 +71,9 @@ export const toggleTaskListItem = (taskItemElement: Element): void => {
|
||||
taskItemElement.classList.add("protyle-task--done");
|
||||
useElement?.setAttribute("xlink:href", "#iconCheck");
|
||||
}
|
||||
taskItemElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
||||
taskItemElement.setAttribute(Constants.ATTRIBUTE_EDITING, "true");
|
||||
updateTransaction(protyle, taskItemElement, html);
|
||||
};
|
||||
|
||||
export const genListItemElement = (listItemElement: Element, offset = 0, wbr = false, startIndex?: number) => {
|
||||
|
||||
Reference in New Issue
Block a user