mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-26 11:28:49 +01:00
🎨 OCR no longer blocks document loading https://github.com/siyuan-note/siyuan/issues/9230
This commit is contained in:
parent
b31765d0ab
commit
283917a9a8
8 changed files with 123 additions and 11 deletions
|
|
@ -52,27 +52,32 @@ func SetAssetText(asset, text string) {
|
|||
AssetsTextsChanged = true
|
||||
}
|
||||
|
||||
func GetAssetText(asset string, force bool) string {
|
||||
func ExistsAssetText(asset string) (ret bool) {
|
||||
AssetsTextsLock.Lock()
|
||||
_, ret = AssetsTexts[asset]
|
||||
AssetsTextsLock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
func GetAssetText(asset string, force bool) (ret string) {
|
||||
if !force {
|
||||
AssetsTextsLock.Lock()
|
||||
ret, ok := AssetsTexts[asset]
|
||||
ret = AssetsTexts[asset]
|
||||
AssetsTextsLock.Unlock()
|
||||
if ok {
|
||||
return ret
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
assetsPath := GetDataAssetsAbsPath()
|
||||
assetAbsPath := strings.TrimPrefix(asset, "assets")
|
||||
assetAbsPath = filepath.Join(assetsPath, assetAbsPath)
|
||||
ret := Tesseract(assetAbsPath)
|
||||
ret = Tesseract(assetAbsPath)
|
||||
AssetsTextsLock.Lock()
|
||||
AssetsTexts[asset] = ret
|
||||
AssetsTextsLock.Unlock()
|
||||
if "" != ret {
|
||||
AssetsTextsChanged = true
|
||||
}
|
||||
return ret
|
||||
return
|
||||
}
|
||||
|
||||
func IsTesseractExtractable(p string) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue