Skip to content

Commit 531628f

Browse files
committedJun 1, 2023
feat: 升级 siyuan 到 0.7.2,兼容最新 API ,解决 isMobile报错问题
·
v1.8.1v1.6.0
1 parent 93761c9 commit 531628f

File tree

6 files changed

+293
-450
lines changed

6 files changed

+293
-450
lines changed
 

‎README_zh_CN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
安装完成后,在顶部右侧工具栏找到 `导入工具` 图标,点击按照弹窗操作即可。
2121

22+
* Q2: 能到支持 mobi 文件?能否支持 Markdown 文件夹?
23+
24+
A2:参考 https://github.com/terwer/siyuan-plugin-importer/issues/31 ,可先用 https://products.aspose.app/words/conversion/mobi-to-md 转换,然后用笔记本自带的导入文件夹实现。功能重叠,插件暂不做了。
25+
2226
## 更新历史
2327
**v1.5.3 主要更新**
2428
* 优化移动端图标展示,注:移动端没有pandoc,导入功能暂不可用

‎package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919
"package": "python scripts/package.py"
2020
},
2121
"devDependencies": {
22-
"@sveltejs/vite-plugin-svelte": "^2.0.3",
22+
"@sveltejs/vite-plugin-svelte": "^2.4.1",
2323
"@terwer/eslint-config-custom": "^1.2.0",
2424
"@tsconfig/svelte": "^4.0.1",
25-
"@types/node": "16",
25+
"@types/node": "^16.18.34",
2626
"fast-glob": "^3.2.12",
2727
"glob": "^7.2.3",
2828
"minimist": "^1.2.8",
2929
"rollup-plugin-livereload": "^2.0.5",
30-
"siyuan": "^0.7.1",
30+
"siyuan": "^0.7.2",
3131
"stylus": "^0.59.0",
32-
"svelte": "^3.57.0",
32+
"svelte": "^3.59.1",
3333
"ts-node": "^10.9.1",
34-
"vite": "^4.3.7",
34+
"vite": "^4.3.9",
3535
"vite-plugin-static-copy": "^0.15.0",
36-
"vitest": "^0.31.1"
36+
"vitest": "^0.31.3"
3737
},
3838
"dependencies": {
3939
"shorthash2": "^1.0.3"

‎pnpm-lock.yaml

Lines changed: 245 additions & 236 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/service/importService.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2023, Terwer . All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Terwer designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Terwer in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22+
* or visit www.terwer.space if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
export class ImportService {
27+
public static async simpleImport() {}
28+
29+
public static async multiImport() {}
30+
31+
//////////////////////////////////////////////////////////////////
32+
// private function
33+
//////////////////////////////////////////////////////////////////
34+
}

‎src/siyuan.d.ts

Lines changed: 0 additions & 206 deletions
This file was deleted.

‎src/topbar.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
import ImporterPlugin from "./index"
27-
import { Dialog, isMobile } from "siyuan"
27+
import { Dialog, getFrontend } from "siyuan"
2828
import ImportForm from "./lib/ImportForm.svelte"
2929
import { iconImporter } from "./utils/svg"
3030

@@ -46,11 +46,13 @@ export async function initTopbar(pluginInstance: ImporterPlugin) {
4646
},
4747
})
4848
topBarElement.addEventListener("click", async () => {
49+
const frontEnd = getFrontend()
50+
const isMobile = frontEnd === "mobile" || frontEnd === "browser-mobile"
4951
const importFormId = "siyuan-import-form"
5052
const d = new Dialog({
5153
title: `${pluginInstance.i18n.selectFile} - ${pluginInstance.i18n.importer}`,
5254
content: `<div id="${importFormId}"></div>`,
53-
width: isMobile() ? "92vw" : "720px",
55+
width: isMobile ? "92vw" : "720px",
5456
})
5557
new ImportForm({
5658
target: document.getElementById(importFormId) as HTMLElement,

0 commit comments

Comments
 (0)
Please sign in to comment.