mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-18 10:00:48 +08:00
This commit is contained in:
parent
43d0bb1bfe
commit
932e45e612
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"switchReadonly": "Switch read-only mode",
|
||||||
"original": "Original",
|
"original": "Original",
|
||||||
"selectRelation": "Please select the related column first",
|
"selectRelation": "Please select the related column first",
|
||||||
"backRelation": "Bidirectional",
|
"backRelation": "Bidirectional",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"switchReadonly": "Cambiar modo de sólo lectura",
|
||||||
"original": "Original",
|
"original": "Original",
|
||||||
"selectRelation": "Seleccione primero la columna relacionada",
|
"selectRelation": "Seleccione primero la columna relacionada",
|
||||||
"backRelation": "Bidireccional",
|
"backRelation": "Bidireccional",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"switchReadonly": "Changer de mode lecture seule",
|
||||||
"original": "Originale",
|
"original": "Originale",
|
||||||
"selectRelation": "Veuillez d'abord sélectionner la colonne associée",
|
"selectRelation": "Veuillez d'abord sélectionner la colonne associée",
|
||||||
"backRelation": "Bidirectionnel",
|
"backRelation": "Bidirectionnel",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"switchReadonly": "唯讀模式切換",
|
||||||
"original": "原值",
|
"original": "原值",
|
||||||
"selectRelation": "請先選擇關聯列",
|
"selectRelation": "請先選擇關聯列",
|
||||||
"backRelation": "雙向關聯",
|
"backRelation": "雙向關聯",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"switchReadonly": "只读模式切换",
|
||||||
"original": "原值",
|
"original": "原值",
|
||||||
"selectRelation": "请先选择关联列",
|
"selectRelation": "请先选择关联列",
|
||||||
"backRelation": "双向关联",
|
"backRelation": "双向关联",
|
||||||
|
@ -57,7 +57,7 @@ import {openCard, openCardByData} from "../../card/openCard";
|
|||||||
import {lockScreen} from "../../dialog/processSystem";
|
import {lockScreen} from "../../dialog/processSystem";
|
||||||
import {isWindow} from "../../util/functions";
|
import {isWindow} from "../../util/functions";
|
||||||
import {reloadProtyle} from "../../protyle/util/reload";
|
import {reloadProtyle} from "../../protyle/util/reload";
|
||||||
import {fullscreen} from "../../protyle/breadcrumb/action";
|
import {fullscreen, updateReadonly} from "../../protyle/breadcrumb/action";
|
||||||
import {openRecentDocs} from "../../business/openRecentDocs";
|
import {openRecentDocs} from "../../business/openRecentDocs";
|
||||||
import {App} from "../../index";
|
import {App} from "../../index";
|
||||||
import {commandPanel} from "../../plugin/commandPanel";
|
import {commandPanel} from "../../plugin/commandPanel";
|
||||||
@ -333,6 +333,11 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||||||
zoomOut({protyle, id: protyle.block.rootID, focusId: protyle.block.id});
|
zoomOut({protyle, id: protyle.block.rootID, focusId: protyle.block.id});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.switchReadonly.custom, event)) {
|
||||||
|
event.preventDefault();
|
||||||
|
updateReadonly(protyle.breadcrumb.element.parentElement.querySelector('.block__icon[data-type="readonly"]'), protyle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (range) {
|
if (range) {
|
||||||
|
@ -359,6 +359,7 @@ export abstract class Constants {
|
|||||||
refPopover: {default: "", custom: ""},
|
refPopover: {default: "", custom: ""},
|
||||||
copyText: {default: "", custom: ""},
|
copyText: {default: "", custom: ""},
|
||||||
exitFocus: {default: "", custom: ""},
|
exitFocus: {default: "", custom: ""},
|
||||||
|
switchReadonly: {default: "", custom: ""},
|
||||||
expand: {default: "⌘↓", custom: "⌘↓"},
|
expand: {default: "⌘↓", custom: "⌘↓"},
|
||||||
collapse: {default: "⌘↑", custom: "⌘↑"},
|
collapse: {default: "⌘↑", custom: "⌘↑"},
|
||||||
insertBottom: {default: "⌥⌘.", custom: "⌥⌘."},
|
insertBottom: {default: "⌥⌘.", custom: "⌥⌘."},
|
||||||
|
@ -8,6 +8,7 @@ import {hideAllElements, hideElements} from "../ui/hideElements";
|
|||||||
import {hasClosestByClassName} from "../util/hasClosest";
|
import {hasClosestByClassName} from "../util/hasClosest";
|
||||||
import {reloadProtyle} from "../util/reload";
|
import {reloadProtyle} from "../util/reload";
|
||||||
import {resize} from "../util/resize";
|
import {resize} from "../util/resize";
|
||||||
|
import {disabledProtyle, enableProtyle} from "../util/onGet";
|
||||||
|
|
||||||
export const net2LocalAssets = (protyle: IProtyle, type: "Assets" | "Img") => {
|
export const net2LocalAssets = (protyle: IProtyle, type: "Assets" | "Img") => {
|
||||||
if (protyle.element.querySelector(".wysiwygLoading")) {
|
if (protyle.element.querySelector(".wysiwygLoading")) {
|
||||||
@ -81,3 +82,23 @@ export const fullscreen = (element: Element, btnElement?: Element) => {
|
|||||||
});
|
});
|
||||||
/// #endif
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const updateReadonly = (target: Element, protyle: IProtyle) => {
|
||||||
|
if (!window.siyuan.config.readonly) {
|
||||||
|
const isReadonly = target.querySelector("use").getAttribute("xlink:href") !== "#iconUnlock";
|
||||||
|
if (window.siyuan.config.editor.readOnly) {
|
||||||
|
if (isReadonly) {
|
||||||
|
enableProtyle(protyle);
|
||||||
|
} else {
|
||||||
|
disabledProtyle(protyle);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fetchPost("/api/attr/setBlockAttrs", {
|
||||||
|
id: protyle.block.rootID,
|
||||||
|
attrs: {
|
||||||
|
[Constants.CUSTOM_SY_READONLY]: isReadonly ? "false" : "true"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2,7 +2,7 @@ import {getIconByType} from "../../editor/getIcon";
|
|||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {MenuItem} from "../../menus/Menu";
|
import {MenuItem} from "../../menus/Menu";
|
||||||
import {fullscreen, net2LocalAssets} from "./action";
|
import {fullscreen, net2LocalAssets, updateReadonly} from "./action";
|
||||||
import {openFileAttr} from "../../menus/commonMenuItem";
|
import {openFileAttr} from "../../menus/commonMenuItem";
|
||||||
import {setEditMode} from "../util/setEditMode";
|
import {setEditMode} from "../util/setEditMode";
|
||||||
import {RecordMedia} from "../util/RecordMedia";
|
import {RecordMedia} from "../util/RecordMedia";
|
||||||
@ -107,23 +107,7 @@ export class Breadcrumb {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
} else if (type === "readonly") {
|
} else if (type === "readonly") {
|
||||||
if (!window.siyuan.config.readonly) {
|
updateReadonly(target, protyle);
|
||||||
const isReadonly = target.querySelector("use").getAttribute("xlink:href") !== "#iconUnlock";
|
|
||||||
if (window.siyuan.config.editor.readOnly) {
|
|
||||||
if (isReadonly) {
|
|
||||||
enableProtyle(protyle);
|
|
||||||
} else {
|
|
||||||
disabledProtyle(protyle);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fetchPost("/api/attr/setBlockAttrs", {
|
|
||||||
id: protyle.block.rootID,
|
|
||||||
attrs: {
|
|
||||||
[Constants.CUSTOM_SY_READONLY]: isReadonly ? "false" : "true"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user