mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +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 {getAllModels} from "../getAll";
|
||||
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 {Constants} from "../../constants";
|
||||
import {MenuItem} from "../../menus/Menu";
|
||||
|
|
@ -18,7 +24,6 @@ import {checkFold} from "../../util/noRelyPCFunction";
|
|||
import {transaction, turnsIntoTransaction} from "../../protyle/wysiwyg/transaction";
|
||||
import {goHome} from "../../protyle/wysiwyg/commonHotkey";
|
||||
import {Editor} from "../../editor";
|
||||
import {writeText, isInAndroid, isInHarmony} from "../../protyle/util/compatibility";
|
||||
import {mathRender} from "../../protyle/render/mathRender";
|
||||
import {genEmptyElement} from "../../block/util";
|
||||
import {focusBlock, focusByWbr} from "../../protyle/util/selection";
|
||||
|
|
@ -658,6 +663,10 @@ export class Outline extends Model {
|
|||
}
|
||||
|
||||
public saveExpendIds() {
|
||||
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isPreview && this.type === "pin") {
|
||||
fetchPost("/api/storage/setOutlineStorage", {
|
||||
docID: this.blockId,
|
||||
|
|
|
|||
|
|
@ -251,6 +251,10 @@ export class Plugin {
|
|||
}
|
||||
|
||||
public saveData(storageName: string, data: any) {
|
||||
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
|
||||
return;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const pathString = `/data/storage/petal/${this.name}/${storageName}`;
|
||||
let file: File;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import {focusByRange} from "./selection";
|
|||
import {fetchPost, fetchSyncPost} from "../../util/fetch";
|
||||
import {Constants} from "../../constants";
|
||||
/// #if !BROWSER
|
||||
import {clipboard} from "electron";
|
||||
import {ipcRenderer} from "electron";
|
||||
import {clipboard, ipcRenderer} from "electron";
|
||||
/// #endif
|
||||
|
||||
export const encodeBase64 = (text: string): string => {
|
||||
|
|
@ -500,7 +499,7 @@ export const getLocalStorage = (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;
|
||||
}
|
||||
fetchPost("/api/storage/setLocalStorageVal", {
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
|
|||
case FilterQuantifierNone:
|
||||
if FilterOperatorIsEmpty == filter.Operator {
|
||||
if 1 > len(value.MAsset) {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
for _, asset := range value.MAsset {
|
||||
|
|
@ -404,7 +404,7 @@ func (value *Value) Filter(filter *ViewFilter, attrView *AttributeView, itemID s
|
|||
return true
|
||||
} else if FilterOperatorIsNotEmpty == filter.Operator {
|
||||
if 1 > len(value.MAsset) {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
for _, asset := range value.MAsset {
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ func GetCaptcha(c *gin.Context) {
|
|||
}
|
||||
|
||||
func CheckReadonly(c *gin.Context) {
|
||||
if util.ReadOnly {
|
||||
if util.ReadOnly || IsReadOnlyRole(GetGinContextRole(c)) {
|
||||
result := util.NewResult()
|
||||
result.Code = -1
|
||||
result.Msg = Conf.Language(34)
|
||||
|
|
|
|||
|
|
@ -362,10 +362,6 @@ func GetLocalStorage() (ret map[string]interface{}) {
|
|||
}
|
||||
|
||||
func setLocalStorage(val interface{}) (err error) {
|
||||
if util.ReadOnly {
|
||||
return
|
||||
}
|
||||
|
||||
dirPath := filepath.Join(util.DataDir, "storage")
|
||||
if err = os.MkdirAll(dirPath, 0755); err != nil {
|
||||
logging.LogErrorf("create storage [local] dir failed: %s", err)
|
||||
|
|
@ -437,7 +433,7 @@ func SetOutlineStorage(docID string, val interface{}) (err error) {
|
|||
DocID: docID,
|
||||
Data: make(map[string]interface{}),
|
||||
}
|
||||
|
||||
|
||||
if valMap, ok := val.(map[string]interface{}); ok {
|
||||
outlineDoc.Data = valMap
|
||||
}
|
||||
|
|
@ -457,7 +453,7 @@ func SetOutlineStorage(docID string, val interface{}) (err error) {
|
|||
|
||||
// 将新的文档信息添加到最前面
|
||||
outlineDocs = append([]*OutlineDoc{outlineDoc}, outlineDocs...)
|
||||
|
||||
|
||||
// 限制为2000个文档
|
||||
if 2000 < len(outlineDocs) {
|
||||
outlineDocs = outlineDocs[:2000]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue