mirror of
https://github.com/OpenListTeam/OpenList-Frontend.git
synced 2026-03-13 11:20:24 +00:00
refactor(aliyun_office): remove Aliyun Office preview (#169)
* refactor(aliyun_office): load Aliyun Office SDK dynamically * refactor(aliyun_office): remove Aliyun Office preview
This commit is contained in:
@@ -12,10 +12,6 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-title" content="OpenList" />
|
||||
<link rel="apple-touch-icon" href="https://res.oplist.org/logo/logo.png" />
|
||||
<script
|
||||
src="https://g.alicdn.com/IMM/office-js/1.1.5/aliyun-web-office-sdk.min.js"
|
||||
async
|
||||
></script>
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
type="image/ico"
|
||||
|
||||
6
src/index.d.ts
vendored
6
src/index.d.ts
vendored
@@ -1,7 +1 @@
|
||||
declare module "aplayer"
|
||||
declare namespace aliyun {
|
||||
class Config {
|
||||
setToken(token: { token: string }): any
|
||||
}
|
||||
function config(options: { mount: Element; url: string }): Config
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import { Box } from "@hope-ui/solid"
|
||||
import { MaybeLoading } from "~/components"
|
||||
import { useFetch, useRouter } from "~/hooks"
|
||||
import { password } from "~/store"
|
||||
import { PResp } from "~/types"
|
||||
import { handleResp, r } from "~/utils"
|
||||
|
||||
const AliDocPreview = () => {
|
||||
const { pathname } = useRouter()
|
||||
const [loading, post] = useFetch(
|
||||
(): PResp<{ access_token: string; preview_url: string }> =>
|
||||
r.post("/fs/other", {
|
||||
path: pathname(),
|
||||
password: password(),
|
||||
method: "doc_preview",
|
||||
}),
|
||||
)
|
||||
const init = async () => {
|
||||
const resp = await post()
|
||||
handleResp(resp, (data) => {
|
||||
const docOptions = aliyun.config({
|
||||
mount: document.querySelector("#office-preview")!,
|
||||
url: data.preview_url,
|
||||
})
|
||||
docOptions.setToken({ token: data.access_token })
|
||||
})
|
||||
}
|
||||
init()
|
||||
return (
|
||||
<MaybeLoading loading={loading()}>
|
||||
<Box w="$full" h="70vh" id="office-preview"></Box>
|
||||
</MaybeLoading>
|
||||
)
|
||||
}
|
||||
|
||||
export default AliDocPreview
|
||||
@@ -120,13 +120,6 @@ const previews: Preview[] = [
|
||||
component: lazy(() => import("./heic")),
|
||||
prior: true,
|
||||
},
|
||||
{
|
||||
name: "Aliyun Office Previewer",
|
||||
exts: ["doc", "docx", "ppt", "pptx", "xls", "xlsx", "pdf"],
|
||||
provider: /^Aliyundrive(Share)?$/,
|
||||
component: lazy(() => import("./aliyun_office")),
|
||||
prior: true,
|
||||
},
|
||||
{
|
||||
name: "PDF Preview",
|
||||
exts: ["pdf"],
|
||||
|
||||
Reference in New Issue
Block a user