@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.18 → 1.0.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/LcdpUeditor.d.ts +2 -12
- package/es/LcdpUeditor.d.ts.map +1 -1
- package/es/LcdpUeditor.js +16 -107
- package/es/type.d.ts +0 -21
- package/es/type.d.ts.map +1 -1
- package/lib/LcdpUeditor.d.ts +2 -12
- package/lib/LcdpUeditor.js +16 -93
- package/lib/type.d.ts +0 -21
- package/package.json +3 -8
- package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
- package/ueditor-resource/dialogs/attachment/attachment.html +3 -3
- package/ueditor-resource/dialogs/attachment/attachment.js +1 -1
- package/ueditor-resource/dialogs/audio/audio.js +1 -1
- package/ueditor-resource/dialogs/background/background.html +2 -2
- package/ueditor-resource/dialogs/background/background.js +1 -1
- package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
- package/ueditor-resource/dialogs/contentimport/contentimport.js +1 -1
- package/ueditor-resource/dialogs/emotion/emotion.html +2 -2
- package/ueditor-resource/dialogs/emotion/emotion.js +1 -1
- package/ueditor-resource/dialogs/formula/formula.html +4 -4
- package/ueditor-resource/dialogs/formula/formula.js +1 -1
- package/ueditor-resource/dialogs/help/help.html +2 -2
- package/ueditor-resource/dialogs/help/help.js +1 -1
- package/ueditor-resource/dialogs/image/image.js +1 -1
- package/ueditor-resource/dialogs/insertframe/insertframe.html +1 -1
- package/ueditor-resource/dialogs/internal.js +1 -1
- package/ueditor-resource/dialogs/preview/preview.html +2 -2
- package/ueditor-resource/dialogs/scrawl/scrawl.html +2 -2
- package/ueditor-resource/dialogs/scrawl/scrawl.js +1 -1
- package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
- package/ueditor-resource/dialogs/searchreplace/searchreplace.js +1 -1
- package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
- package/ueditor-resource/dialogs/spechars/spechars.js +1 -1
- package/ueditor-resource/dialogs/table/edittable.html +2 -2
- package/ueditor-resource/dialogs/table/edittable.js +1 -1
- package/ueditor-resource/dialogs/table/edittd.html +1 -1
- package/ueditor-resource/dialogs/table/edittip.html +1 -1
- package/ueditor-resource/dialogs/template/template.html +2 -2
- package/ueditor-resource/dialogs/template/template.js +1 -1
- package/ueditor-resource/dialogs/video/video.js +1 -1
- package/ueditor-resource/dialogs/wordimage/wordimage.html +4 -4
- package/ueditor-resource/dialogs/wordimage/wordimage.js +1 -1
- package/ueditor-resource/plugins/demo/demo.js +1 -3
- package/ueditor-resource/themes/default/css/ueditor.css +1 -1
- package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3 -3
- package/ueditor-resource/third-party/clipboard/clipboard.js +1 -1
- package/ueditor-resource/third-party/codemirror/codemirror.js +2 -3
- package/ueditor-resource/third-party/jquery-3.5.1.js +3 -3
- package/ueditor-resource/third-party/jquery-3.5.1_1.js +3 -3
- package/ueditor-resource/ueditor.all.js +19 -22
- package/ueditor-resource/ueditor.config.js +1 -1
- package/ueditor-resource/ueditor.parse.js +1 -1
- package/es/ToolBottomBar/FormatModal/index.d.ts +0 -9
- package/es/ToolBottomBar/FormatModal/index.d.ts.map +0 -1
- package/es/ToolBottomBar/FormatModal/index.js +0 -543
- package/es/ToolBottomBar/FormatModal/index.less +0 -276
- package/es/ToolBottomBar/ProgressModal/index.d.ts +0 -10
- package/es/ToolBottomBar/ProgressModal/index.d.ts.map +0 -1
- package/es/ToolBottomBar/ProgressModal/index.js +0 -53
- package/es/ToolBottomBar/ProgressModal/index.less +0 -16
- package/es/ToolBottomBar/index.d.ts +0 -33
- package/es/ToolBottomBar/index.d.ts.map +0 -1
- package/es/ToolBottomBar/index.js +0 -296
- package/es/ToolBottomBar/index.less +0 -75
- package/es/icon/ExportPDF.d.ts +0 -3
- package/es/icon/ExportPDF.d.ts.map +0 -1
- package/es/icon/ExportPDF.js +0 -24
- package/es/icon/TextCopy.d.ts +0 -3
- package/es/icon/TextCopy.d.ts.map +0 -1
- package/es/icon/TextCopy.js +0 -25
- package/es/icon/TextFileIcon.d.ts +0 -3
- package/es/icon/TextFileIcon.d.ts.map +0 -1
- package/es/icon/TextFileIcon.js +0 -26
- package/es/icon/TextIcon.d.ts +0 -3
- package/es/icon/TextIcon.d.ts.map +0 -1
- package/es/icon/TextIcon.js +0 -28
- package/es/tools/exportPDF.d.ts +0 -27
- package/es/tools/exportPDF.d.ts.map +0 -1
- package/es/tools/exportPDF.js +0 -146
- package/es/tools/generateStylesFromSettings.d.ts +0 -38
- package/es/tools/generateStylesFromSettings.d.ts.map +0 -1
- package/es/tools/generateStylesFromSettings.js +0 -24
- package/lib/ToolBottomBar/FormatModal/index.d.ts +0 -9
- package/lib/ToolBottomBar/FormatModal/index.js +0 -261
- package/lib/ToolBottomBar/FormatModal/index.less +0 -276
- package/lib/ToolBottomBar/ProgressModal/index.d.ts +0 -10
- package/lib/ToolBottomBar/ProgressModal/index.js +0 -73
- package/lib/ToolBottomBar/ProgressModal/index.less +0 -16
- package/lib/ToolBottomBar/index.d.ts +0 -33
- package/lib/ToolBottomBar/index.js +0 -235
- package/lib/ToolBottomBar/index.less +0 -75
- package/lib/icon/ExportPDF.d.ts +0 -3
- package/lib/icon/ExportPDF.js +0 -57
- package/lib/icon/TextCopy.d.ts +0 -3
- package/lib/icon/TextCopy.js +0 -39
- package/lib/icon/TextFileIcon.d.ts +0 -3
- package/lib/icon/TextFileIcon.js +0 -39
- package/lib/icon/TextIcon.d.ts +0 -3
- package/lib/icon/TextIcon.js +0 -39
- package/lib/tools/exportPDF.d.ts +0 -27
- package/lib/tools/exportPDF.js +0 -95
- package/lib/tools/generateStylesFromSettings.d.ts +0 -38
- package/lib/tools/generateStylesFromSettings.js +0 -77
- package/ueditor-resource/plugins/browser-image-compression.js +0 -9
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
.ueditor-bottom-bar-with-status {
|
|
2
|
-
.edui-default {
|
|
3
|
-
display: none;
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
.ueditor-rich-status-bar {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
padding: 4px 12px;
|
|
11
|
-
background-color: #f0f0f0;
|
|
12
|
-
border-top: 1px solid #e0e0e0;
|
|
13
|
-
min-height: 32px;
|
|
14
|
-
.ueditor-rich-status-bar-box {
|
|
15
|
-
display: flex;
|
|
16
|
-
gap: 16px;
|
|
17
|
-
color: #666;
|
|
18
|
-
.ueditor-rich-status-bar-item:not(.ueditor-rich-status-bar-text) {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
border-radius: 4px;
|
|
23
|
-
padding: 4px 10px;
|
|
24
|
-
&:hover {
|
|
25
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
26
|
-
color: #1a73e8;
|
|
27
|
-
}
|
|
28
|
-
&.isActive {
|
|
29
|
-
color: #52c41a;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
.ueditor-rich-status-bar-text {
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
}
|
|
36
|
-
.ueditor-rich-status-bar-icon {
|
|
37
|
-
margin-right: 4px;
|
|
38
|
-
font-size: 14px;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
}
|
|
42
|
-
.ueditor-rich-status-bar-extra {
|
|
43
|
-
margin-left: 12px;
|
|
44
|
-
color: rgba(0, 0, 0, 0.25);
|
|
45
|
-
font-size: 12px;
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: center;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.edui-default .edui-editor {
|
|
53
|
-
&.ueditor-rich-status-not-full {
|
|
54
|
-
background-color: #fafbfc;
|
|
55
|
-
.edui-editor-iframeholder {
|
|
56
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
57
|
-
margin: 20px auto;
|
|
58
|
-
background-color: #fff;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.edui-default .edui-editor-iframeholder {
|
|
64
|
-
&.ueditor-rich-status-content {
|
|
65
|
-
&-a3 {
|
|
66
|
-
width: 80% !important;
|
|
67
|
-
}
|
|
68
|
-
&-a4 {
|
|
69
|
-
width: 60% !important;
|
|
70
|
-
}
|
|
71
|
-
&-a5 {
|
|
72
|
-
width: 40% !important;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
package/es/icon/ExportPDF.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExportPDF.d.ts","sourceRoot":"","sources":["ExportPDF.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,UAAU,mBAoBf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/es/icon/ExportPDF.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
var ExportFile = function ExportFile() {
|
|
3
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
-
width: "14",
|
|
6
|
-
height: "14",
|
|
7
|
-
viewBox: "0 0 24 24",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: "2",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
className: "lucide lucide-file-down"
|
|
14
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
-
d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"
|
|
16
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
-
d: "M14 2v4a2 2 0 0 0 2 2h4"
|
|
18
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
-
d: "M12 18v-6"
|
|
20
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
21
|
-
d: "m9 15 3 3 3-3"
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
24
|
-
export default ExportFile;
|
package/es/icon/TextCopy.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextCopy.d.ts","sourceRoot":"","sources":["TextCopy.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/es/icon/TextCopy.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
var TextIcon = function TextIcon() {
|
|
3
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
-
width: "14",
|
|
6
|
-
height: "14",
|
|
7
|
-
viewBox: "0 0 24 24",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: "2",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
className: "lucide lucide-copy"
|
|
14
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
|
15
|
-
width: "14",
|
|
16
|
-
height: "14",
|
|
17
|
-
x: "8",
|
|
18
|
-
y: "8",
|
|
19
|
-
rx: "2",
|
|
20
|
-
ry: "2"
|
|
21
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
22
|
-
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
23
|
-
}));
|
|
24
|
-
};
|
|
25
|
-
export default TextIcon;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextFileIcon.d.ts","sourceRoot":"","sources":["TextFileIcon.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/es/icon/TextFileIcon.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
var TextIcon = function TextIcon() {
|
|
3
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
-
width: "14",
|
|
6
|
-
height: "14",
|
|
7
|
-
viewBox: "0 0 24 24",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: "2",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
className: "lucide lucide-file-text"
|
|
14
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
-
d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"
|
|
16
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
-
d: "M14 2v4a2 2 0 0 0 2 2h4"
|
|
18
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
-
d: "M10 9H8"
|
|
20
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
21
|
-
d: "M16 13H8"
|
|
22
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
23
|
-
d: "M16 17H8"
|
|
24
|
-
}));
|
|
25
|
-
};
|
|
26
|
-
export default TextIcon;
|
package/es/icon/TextIcon.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextIcon.d.ts","sourceRoot":"","sources":["TextIcon.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/es/icon/TextIcon.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
var TextIcon = function TextIcon() {
|
|
3
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
-
width: "14",
|
|
6
|
-
height: "14",
|
|
7
|
-
viewBox: "0 0 24 24",
|
|
8
|
-
fill: "none",
|
|
9
|
-
stroke: "currentColor",
|
|
10
|
-
strokeWidth: "2",
|
|
11
|
-
strokeLinecap: "round",
|
|
12
|
-
strokeLinejoin: "round",
|
|
13
|
-
className: "lucide lucide-type"
|
|
14
|
-
}, /*#__PURE__*/React.createElement("polyline", {
|
|
15
|
-
points: "4 7 4 4 20 4 20 7"
|
|
16
|
-
}), /*#__PURE__*/React.createElement("line", {
|
|
17
|
-
x1: "9",
|
|
18
|
-
x2: "15",
|
|
19
|
-
y1: "20",
|
|
20
|
-
y2: "20"
|
|
21
|
-
}), /*#__PURE__*/React.createElement("line", {
|
|
22
|
-
x1: "12",
|
|
23
|
-
x2: "12",
|
|
24
|
-
y1: "4",
|
|
25
|
-
y2: "20"
|
|
26
|
-
}));
|
|
27
|
-
};
|
|
28
|
-
export default TextIcon;
|
package/es/tools/exportPDF.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 将HTML内容转换为PDF文档流
|
|
3
|
-
* @param htmlElement HTML元素
|
|
4
|
-
* @param options 配置选项
|
|
5
|
-
* @returns PDF文档的Blob对象
|
|
6
|
-
*/
|
|
7
|
-
export declare const html2pdf: (htmlElement: HTMLElement, options?: {
|
|
8
|
-
filename?: string;
|
|
9
|
-
margin?: number;
|
|
10
|
-
image?: {
|
|
11
|
-
type?: 'jpeg' | 'png';
|
|
12
|
-
quality?: number;
|
|
13
|
-
};
|
|
14
|
-
jsPDF?: {
|
|
15
|
-
orientation?: 'portrait' | 'landscape';
|
|
16
|
-
unit?: 'pt' | 'mm' | 'cm' | 'in';
|
|
17
|
-
format?: 'a4' | 'a3' | 'a5' | 'a0';
|
|
18
|
-
};
|
|
19
|
-
}, onProgress?: ((progress: number, title: string) => void) | undefined) => Promise<Blob>;
|
|
20
|
-
/**
|
|
21
|
-
* 将HTML元素转换为PDF文档流并下载
|
|
22
|
-
* @param dom HTML元素
|
|
23
|
-
* @param pageWidth 页面宽度
|
|
24
|
-
* @param fileName 文件名
|
|
25
|
-
* @returns 下载的PDF文件
|
|
26
|
-
*/
|
|
27
|
-
export declare const domloadPdf: (dom: HTMLElement, pageWidth: 'a4' | 'a3' | 'a5' | 'a0', fileName?: string, onProgress?: ((progress: number, title: string) => void) | undefined) => Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exportPDF.d.ts","sourceRoot":"","sources":["exportPDF.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,gBAAuB,WAAW,YAAW;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;QACvC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACjC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;KACpC,CAAA;CACF,2BACsB,MAAM,SAAS,MAAM,KAAK,IAAI,+BAiDpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAe,WAAW,aAAa,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,aAAY,MAAM,2BAChF,MAAM,SAAS,MAAM,KAAK,IAAI,+BAatD,CAAC"}
|
package/es/tools/exportPDF.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
/**
|
|
4
|
-
* 将HTML内容转换为PDF文档流
|
|
5
|
-
* @param htmlElement HTML元素
|
|
6
|
-
* @param options 配置选项
|
|
7
|
-
* @returns PDF文档的Blob对象
|
|
8
|
-
*/
|
|
9
|
-
export var html2pdf = /*#__PURE__*/function () {
|
|
10
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(htmlElement) {
|
|
11
|
-
var _options$jsPDF, _options$jsPDF2, _options$jsPDF3, _options$image, _options$image2;
|
|
12
|
-
var options,
|
|
13
|
-
onProgress,
|
|
14
|
-
_yield$import,
|
|
15
|
-
JS_PDF,
|
|
16
|
-
pdf,
|
|
17
|
-
_yield$import2,
|
|
18
|
-
html2canvas,
|
|
19
|
-
canvas,
|
|
20
|
-
imageType,
|
|
21
|
-
imageQuality,
|
|
22
|
-
imgData,
|
|
23
|
-
margin,
|
|
24
|
-
pdfWidth,
|
|
25
|
-
pdfHeight,
|
|
26
|
-
imgWidth,
|
|
27
|
-
imgHeight,
|
|
28
|
-
heightLeft,
|
|
29
|
-
position,
|
|
30
|
-
pageHeight,
|
|
31
|
-
_args = arguments;
|
|
32
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
|
-
while (1) switch (_context.prev = _context.next) {
|
|
34
|
-
case 0:
|
|
35
|
-
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
36
|
-
onProgress = _args.length > 2 ? _args[2] : undefined;
|
|
37
|
-
_context.next = 4;
|
|
38
|
-
return import( /* webpackChunkName: "jspdf" */'jspdf');
|
|
39
|
-
case 4:
|
|
40
|
-
_yield$import = _context.sent;
|
|
41
|
-
JS_PDF = _yield$import.jsPDF;
|
|
42
|
-
// 创建jsPDF实例
|
|
43
|
-
pdf = new JS_PDF({
|
|
44
|
-
orientation: ((_options$jsPDF = options.jsPDF) === null || _options$jsPDF === void 0 ? void 0 : _options$jsPDF.orientation) || 'portrait',
|
|
45
|
-
unit: ((_options$jsPDF2 = options.jsPDF) === null || _options$jsPDF2 === void 0 ? void 0 : _options$jsPDF2.unit) || 'pt',
|
|
46
|
-
format: ((_options$jsPDF3 = options.jsPDF) === null || _options$jsPDF3 === void 0 ? void 0 : _options$jsPDF3.format) || 'a4'
|
|
47
|
-
});
|
|
48
|
-
_context.next = 9;
|
|
49
|
-
return import /* webpackChunkName: "html2canvas" */('html2canvas');
|
|
50
|
-
case 9:
|
|
51
|
-
_yield$import2 = _context.sent;
|
|
52
|
-
html2canvas = _yield$import2.default;
|
|
53
|
-
onProgress === null || onProgress === void 0 || onProgress(20, '渲染页面内容...');
|
|
54
|
-
// 将HTML元素转换为Canvas
|
|
55
|
-
_context.next = 14;
|
|
56
|
-
return html2canvas(htmlElement, {
|
|
57
|
-
scale: 2,
|
|
58
|
-
// 提高清晰度
|
|
59
|
-
useCORS: true,
|
|
60
|
-
// 允许跨域图片
|
|
61
|
-
logging: false
|
|
62
|
-
});
|
|
63
|
-
case 14:
|
|
64
|
-
canvas = _context.sent;
|
|
65
|
-
// 获取Canvas数据URL
|
|
66
|
-
imageType = ((_options$image = options.image) === null || _options$image === void 0 ? void 0 : _options$image.type) || 'jpeg';
|
|
67
|
-
imageQuality = ((_options$image2 = options.image) === null || _options$image2 === void 0 ? void 0 : _options$image2.quality) || 1.0;
|
|
68
|
-
imgData = canvas.toDataURL("image/".concat(imageType), imageQuality); // 设置页面边距
|
|
69
|
-
margin = options.margin || 20;
|
|
70
|
-
pdfWidth = pdf.internal.pageSize.getWidth();
|
|
71
|
-
pdfHeight = pdf.internal.pageSize.getHeight();
|
|
72
|
-
imgWidth = pdfWidth - margin * 2;
|
|
73
|
-
imgHeight = canvas.height * imgWidth / canvas.width; // 添加图片到PDF
|
|
74
|
-
heightLeft = imgHeight;
|
|
75
|
-
position = margin;
|
|
76
|
-
pageHeight = pdfHeight - margin * 2; // 处理多页情况
|
|
77
|
-
pdf.addImage(imgData, imageType.toUpperCase(), margin, position, imgWidth, imgHeight);
|
|
78
|
-
heightLeft -= pageHeight;
|
|
79
|
-
while (heightLeft >= 0) {
|
|
80
|
-
position = heightLeft - imgHeight;
|
|
81
|
-
pdf.addPage();
|
|
82
|
-
pdf.addImage(imgData, imageType.toUpperCase(), margin, position, imgWidth, imgHeight);
|
|
83
|
-
heightLeft -= pageHeight;
|
|
84
|
-
}
|
|
85
|
-
onProgress === null || onProgress === void 0 || onProgress(50, '转换HTML内容...');
|
|
86
|
-
// 返回PDF文档流
|
|
87
|
-
return _context.abrupt("return", pdf.output('blob'));
|
|
88
|
-
case 31:
|
|
89
|
-
case "end":
|
|
90
|
-
return _context.stop();
|
|
91
|
-
}
|
|
92
|
-
}, _callee);
|
|
93
|
-
}));
|
|
94
|
-
return function html2pdf(_x) {
|
|
95
|
-
return _ref.apply(this, arguments);
|
|
96
|
-
};
|
|
97
|
-
}();
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* 将HTML元素转换为PDF文档流并下载
|
|
101
|
-
* @param dom HTML元素
|
|
102
|
-
* @param pageWidth 页面宽度
|
|
103
|
-
* @param fileName 文件名
|
|
104
|
-
* @returns 下载的PDF文件
|
|
105
|
-
*/
|
|
106
|
-
export var domloadPdf = /*#__PURE__*/function () {
|
|
107
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dom, pageWidth) {
|
|
108
|
-
var fileName,
|
|
109
|
-
onProgress,
|
|
110
|
-
_yield$import3,
|
|
111
|
-
saveAs,
|
|
112
|
-
blob,
|
|
113
|
-
_args2 = arguments;
|
|
114
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
115
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
116
|
-
case 0:
|
|
117
|
-
fileName = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '未命名';
|
|
118
|
-
onProgress = _args2.length > 3 ? _args2[3] : undefined;
|
|
119
|
-
_context2.next = 4;
|
|
120
|
-
return import /* webpackChunkName: "saveAs" */('file-saver');
|
|
121
|
-
case 4:
|
|
122
|
-
_yield$import3 = _context2.sent;
|
|
123
|
-
saveAs = _yield$import3.saveAs;
|
|
124
|
-
onProgress === null || onProgress === void 0 || onProgress(5, '初始化...');
|
|
125
|
-
_context2.next = 9;
|
|
126
|
-
return html2pdf(dom, {
|
|
127
|
-
jsPDF: {
|
|
128
|
-
orientation: 'portrait',
|
|
129
|
-
unit: 'pt',
|
|
130
|
-
format: pageWidth
|
|
131
|
-
}
|
|
132
|
-
}, onProgress);
|
|
133
|
-
case 9:
|
|
134
|
-
blob = _context2.sent;
|
|
135
|
-
onProgress === null || onProgress === void 0 || onProgress(80, '生成PDF...');
|
|
136
|
-
return _context2.abrupt("return", saveAs(blob, "".concat(fileName, ".pdf")));
|
|
137
|
-
case 12:
|
|
138
|
-
case "end":
|
|
139
|
-
return _context2.stop();
|
|
140
|
-
}
|
|
141
|
-
}, _callee2);
|
|
142
|
-
}));
|
|
143
|
-
return function domloadPdf(_x2, _x3) {
|
|
144
|
-
return _ref2.apply(this, arguments);
|
|
145
|
-
};
|
|
146
|
-
}();
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
interface HeadingStyle extends TextStyle {
|
|
2
|
-
marginTop: string;
|
|
3
|
-
marginBottom: string;
|
|
4
|
-
}
|
|
5
|
-
export interface TextStyle {
|
|
6
|
-
fontSize: string;
|
|
7
|
-
fontFamily: string;
|
|
8
|
-
fontWeight: string;
|
|
9
|
-
lineHeight: string;
|
|
10
|
-
color: string;
|
|
11
|
-
}
|
|
12
|
-
interface ListStyle extends TextStyle {
|
|
13
|
-
paddingLeft: string;
|
|
14
|
-
marginTop: string;
|
|
15
|
-
marginBottom: string;
|
|
16
|
-
}
|
|
17
|
-
export interface FormatSettings {
|
|
18
|
-
headings: {
|
|
19
|
-
h1: HeadingStyle;
|
|
20
|
-
h2: HeadingStyle;
|
|
21
|
-
h3: HeadingStyle;
|
|
22
|
-
h4: HeadingStyle;
|
|
23
|
-
h5: HeadingStyle;
|
|
24
|
-
h6: HeadingStyle;
|
|
25
|
-
};
|
|
26
|
-
paragraph: TextStyle;
|
|
27
|
-
lists: {
|
|
28
|
-
ul: ListStyle;
|
|
29
|
-
ol: ListStyle;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 生成CSS样式内容
|
|
34
|
-
* @param settings 格式设置
|
|
35
|
-
* @returns CSS样式字符串
|
|
36
|
-
*/
|
|
37
|
-
export declare const generateStylesFromSettings: (settings: FormatSettings) => string;
|
|
38
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateStylesFromSettings.d.ts","sourceRoot":"","sources":["generateStylesFromSettings.ts"],"names":[],"mappings":"AAAA,UAAU,YAAa,SAAQ,SAAS;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,SAAU,SAAQ,SAAS;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE;QACR,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;QACjB,EAAE,EAAE,YAAY,CAAC;KAClB,CAAC;IACF,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE;QACL,EAAE,EAAE,SAAS,CAAC;QACd,EAAE,EAAE,SAAS,CAAC;KACf,CAAC;CACH;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,aAAc,cAAc,KAAG,MAuDrE,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
/**
|
|
3
|
-
* 生成CSS样式内容
|
|
4
|
-
* @param settings 格式设置
|
|
5
|
-
* @returns CSS样式字符串
|
|
6
|
-
*/
|
|
7
|
-
export var generateStylesFromSettings = function generateStylesFromSettings(settings) {
|
|
8
|
-
var css = '';
|
|
9
|
-
|
|
10
|
-
// 处理标题样式
|
|
11
|
-
Object.entries(settings.headings).forEach(function (_ref) {
|
|
12
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
13
|
-
heading = _ref2[0],
|
|
14
|
-
style = _ref2[1];
|
|
15
|
-
css += "\n".concat(heading, " {\n font-family: ").concat(style.fontFamily, ";\n font-size: ").concat(style.fontSize, ";\n font-weight: ").concat(style.fontWeight, ";\n line-height: ").concat(style.lineHeight, ";\n color: ").concat(style.color, ";\n margin-top: ").concat(style.marginTop, ";\n margin-bottom: ").concat(style.marginBottom, ";\n}\n");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// 处理段落样式
|
|
19
|
-
css += "\np {\n font-family: ".concat(settings.paragraph.fontFamily, ";\n font-size: ").concat(settings.paragraph.fontSize, ";\n font-weight: ").concat(settings.paragraph.fontWeight, ";\n line-height: ").concat(settings.paragraph.lineHeight, ";\n color: ").concat(settings.paragraph.color, ";\n}\n");
|
|
20
|
-
|
|
21
|
-
// 处理列表样式
|
|
22
|
-
css += "\nul {\n font-family: ".concat(settings.lists.ul.fontFamily, ";\n font-size: ").concat(settings.lists.ul.fontSize, ";\n font-weight: ").concat(settings.lists.ul.fontWeight, ";\n line-height: ").concat(settings.lists.ul.lineHeight, ";\n color: ").concat(settings.lists.ul.color, ";\n padding-left: ").concat(settings.lists.ul.paddingLeft, ";\n margin-top: ").concat(settings.lists.ul.marginTop, ";\n margin-bottom: ").concat(settings.lists.ul.marginBottom, ";\n}\n\nol {\n font-family: ").concat(settings.lists.ol.fontFamily, ";\n font-size: ").concat(settings.lists.ol.fontSize, ";\n font-weight: ").concat(settings.lists.ol.fontWeight, ";\n line-height: ").concat(settings.lists.ol.lineHeight, ";\n color: ").concat(settings.lists.ol.color, ";\n padding-left: ").concat(settings.lists.ol.paddingLeft, ";\n margin-top: ").concat(settings.lists.ol.marginTop, ";\n margin-bottom: ").concat(settings.lists.ol.marginBottom, ";\n}\n");
|
|
23
|
-
return css;
|
|
24
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.less';
|
|
3
|
-
import { FormatSettings } from '../../tools/generateStylesFromSettings';
|
|
4
|
-
interface FormatSettingsPanelProps {
|
|
5
|
-
onApply: (settings: FormatSettings) => void;
|
|
6
|
-
initialSettings?: Partial<FormatSettings>;
|
|
7
|
-
}
|
|
8
|
-
declare const FormatSettingsPanel: React.FC<React.PropsWithChildren<FormatSettingsPanelProps>>;
|
|
9
|
-
export default FormatSettingsPanel;
|