Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
43e53672b0
8 changed files with 91 additions and 122 deletions
|
@ -31,6 +31,7 @@ Below are the detailed changes in this version.
|
|||
* [Remove animation when opening editor](https://github.com/siyuan-note/siyuan/issues/9324)
|
||||
* [The access authorization code command line parameter must be set when deploying via Docker](https://github.com/siyuan-note/siyuan/issues/9328)
|
||||
* [Remove the access authorization code setting item on the browser-end](https://github.com/siyuan-note/siyuan/issues/9331)
|
||||
* [Shift+Click cannot select block upwards](https://github.com/siyuan-note/siyuan/issues/9334)
|
||||
|
||||
### Bugfix
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
* [移除開啟文件時的動畫](https://github.com/siyuan-note/siyuan/issues/9324)
|
||||
* [透過 Docker 部署時必須設定存取授權碼命令列參數](https://github.com/siyuan-note/siyuan/issues/9328)
|
||||
* [瀏覽器端移除存取授權碼設定項目](https://github.com/siyuan-note/siyuan/issues/9331)
|
||||
* [Shift+Click 無法從下往上多選塊](https://github.com/siyuan-note/siyuan/issues/9334)
|
||||
|
||||
### 修復缺陷
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
* [移除打开文档时的动画](https://github.com/siyuan-note/siyuan/issues/9324)
|
||||
* [通过 Docker 部署时必须设置访问授权码命令行参数](https://github.com/siyuan-note/siyuan/issues/9328)
|
||||
* [浏览器端移除访问授权码配置项](https://github.com/siyuan-note/siyuan/issues/9331)
|
||||
* [Shift+Click 无法从下往上多选块](https://github.com/siyuan-note/siyuan/issues/9334)
|
||||
|
||||
### 修复缺陷
|
||||
|
||||
|
|
|
@ -354,10 +354,6 @@ type ValueTemplate struct {
|
|||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
func (t *ValueTemplate) Render(blockID, tplContent string, r func(blockID, tplContent string) string) {
|
||||
t.Content = r(blockID, tplContent)
|
||||
}
|
||||
|
||||
// View 描述了视图的结构。
|
||||
type View struct {
|
||||
ID string `json:"id"` // 视图 ID
|
||||
|
|
|
@ -5,7 +5,6 @@ go 1.18
|
|||
require (
|
||||
code.sajari.com/docconv v1.3.7
|
||||
github.com/88250/clipboard v0.1.5
|
||||
github.com/88250/css v0.1.2
|
||||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||
github.com/88250/gulu v1.2.3-0.20230615033005-b519d6875346
|
||||
github.com/88250/lute v1.7.6-0.20230926080700-f85353a11d9f
|
||||
|
@ -37,7 +36,7 @@ require (
|
|||
github.com/imroc/req/v3 v3.42.0
|
||||
github.com/jinzhu/copier v0.4.0
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/klippa-app/go-pdfium v1.8.1
|
||||
github.com/klippa-app/go-pdfium v1.8.2
|
||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/mssola/useragent v1.0.0
|
||||
|
@ -46,8 +45,8 @@ require (
|
|||
github.com/panjf2000/ants/v2 v2.8.2
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/sashabaranov/go-openai v1.15.3
|
||||
github.com/shirou/gopsutil/v3 v3.23.8
|
||||
github.com/sashabaranov/go-openai v1.15.4
|
||||
github.com/shirou/gopsutil/v3 v3.23.9
|
||||
github.com/siyuan-note/dejavu v0.0.0-20230922010755-b258c02dca85
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80
|
||||
|
@ -57,7 +56,7 @@ require (
|
|||
github.com/siyuan-note/riff v0.0.0-20230928143458-ffd178c7e0fc
|
||||
github.com/steambap/captcha v1.4.1
|
||||
github.com/studio-b12/gowebdav v0.9.0
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.0
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
|
||||
github.com/xuri/excelize/v2 v2.8.0
|
||||
golang.org/x/image v0.12.0
|
||||
|
@ -76,8 +75,7 @@ require (
|
|||
github.com/andybalholm/brotli v1.0.5 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.2 // indirect
|
||||
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect
|
||||
github.com/aws/aws-sdk-go v1.45.18 // indirect
|
||||
github.com/bmharper/turbo v1.0.1 // indirect
|
||||
github.com/aws/aws-sdk-go v1.45.20 // indirect
|
||||
github.com/bytedance/sonic v1.10.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
|
||||
|
@ -91,8 +89,8 @@ require (
|
|||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.15.4 // indirect
|
||||
github.com/go-resty/resty/v2 v2.8.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.15.5 // indirect
|
||||
github.com/go-resty/resty/v2 v2.9.1 // indirect
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
github.com/golang/glog v1.1.2 // indirect
|
||||
|
@ -100,7 +98,6 @@ require (
|
|||
github.com/google/uuid v1.3.1 // indirect
|
||||
github.com/gopherjs/gopherjs v1.17.2 // indirect
|
||||
github.com/gorilla/context v1.1.1 // indirect
|
||||
github.com/gorilla/css v1.0.0 // indirect
|
||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||
github.com/gorilla/sessions v1.2.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
|
|
|
@ -4,8 +4,6 @@ dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab h1:Ew70NL+wL6
|
|||
dmitri.shuralyov.com/font/woff2 v0.0.0-20180220214647-957792cbbdab/go.mod h1:FvHgTMJanm43G7B3MVSjS/jim5ytVqAJNAOpRhnuHJc=
|
||||
github.com/88250/clipboard v0.1.5 h1:V/mCiSrjwmIiJwvchGTs+W2ozdINxk7y7KgHNTSzlCI=
|
||||
github.com/88250/clipboard v0.1.5/go.mod h1:bNLJx4L8cF6fEgiXMPVrK1Iidnaff8BTkktTNtefcks=
|
||||
github.com/88250/css v0.1.2 h1:+AADhEwWoGZFbUjqIsBcdnq2xfj8fDFDAGRXhBUhUY8=
|
||||
github.com/88250/css v0.1.2/go.mod h1:XfcZHQ0YuUb9VncVBurQfVyw1ZQicsB5Gc9N7BK3/ig=
|
||||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48 h1:qiE88Pw/9GG8hvMfpfB4aUhnIikZTwG+Z/Xbn0a9R14=
|
||||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48/go.mod h1:UgVSq5iO9pOvqs3hIGNVk6WXDiAB0v3Dlg4nssQJ7W4=
|
||||
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXSiEXYAo8Zbi/r2Ld6Dd4MmGHgir3EaSuHQ=
|
||||
|
@ -51,10 +49,8 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhP
|
|||
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw=
|
||||
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP9/R33ZaagQtAM4EkkSYnIAlOG5EI8gkM=
|
||||
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=
|
||||
github.com/aws/aws-sdk-go v1.45.18 h1:uSOGg4LFtpQH/bq9FsumMKfZHNl7BdH7WURHOqKXHNU=
|
||||
github.com/aws/aws-sdk-go v1.45.18/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/bmharper/turbo v1.0.1 h1:33ZPJnpZ1g843xaGygSnSmP/W+jNw0NAqDCvjBksDeM=
|
||||
github.com/bmharper/turbo v1.0.1/go.mod h1:EKWw/jfxBnzV9ms6tegpJV3DVZPd4Fu7vExf3P1OIcA=
|
||||
github.com/aws/aws-sdk-go v1.45.20 h1:U/wLZEwqVB6o2XlcJ7um8kczx+A1X2MgO2y4wdKDQTs=
|
||||
github.com/aws/aws-sdk-go v1.45.20/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
|
||||
github.com/bytedance/sonic v1.10.1 h1:7a1wuFXL1cMy7a3f7/VFcEtriuXQnUBhtoVfOZiaysc=
|
||||
|
@ -138,11 +134,11 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
|
|||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.8.0/go.mod h1:9JhgTzTaE31GZDpH/HSvHiRJrJ3iKAgqqH0Bl/Ocjdk=
|
||||
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||
github.com/go-playground/validator/v10 v10.15.4 h1:zMXza4EpOdooxPel5xDqXEdXG5r+WggpvnAKMsalBjs=
|
||||
github.com/go-playground/validator/v10 v10.15.4/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24=
|
||||
github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-resty/resty/v2 v2.0.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
|
||||
github.com/go-resty/resty/v2 v2.8.0 h1:J29d0JFWwSWrDCysnOK/YjsPMLQTx0TvgJEHVGvf2L8=
|
||||
github.com/go-resty/resty/v2 v2.8.0/go.mod h1:UCui0cMHekLrSntoMyofdSTaPpinlRHFtPpizuyDW2w=
|
||||
github.com/go-resty/resty/v2 v2.9.1 h1:PIgGx4VrHvag0juCJ4dDv3MiFRlDmP0vicBucwf+gLM=
|
||||
github.com/go-resty/resty/v2 v2.9.1/go.mod h1:4/GYJVjh9nhkhGR6AUNW3XhpDYNUr+Uvy9gV/VGZIy4=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
|
||||
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
|
@ -172,8 +168,6 @@ github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25d
|
|||
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
|
||||
github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
|
||||
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
|
||||
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
|
||||
|
@ -224,8 +218,8 @@ github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgo
|
|||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/klippa-app/go-pdfium v1.8.1 h1:v+cbJf0d61a2o3YgJJ97uZPthxzpBNQCC6uPZ0JU6EA=
|
||||
github.com/klippa-app/go-pdfium v1.8.1/go.mod h1:mstU4eOtvJ8Gqd18v+NJDxQCMm9yEayXu1RHswyzvas=
|
||||
github.com/klippa-app/go-pdfium v1.8.2 h1:Iny6xfgeCskVwgeeByHpQELVelKGsDJRRuLENg0h11E=
|
||||
github.com/klippa-app/go-pdfium v1.8.2/go.mod h1:/2rpgzjQbsqJm3+eeA3S1ziPHN+APRu/ipphM6zTO20=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
|
@ -276,7 +270,7 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N
|
|||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA=
|
||||
github.com/onsi/ginkgo/v2 v2.12.1/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
|
||||
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
|
||||
github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c=
|
||||
github.com/open-spaced-repetition/go-fsrs v1.0.0 h1:FIH5MW29EEHTTLwXPeDWJqO4QA/b7L9i2GEH4lAEl0U=
|
||||
github.com/open-spaced-repetition/go-fsrs v1.0.0/go.mod h1:WpbNs4TTKZChOHFO+ME0B9femUVZsepFT5mhAioszRg=
|
||||
github.com/otiai10/gosseract/v2 v2.4.1 h1:G8AyBpXEeSlcq8TI85LH/pM5SXk8Djy2GEXisgyblRw=
|
||||
|
@ -329,11 +323,11 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po
|
|||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
|
||||
github.com/sashabaranov/go-openai v1.15.3 h1:rzoNK9n+Cak+PM6OQ9puxDmFllxfnVea9StlmhglXqA=
|
||||
github.com/sashabaranov/go-openai v1.15.3/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||
github.com/sashabaranov/go-openai v1.15.4 h1:BXCR0Uxk5RipeY4yBC7g6pBVfcjh8jwrMNOYdie6yuk=
|
||||
github.com/sashabaranov/go-openai v1.15.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||
github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg=
|
||||
github.com/shirou/gopsutil/v3 v3.23.8 h1:xnATPiybo6GgdRoC4YoGnxXZFRc3dqQTGi73oLvvBrE=
|
||||
github.com/shirou/gopsutil/v3 v3.23.8/go.mod h1:7hmCaBn+2ZwaZOr6jmPBZDfawwMGuo1id3C6aM8EDqQ=
|
||||
github.com/shirou/gopsutil/v3 v3.23.9 h1:ZI5bWVeu2ep4/DIxB4U9okeYJ7zp/QLTO4auRb/ty/E=
|
||||
github.com/shirou/gopsutil/v3 v3.23.9/go.mod h1:x/NWSb71eMcjFIO0vhyGW5nZ7oSIgVjrCnADckb85GA=
|
||||
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
|
||||
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
|
||||
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
|
||||
|
@ -399,8 +393,8 @@ github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95
|
|||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/wmentor/html v1.0.1 h1:iIuDyH7pohHMMzdD5WQhvya5UyIecFDWTYzdM873Ook=
|
||||
|
@ -510,6 +504,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
|||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
|
|
|
@ -38,7 +38,7 @@ type BlockAttributeViewKeys struct {
|
|||
KeyValues []*av.KeyValues `json:"keyValues"`
|
||||
}
|
||||
|
||||
func renderTemplateCol(blockID, tplContent string) string {
|
||||
func renderTemplateCol(blockID, tplContent string, rowValues []*av.KeyValues) string {
|
||||
funcMap := sprig.TxtFuncMap()
|
||||
goTpl := template.New("").Delims(".action{", "}")
|
||||
tplContent = strings.ReplaceAll(tplContent, ".custom-", ".custom_") // 模板中的属性名不允许包含 - 字符,因此这里需要替换
|
||||
|
@ -54,6 +54,11 @@ func renderTemplateCol(blockID, tplContent string) string {
|
|||
for k, v := range ial {
|
||||
dataModel[strings.ReplaceAll(k, "custom-", "custom_")] = v
|
||||
}
|
||||
for _, rowValue := range rowValues {
|
||||
if 0 < len(rowValue.Values) {
|
||||
dataModel[rowValue.Key.Name] = rowValue.Values[0].String()
|
||||
}
|
||||
}
|
||||
if err := tpl.Execute(buf, dataModel); nil != err {
|
||||
logging.LogWarnf("execute template [%s] failed: %s", tplContent, err)
|
||||
}
|
||||
|
@ -97,11 +102,7 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
|
|||
}
|
||||
|
||||
if av.KeyTypeTemplate == kValues.Key.Type {
|
||||
// 渲染模板列
|
||||
content := renderTemplateCol(blockID, kValues.Key.Template)
|
||||
if "<no value>" != content {
|
||||
kValues.Values = append(kValues.Values, &av.Value{ID: ast.NewNodeID(), KeyID: kValues.Key.ID, BlockID: blockID, Type: av.KeyTypeTemplate, Template: &av.ValueTemplate{Content: content}})
|
||||
}
|
||||
kValues.Values = append(kValues.Values, &av.Value{ID: ast.NewNodeID(), KeyID: kValues.Key.ID, BlockID: blockID, Type: av.KeyTypeTemplate, Template: &av.ValueTemplate{Content: ""}})
|
||||
}
|
||||
|
||||
if 0 < len(kValues.Values) {
|
||||
|
@ -109,6 +110,15 @@ func GetBlockAttributeViewKeys(blockID string) (ret []*BlockAttributeViewKeys) {
|
|||
}
|
||||
}
|
||||
|
||||
// 渲染模板列
|
||||
for _, kv := range keyValues {
|
||||
if av.KeyTypeTemplate == kv.Key.Type {
|
||||
if 0 < len(kv.Values) {
|
||||
kv.Values[0].Template.Content = renderTemplateCol(blockID, kv.Key.Template, keyValues)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attribute Panel - Database sort attributes by view column order https://github.com/siyuan-note/siyuan/issues/9319
|
||||
view, _ := attrView.GetView()
|
||||
if nil != view {
|
||||
|
@ -210,17 +220,34 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
}
|
||||
|
||||
// 生成行
|
||||
rows := map[string][]*av.Value{}
|
||||
rows := map[string][]*av.KeyValues{}
|
||||
for _, keyValues := range attrView.KeyValues {
|
||||
for _, val := range keyValues.Values {
|
||||
rows[val.BlockID] = append(rows[val.BlockID], val)
|
||||
values := rows[val.BlockID]
|
||||
if nil == values {
|
||||
values = []*av.KeyValues{{Key: keyValues.Key, Values: []*av.Value{val}}}
|
||||
} else {
|
||||
values = append(values, &av.KeyValues{Key: keyValues.Key, Values: []*av.Value{val}})
|
||||
}
|
||||
rows[val.BlockID] = values
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤掉不存在的行
|
||||
var notFound []string
|
||||
for blockID, v := range rows {
|
||||
if v[0].IsDetached {
|
||||
for blockID, keyValues := range rows {
|
||||
blockValue := getRowBlockValue(keyValues)
|
||||
if nil == blockValue {
|
||||
notFound = append(notFound, blockID)
|
||||
continue
|
||||
}
|
||||
|
||||
if blockValue.IsDetached {
|
||||
continue
|
||||
}
|
||||
|
||||
if nil != blockValue.Block && "" == blockValue.Block.ID {
|
||||
notFound = append(notFound, blockID)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -237,12 +264,12 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
var tableRow av.TableRow
|
||||
for _, col := range ret.Columns {
|
||||
var tableCell *av.TableCell
|
||||
for _, val := range row {
|
||||
if val.KeyID == col.ID {
|
||||
for _, keyValues := range row {
|
||||
if keyValues.Key.ID == col.ID {
|
||||
tableCell = &av.TableCell{
|
||||
ID: val.ID,
|
||||
Value: val,
|
||||
ValueType: col.Type,
|
||||
ID: keyValues.Values[0].ID,
|
||||
Value: keyValues.Values[0],
|
||||
ValueType: keyValues.Values[0].Type,
|
||||
}
|
||||
break
|
||||
}
|
||||
|
@ -263,8 +290,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
|
||||
// 渲染模板列
|
||||
if av.KeyTypeTemplate == tableCell.ValueType {
|
||||
tableCell.Value = &av.Value{ID: tableCell.ID, KeyID: col.ID, BlockID: rowID, Type: av.KeyTypeTemplate, Template: &av.ValueTemplate{}}
|
||||
tableCell.Value.Template.Render(tableCell.Value.BlockID, col.Template, renderTemplateCol)
|
||||
tableCell.Value = &av.Value{ID: tableCell.ID, KeyID: col.ID, BlockID: rowID, Type: av.KeyTypeTemplate, Template: &av.ValueTemplate{Content: col.Template}}
|
||||
}
|
||||
|
||||
tableRow.Cells = append(tableRow.Cells, tableCell)
|
||||
|
@ -272,6 +298,17 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
ret.Rows = append(ret.Rows, &tableRow)
|
||||
}
|
||||
|
||||
// 渲染模板列
|
||||
for _, row := range ret.Rows {
|
||||
for _, cell := range row.Cells {
|
||||
if av.KeyTypeTemplate == cell.ValueType {
|
||||
keyValues := rows[row.ID]
|
||||
content := renderTemplateCol(row.ID, cell.Value.Template.Content, keyValues)
|
||||
cell.Value.Template.Content = content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义排序
|
||||
sortRowIDs := map[string]int{}
|
||||
if 0 < len(view.Table.RowIDs) {
|
||||
|
@ -291,6 +328,16 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
|
|||
return
|
||||
}
|
||||
|
||||
func getRowBlockValue(keyValues []*av.KeyValues) (ret *av.Value) {
|
||||
for _, kv := range keyValues {
|
||||
if av.KeyTypeBlock == kv.Key.Type && 0 < len(kv.Values) {
|
||||
ret = kv.Values[0]
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (tx *Transaction) doSetAttrViewName(operation *Operation) (ret *TxErr) {
|
||||
err := setAttributeViewName(operation)
|
||||
if nil != err {
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
// SiYuan - Refactor your thinking
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/88250/css"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func currentCSSValue(key string) string {
|
||||
var themeName string
|
||||
if 0 == Conf.Appearance.Mode {
|
||||
themeName = Conf.Appearance.ThemeLight
|
||||
} else {
|
||||
themeName = Conf.Appearance.ThemeDark
|
||||
}
|
||||
|
||||
themePath := filepath.Join(util.ThemesPath, themeName)
|
||||
theme := filepath.Join(themePath, "theme.css")
|
||||
|
||||
data, err := os.ReadFile(theme)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read theme css [%s] failed: %s", theme, err)
|
||||
return "#ffffff"
|
||||
}
|
||||
|
||||
ss := css.Parse(string(data))
|
||||
rules := ss.GetCSSRuleList()
|
||||
for _, rule := range rules {
|
||||
for _, style := range rule.Style.Styles {
|
||||
fixStyle(style)
|
||||
|
||||
if key == style.Property {
|
||||
return style.Value.Text()
|
||||
}
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func fixStyle(style *css.CSSStyleDeclaration) {
|
||||
// css 解析库似乎有 bug,这里做修正
|
||||
|
||||
if strings.HasPrefix(style.Property, "-") && !strings.HasPrefix(style.Property, "--") {
|
||||
style.Property = "-" + style.Property
|
||||
}
|
||||
|
||||
if strings.HasPrefix(style.Value.Text(), "- ") {
|
||||
value := style.Value.Text()[2:]
|
||||
style.Value = css.NewCSSValue(value)
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue