-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new component MPdfMobileViewer (#2103)
* worked! * missing firstElementChild * toolbar * working on toolbar ui * done * remove unused css * add docs
- Loading branch information
Showing
31 changed files
with
664 additions
and
5 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
docs/Masa.Blazor.Docs/Examples/labs/pdf-mobile-viewer/Usage.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="text-center"> | ||
<iframe src="/blazor/examples/pdf-mobile-viewer" | ||
style="width: 375px; height: 667px; border: none;" | ||
width="100%"> | ||
</iframe> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@page "/blazor/examples/pdf-mobile-viewer" | ||
@layout EmptyLayout | ||
|
||
<MPdfMobileViewer Url="_content/Masa.Blazor.Docs/img/compressed.tracemonkey-pldi-09.pdf" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<MApp> | ||
<MMain> | ||
@Body | ||
</MMain> | ||
</MApp> |
7 changes: 7 additions & 0 deletions
7
docs/Masa.Blazor.Docs/wwwroot/data/apis/pdf-mobile-viewer/MPdfMobileViewer-en-US.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"props": { | ||
"hideToolbar": "Hide the toolbar", | ||
"maxCanvasPixels": "The maximum supported canvas size in total pixels, i.e.width* height. Use `-1` for no limit, or `0` for CSS-only zooming", | ||
"url": "The URL of PDF file to display." | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
docs/Masa.Blazor.Docs/wwwroot/data/apis/pdf-mobile-viewer/MPdfMobileViewer-zh-CN.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"props": { | ||
"hideToolbar": "隐藏底部工具栏", | ||
"maxCanvasPixels": "支持的最大画布大小(以总像素计算,即宽度 * 高度)。使用 -1 表示不限制,使用 0 表示仅使用 CSS 进行缩放。", | ||
"url": "PDF 文件的路径" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
docs/Masa.Blazor.Docs/wwwroot/pages/labs/pdf-mobile-viewer/en-US.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: PDF Mobile Viewer | ||
desc: "A PDF viewer designed for mobile." | ||
--- | ||
|
||
Before using, you need to include the style sheet: | ||
|
||
``` html | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/web/pdf_viewer.min.css" rel="stylesheet"> | ||
``` | ||
|
||
## Usage | ||
|
||
<masa-example file="Examples.labs.pdf_mobile_viewer.Usage" no-actions="true"></masa-example> | ||
|
||
```razor | ||
<MPdfMobileViewer Url="_content/Masa.Blazor.Docs/img/compressed.tracemonkey-pldi-09.pdf" /> | ||
``` |
18 changes: 18 additions & 0 deletions
18
docs/Masa.Blazor.Docs/wwwroot/pages/labs/pdf-mobile-viewer/zh-CN.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: PDF Mobile Viewer(PDF 移动端查看器) | ||
desc: "专为移动设备设计的 PDF 查看器。" | ||
--- | ||
|
||
在使用之前,需要引入样式表: | ||
|
||
``` html | ||
<link href="https://cdn.masastack.com/npm/pdfjs-dist/4.5.136/web/pdf_viewer.min.css" rel="stylesheet"> | ||
``` | ||
|
||
## 使用 | ||
|
||
<masa-example file="Examples.labs.pdf_mobile_viewer.Usage" no-actions="true"></masa-example> | ||
|
||
```razor | ||
<MPdfMobileViewer Url="_content/Masa.Blazor.Docs/img/compressed.tracemonkey-pldi-09.pdf" /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineConfig } from "rollup"; | ||
import { terser } from "rollup-plugin-terser"; | ||
|
||
import resolve from "@rollup/plugin-node-resolve"; | ||
import typescript from "@rollup/plugin-typescript"; | ||
|
||
export default defineConfig({ | ||
input: [ | ||
"./src/proxies/pdf.js/mobile-viewer.ts", | ||
"pdfjs-dist/legacy/build/pdf.worker.min.mjs" | ||
], | ||
output: [ | ||
{ | ||
dir: "../Masa.Blazor/wwwroot/js/proxies/pdf-mobile-viewer", | ||
entryFileNames: "[name].js", | ||
format: "esm", | ||
sourcemap: true, | ||
}, | ||
], | ||
plugins: [ | ||
typescript(), | ||
resolve(), | ||
terser(), | ||
], | ||
watch: { | ||
exclude: "node_modules/**", | ||
}, | ||
}); |
Oops, something went wrong.