Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2024-04-08 12:06:25 +08:00
commit 2b273974b4
5 changed files with 58 additions and 31 deletions

View file

@ -52,7 +52,6 @@ Most features are free, even for commercial use.
* Markdown WYSIWYG
* List outline
* Block zoom-in
* Block horizontal layout
* Million-word large document editing
* Mathematical formulas, charts, flowcharts, Gantt charts, timing charts, staffs, etc.
* Web clipping
@ -64,11 +63,13 @@ Most features are free, even for commercial use.
* Copy to WeChat MP, Zhihu and Yuque
* Database
* Table view
* Spaced repetition
* Flashcard spaced repetition
* AI writing and Q/A chat via OpenAI API
* Tesseract OCR
* Multi-tab, drag and drop to split screen
* Template snippet
* JavaScript/CSS snippet
* Android/iOS APP
* Android/iOS App
* Docker deployment
* [API](https://github.com/siyuan-note/siyuan/blob/master/API.md)
* Community marketplace
@ -79,16 +80,16 @@ Some features are only available to paid members, for more details please refer
![SiYuan Arch](https://b3logfile.com/file/2023/05/SiYuan_Arch-Sgu8vXT.png "SiYuan Arch")
| Project | Description | Forks | Stars |
|----------------------------------------------------------|-------------------------|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [lute](https://github.com/88250/lute) | Editor engine | ![GitHub forks](https://img.shields.io/github/forks/88250/lute) | ![GitHub Repo stars](https://img.shields.io/github/stars/88250/lute) |
| [chrome](https://github.com/siyuan-note/siyuan-chrome) | Chrome/Edge extension | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-chrome) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-chrome) |
| [bazaar](https://github.com/siyuan-note/bazaar) | Community marketplace | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/bazaar) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/bazaar) |
| [dejavu](https://github.com/siyuan-note/dejavu) | Data repo | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/dejavu) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/dejavu) |
| [petal](https://github.com/siyuan-note/petal) | Plugin API | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/petal) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/petal) |
| [android](https://github.com/siyuan-note/siyuan-android) | Android APP | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-android) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-android) |
| [ios](https://github.com/siyuan-note/siyuan-ios) | iOS APP | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-ios) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-ios) |
| [riff](https://github.com/siyuan-note/riff) | Spaced repetition | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/riff) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/riff) |
| Project | Description | Forks | Stars |
|----------------------------------------------------------|-----------------------|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [lute](https://github.com/88250/lute) | Editor engine | ![GitHub forks](https://img.shields.io/github/forks/88250/lute) | ![GitHub Repo stars](https://img.shields.io/github/stars/88250/lute) |
| [chrome](https://github.com/siyuan-note/siyuan-chrome) | Chrome/Edge extension | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-chrome) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-chrome) |
| [bazaar](https://github.com/siyuan-note/bazaar) | Community marketplace | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/bazaar) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/bazaar) |
| [dejavu](https://github.com/siyuan-note/dejavu) | Data repo | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/dejavu) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/dejavu) |
| [petal](https://github.com/siyuan-note/petal) | Plugin API | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/petal) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/petal) |
| [android](https://github.com/siyuan-note/siyuan-android) | Android App | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-android) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-android) |
| [ios](https://github.com/siyuan-note/siyuan-ios) | iOS App | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-ios) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-ios) |
| [riff](https://github.com/siyuan-note/riff) | Spaced repetition | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/riff) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/riff) |
## 🌟 Star History

View file

@ -53,7 +53,6 @@
* Markdown 所见即所得
* 列表大纲
* 块缩放聚焦
* 块横向排版
* 百万字大文档编辑
* 数学公式、图表、流程图、甘特图、时序图、五线谱等
* 网页剪藏
@ -65,10 +64,12 @@
* 复制到微信公众号、知乎和语雀
* 数据库
* 表格视图
* 间隔重复
* 闪卡间隔重复
* 接入 OpenAI 接口支持人工智能写作和问答聊天
* Tesseract OCR
* 模板片段
* JavaScript/CSS 代码片段
* Android/iOS APP
* Android/iOS App
* Docker 部署
* [API](API_zh_CN.md)
* 社区集市
@ -86,8 +87,8 @@
| [bazaar](https://github.com/siyuan-note/bazaar) | 社区集市 | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/bazaar) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/bazaar) |
| [dejavu](https://github.com/siyuan-note/dejavu) | 数据仓库 | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/dejavu) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/dejavu) |
| [petal](https://github.com/siyuan-note/petal) | 插件 API | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/petal) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/petal) |
| [android](https://github.com/siyuan-note/siyuan-android) | Android APP | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-android) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-android) |
| [ios](https://github.com/siyuan-note/siyuan-ios) | iOS APP | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-ios) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-ios) |
| [android](https://github.com/siyuan-note/siyuan-android) | Android App | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-android) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-android) |
| [ios](https://github.com/siyuan-note/siyuan-ios) | iOS App | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/siyuan-ios) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/siyuan-ios) |
| [riff](https://github.com/siyuan-note/riff) | 间隔重复 | ![GitHub forks](https://img.shields.io/github/forks/siyuan-note/riff) | ![GitHub Repo stars](https://img.shields.io/github/stars/siyuan-note/riff) |
## 🌟 Star History

View file

@ -2039,23 +2039,29 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
return
}
// 不允许重复添加相同的块到属性视图中
var content string
if !isDetached {
content = getNodeRefText(node)
}
now := time.Now().UnixMilli()
// 检查是否重复添加相同的块
blockValues := attrView.GetBlockKeyValues()
for _, blockValue := range blockValues.Values {
if blockValue.Block.ID == addingBlockID {
if !isDetached {
// 重复绑定一下,比如剪切数据库块的场景需要
bindBlockAv0(tx, avID, blockID, node, tree)
// 重复绑定一下,比如剪切数据库块、取消绑定块后再次添加的场景需要
bindBlockAv0(tx, avID, node, tree)
blockValue.IsDetached = isDetached
blockValue.Block.Content = content
blockValue.UpdatedAt = now
err = av.SaveAttributeView(attrView)
}
return
}
}
var content string
if !isDetached {
content = getNodeRefText(node)
}
now := time.Now().UnixMilli()
blockValue := &av.Value{
ID: ast.NewNodeID(),
KeyID: blockValues.Key.ID,
@ -2148,7 +2154,7 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
}
if !isDetached {
bindBlockAv0(tx, avID, blockID, node, tree)
bindBlockAv0(tx, avID, node, tree)
}
for _, v := range attrView.Views {
@ -3069,6 +3075,11 @@ func unbindBlockAv(tx *Transaction, avID, blockID string) {
node.SetIALAttr(av.NodeAttrNameAvs, strings.Join(avIDs, ","))
}
avNames := getAvNames(attrs[av.NodeAttrNameAvs])
if "" != avNames {
attrs[av.NodeAttrViewNames] = avNames
}
if nil != tx {
err = setNodeAttrsWithTx(tx, node, tree, attrs)
} else {
@ -3087,11 +3098,11 @@ func bindBlockAv(tx *Transaction, avID, blockID string) {
return
}
bindBlockAv0(tx, avID, blockID, node, tree)
bindBlockAv0(tx, avID, node, tree)
return
}
func bindBlockAv0(tx *Transaction, avID, blockID string, node *ast.Node, tree *parse.Tree) {
func bindBlockAv0(tx *Transaction, avID string, node *ast.Node, tree *parse.Tree) {
attrs := parse.IAL2Map(node.KramdownIAL)
if "" == attrs[av.NodeAttrNameAvs] {
attrs[av.NodeAttrNameAvs] = avID
@ -3114,7 +3125,7 @@ func bindBlockAv0(tx *Transaction, avID, blockID string, node *ast.Node, tree *p
err = setNodeAttrs(node, tree, attrs)
}
if nil != err {
logging.LogWarnf("set node [%s] attrs failed: %s", blockID, err)
logging.LogWarnf("set node [%s] attrs failed: %s", node.ID, err)
return
}
return

View file

@ -1312,10 +1312,15 @@ func (tx *Transaction) commit() (err error) {
if err = writeJSONQueue(tree); nil != err {
return
}
var sources []interface{}
for _, op := range tx.DoOperations {
sources = append(sources, op.Action)
}
util.PushSaveDoc(tree.ID, "tx", sources)
}
refreshDynamicRefTexts(tx.nodes, tx.trees)
IncSync()
tx.trees = nil
tx.state.Store(2)
tx.m.Unlock()
return

View file

@ -220,6 +220,15 @@ func PushReloadDoc(rootID string) {
BroadcastByType("main", "reloaddoc", 0, "", rootID)
}
func PushSaveDoc(rootID, typ string, sources interface{}) {
data := map[string]interface{}{
"rootID": rootID,
"type": typ,
"sources": sources,
}
BroadcastByType("main", "savedoc", 0, "", data)
}
func PushProtyleReload(rootID string) {
BroadcastByType("protyle", "reload", 0, "", rootID)
}