mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
🚨
This commit is contained in:
parent
0fe6759bde
commit
5987b0cea7
7 changed files with 21 additions and 21 deletions
|
|
@ -365,7 +365,7 @@ export const globalShortcut = () => {
|
||||||
const currentType = currentLiElement.getAttribute("data-type");
|
const currentType = currentLiElement.getAttribute("data-type");
|
||||||
if (currentType) {
|
if (currentType) {
|
||||||
if (currentType === "riffCard") {
|
if (currentType === "riffCard") {
|
||||||
openCard()
|
openCard();
|
||||||
} else {
|
} else {
|
||||||
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
||||||
}
|
}
|
||||||
|
|
@ -931,7 +931,7 @@ const dialogArrow = (element: HTMLElement, event: KeyboardEvent) => {
|
||||||
const currentType = currentLiElement.getAttribute("data-type");
|
const currentType = currentLiElement.getAttribute("data-type");
|
||||||
if (currentType) {
|
if (currentType) {
|
||||||
if (currentType === "riffCard") {
|
if (currentType === "riffCard") {
|
||||||
openCard()
|
openCard();
|
||||||
} else {
|
} else {
|
||||||
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
getDockByType(currentType as TDockType).toggleModel(currentType as TDockType, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ export const openChangelog = () => {
|
||||||
const dialog = new Dialog({
|
const dialog = new Dialog({
|
||||||
title: `v${Constants.SIYUAN_VERSION} ${window.siyuan.languages.update}`,
|
title: `v${Constants.SIYUAN_VERSION} ${window.siyuan.languages.update}`,
|
||||||
width: isMobile() ? "80vw" : "520px",
|
width: isMobile() ? "80vw" : "520px",
|
||||||
content: `<div class="b3-dialog__content b3-typography b3-typography--default">${response.data.html}</div>`
|
content: `<div style="overflow:auto;height: ${isMobile() ? "80" : "70"}vh;" class="b3-dialog__content b3-typography b3-typography--default">${response.data.html}</div>`
|
||||||
});
|
});
|
||||||
highlightRender(dialog.element);
|
highlightRender(dialog.element);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ const showKeyboardToolbarUtil = (oldScrollTop: number) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideKeyboardToolbarUtil = () => {
|
const hideKeyboardToolbarUtil = () => {
|
||||||
const toolbarElement = document.getElementById("keyboardToolbar")
|
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||||
toolbarElement.style.height = "";
|
toolbarElement.style.height = "";
|
||||||
window.siyuan.mobile.editor.protyle.element.style.marginBottom = "42px";
|
window.siyuan.mobile.editor.protyle.element.style.marginBottom = "42px";
|
||||||
toolbarElement.querySelector('.keyboard__action[data-type="add"]').classList.remove("protyle-toolbar__item--current");
|
toolbarElement.querySelector('.keyboard__action[data-type="add"]').classList.remove("protyle-toolbar__item--current");
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ export const handleTouchEnd = (event: TouchEvent) => {
|
||||||
hasClosestByAttribute(target, "data-type", "NodeTable");
|
hasClosestByAttribute(target, "data-type", "NodeTable");
|
||||||
if (scrollElement) {
|
if (scrollElement) {
|
||||||
if (scrollElement.classList.contains("table")) {
|
if (scrollElement.classList.contains("table")) {
|
||||||
scrollElement = scrollElement.firstElementChild as HTMLElement
|
scrollElement = scrollElement.firstElementChild as HTMLElement;
|
||||||
} else if (scrollElement.classList.contains("code-block")) {
|
} else if (scrollElement.classList.contains("code-block")) {
|
||||||
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement
|
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement;
|
||||||
}
|
}
|
||||||
if ((xDiff <= 0 && scrollElement.scrollLeft > 0) ||
|
if ((xDiff <= 0 && scrollElement.scrollLeft > 0) ||
|
||||||
(xDiff >= 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)) {
|
(xDiff >= 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)) {
|
||||||
|
|
@ -196,9 +196,9 @@ export const handleTouchMove = (event: TouchEvent) => {
|
||||||
hasClosestByAttribute(target, "data-type", "NodeTable");
|
hasClosestByAttribute(target, "data-type", "NodeTable");
|
||||||
if (scrollElement) {
|
if (scrollElement) {
|
||||||
if (scrollElement.classList.contains("table")) {
|
if (scrollElement.classList.contains("table")) {
|
||||||
scrollElement = scrollElement.firstElementChild as HTMLElement
|
scrollElement = scrollElement.firstElementChild as HTMLElement;
|
||||||
} else if (scrollElement.classList.contains("code-block")) {
|
} else if (scrollElement.classList.contains("code-block")) {
|
||||||
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement
|
scrollElement = scrollElement.firstElementChild.nextElementSibling as HTMLElement;
|
||||||
}
|
}
|
||||||
if ((xDiff < 0 && scrollElement.scrollLeft > 0) ||
|
if ((xDiff < 0 && scrollElement.scrollLeft > 0) ||
|
||||||
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)) {
|
(xDiff > 0 && scrollElement.clientWidth + scrollElement.scrollLeft < scrollElement.scrollWidth)) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => {
|
||||||
if (protyle.options.render.breadcrumb) {
|
if (protyle.options.render.breadcrumb) {
|
||||||
protyle.breadcrumb?.element.classList.add("fn__none");
|
protyle.breadcrumb?.element.classList.add("fn__none");
|
||||||
if (protyle.block.showAll) {
|
if (protyle.block.showAll) {
|
||||||
const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]')
|
const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
|
||||||
exitFocusElement.classList.add("fn__none");
|
exitFocusElement.classList.add("fn__none");
|
||||||
exitFocusElement.nextElementSibling.classList.add("fn__none");
|
exitFocusElement.nextElementSibling.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ export const setEditMode = (protyle: IProtyle, type: TEditorMode) => {
|
||||||
if (protyle.options.render.breadcrumb) {
|
if (protyle.options.render.breadcrumb) {
|
||||||
protyle.breadcrumb?.element.classList.remove("fn__none");
|
protyle.breadcrumb?.element.classList.remove("fn__none");
|
||||||
if (protyle.block.showAll) {
|
if (protyle.block.showAll) {
|
||||||
const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]')
|
const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
|
||||||
exitFocusElement.classList.remove("fn__none");
|
exitFocusElement.classList.remove("fn__none");
|
||||||
exitFocusElement.nextElementSibling.classList.remove("fn__none");
|
exitFocusElement.nextElementSibling.classList.remove("fn__none");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ export const openGlobalSearch = (text: string, replace: boolean) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const newEmptyFileByInput = (value: string) => {
|
const newEmptyFileByInput = (value: string) => {
|
||||||
const newData = getNewFilePath(true)
|
const newData = getNewFilePath(true);
|
||||||
fetchPost("/api/filetree/getHPathByPath", {
|
fetchPost("/api/filetree/getHPathByPath", {
|
||||||
notebook: newData.notebookId,
|
notebook: newData.notebookId,
|
||||||
path: newData.currentPath,
|
path: newData.currentPath,
|
||||||
|
|
@ -552,7 +552,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
replaceInputElement.value = target.textContent;
|
replaceInputElement.value = target.textContent;
|
||||||
replaceHistoryElement.classList.add("fn__none");
|
replaceHistoryElement.classList.add("fn__none");
|
||||||
} else if (target.getAttribute("data-type") === "search-new") {
|
} else if (target.getAttribute("data-type") === "search-new") {
|
||||||
newEmptyFileByInput(searchInputElement.value)
|
newEmptyFileByInput(searchInputElement.value);
|
||||||
} else if (target.getAttribute("data-type") === "search-item") {
|
} else if (target.getAttribute("data-type") === "search-item") {
|
||||||
if (event.detail === 1) {
|
if (event.detail === 1) {
|
||||||
clickTimeout = window.setTimeout(() => {
|
clickTimeout = window.setTimeout(() => {
|
||||||
|
|
@ -635,7 +635,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
if (!currentList || event.isComposing) {
|
if (!currentList || event.isComposing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const focusIsNew = currentList.getAttribute("data-type") === "search-new"
|
const focusIsNew = currentList.getAttribute("data-type") === "search-new";
|
||||||
if (focusIsNew && matchHotKey(window.siyuan.config.keymap.general.newFile.custom, event)) {
|
if (focusIsNew && matchHotKey(window.siyuan.config.keymap.general.newFile.custom, event)) {
|
||||||
newEmptyFileByInput(searchInputElement.value);
|
newEmptyFileByInput(searchInputElement.value);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -644,7 +644,7 @@ export const genSearch = (config: ISearchOption, element: Element, closeCB?: ()
|
||||||
}
|
}
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
if (focusIsNew) {
|
if (focusIsNew) {
|
||||||
newEmptyFileByInput(searchInputElement.value)
|
newEmptyFileByInput(searchInputElement.value);
|
||||||
} else {
|
} else {
|
||||||
const id = currentList.getAttribute("data-node-id");
|
const id = currentList.getAttribute("data-node-id");
|
||||||
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
fetchPost("/api/block/checkBlockFold", {id}, (foldResponse) => {
|
||||||
|
|
@ -1334,7 +1334,7 @@ const replace = (element: Element, config: ISearchOption, edit: Protyle, isAll:
|
||||||
if (currentList.nextElementSibling || currentList.previousElementSibling) {
|
if (currentList.nextElementSibling || currentList.previousElementSibling) {
|
||||||
currentList.remove();
|
currentList.remove();
|
||||||
} else {
|
} else {
|
||||||
const nextDocElement = currentList.parentElement.nextElementSibling || currentList.parentElement.previousElementSibling.previousElementSibling?.previousElementSibling
|
const nextDocElement = currentList.parentElement.nextElementSibling || currentList.parentElement.previousElementSibling.previousElementSibling?.previousElementSibling;
|
||||||
if (nextDocElement) {
|
if (nextDocElement) {
|
||||||
nextDocElement.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus");
|
nextDocElement.nextElementSibling.firstElementChild.classList.add("b3-list-item--focus");
|
||||||
nextDocElement.nextElementSibling.classList.remove("fn__none");
|
nextDocElement.nextElementSibling.classList.remove("fn__none");
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ import {Constants} from "../constants";
|
||||||
import {validateName} from "../editor/rename";
|
import {validateName} from "../editor/rename";
|
||||||
|
|
||||||
export const getNewFilePath = (useSavePath: boolean) => {
|
export const getNewFilePath = (useSavePath: boolean) => {
|
||||||
let notebookId = ""
|
let notebookId = "";
|
||||||
let currentPath = ""
|
let currentPath = "";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
getAllModels().editor.find((item) => {
|
getAllModels().editor.find((item) => {
|
||||||
const currentElement = item.parent.headElement;
|
const currentElement = item.parent.headElement;
|
||||||
|
|
@ -57,8 +57,8 @@ export const getNewFilePath = (useSavePath: boolean) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return {notebookId, currentPath}
|
return {notebookId, currentPath};
|
||||||
}
|
};
|
||||||
|
|
||||||
export const newFile = (notebookId?: string, currentPath?: string, paths?: string[], useSavePath = false) => {
|
export const newFile = (notebookId?: string, currentPath?: string, paths?: string[], useSavePath = false) => {
|
||||||
if (getOpenNotebookCount() === 0) {
|
if (getOpenNotebookCount() === 0) {
|
||||||
|
|
@ -66,7 +66,7 @@ export const newFile = (notebookId?: string, currentPath?: string, paths?: strin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!notebookId) {
|
if (!notebookId) {
|
||||||
const resultData = getNewFilePath(useSavePath)
|
const resultData = getNewFilePath(useSavePath);
|
||||||
notebookId = resultData.notebookId;
|
notebookId = resultData.notebookId;
|
||||||
currentPath = resultData.currentPath;
|
currentPath = resultData.currentPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue