Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-12-18 13:30:36 +08:00
commit 71c24646cb
12 changed files with 82 additions and 56 deletions

View file

@ -464,7 +464,7 @@
"exporting": "Exporting, please wait...",
"exported": "Export complete",
"refExpired": "Search content block does not exist",
"emptyContent": "No related content",
"emptyContent": "No related content found",
"useBrowserView": "View in the browser",
"userLocalPDF": "Open with local PDF tool",
"copyID": "Copy ID",
@ -852,8 +852,8 @@
"setWindowTop": "Set Window top",
"cancelWindowTop": "Cancel Window top",
"officialWebsite": "Visit official website",
"openSource": "Visit Project on Github",
"resetWindow": "Reset Window on restart",
"openSource": "Visit project on GitHub",
"resetWindow": "Reset window and quit the program",
"quit": "Quit application"
},
"_kernel": {

View file

@ -464,7 +464,7 @@
"exporting": "Exportando, por favor espere...",
"exported": "Exportación completada",
"refExpired": "El bloque de contenido de búsqueda no existe",
"emptyContent": "No hay contenido relacionado",
"emptyContent": "No se encontró contenido relacionado",
"useBrowserView": "Ver en el navegador",
"userLocalPDF": "Abrir con la herramienta local de PDF",
"copyID": "ID de copia",
@ -852,8 +852,8 @@
"setWindowTop": "Establecer parte superior de la ventana",
"cancelWindowTop": "Cancelar ventana superior",
"officialWebsite": "Visita el sitio web oficial",
"openSource": "Visita el proyecto en Github",
"resetWindow": "Restablecer ventana al reiniciar",
"openSource": "Visita el proyecto en GitHub",
"resetWindow": "Restablecer ventana y salir del programa",
"quit": "Salir de la aplicación"
},
"_kernel": {

View file

@ -464,7 +464,7 @@
"exporting": "En cours d'exportation, veuillez patienter...",
"exported": "Exportation terminée",
"refExpired": "Le bloc de contenu de recherche n'existe pas",
"emptyContent": "Aucun contenu pertinent pour le moment",
"emptyContent": "Aucun contenu connexe trouvé",
"useBrowserView": "Afficher dans le navigateur",
"userLocalPDF": "Ouvrir avec un outil PDF local",
"copyID": "Copie ID",
@ -852,8 +852,8 @@
"setWindowTop": "Fenêtre en haut",
"cancelWindowTop": "Annuler le haut de la fenêtre",
"officialWebsite": "Visiter le site officiel",
"openSource": "Accéder aux projets open source GitHub",
"resetWindow": "Réinitialiser l'état de la fenêtre au redémarrage",
"openSource": "Visitez le projet sur GitHub",
"resetWindow": "Réinitialiser la fenêtre et quitter le programme",
"quit": "Quitter le programme"
},
"_kernel": {

View file

@ -464,7 +464,7 @@
"exporting": "正在匯出,請稍等...",
"exported": "匯出完成",
"refExpired": "不存在符合條件的內容塊",
"emptyContent": "暫無相關內容",
"emptyContent": "未找到相關內容",
"useBrowserView": "在瀏覽器中查看",
"userLocalPDF": "使用本地 PDF 工具打開",
"copyID": "複製 ID",
@ -852,8 +852,8 @@
"setWindowTop": "窗口置頂",
"cancelWindowTop": "取消窗口置頂",
"officialWebsite": "訪問官方網站",
"openSource": "訪問 GitHub 開源項目",
"resetWindow": "重啟時重置窗口",
"openSource": "訪問 GitHub 項目",
"resetWindow": "重置窗口並退出程序",
"quit": "退出程序"
},
"_kernel": {

View file

@ -464,7 +464,7 @@
"exporting": "正在导出,请稍等...",
"exported": "导出完成",
"refExpired": "不存在符合条件的内容块",
"emptyContent": "暂无相关内容",
"emptyContent": "未找到相关内容",
"useBrowserView": "在浏览器中查看",
"userLocalPDF": "使用本地 PDF 工具打开",
"copyID": "复制 ID",
@ -852,8 +852,8 @@
"setWindowTop": "窗口置顶",
"cancelWindowTop": "取消窗口置顶",
"officialWebsite": "访问官方网站",
"openSource": "访问 GitHub 开源项目",
"resetWindow": "重启时重置窗口",
"openSource": "访问 GitHub 项目",
"resetWindow": "重置窗口并退出程序",
"quit": "退出程序"
},
"_kernel": {

View file

@ -421,39 +421,54 @@ const boot = () => {
tray.setContextMenu(contextMenu)
}
const showWndMenu = {
label: trayMenu.hideWindow,
click: () => {
showHideWnd()
},
const buildShowWndMenu = () => {
const ret = {
label: trayMenu.hideWindow,
click: () => {
showHideWnd()
},
}
if (mainWindow.isVisible()) {
ret.label = trayMenu.hideWindow
} else {
ret.label = trayMenu.showWindow
}
return ret
}
const showHideWnd = () => {
if (!mainWindow.isVisible()) {
if (mainWindow.isMinimized()) {
mainWindow.restore()
}
mainWindow.show()
showWndMenu.label = trayMenu.hideWindow
} else {
mainWindow.hide()
showWndMenu.label = trayMenu.showWindow
}
resetTrayMenu()
}
const setWndTopMenu = {
label: trayMenu.setWindowTop,
click: () => {
setCancelWndTop()
},
const buildSetWndTopMenu = () => {
const ret = {
label: trayMenu.setWindowTop,
click: () => {
setCancelWndTop()
},
}
if (mainWindow.isAlwaysOnTop()) {
ret.label = trayMenu.cancelWindowTop
} else {
ret.label = trayMenu.setWindowTop
}
return ret;
}
const setCancelWndTop = () => {
if (!mainWindow.isAlwaysOnTop()) {
mainWindow.setAlwaysOnTop(true)
setWndTopMenu.label = trayMenu.cancelWindowTop
} else {
mainWindow.setAlwaysOnTop(false)
setWndTopMenu.label = trayMenu.setWindowTop
}
resetTrayMenu()
@ -461,7 +476,7 @@ const boot = () => {
const buildTrayMenuTemplate = () => {
let ret = [
showWndMenu,
buildShowWndMenu(),
{
label: trayMenu.officialWebsite,
click: () => {
@ -479,6 +494,7 @@ const boot = () => {
type: 'checkbox',
click: v => {
resetWindowStateOnRestart = v.checked
mainWindow.webContents.send('siyuan-save-close', true)
},
},
{
@ -491,7 +507,7 @@ const boot = () => {
if ('win32' === process.platform) {
// Windows 端支持窗口置顶 https://github.com/siyuan-note/siyuan/issues/6860
ret.splice(1, 0, setWndTopMenu)
ret.splice(1, 0, buildSetWndTopMenu())
}
return ret;
}
@ -502,7 +518,24 @@ const boot = () => {
return
}
globalShortcut.register(hotkey, () => {
showHideWnd()
if (mainWindow.isMinimized()) {
mainWindow.restore()
if (!mainWindow.isVisible()) {
mainWindow.show()
}
} else {
if (mainWindow.isVisible()) {
if (!mainWindow.isFocused()) {
mainWindow.show()
} else {
mainWindow.hide()
}
} else {
mainWindow.show()
}
}
resetTrayMenu()
})
})

File diff suppressed because one or more lines are too long

View file

@ -122,7 +122,7 @@ func html2BlockDOM(c *gin.Context) {
}
// 复制带超链接的图片无法保存到本地 https://github.com/siyuan-note/siyuan/issues/5993
luteEngine.NestedInlines2FlattedSpans(tree)
parse.NestedInlines2FlattedSpans(tree)
renderer := render.NewProtyleRenderer(tree, luteEngine.RenderOptions)
output := renderer.Render()

View file

@ -155,7 +155,7 @@ func prepareWriteTree(tree *parse.Tree) (data []byte, filePath string, err error
filePath = filepath.Join(util.DataDir, tree.Box, tree.Path)
if oldSpec := tree.Root.Spec; "" == oldSpec {
luteEngine.NestedInlines2FlattedSpans(tree)
parse.NestedInlines2FlattedSpans(tree)
tree.Root.Spec = "1"
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, tree.Root.Spec)
}
@ -236,7 +236,7 @@ func parseJSON2Tree(boxID, p string, jsonData []byte, luteEngine *lute.Lute) (re
filePath := filepath.Join(util.DataDir, ret.Box, ret.Path)
if oldSpec := ret.Root.Spec; "" == oldSpec {
luteEngine.NestedInlines2FlattedSpans(ret)
parse.NestedInlines2FlattedSpans(ret)
ret.Root.Spec = "1"
needFix = true
logging.LogInfof("migrated tree [%s] from spec [%s] to [%s]", filePath, oldSpec, ret.Root.Spec)

View file

@ -6,7 +6,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/css v0.1.2
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798
github.com/88250/lute v1.7.5-0.20221214053806-405c2847062a
github.com/88250/lute v1.7.5-0.20221218043446-d967dba6874e
github.com/88250/pdfcpu v0.3.13
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732
@ -39,7 +39,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/radovskyb/watcher v1.0.7
github.com/shirou/gopsutil/v3 v3.22.11
github.com/siyuan-note/dejavu v0.0.0-20221217082303-2b63c518c7b1
github.com/siyuan-note/dejavu v0.0.0-20221218044903-166a39f286d7
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da
github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e
@ -119,7 +119,7 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.4.0 // indirect
golang.org/x/exp v0.0.0-20221215174704-0915cd710c24 // indirect
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 // indirect
golang.org/x/mod v0.7.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/sync v0.1.0 // indirect

View file

@ -17,8 +17,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798 h1:sR/s/Y9wyl79ZRCUERwLPo9zqaB3KhNRodCMTJ4ozEU=
github.com/88250/gulu v1.2.3-0.20221117052724-cd06804db798/go.mod h1:I1qBzsksFL2ciGSuqDE7R3XW4BUMrfDgOvSXEk7FsAI=
github.com/88250/lute v1.7.5-0.20221214053806-405c2847062a h1:xkIaVEJt2oDBeGTSGmYoeGJyUr1AEyZSxqkLGz2XEcw=
github.com/88250/lute v1.7.5-0.20221214053806-405c2847062a/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
github.com/88250/lute v1.7.5-0.20221218043446-d967dba6874e h1:W9QP3v4GnZZkwKln5jrg6H6WPrtReVuuqb/NtfNx+jU=
github.com/88250/lute v1.7.5-0.20221218043446-d967dba6874e/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q=
github.com/88250/pdfcpu v0.3.13/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
@ -46,8 +46,6 @@ 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.44.160 h1:F41sWUel1CJ69ezoBGCg8sDyu9kyeKEpwmDrLXbCuyA=
github.com/aws/aws-sdk-go v1.44.160/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.162 h1:hKAd+X+/BLxVMzH+4zKxbQcQQGrk2UhFX0OTu1Mhon8=
github.com/aws/aws-sdk-go v1.44.162/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@ -373,10 +371,8 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
github.com/siyuan-note/dejavu v0.0.0-20221215030457-cdeb29f2189f h1:ufAgHjQdpXsEN0CVnMbXng3qyObITEw7dnoiSBlbjL0=
github.com/siyuan-note/dejavu v0.0.0-20221215030457-cdeb29f2189f/go.mod h1:aarwJw3uJaqNoIGVLmyhZjMCjI+xAzwrMIg05scqmtc=
github.com/siyuan-note/dejavu v0.0.0-20221217082303-2b63c518c7b1 h1:OsKmVwcihgfoylPB4+qjJ5q0GuZgUPBBDXQ9hMs4zZM=
github.com/siyuan-note/dejavu v0.0.0-20221217082303-2b63c518c7b1/go.mod h1:aarwJw3uJaqNoIGVLmyhZjMCjI+xAzwrMIg05scqmtc=
github.com/siyuan-note/dejavu v0.0.0-20221218044903-166a39f286d7 h1:klsbBOKibDh3pNEIGBgNrQj3C8QBOJtPr2BMt3eKe8o=
github.com/siyuan-note/dejavu v0.0.0-20221218044903-166a39f286d7/go.mod h1:aarwJw3uJaqNoIGVLmyhZjMCjI+xAzwrMIg05scqmtc=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da h1:/jNhl7LC+9BhkWvNxuJDdsNfA/2wvfuj9mqWx4CbV90=
@ -458,10 +454,8 @@ golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/exp v0.0.0-20221212164502-fae10dda9338 h1:OvjRkcNHnf6/W5FZXSxODbxwD+X7fspczG7Jn/xQVD4=
golang.org/x/exp v0.0.0-20221212164502-fae10dda9338/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20221215174704-0915cd710c24 h1:6w3iSY8IIkp5OQtbYj8NeuKG1jS9d+kYaubXqsoOiQ8=
golang.org/x/exp v0.0.0-20221215174704-0915cd710c24/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 h1:5oN1Pz/eDhCpbMbLstvIPa0b/BEQo6g6nwV3pLjfM6w=
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20190823064033-3a9bac650e44/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=

View file

@ -149,7 +149,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
for _, tree := range trees {
syPath := filepath.Join(unzipRootPath, tree.Path)
if "" == tree.Root.Spec {
luteEngine.NestedInlines2FlattedSpans(tree)
parse.NestedInlines2FlattedSpans(tree)
tree.Root.Spec = "1"
}
renderer := render.NewJSONRenderer(tree, luteEngine.RenderOptions)
@ -405,7 +405,6 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
base64TmpDir := filepath.Join(util.TempDir, "base64")
os.MkdirAll(base64TmpDir, 0755)
luteEngine := NewLute()
if gulu.File.IsDir(localPath) {
// 收集所有资源文件
assets := map[string]string{}
@ -497,7 +496,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
targetPaths[curRelPath] = targetPath
tree.HPath = hPath
tree.Root.Spec = "1"
luteEngine.NestedInlines2FlattedSpans(tree)
parse.NestedInlines2FlattedSpans(tree)
docDirLocalPath := filepath.Dir(filepath.Join(boxLocalPath, targetPath))
assetDirPath := getAssetsDir(boxLocalPath, docDirLocalPath)
@ -598,7 +597,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
tree.Path = targetPath
tree.HPath = path.Join(baseHPath, title)
tree.Root.Spec = "1"
luteEngine.NestedInlines2FlattedSpans(tree)
parse.NestedInlines2FlattedSpans(tree)
docDirLocalPath := filepath.Dir(filepath.Join(boxLocalPath, targetPath))
assetDirPath := getAssetsDir(boxLocalPath, docDirLocalPath)