mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
d51999f2df
14 changed files with 112 additions and 55 deletions
6
.github/CONTRIBUTING.md
vendored
6
.github/CONTRIBUTING.md
vendored
|
|
@ -16,10 +16,10 @@ Install pnpm: `npm install -g pnpm`
|
||||||
|
|
||||||
Set the Electron mirror environment variable and install Electron:
|
Set the Electron mirror environment variable and install Electron:
|
||||||
|
|
||||||
* macOS/Linux: `ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@25.8.1 -D`
|
* macOS/Linux: `ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@26.2.3 -D`
|
||||||
* Windows:
|
* Windows:
|
||||||
* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`
|
* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`
|
||||||
* `pnpm install electron@25.8.1 -D`
|
* `pnpm install electron@26.2.3 -D`
|
||||||
|
|
||||||
NPM mirror:
|
NPM mirror:
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ NPM mirror:
|
||||||
|
|
||||||
On the desktop, go to the app folder to run:
|
On the desktop, go to the app folder to run:
|
||||||
|
|
||||||
* `pnpm install electron@25.8.1 -D`
|
* `pnpm install electron@26.2.3 -D`
|
||||||
* `pnpm run dev`
|
* `pnpm run dev`
|
||||||
* `pnpm run start`
|
* `pnpm run start`
|
||||||
|
|
||||||
|
|
|
||||||
6
.github/CONTRIBUTING_zh_CN.md
vendored
6
.github/CONTRIBUTING_zh_CN.md
vendored
|
|
@ -18,11 +18,11 @@
|
||||||
|
|
||||||
* macOS/Linux:
|
* macOS/Linux:
|
||||||
```
|
```
|
||||||
ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@25.8.1 -D
|
ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@26.2.3 -D
|
||||||
```
|
```
|
||||||
* Windows:
|
* Windows:
|
||||||
* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`
|
* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`
|
||||||
* `pnpm install electron@25.8.1 -D`
|
* `pnpm install electron@26.2.3 -D`
|
||||||
|
|
||||||
NPM 镜像:
|
NPM 镜像:
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ NPM 镜像:
|
||||||
|
|
||||||
桌面端进入 app 文件夹运行:
|
桌面端进入 app 文件夹运行:
|
||||||
|
|
||||||
* `pnpm install electron@25.8.1 -D`
|
* `pnpm install electron@26.2.3 -D`
|
||||||
* `pnpm run dev`
|
* `pnpm run dev`
|
||||||
* `pnpm run start`
|
* `pnpm run start`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "Remove reminder completed [%s]",
|
"109": "Remove reminder completed [%s]",
|
||||||
"110": "Renaming...",
|
"110": "Renaming...",
|
||||||
"111": "Saving document [%s]...",
|
"111": "Saving document [%s]...",
|
||||||
"112": "Do not include Markdown syntax marker",
|
"112": "Do not include Markdown syntax marker [%s]",
|
||||||
"113": "Completing data writing...",
|
"113": "Completing data writing...",
|
||||||
"114": "Tag cannot be empty",
|
"114": "Tag cannot be empty",
|
||||||
"115": "Please configure [Settings - Export - Pandoc executable path] first",
|
"115": "Please configure [Settings - Export - Pandoc executable path] first",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "Eliminación de recordatorios completada [%s]",
|
"109": "Eliminación de recordatorios completada [%s]",
|
||||||
"110": "Renombrar...",
|
"110": "Renombrar...",
|
||||||
"111": "Guardando documento [%s]...",
|
"111": "Guardando documento [%s]...",
|
||||||
"112": "No incluir marcador de sintaxis Markdown",
|
"112": "No incluir marcador de sintaxis Markdown [%s]",
|
||||||
"113": "Completando la escritura de datos...",
|
"113": "Completando la escritura de datos...",
|
||||||
"114": "La etiqueta no puede estar vacía",
|
"114": "La etiqueta no puede estar vacía",
|
||||||
"115": "Por favor, configure primero [Configuración - Exportación - Ruta ejecutable de Pandoc]",
|
"115": "Por favor, configure primero [Configuración - Exportación - Ruta ejecutable de Pandoc]",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "Supprimer le rappel terminé [%s]",
|
"109": "Supprimer le rappel terminé [%s]",
|
||||||
"110": "Renommer...",
|
"110": "Renommer...",
|
||||||
"111": "Enregistrement du document [%s]...",
|
"111": "Enregistrement du document [%s]...",
|
||||||
"112": "Ne pas inclure les balises de syntaxe Markdown",
|
"112": "Ne pas inclure les balises de syntaxe Markdown [%s]",
|
||||||
"113": "Fin de l'écriture des données...",
|
"113": "Fin de l'écriture des données...",
|
||||||
"114": "La balise ne peut pas être vide",
|
"114": "La balise ne peut pas être vide",
|
||||||
"115": "Veuillez d'abord configurer [Paramètres - Exporter - Chemin de l'exécutable Pandoc]",
|
"115": "Veuillez d'abord configurer [Paramètres - Exporter - Chemin de l'exécutable Pandoc]",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "移除提醒完畢 [%s]",
|
"109": "移除提醒完畢 [%s]",
|
||||||
"110": "正在重命名...",
|
"110": "正在重命名...",
|
||||||
"111": "正在保存文檔 [%s]...",
|
"111": "正在保存文檔 [%s]...",
|
||||||
"112": "請勿包含 Markdown 語法標記符",
|
"112": "請勿包含 Markdown 語法標記符 [%s]",
|
||||||
"113": "正在完成資料寫入...",
|
"113": "正在完成資料寫入...",
|
||||||
"114": "標籤不能為空",
|
"114": "標籤不能為空",
|
||||||
"115": "請先配置 [設置 - 導出 - Pandoc 可執行文件路徑]",
|
"115": "請先配置 [設置 - 導出 - Pandoc 可執行文件路徑]",
|
||||||
|
|
|
||||||
|
|
@ -1182,7 +1182,7 @@
|
||||||
"109": "移除提醒完毕 [%s]",
|
"109": "移除提醒完毕 [%s]",
|
||||||
"110": "正在重命名...",
|
"110": "正在重命名...",
|
||||||
"111": "正在保存文档 [%s]...",
|
"111": "正在保存文档 [%s]...",
|
||||||
"112": "请勿包含 Markdown 语法标记符",
|
"112": "请勿包含 Markdown 语法标记符 [%s]",
|
||||||
"113": "正在完成数据写入...",
|
"113": "正在完成数据写入...",
|
||||||
"114": "标签不能为空",
|
"114": "标签不能为空",
|
||||||
"115": "请先配置 [设置 - 导出 - Pandoc 可执行文件路径]",
|
"115": "请先配置 [设置 - 导出 - Pandoc 可执行文件路径]",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "Refactor your thinking",
|
"description": "Refactor your thinking",
|
||||||
"homepage": "https://b3log.org/siyuan",
|
"homepage": "https://b3log.org/siyuan",
|
||||||
"main": "./electron/main.js",
|
"main": "./electron/main.js",
|
||||||
"packageManager": "pnpm@8.2.0",
|
"packageManager": "pnpm@8.8.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint . --fix --cache",
|
"lint": "eslint . --fix --cache",
|
||||||
"dev": "webpack --mode development",
|
"dev": "webpack --mode development",
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"clean-webpack-plugin": "^4.0.0",
|
||||||
"css-loader": "^6.7.1",
|
"css-loader": "^6.7.1",
|
||||||
"dayjs": "^1.11.5",
|
"dayjs": "^1.11.5",
|
||||||
"electron": "25.8.1",
|
"electron": "26.2.3",
|
||||||
"electron-builder": "^24.6.3",
|
"electron-builder": "^24.6.3",
|
||||||
"encoding": "^0.1.13",
|
"encoding": "^0.1.13",
|
||||||
"esbuild-loader": "^3.0.1",
|
"esbuild-loader": "^3.0.1",
|
||||||
|
|
@ -74,6 +74,6 @@
|
||||||
"webpack-cli": "^4.10.0"
|
"webpack-cli": "^4.10.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/remote": "^2.0.9"
|
"@electron/remote": "^2.0.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
app/pnpm-lock.yaml
generated
18
app/pnpm-lock.yaml
generated
|
|
@ -6,8 +6,8 @@ settings:
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@electron/remote':
|
'@electron/remote':
|
||||||
specifier: ^2.0.9
|
specifier: ^2.0.11
|
||||||
version: 2.0.9(electron@25.8.1)
|
version: 2.0.11(electron@26.2.3)
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/node':
|
'@types/node':
|
||||||
|
|
@ -32,8 +32,8 @@ devDependencies:
|
||||||
specifier: ^1.11.5
|
specifier: ^1.11.5
|
||||||
version: 1.11.5
|
version: 1.11.5
|
||||||
electron:
|
electron:
|
||||||
specifier: 25.8.1
|
specifier: 26.2.3
|
||||||
version: 25.8.1
|
version: 26.2.3
|
||||||
electron-builder:
|
electron-builder:
|
||||||
specifier: ^24.6.3
|
specifier: ^24.6.3
|
||||||
version: 24.6.3
|
version: 24.6.3
|
||||||
|
|
@ -160,12 +160,12 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@electron/remote@2.0.9(electron@25.8.1):
|
/@electron/remote@2.0.11(electron@26.2.3):
|
||||||
resolution: {integrity: sha512-LR0W0ID6WAKHaSs0x5LX9aiG+5pFBNAJL6eQAJfGkCuZPUa6nZz+czZLdlTDETG45CgF/0raSvCtYOYUpr6c+A==}
|
resolution: {integrity: sha512-PYEs7W3GrQNuhgiMHjFEvL5MbAL6C7m1AwSAHGqC+xc33IdP7rcGtJSdTP2eg1ssyB3oI00KwTsiSlsQbAoXpA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
electron: '>= 13.0.0'
|
electron: '>= 13.0.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
electron: 25.8.1
|
electron: 26.2.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@electron/universal@1.3.4:
|
/@electron/universal@1.3.4:
|
||||||
|
|
@ -1669,8 +1669,8 @@ packages:
|
||||||
resolution: {integrity: sha512-YoVeFrGd/7ROjz4R9uPoND1K/hSRC/xADy9639ZmIZeJSaBnKdYx3I6LMPsY7CXLpK7JFgKQVzeZ/dk2br6Eaw==}
|
resolution: {integrity: sha512-YoVeFrGd/7ROjz4R9uPoND1K/hSRC/xADy9639ZmIZeJSaBnKdYx3I6LMPsY7CXLpK7JFgKQVzeZ/dk2br6Eaw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/electron@25.8.1:
|
/electron@26.2.3:
|
||||||
resolution: {integrity: sha512-GtcP1nMrROZfFg0+mhyj1hamrHvukfF6of2B/pcWxmWkd5FVY1NJib0tlhiorFZRzQN5Z+APLPr7aMolt7i2AQ==}
|
resolution: {integrity: sha512-osdKf9mbhrqE81ITdvQ7TjVOayXfcAlWm8A6EtBt/eFSh7a/FijebGVkgs0S7qWQdhO0KaNZDb1Gx00sWuDQdw==}
|
||||||
engines: {node: '>= 12.20.55'}
|
engines: {node: '>= 12.20.55'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
|
|
|
||||||
|
|
@ -885,6 +885,51 @@ func removeAttributeViewColumn(operation *Operation) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tx *Transaction) doReplaceAttrViewBlock(operation *Operation) (ret *TxErr) {
|
||||||
|
err := replaceAttributeViewBlock(operation)
|
||||||
|
if nil != err {
|
||||||
|
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func replaceAttributeViewBlock(operation *Operation) (err error) {
|
||||||
|
attrView, err := av.ParseAttributeView(operation.AvID)
|
||||||
|
if nil != err {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, keyValues := range attrView.KeyValues {
|
||||||
|
for _, value := range keyValues.Values {
|
||||||
|
if value.BlockID == operation.PreviousID {
|
||||||
|
value.BlockID = operation.NextID
|
||||||
|
if nil != value.Block {
|
||||||
|
value.Block.ID = operation.NextID
|
||||||
|
value.IsDetached = operation.IsDetached
|
||||||
|
}
|
||||||
|
|
||||||
|
if !operation.IsDetached {
|
||||||
|
bindBlockAv(operation.AvID, operation.NextID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range attrView.Views {
|
||||||
|
switch v.LayoutType {
|
||||||
|
case av.LayoutTypeTable:
|
||||||
|
for i, rowID := range v.Table.RowIDs {
|
||||||
|
if rowID == operation.PreviousID {
|
||||||
|
v.Table.RowIDs[i] = operation.NextID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = av.SaveAttributeView(attrView)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doUpdateAttrViewCell(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doUpdateAttrViewCell(operation *Operation) (ret *TxErr) {
|
||||||
err := updateAttributeViewCell(operation, tx)
|
err := updateAttributeViewCell(operation, tx)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
@ -937,30 +982,7 @@ func UpdateAttributeViewCell(avID, keyID, rowID, cellID string, valueData interf
|
||||||
|
|
||||||
if oldIsDetached && !val.IsDetached {
|
if oldIsDetached && !val.IsDetached {
|
||||||
// 将游离行绑定到新建的块上
|
// 将游离行绑定到新建的块上
|
||||||
tree, loadErr := loadTreeByBlockID(rowID)
|
bindBlockAv(avID, rowID)
|
||||||
if nil != loadErr {
|
|
||||||
logging.LogWarnf("load tree by block id [%s] failed: %s", rowID, loadErr)
|
|
||||||
} else {
|
|
||||||
node := treenode.GetNodeInTree(tree, rowID)
|
|
||||||
if nil == node {
|
|
||||||
logging.LogWarnf("node [%s] not found in tree [%s]", rowID, tree.ID)
|
|
||||||
} else {
|
|
||||||
attrs := parse.IAL2Map(node.KramdownIAL)
|
|
||||||
|
|
||||||
if "" == attrs[NodeAttrNameAvs] {
|
|
||||||
attrs[NodeAttrNameAvs] = avID
|
|
||||||
} else {
|
|
||||||
avIDs := strings.Split(attrs[NodeAttrNameAvs], ",")
|
|
||||||
avIDs = append(avIDs, avID)
|
|
||||||
avIDs = gulu.Str.RemoveDuplicatedElem(avIDs)
|
|
||||||
attrs[NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = setNodeAttrs(node, tree, attrs); nil != err {
|
|
||||||
logging.LogWarnf("set node [%s] attrs failed: %s", rowID, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = av.SaveAttributeView(attrView); nil != err {
|
if err = av.SaveAttributeView(attrView); nil != err {
|
||||||
|
|
@ -969,6 +991,39 @@ func UpdateAttributeViewCell(avID, keyID, rowID, cellID string, valueData interf
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func bindBlockAv(avID, blockID string) {
|
||||||
|
tree, loadErr := loadTreeByBlockID(blockID)
|
||||||
|
if nil != loadErr {
|
||||||
|
logging.LogWarnf("load tree by block id [%s] failed: %s", blockID, loadErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
node := treenode.GetNodeInTree(tree, blockID)
|
||||||
|
if nil == node {
|
||||||
|
logging.LogWarnf("node [%s] not found in tree [%s]", blockID, tree.ID)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs := parse.IAL2Map(node.KramdownIAL)
|
||||||
|
if "" == attrs[NodeAttrNameAvs] {
|
||||||
|
attrs[NodeAttrNameAvs] = avID
|
||||||
|
} else {
|
||||||
|
avIDs := strings.Split(attrs[NodeAttrNameAvs], ",")
|
||||||
|
if gulu.Str.Contains(avID, avIDs) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
avIDs = append(avIDs, avID)
|
||||||
|
avIDs = gulu.Str.RemoveDuplicatedElem(avIDs)
|
||||||
|
attrs[NodeAttrNameAvs] = strings.Join(avIDs, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := setNodeAttrs(node, tree, attrs); nil != err {
|
||||||
|
logging.LogWarnf("set node [%s] attrs failed: %s", blockID, err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Transaction) doUpdateAttrViewColOptions(operation *Operation) (ret *TxErr) {
|
func (tx *Transaction) doUpdateAttrViewColOptions(operation *Operation) (ret *TxErr) {
|
||||||
err := updateAttributeViewColumnOptions(operation)
|
err := updateAttributeViewColumnOptions(operation)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ func RemoveBookmark(bookmark string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenameBookmark(oldBookmark, newBookmark string) (err error) {
|
func RenameBookmark(oldBookmark, newBookmark string) (err error) {
|
||||||
if treenode.ContainsMarker(newBookmark) {
|
if invalidChar := treenode.ContainsMarker(newBookmark); "" != invalidChar {
|
||||||
return errors.New(Conf.Language(112))
|
return errors.New(fmt.Sprintf(Conf.Language(112), invalidChar))
|
||||||
}
|
}
|
||||||
|
|
||||||
newBookmark = strings.TrimSpace(newBookmark)
|
newBookmark = strings.TrimSpace(newBookmark)
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,8 @@ func RemoveTag(label string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenameTag(oldLabel, newLabel string) (err error) {
|
func RenameTag(oldLabel, newLabel string) (err error) {
|
||||||
if treenode.ContainsMarker(newLabel) {
|
if invalidChar := treenode.ContainsMarker(newLabel); "" != invalidChar {
|
||||||
return errors.New(Conf.Language(112))
|
return errors.New(fmt.Sprintf(Conf.Language(112), invalidChar))
|
||||||
}
|
}
|
||||||
|
|
||||||
newLabel = strings.TrimSpace(newLabel)
|
newLabel = strings.TrimSpace(newLabel)
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
|
||||||
ret = tx.doSetAttrViewColCalc(op)
|
ret = tx.doSetAttrViewColCalc(op)
|
||||||
case "updateAttrViewColNumberFormat":
|
case "updateAttrViewColNumberFormat":
|
||||||
ret = tx.doUpdateAttrViewColNumberFormat(op)
|
ret = tx.doUpdateAttrViewColNumberFormat(op)
|
||||||
|
case "replaceAttrViewBlock":
|
||||||
|
ret = tx.doReplaceAttrViewBlock(op)
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != ret {
|
if nil != ret {
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,17 @@ import (
|
||||||
"github.com/88250/lute/lex"
|
"github.com/88250/lute/lex"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ContainsMarker(str string) bool {
|
func ContainsMarker(str string) (ret string) {
|
||||||
if !gulu.Str.IsASCII(str) {
|
if !gulu.Str.IsASCII(str) {
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, token := range str {
|
for _, token := range str {
|
||||||
if IsMarker(byte(token)) {
|
if IsMarker(byte(token)) {
|
||||||
return true
|
return string(token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsMarker(token byte) bool {
|
func IsMarker(token byte) bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue