mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
This commit is contained in:
parent
ea9738b88c
commit
7d01a45b66
3 changed files with 28 additions and 0 deletions
|
|
@ -462,6 +462,8 @@ export abstract class Constants {
|
||||||
ai: {default: "", custom: ""},
|
ai: {default: "", custom: ""},
|
||||||
switchReadonly: {default: "", custom: ""},
|
switchReadonly: {default: "", custom: ""},
|
||||||
switchAdjust: {default: "", custom: ""},
|
switchAdjust: {default: "", custom: ""},
|
||||||
|
rtl: {default: "", custom: ""},
|
||||||
|
ltr: {default: "", custom: ""},
|
||||||
},
|
},
|
||||||
insert: {
|
insert: {
|
||||||
appearance: {default: "⌥⌘X", custom: "⌥⌘X"},
|
appearance: {default: "⌥⌘X", custom: "⌥⌘X"},
|
||||||
|
|
|
||||||
|
|
@ -2055,6 +2055,7 @@ export class Gutter {
|
||||||
id: "ltr",
|
id: "ltr",
|
||||||
icon: "iconLtr",
|
icon: "iconLtr",
|
||||||
label: window.siyuan.languages.ltr,
|
label: window.siyuan.languages.ltr,
|
||||||
|
accelerator: window.siyuan.config.keymap.editor.general.ltr.custom,
|
||||||
click: () => {
|
click: () => {
|
||||||
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
||||||
e.style.direction = "ltr";
|
e.style.direction = "ltr";
|
||||||
|
|
@ -2064,6 +2065,7 @@ export class Gutter {
|
||||||
id: "rtl",
|
id: "rtl",
|
||||||
icon: "iconRtl",
|
icon: "iconRtl",
|
||||||
label: window.siyuan.languages.rtl,
|
label: window.siyuan.languages.rtl,
|
||||||
|
accelerator: window.siyuan.config.keymap.editor.general.rtl.custom,
|
||||||
click: () => {
|
click: () => {
|
||||||
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
this.genClick(nodeElements, protyle, (e: HTMLElement) => {
|
||||||
if (!e.classList.contains("av")) {
|
if (!e.classList.contains("av")) {
|
||||||
|
|
|
||||||
|
|
@ -1198,6 +1198,30 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.rtl.custom, event)) {
|
||||||
|
let selectElements: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||||
|
if (selectElements.length === 0) {
|
||||||
|
selectElements = [nodeElement];
|
||||||
|
}
|
||||||
|
updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {
|
||||||
|
e.style.direction = "rtl";
|
||||||
|
});
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.ltr.custom, event)) {
|
||||||
|
let selectElements: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||||
|
if (selectElements.length === 0) {
|
||||||
|
selectElements = [nodeElement];
|
||||||
|
}
|
||||||
|
updateBatchTransaction(selectElements, protyle, (e: HTMLElement) => {
|
||||||
|
e.style.direction = "ltr";
|
||||||
|
});
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// esc
|
// esc
|
||||||
if (event.key === "Escape") {
|
if (event.key === "Escape") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue