This commit is contained in:
Vanessa 2022-11-12 00:55:13 +08:00
parent 85d2faa158
commit 5f09312ae1
3 changed files with 18 additions and 18 deletions

View file

@ -92,14 +92,14 @@ const renderProvider = (provider: number) => {
}; };
const bindProviderEvent = () => { const bindProviderEvent = () => {
const reposDataElement = repos.element.querySelector("#reposData") const reposDataElement = repos.element.querySelector("#reposData");
const loadingElement = repos.element.querySelector("#reposLoading") const loadingElement = repos.element.querySelector("#reposLoading");
if (window.siyuan.config.sync.provider === 0) { if (window.siyuan.config.sync.provider === 0) {
if (needSubscribe("")) { if (needSubscribe("")) {
loadingElement.classList.add("fn__none"); loadingElement.classList.add("fn__none");
let nextElement = reposDataElement let nextElement = reposDataElement;
while (nextElement) { while (nextElement) {
nextElement.classList.add("fn__none") nextElement.classList.add("fn__none");
nextElement = nextElement.nextElementSibling; nextElement = nextElement.nextElementSibling;
} }
return; return;
@ -133,16 +133,16 @@ const bindProviderEvent = () => {
</div>`; </div>`;
} }
}); });
reposDataElement.classList.remove("fn__none") reposDataElement.classList.remove("fn__none");
return; return;
} }
loadingElement.classList.add("fn__none"); loadingElement.classList.add("fn__none");
let nextElement = reposDataElement.nextElementSibling let nextElement = reposDataElement.nextElementSibling;
while (nextElement) { while (nextElement) {
nextElement.classList.remove("fn__none") nextElement.classList.remove("fn__none");
nextElement = nextElement.nextElementSibling; nextElement = nextElement.nextElementSibling;
} }
reposDataElement.classList.add("fn__none") reposDataElement.classList.add("fn__none");
const providerPanelElement = repos.element.querySelector("#syncProviderPanel"); const providerPanelElement = repos.element.querySelector("#syncProviderPanel");
providerPanelElement.querySelectorAll(".b3-text-field").forEach(item => { providerPanelElement.querySelectorAll(".b3-text-field").forEach(item => {
item.addEventListener("blur", () => { item.addEventListener("blur", () => {
@ -319,7 +319,7 @@ ${syncModeHTML}
} }
repos.element.querySelector("#syncProviderPanel").innerHTML = renderProvider(window.siyuan.config.sync.provider); repos.element.querySelector("#syncProviderPanel").innerHTML = renderProvider(window.siyuan.config.sync.provider);
bindProviderEvent(); bindProviderEvent();
syncConfigElement.innerHTML = "" syncConfigElement.innerHTML = "";
}); });
}); });
const loadingElement = repos.element.querySelector("#reposLoading") as HTMLElement; const loadingElement = repos.element.querySelector("#reposLoading") as HTMLElement;

View file

@ -104,8 +104,8 @@ export class Gutter {
} }
} }
}); });
const doOperations: IOperation[] = [] const doOperations: IOperation[] = [];
const undoOperations: IOperation[] = [] const undoOperations: IOperation[] = [];
Array.from(foldElement.children).forEach((ulElement) => { Array.from(foldElement.children).forEach((ulElement) => {
if (ulElement.classList.contains("list")) { if (ulElement.classList.contains("list")) {
Array.from(ulElement.children).forEach((listItemElement) => { Array.from(ulElement.children).forEach((listItemElement) => {
@ -120,12 +120,12 @@ export class Gutter {
action: "setAttrs", action: "setAttrs",
id: listId, id: listId,
data: JSON.stringify({fold: hasFold ? "0" : "1"}) data: JSON.stringify({fold: hasFold ? "0" : "1"})
}) });
undoOperations.push({ undoOperations.push({
action: "setAttrs", action: "setAttrs",
id: listId, id: listId,
data: JSON.stringify({fold: hasFold ? "1" : "0"}) data: JSON.stringify({fold: hasFold ? "1" : "0"})
}) });
} }
}); });
} }
@ -169,8 +169,8 @@ export class Gutter {
} }
} }
}); });
const doOperations: IOperation[] = [] const doOperations: IOperation[] = [];
const undoOperations: IOperation[] = [] const undoOperations: IOperation[] = [];
Array.from(foldElement.parentElement.children).find((listItemElement) => { Array.from(foldElement.parentElement.children).find((listItemElement) => {
if (listItemElement.classList.contains("li")) { if (listItemElement.classList.contains("li")) {
if (hasFold) { if (hasFold) {
@ -183,12 +183,12 @@ export class Gutter {
action: "setAttrs", action: "setAttrs",
id: listId, id: listId,
data: JSON.stringify({fold: hasFold ? "0" : "1"}) data: JSON.stringify({fold: hasFold ? "0" : "1"})
}) });
undoOperations.push({ undoOperations.push({
action: "setAttrs", action: "setAttrs",
id: listId, id: listId,
data: JSON.stringify({fold: hasFold ? "1" : "0"}) data: JSON.stringify({fold: hasFold ? "1" : "0"})
}) });
} }
}); });
transaction(protyle, doOperations, undoOperations); transaction(protyle, doOperations, undoOperations);

View file

@ -124,7 +124,7 @@ const promiseTransaction = () => {
// 仅在 alt+click 箭头折叠时才会触发 // 仅在 alt+click 箭头折叠时才会触发
protyle.wysiwyg.element.querySelectorAll('[data-type="NodeBlockQueryEmbed"]').forEach((item) => { protyle.wysiwyg.element.querySelectorAll('[data-type="NodeBlockQueryEmbed"]').forEach((item) => {
if (item.querySelector(`[data-node-id="${doOperations[0].id}"]`)) { if (item.querySelector(`[data-node-id="${doOperations[0].id}"]`)) {
item.removeAttribute("data-render") item.removeAttribute("data-render");
blockRender(protyle, item); blockRender(protyle, item);
} }
}); });