mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 Fix doc2heading issue https://github.com/siyuan-note/siyuan/issues/13225
This commit is contained in:
parent
923d4b8c1f
commit
8b882db317
2 changed files with 0 additions and 13 deletions
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/88250/gulu"
|
"github.com/88250/gulu"
|
||||||
"github.com/88250/lute/ast"
|
"github.com/88250/lute/ast"
|
||||||
|
|
@ -118,16 +117,12 @@ func (tx *Transaction) doUnfoldHeading(operation *Operation) (ret *TxErr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var docConvertLock = sync.Mutex{}
|
|
||||||
|
|
||||||
func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath string, err error) {
|
func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath string, err error) {
|
||||||
if !ast.IsNodeIDPattern(srcID) || !ast.IsNodeIDPattern(targetID) {
|
if !ast.IsNodeIDPattern(srcID) || !ast.IsNodeIDPattern(targetID) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
FlushTxQueue()
|
FlushTxQueue()
|
||||||
docConvertLock.Lock()
|
|
||||||
defer docConvertLock.Unlock()
|
|
||||||
|
|
||||||
srcTree, _ := LoadTreeByBlockID(srcID)
|
srcTree, _ := LoadTreeByBlockID(srcID)
|
||||||
if nil == srcTree {
|
if nil == srcTree {
|
||||||
|
|
@ -253,10 +248,6 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st
|
||||||
pivot.InsertAfter(heading)
|
pivot.InsertAfter(heading)
|
||||||
}
|
}
|
||||||
|
|
||||||
if contentPivot := treenode.GetNodeInTree(targetTree, targetID); nil != contentPivot && ast.NodeParagraph == contentPivot.Type && nil == contentPivot.FirstChild { // 插入到空的段落块下
|
|
||||||
contentPivot.Unlink()
|
|
||||||
}
|
|
||||||
|
|
||||||
box := Conf.Box(srcTree.Box)
|
box := Conf.Box(srcTree.Box)
|
||||||
if removeErr := box.Remove(srcTree.Path); nil != removeErr {
|
if removeErr := box.Remove(srcTree.Path); nil != removeErr {
|
||||||
logging.LogWarnf("remove tree [%s] failed: %s", srcTree.Path, removeErr)
|
logging.LogWarnf("remove tree [%s] failed: %s", srcTree.Path, removeErr)
|
||||||
|
|
@ -282,8 +273,6 @@ func Doc2Heading(srcID, targetID string, after bool) (srcTreeBox, srcTreePath st
|
||||||
|
|
||||||
func Heading2Doc(srcHeadingID, targetBoxID, targetPath, previousPath string) (srcRootBlockID, newTargetPath string, err error) {
|
func Heading2Doc(srcHeadingID, targetBoxID, targetPath, previousPath string) (srcRootBlockID, newTargetPath string, err error) {
|
||||||
FlushTxQueue()
|
FlushTxQueue()
|
||||||
docConvertLock.Lock()
|
|
||||||
defer docConvertLock.Unlock()
|
|
||||||
|
|
||||||
srcTree, _ := LoadTreeByBlockID(srcHeadingID)
|
srcTree, _ := LoadTreeByBlockID(srcHeadingID)
|
||||||
if nil == srcTree {
|
if nil == srcTree {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ import (
|
||||||
|
|
||||||
func ListItem2Doc(srcListItemID, targetBoxID, targetPath, previousPath string) (srcRootBlockID, newTargetPath string, err error) {
|
func ListItem2Doc(srcListItemID, targetBoxID, targetPath, previousPath string) (srcRootBlockID, newTargetPath string, err error) {
|
||||||
FlushTxQueue()
|
FlushTxQueue()
|
||||||
docConvertLock.Lock()
|
|
||||||
defer docConvertLock.Unlock()
|
|
||||||
|
|
||||||
srcTree, _ := LoadTreeByBlockID(srcListItemID)
|
srcTree, _ := LoadTreeByBlockID(srcListItemID)
|
||||||
if nil == srcTree {
|
if nil == srcTree {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue