소스 검색

:art: 支持通过界面设置代码片段 https://github.com/siyuan-note/siyuan/issues/6357

Liang Ding 2 년 전
부모
커밋
5784b0711c
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      kernel/model/snippet.go

+ 2 - 1
kernel/model/snippet.go

@@ -21,6 +21,7 @@ import (
 	"sync"
 	"sync"
 
 
 	"github.com/88250/gulu"
 	"github.com/88250/gulu"
+	"github.com/88250/lute/ast"
 	"github.com/siyuan-note/filelock"
 	"github.com/siyuan-note/filelock"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/siyuan/kernel/conf"
 	"github.com/siyuan-note/siyuan/kernel/conf"
@@ -106,7 +107,7 @@ func loadSnippets() (ret []*conf.Snippet, err error) {
 	needRewrite := false
 	needRewrite := false
 	for _, snippet := range ret {
 	for _, snippet := range ret {
 		if "" == snippet.ID {
 		if "" == snippet.ID {
-			snippet.ID = gulu.Rand.String(12)
+			snippet.ID = ast.NewNodeID()
 			needRewrite = true
 			needRewrite = true
 		}
 		}
 	}
 	}