Vanessa 2024-12-24 23:30:51 +08:00
parent cec9a2520f
commit 135c80fcb2
15 changed files with 30 additions and 0 deletions

View file

@ -380,6 +380,22 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
updateReadonly(protyle.breadcrumb.element.parentElement.querySelector('.block__icon[data-type="readonly"]'), protyle);
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.switchAdjust.custom, event)) {
event.preventDefault();
let fullWidth;
const adjustWidth = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH)
if (!adjustWidth) {
fullWidth = window.siyuan.config.editor.fullWidth ? "false" : "true";
} else {
fullWidth = adjustWidth === "true" ? "false" : "true";
}
fetchPost("/api/attr/setBlockAttrs", {
id: protyle.block.rootID,
attrs: {[Constants.CUSTOM_SY_FULLWIDTH]: fullWidth}
});
return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {
event.preventDefault();
if (range) {

View file

@ -459,6 +459,7 @@ export abstract class Constants {
exitFocus: {default: "", custom: ""},
ai: {default: "", custom: ""},
switchReadonly: {default: "", custom: ""},
switchAdjust: {default: "", custom: ""},
},
insert: {
appearance: {default: "⌥⌘X", custom: "⌥⌘X"},

View file

@ -885,6 +885,7 @@ declare namespace Config {
showInFolder: IKey;
spaceRepetition: IKey;
switchReadonly: IKey;
switchAdjust: IKey;
undo: IKey;
vLayout: IKey;
wysiwyg: IKey;