mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-18 07:30:12 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
bda1ec9e03
6 changed files with 22 additions and 14 deletions
|
|
@ -6,7 +6,13 @@ import {getDockByType} from "../tabUtil";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {getAllModels} from "../getAll";
|
import {getAllModels} from "../getAll";
|
||||||
import {hasClosestBlock, hasClosestByClassName, hasTopClosestByClassName} from "../../protyle/util/hasClosest";
|
import {hasClosestBlock, hasClosestByClassName, hasTopClosestByClassName} from "../../protyle/util/hasClosest";
|
||||||
import {setStorageVal, updateHotkeyAfterTip, updateHotkeyTip} from "../../protyle/util/compatibility";
|
import {
|
||||||
|
isInAndroid,
|
||||||
|
isInHarmony,
|
||||||
|
setStorageVal,
|
||||||
|
updateHotkeyAfterTip,
|
||||||
|
writeText
|
||||||
|
} from "../../protyle/util/compatibility";
|
||||||
import {openFileById} from "../../editor/util";
|
import {openFileById} from "../../editor/util";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
import {MenuItem} from "../../menus/Menu";
|
import {MenuItem} from "../../menus/Menu";
|
||||||
|
|
@ -18,7 +24,6 @@ import {checkFold} from "../../util/noRelyPCFunction";
|
||||||
import {transaction, turnsIntoTransaction} from "../../protyle/wysiwyg/transaction";
|
import {transaction, turnsIntoTransaction} from "../../protyle/wysiwyg/transaction";
|
||||||
import {goHome} from "../../protyle/wysiwyg/commonHotkey";
|
import {goHome} from "../../protyle/wysiwyg/commonHotkey";
|
||||||
import {Editor} from "../../editor";
|
import {Editor} from "../../editor";
|
||||||
import {writeText, isInAndroid, isInHarmony} from "../../protyle/util/compatibility";
|
|
||||||
import {mathRender} from "../../protyle/render/mathRender";
|
import {mathRender} from "../../protyle/render/mathRender";
|
||||||
import {genEmptyElement} from "../../block/util";
|
import {genEmptyElement} from "../../block/util";
|
||||||
import {focusBlock, focusByWbr} from "../../protyle/util/selection";
|
import {focusBlock, focusByWbr} from "../../protyle/util/selection";
|
||||||
|
|
@ -658,6 +663,10 @@ export class Outline extends Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveExpendIds() {
|
public saveExpendIds() {
|
||||||
|
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.isPreview && this.type === "pin") {
|
if (!this.isPreview && this.type === "pin") {
|
||||||
fetchPost("/api/storage/setOutlineStorage", {
|
fetchPost("/api/storage/setOutlineStorage", {
|
||||||
docID: this.blockId,
|
docID: this.blockId,
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,10 @@ export class Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveData(storageName: string, data: any) {
|
public saveData(storageName: string, data: any) {
|
||||||
|
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const pathString = `/data/storage/petal/${this.name}/${storageName}`;
|
const pathString = `/data/storage/petal/${this.name}/${storageName}`;
|
||||||
let file: File;
|
let file: File;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ import {focusByRange} from "./selection";
|
||||||
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {clipboard} from "electron";
|
import {clipboard, ipcRenderer} from "electron";
|
||||||
import {ipcRenderer} from "electron";
|
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
||||||
export const encodeBase64 = (text: string): string => {
|
export const encodeBase64 = (text: string): string => {
|
||||||
|
|
@ -500,7 +499,7 @@ export const getLocalStorage = (cb: () => void) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setStorageVal = (key: string, val: any, cb?: () => void) => {
|
export const setStorageVal = (key: string, val: any, cb?: () => void) => {
|
||||||
if (window.siyuan.config.readonly) {
|
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fetchPost("/api/storage/setLocalStorageVal", {
|
fetchPost("/api/storage/setLocalStorageVal", {
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
|
||||||
case FilterQuantifierNone:
|
case FilterQuantifierNone:
|
||||||
if FilterOperatorIsEmpty == filter.Operator {
|
if FilterOperatorIsEmpty == filter.Operator {
|
||||||
if 1 > len(value.MAsset) {
|
if 1 > len(value.MAsset) {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, asset := range value.MAsset {
|
for _, asset := range value.MAsset {
|
||||||
|
|
@ -404,7 +404,7 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
|
||||||
return true
|
return true
|
||||||
} else if FilterOperatorIsNotEmpty == filter.Operator {
|
} else if FilterOperatorIsNotEmpty == filter.Operator {
|
||||||
if 1 > len(value.MAsset) {
|
if 1 > len(value.MAsset) {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, asset := range value.MAsset {
|
for _, asset := range value.MAsset {
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ func GetCaptcha(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckReadonly(c *gin.Context) {
|
func CheckReadonly(c *gin.Context) {
|
||||||
if util.ReadOnly {
|
if util.ReadOnly || IsReadOnlyRole(GetGinContextRole(c)) {
|
||||||
result := util.NewResult()
|
result := util.NewResult()
|
||||||
result.Code = -1
|
result.Code = -1
|
||||||
result.Msg = Conf.Language(34)
|
result.Msg = Conf.Language(34)
|
||||||
|
|
|
||||||
|
|
@ -362,10 +362,6 @@ func GetLocalStorage() (ret map[string]interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setLocalStorage(val interface{}) (err error) {
|
func setLocalStorage(val interface{}) (err error) {
|
||||||
if util.ReadOnly {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
dirPath := filepath.Join(util.DataDir, "storage")
|
dirPath := filepath.Join(util.DataDir, "storage")
|
||||||
if err = os.MkdirAll(dirPath, 0755); err != nil {
|
if err = os.MkdirAll(dirPath, 0755); err != nil {
|
||||||
logging.LogErrorf("create storage [local] dir failed: %s", err)
|
logging.LogErrorf("create storage [local] dir failed: %s", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue