mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
590b088f69
commit
d152a7ff6f
3 changed files with 15 additions and 7 deletions
|
|
@ -223,7 +223,7 @@ const getEditor = (id: string, protyle: IProtyle, element: Element, currentCard:
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
export const bindCardEvent = async (options: {
|
export const bindCardEvent = async (options: {
|
||||||
app: App,
|
app: App,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ export class Files extends Model {
|
||||||
if (data) {
|
if (data) {
|
||||||
switch (data.cmd) {
|
switch (data.cmd) {
|
||||||
case "reloadDocInfo":
|
case "reloadDocInfo":
|
||||||
this.element.querySelector(`li[data-node-id="${data.data.rootID}"] .ariaLabel`)?.setAttribute("aria-label", this.genDocAriaLabel(data.data, escapeGreat));
|
this.updateDocInfo(data);
|
||||||
break;
|
break;
|
||||||
case "moveDoc":
|
case "moveDoc":
|
||||||
this.onMove(data);
|
this.onMove(data);
|
||||||
|
|
@ -736,6 +736,14 @@ export class Files extends Model {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateDocInfo(data: IWebSocketData) {
|
||||||
|
const liElement = this.element.querySelector(`li[data-node-id="${data.data.rootID}"]`)
|
||||||
|
if (liElement) {
|
||||||
|
liElement.setAttribute("data-count", data.data.subFileCount);
|
||||||
|
liElement.querySelector(".ariaLabel")?.setAttribute("aria-label", this.genDocAriaLabel(data.data, escapeGreat));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private genNotebook(item: INotebook) {
|
private genNotebook(item: INotebook) {
|
||||||
const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
|
const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
|
||||||
if (item.closed) {
|
if (item.closed) {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ export const recordBeforeResizeTop = () => {
|
||||||
getAllModels().editor.forEach((item) => {
|
getAllModels().editor.forEach((item) => {
|
||||||
if (item.editor && item.editor.protyle &&
|
if (item.editor && item.editor.protyle &&
|
||||||
item.element.parentElement && !item.element.classList.contains("fn__none")) {
|
item.element.parentElement && !item.element.classList.contains("fn__none")) {
|
||||||
item.editor.protyle.wysiwyg.element.querySelector('[data-resize-top]')?.removeAttribute("data-resize-top");
|
item.editor.protyle.wysiwyg.element.querySelector("[data-resize-top]")?.removeAttribute("data-resize-top");
|
||||||
const contentRect = item.editor.protyle.contentElement.getBoundingClientRect()
|
const contentRect = item.editor.protyle.contentElement.getBoundingClientRect();
|
||||||
let topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top);
|
let topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top);
|
||||||
if (!topElement) {
|
if (!topElement) {
|
||||||
topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top + 17);
|
topElement = document.elementFromPoint(contentRect.left + (contentRect.width / 2), contentRect.top + 17);
|
||||||
|
|
@ -23,11 +23,11 @@ export const recordBeforeResizeTop = () => {
|
||||||
if (!topElement) {
|
if (!topElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(topElement)
|
console.log(topElement);
|
||||||
topElement.setAttribute("data-resize-top", topElement.getBoundingClientRect().top.toString());
|
topElement.setAttribute("data-resize-top", topElement.getBoundingClientRect().top.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export const resize = (protyle: IProtyle) => {
|
export const resize = (protyle: IProtyle) => {
|
||||||
hideElements(["gutterOnly"], protyle);
|
hideElements(["gutterOnly"], protyle);
|
||||||
|
|
@ -61,7 +61,7 @@ export const resize = (protyle: IProtyle) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const topElement = protyle.wysiwyg.element.querySelector('[data-resize-top]');
|
const topElement = protyle.wysiwyg.element.querySelector("[data-resize-top]");
|
||||||
if (topElement) {
|
if (topElement) {
|
||||||
topElement.scrollIntoView();
|
topElement.scrollIntoView();
|
||||||
protyle.contentElement.scrollTop += topElement.getBoundingClientRect().top - parseInt(topElement.getAttribute("data-resize-top"));
|
protyle.contentElement.scrollTop += topElement.getBoundingClientRect().top - parseInt(topElement.getAttribute("data-resize-top"));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue