Vanessa 2022-07-28 10:27:51 +08:00
parent 6cbbd2ba1d
commit 9e55cc6c37
9 changed files with 37 additions and 5 deletions

View file

@ -1,4 +1,5 @@
{
"jumpToParentNext": "Jump to the next block in the previous level",
"initRepoKeyTip": "If the key has been initialized on other devices, please use [Import Key] or generate the key with the same passphrase, otherwise the data cannot be synced to the cloud, so be sure to use the same key on all devices",
"crossKeepLazyLoad": "Cross-page multi-selection needs to select [Keep Loaded Content] in the more menu",
"keepLazyLoad": "Keep loaded content",

View file

@ -1,4 +1,5 @@
{
"jumpToParentNext": "Saltar al siguiente bloque en el nivel anterior",
"initRepoKeyTip": "Si la clave se ha inicializado en otros dispositivos, use [Importar la clave] o genere la clave con la misma contraseña; de lo contrario, los datos no se pueden sincronizar con la nube, así que asegúrese de usar la misma clave en todos los dispositivos.",
"crossKeepLazyLoad": "La selección múltiple entre páginas debe seleccionar [Mantener contenido cargado] en el menú más",
"keepLazyLoad": "Mantener el contenido cargado",

View file

@ -1,4 +1,5 @@
{
"jumpToParentNext": "Aller au bloc suivant du niveau précédent",
"initRepoKeyTip": "Si la clé a été initialisée sur d'autres appareils, veuillez utiliser [Importer la clé] ou générer la clé avec le même mot de passe, sinon les données ne peuvent pas être synchronisées avec le cloud, alors assurez-vous d'utiliser la même clé sur tous les appareils",
"crossKeepLazyLoad": "La multi-sélection sur plusieurs pages doit sélectionner [Conserver le contenu chargé] dans le menu plus",
"keepLazyLoad": "Conserver le contenu chargé",

View file

@ -1,4 +1,5 @@
{
"jumpToParentNext": "跳轉到上一層級的下一個塊",
"initRepoKeyTip": "如果其他設備上已經初始化過密鑰,請使用 [導入密鑰] 或者通過相同的密碼生成密鑰,否則無法雲端同步數據,所以請務必在所有設備上使用相同的密鑰",
"crossKeepLazyLoad": "跨頁多選需在更多菜單中選中【保持已加載內容】",
"keepLazyLoad": "保持已加載的內容",

View file

@ -1,4 +1,5 @@
{
"jumpToParentNext": "跳转到上一层级的下一个块",
"initRepoKeyTip": "如果其他设备上已经初始化过密钥,请使用 [导入密钥] 或者通过相同的密码生成密钥,否则无法云端同步数据,所以请务必在所有设备上使用相同的密钥",
"crossKeepLazyLoad": "跨页多选需在更多菜单中选中 [保持已加载内容]",
"keepLazyLoad": "保持已加载的内容",

View file

@ -1,6 +1,6 @@
import {focusByWbr, getEditorRange} from "../protyle/util/selection";
import {hasClosestBlock} from "../protyle/util/hasClosest";
import {getTopAloneElement} from "../protyle/wysiwyg/getBlock";
import {focusBlock, focusByWbr, getEditorRange} from "../protyle/util/selection";
import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest";
import {getNextBlock, getTopAloneElement} from "../protyle/wysiwyg/getBlock";
import {genListItemElement, updateListOrder} from "../protyle/wysiwyg/list";
import {transaction, updateTransaction} from "../protyle/wysiwyg/transaction";
import {scrollCenter} from "../util/highlightById";
@ -60,6 +60,18 @@ export const genSBElement = (layout: string, id?: string, attrHTML?: string) =>
return sbElement;
};
export const jumpToParentNext = (protyle:IProtyle,nodeElement: Element) => {
const topElement = getTopAloneElement(nodeElement);
if (topElement) {
const topParentElement = hasClosestByClassName(topElement, "list") || hasClosestByClassName(topElement, "bq") || hasClosestByClassName(topElement, "sb") || topElement
const nextElement = getNextBlock(topParentElement)
if (nextElement) {
focusBlock(nextElement)
scrollCenter(protyle, nextElement);
}
}
}
export const insertEmptyBlock = (protyle: IProtyle, position: InsertPosition, id?: string) => {
const range = getEditorRange(protyle.wysiwyg.element);
let blockElement: Element;

View file

@ -146,6 +146,7 @@ export abstract class Constants {
preview: {default: "⌥⌘9", custom: "⌥⌘9"},
insertBefore: {default: "⇧⌘B", custom: "⇧⌘B"},
insertAfter: {default: "⇧⌘A", custom: "⇧⌘A"},
jumpToParentNext: {default: "⇧⌘N", custom: "⇧⌘N"},
moveToUp: {default: "⇧⌘↑", custom: "⇧⌘↑"},
moveToDown: {default: "⇧⌘↓", custom: "⇧⌘↓"},
},

View file

@ -16,7 +16,7 @@ import {removeEmbed} from "../wysiwyg/removeEmbed";
import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";
import * as dayjs from "dayjs";
import {fetchPost} from "../../util/fetch";
import {cancelSB, insertEmptyBlock} from "../../block/util";
import {cancelSB, insertEmptyBlock, jumpToParentNext} from "../../block/util";
import {scrollCenter} from "../../util/highlightById";
import {isMobile} from "../../util/functions";
import {confirmDialog} from "../../dialog/confirmDialog";
@ -1094,6 +1094,14 @@ export class Gutter {
insertEmptyBlock(protyle, "afterend", id);
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.jumpToParentNext,
accelerator: window.siyuan.config.keymap.editor.general.jumpToParentNext.custom,
click() {
nodeElement.classList.remove("protyle-wysiwyg--select");
jumpToParentNext(protyle, nodeElement)
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(new MenuItem({

View file

@ -32,7 +32,7 @@ import {phTransaction, transaction, turnsIntoTransaction, updateTransaction} fro
import {fontEvent} from "../toolbar/Font";
import {listIndent, listOutdent, updateListOrder} from "./list";
import {newFileBySelect, newFileContentBySelect, rename, replaceFileName} from "../../editor/rename";
import {insertEmptyBlock} from "../../block/util";
import {insertEmptyBlock, jumpToParentNext} from "../../block/util";
import {isLocalPath} from "../../util/pathName";
/// #if !BROWSER
import {clipboard} from "electron";
@ -1189,6 +1189,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.stopPropagation();
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.jumpToParentNext.custom, event)) {
jumpToParentNext(protyle, nodeElement)
event.preventDefault();
event.stopPropagation();
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.moveToUp.custom, event)) {
event.preventDefault();