mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🚨
This commit is contained in:
parent
5727f1b91a
commit
e7a45d4026
3 changed files with 28 additions and 28 deletions
|
|
@ -3,7 +3,7 @@ import {Constants} from "../constants";
|
|||
import {shell} from "electron";
|
||||
import {dialog} from "@electron/remote";
|
||||
/// #endif
|
||||
import {isBrowser, isMobile} from "../util/functions";
|
||||
import {isBrowser} from "../util/functions";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
import {setAccessAuthCode} from "./util";
|
||||
import {exportLayout} from "../layout/util";
|
||||
|
|
@ -214,7 +214,7 @@ export const about = {
|
|||
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
|
||||
<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
|
||||
</div>`,
|
||||
width: isMobile() ? "80vw" : "520px",
|
||||
width: "520px",
|
||||
});
|
||||
const textAreaElement = passwordDialog.element.querySelector("textarea");
|
||||
textAreaElement.focus();
|
||||
|
|
|
|||
|
|
@ -396,13 +396,13 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
|
|||
|
||||
export const resizeDrag = () => {
|
||||
const dragElement = document.getElementById("drag");
|
||||
const right = dragElement.getBoundingClientRect().left - document.querySelector("#windowControls").clientWidth
|
||||
const right = dragElement.getBoundingClientRect().left - document.querySelector("#windowControls").clientWidth;
|
||||
if (right < dragElement.clientWidth) {
|
||||
dragElement.style.paddingRight = right + "px";
|
||||
} else {
|
||||
dragElement.style.paddingRight = "";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const resizeTabs = () => {
|
||||
const models = getAllModels();
|
||||
|
|
|
|||
|
|
@ -176,55 +176,55 @@ export const listIndent = (protyle: IProtyle, liItemElements: Element[], range:
|
|||
};
|
||||
|
||||
export const breakList = (protyle: IProtyle, blockElement: Element, range: Range) => {
|
||||
const listItemElement = blockElement.parentElement
|
||||
const listItemId = listItemElement.getAttribute("data-node-id")
|
||||
const listItemElement = blockElement.parentElement;
|
||||
const listItemId = listItemElement.getAttribute("data-node-id");
|
||||
const doOperations: IOperation[] = [];
|
||||
const undoOperations: IOperation[] = [];
|
||||
|
||||
range.insertNode(document.createElement("wbr"))
|
||||
const newListId = Lute.NewNodeID()
|
||||
let newListHTML = ''
|
||||
let hasFind = 0
|
||||
range.insertNode(document.createElement("wbr"));
|
||||
const newListId = Lute.NewNodeID();
|
||||
let newListHTML = "";
|
||||
let hasFind = 0;
|
||||
Array.from(listItemElement.parentElement.children).forEach(item => {
|
||||
if (!hasFind && item.isSameNode(listItemElement)) {
|
||||
hasFind = 1
|
||||
hasFind = 1;
|
||||
} else if (hasFind && !item.classList.contains("protyle-attr")) {
|
||||
undoOperations.push({
|
||||
id: item.getAttribute("data-node-id"),
|
||||
action: "move",
|
||||
previousID: listItemId,
|
||||
})
|
||||
});
|
||||
doOperations.push({
|
||||
id: item.getAttribute("data-node-id"),
|
||||
action: "delete",
|
||||
})
|
||||
});
|
||||
if (item.getAttribute("data-subtype") === "o") {
|
||||
undoOperations.push({
|
||||
id: item.getAttribute("data-node-id"),
|
||||
action: "update",
|
||||
data: item.outerHTML,
|
||||
})
|
||||
item.setAttribute("data-marker", hasFind + ".")
|
||||
item.firstElementChild.innerHTML = hasFind + "."
|
||||
});
|
||||
item.setAttribute("data-marker", hasFind + ".");
|
||||
item.firstElementChild.innerHTML = hasFind + ".";
|
||||
}
|
||||
newListHTML += item.outerHTML
|
||||
newListHTML += item.outerHTML;
|
||||
item.remove();
|
||||
hasFind++;
|
||||
}
|
||||
})
|
||||
});
|
||||
undoOperations.reverse();
|
||||
newListHTML = `<div data-subtype="${listItemElement.getAttribute("data-subtype")}" data-node-id="${newListId}" data-type="NodeList" class="list" updated="${dayjs().format("YYYYMMDDHHmmss")}">${newListHTML}<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div></div>`
|
||||
newListHTML = `<div data-subtype="${listItemElement.getAttribute("data-subtype")}" data-node-id="${newListId}" data-type="NodeList" class="list" updated="${dayjs().format("YYYYMMDDHHmmss")}">${newListHTML}<div class="protyle-attr" contenteditable="false">${Constants.ZWSP}</div></div>`;
|
||||
listItemElement.parentElement.insertAdjacentHTML("afterend", newListHTML);
|
||||
doOperations.push({
|
||||
id: newListId,
|
||||
action: "insert",
|
||||
previousID: listItemElement.parentElement.getAttribute("data-node-id"),
|
||||
data: newListHTML
|
||||
})
|
||||
});
|
||||
undoOperations.push({
|
||||
id: newListId,
|
||||
action: "delete"
|
||||
})
|
||||
});
|
||||
|
||||
Array.from(listItemElement.children).reverse().forEach((item) => {
|
||||
if (!item.classList.contains("protyle-action") && !item.classList.contains("protyle-attr")) {
|
||||
|
|
@ -232,30 +232,30 @@ export const breakList = (protyle: IProtyle, blockElement: Element, range: Range
|
|||
id: item.getAttribute("data-node-id"),
|
||||
action: "move",
|
||||
previousID: listItemElement.parentElement.getAttribute("data-node-id")
|
||||
})
|
||||
});
|
||||
undoOperations.push({
|
||||
id: item.getAttribute("data-node-id"),
|
||||
action: "move",
|
||||
parentID: listItemId
|
||||
})
|
||||
});
|
||||
listItemElement.parentElement.after(item);
|
||||
}
|
||||
})
|
||||
});
|
||||
undoOperations.splice(0, 0, {
|
||||
id: listItemId,
|
||||
action: "insert",
|
||||
data: listItemElement.outerHTML,
|
||||
previousID: listItemElement.previousElementSibling.getAttribute("data-node-id"),
|
||||
parentID: listItemElement.parentElement.getAttribute("data-node-id")
|
||||
})
|
||||
listItemElement.remove()
|
||||
});
|
||||
listItemElement.remove();
|
||||
doOperations.push({
|
||||
id: listItemId,
|
||||
action: "delete",
|
||||
})
|
||||
});
|
||||
transaction(protyle, doOperations, undoOperations);
|
||||
focusByWbr(protyle.wysiwyg.element, range);
|
||||
}
|
||||
};
|
||||
|
||||
export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range: Range) => {
|
||||
const liElement = liItemElements[0].parentElement;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue