mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🚨
This commit is contained in:
parent
e80354ebbb
commit
5cdcd27faa
7 changed files with 10 additions and 10 deletions
|
|
@ -93,7 +93,7 @@ export const initBlockPopover = (app: App) => {
|
||||||
showTooltip(notebookItemElement.getAttribute("aria-label") || "", notebookItemElement);
|
showTooltip(notebookItemElement.getAttribute("aria-label") || "", notebookItemElement);
|
||||||
fetchPost("/api/notebook/getNotebookInfo", {notebook: notebookItemElement.parentElement.parentElement.getAttribute("data-url")}, (response) => {
|
fetchPost("/api/notebook/getNotebookInfo", {notebook: notebookItemElement.parentElement.parentElement.getAttribute("data-url")}, (response) => {
|
||||||
const boxData = response.data.boxInfo;
|
const boxData = response.data.boxInfo;
|
||||||
const tip = `${boxData.name} <small class='ft__on-surface'>${boxData.hSize}</small>${boxData.docCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", boxData.docCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${boxData.hMtime}<br>${window.siyuan.languages.createdAt} ${boxData.hCtime}`
|
const tip = `${boxData.name} <small class='ft__on-surface'>${boxData.hSize}</small>${boxData.docCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", boxData.docCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${boxData.hMtime}<br>${window.siyuan.languages.createdAt} ${boxData.hCtime}`;
|
||||||
|
|
||||||
const scopeNotebookItemElement = hasClosestByClassName(event.target, "b3-list-item__text");
|
const scopeNotebookItemElement = hasClosestByClassName(event.target, "b3-list-item__text");
|
||||||
if (notebookItemElement && scopeNotebookItemElement && notebookItemElement.isSameNode(scopeNotebookItemElement)) {
|
if (notebookItemElement && scopeNotebookItemElement && notebookItemElement.isSameNode(scopeNotebookItemElement)) {
|
||||||
|
|
@ -104,7 +104,7 @@ export const initBlockPopover = (app: App) => {
|
||||||
scopeNotebookItemElement.parentElement.parentElement.getAttribute("data-url") === boxData.id) {
|
scopeNotebookItemElement.parentElement.parentElement.getAttribute("data-url") === boxData.id) {
|
||||||
scopeNotebookItemElement.setAttribute("aria-label", tip);
|
scopeNotebookItemElement.setAttribute("aria-label", tip);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true);
|
const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true);
|
||||||
if (!tipElement || (
|
if (!tipElement || (
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ export const exportConfig = {
|
||||||
fetchPost("/api/system/importConf", formData, response => {
|
fetchPost("/api/system/importConf", formData, response => {
|
||||||
if (response.code !== 0) {
|
if (response.code !== 0) {
|
||||||
showMessage(response.msg);
|
showMessage(response.msg);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessage(window.siyuan.languages.imported);
|
showMessage(window.siyuan.languages.imported);
|
||||||
|
|
|
||||||
|
|
@ -1129,7 +1129,7 @@ export class Files extends Model {
|
||||||
if (item.count && item.count > 0) {
|
if (item.count && item.count > 0) {
|
||||||
countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.ref}">${item.count}</span>`;
|
countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.ref}">${item.count}</span>`;
|
||||||
}
|
}
|
||||||
const ariaLabel = this.genDocAriaLabel(item)
|
const ariaLabel = this.genDocAriaLabel(item);
|
||||||
return `<li data-node-id="${item.id}" data-name="${Lute.EscapeHTMLStr(item.name)}" draggable="true" data-count="${item.subFileCount}"
|
return `<li data-node-id="${item.id}" data-name="${Lute.EscapeHTMLStr(item.name)}" draggable="true" data-count="${item.subFileCount}"
|
||||||
data-type="navigation-file"
|
data-type="navigation-file"
|
||||||
style="--file-toggle-width:${(item.path.split("/").length - 2) * 18 + 40}px"
|
style="--file-toggle-width:${(item.path.split("/").length - 2) * 18 + 40}px"
|
||||||
|
|
@ -1148,7 +1148,7 @@ aria-label="${escapeHtml(ariaLabel)}">${getDisplayName(item.name, true, true)}</
|
||||||
</span>
|
</span>
|
||||||
${countHTML}
|
${countHTML}
|
||||||
</li>`;
|
</li>`;
|
||||||
};
|
}
|
||||||
|
|
||||||
private initMoreMenu() {
|
private initMoreMenu() {
|
||||||
window.siyuan.menus.menu.remove();
|
window.siyuan.menus.menu.remove();
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ export const exportLayout = async (options: {
|
||||||
cb: () => void,
|
cb: () => void,
|
||||||
errorExit: boolean
|
errorExit: boolean
|
||||||
}) => {
|
}) => {
|
||||||
const editors = getAllModels().editor
|
const editors = getAllModels().editor;
|
||||||
for (let i = 0; i < editors.length; i++) {
|
for (let i = 0; i < editors.length; i++) {
|
||||||
await saveScroll(editors[i].editor.protyle);
|
await saveScroll(editors[i].editor.protyle);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export const saveScroll = (protyle: IProtyle, getObject = false) => {
|
||||||
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION], () => {
|
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION], () => {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDocByScroll = (options: {
|
export const getDocByScroll = (options: {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import * as dayjs from "dayjs";
|
||||||
import {transaction, updateTransaction} from "./transaction";
|
import {transaction, updateTransaction} from "./transaction";
|
||||||
import {mathRender} from "../render/mathRender";
|
import {mathRender} from "../render/mathRender";
|
||||||
import {highlightRender} from "../render/highlightRender";
|
import {highlightRender} from "../render/highlightRender";
|
||||||
import {getContenteditableElement, getNextBlock, hasNextSibling, isNotEditBlock} from "./getBlock";
|
import {getContenteditableElement, hasNextSibling, isNotEditBlock} from "./getBlock";
|
||||||
import {genEmptyBlock} from "../../block/util";
|
import {genEmptyBlock} from "../../block/util";
|
||||||
import {blockRender} from "../render/blockRender";
|
import {blockRender} from "../render/blockRender";
|
||||||
import {hideElements} from "../ui/hideElements";
|
import {hideElements} from "../ui/hideElements";
|
||||||
|
|
|
||||||
|
|
@ -735,7 +735,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else if (nodeEditableElement?.innerText.substr(position.end).indexOf("\n") === -1 || position.end >= nodeEditableElement.innerText.trimEnd().length) {
|
} else if (nodeEditableElement?.innerText.substr(position.end).indexOf("\n") === -1 || position.end >= nodeEditableElement.innerText.trimEnd().length) {
|
||||||
// 需使用 innerText,否则 td 中的 br 无法转换为 \n; position.end 不能加1,否则倒数第二行行末无法下移
|
// 需使用 innerText,否则 td 中的 br 无法转换为 \n; position.end 不能加1,否则倒数第二行行末无法下移
|
||||||
range.collapse(false)
|
range.collapse(false);
|
||||||
const nextFoldElement = getNextBlock(nodeElement) as HTMLElement;
|
const nextFoldElement = getNextBlock(nodeElement) as HTMLElement;
|
||||||
if (nextFoldElement) {
|
if (nextFoldElement) {
|
||||||
if(nodeEditableElement.getBoundingClientRect().bottom - getSelectionPosition(nodeElement, range).top < 40) {
|
if(nodeEditableElement.getBoundingClientRect().bottom - getSelectionPosition(nodeElement, range).top < 40) {
|
||||||
|
|
@ -844,7 +844,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
if (nextSibling.nodeType === 1 && nextSibling.classList.contains("img")) {
|
if (nextSibling.nodeType === 1 && nextSibling.classList.contains("img")) {
|
||||||
// 光标需在图片前 https://github.com/siyuan-note/siyuan/issues/12452
|
// 光标需在图片前 https://github.com/siyuan-note/siyuan/issues/12452
|
||||||
const textPosition = getSelectionOffset(range.startContainer, protyle.wysiwyg.element, range)
|
const textPosition = getSelectionOffset(range.startContainer, protyle.wysiwyg.element, range);
|
||||||
if (textPosition.start === range.startContainer.textContent.length) {
|
if (textPosition.start === range.startContainer.textContent.length) {
|
||||||
removeImage(nextSibling as Element, nodeElement, range, protyle);
|
removeImage(nextSibling as Element, nodeElement, range, protyle);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue