mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 Image OCR may not work in some cases https://github.com/siyuan-note/siyuan/issues/16287
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
404068b91b
commit
a756ca2dde
1 changed files with 3 additions and 4 deletions
|
|
@ -132,12 +132,11 @@ func SaveAssetsTexts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetAssetText(asset, text string) {
|
func SetAssetText(asset, text string) {
|
||||||
var oldText string
|
|
||||||
assetsTextsLock.Lock()
|
assetsTextsLock.Lock()
|
||||||
oldText = assetsTexts[asset]
|
oldText, ok := assetsTexts[asset]
|
||||||
assetsTexts[asset] = text
|
assetsTexts[asset] = text
|
||||||
assetsTextsLock.Unlock()
|
assetsTextsLock.Unlock()
|
||||||
if oldText != text {
|
if !ok || oldText != text {
|
||||||
assetsTextsChanged.Store(true)
|
assetsTextsChanged.Store(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +264,7 @@ func Tesseract(imgAbsPath string) (ret []map[string]interface{}) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取并连接所有 text 字段的函数
|
// GetOcrJsonText 提取并连接所有 text 字段的函数
|
||||||
func GetOcrJsonText(jsonData []map[string]interface{}) (ret string) {
|
func GetOcrJsonText(jsonData []map[string]interface{}) (ret string) {
|
||||||
for _, dataMap := range jsonData {
|
for _, dataMap := range jsonData {
|
||||||
// 检查 text 字段是否存在
|
// 检查 text 字段是否存在
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue