@lingxiteam/lcdp-ueditor-react 1.0.3-alpha.8 → 1.0.4-alpha.1

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.
Files changed (109) hide show
  1. package/es/LcdpUeditor.d.ts +10 -4
  2. package/es/LcdpUeditor.d.ts.map +1 -0
  3. package/es/LcdpUeditor.js +77 -11
  4. package/es/ToolBottomBar/FormatModal/index.d.ts +9 -0
  5. package/es/ToolBottomBar/FormatModal/index.d.ts.map +1 -0
  6. package/es/ToolBottomBar/FormatModal/index.js +543 -0
  7. package/es/ToolBottomBar/FormatModal/index.less +276 -0
  8. package/es/ToolBottomBar/ProgressModal/index.d.ts +10 -0
  9. package/es/ToolBottomBar/ProgressModal/index.d.ts.map +1 -0
  10. package/es/ToolBottomBar/ProgressModal/index.js +53 -0
  11. package/es/ToolBottomBar/ProgressModal/index.less +16 -0
  12. package/es/ToolBottomBar/index.d.ts +33 -0
  13. package/es/ToolBottomBar/index.d.ts.map +1 -0
  14. package/es/ToolBottomBar/index.js +296 -0
  15. package/es/ToolBottomBar/index.less +75 -0
  16. package/es/const.d.ts.map +1 -0
  17. package/es/icon/ExportPDF.d.ts +3 -0
  18. package/es/icon/ExportPDF.d.ts.map +1 -0
  19. package/es/icon/ExportPDF.js +24 -0
  20. package/es/icon/TextCopy.d.ts +3 -0
  21. package/es/icon/TextCopy.d.ts.map +1 -0
  22. package/es/icon/TextCopy.js +25 -0
  23. package/es/icon/TextFileIcon.d.ts +3 -0
  24. package/es/icon/TextFileIcon.d.ts.map +1 -0
  25. package/es/icon/TextFileIcon.js +26 -0
  26. package/es/icon/TextIcon.d.ts +3 -0
  27. package/es/icon/TextIcon.d.ts.map +1 -0
  28. package/es/icon/TextIcon.js +28 -0
  29. package/es/index.d.ts.map +1 -0
  30. package/es/tools/UeditorResourceLoader.d.ts.map +1 -0
  31. package/es/tools/exportPDF.d.ts +27 -0
  32. package/es/tools/exportPDF.d.ts.map +1 -0
  33. package/es/tools/exportPDF.js +146 -0
  34. package/es/tools/filterHtmlNode.d.ts.map +1 -0
  35. package/es/tools/generateStylesFromSettings.d.ts +38 -0
  36. package/es/tools/generateStylesFromSettings.d.ts.map +1 -0
  37. package/es/tools/generateStylesFromSettings.js +24 -0
  38. package/es/tools/loadScript.d.ts.map +1 -0
  39. package/es/type.d.ts +21 -0
  40. package/es/type.d.ts.map +1 -0
  41. package/lib/LcdpUeditor.d.ts +10 -4
  42. package/lib/LcdpUeditor.js +62 -8
  43. package/lib/ToolBottomBar/FormatModal/index.d.ts +9 -0
  44. package/lib/ToolBottomBar/FormatModal/index.js +261 -0
  45. package/lib/ToolBottomBar/FormatModal/index.less +276 -0
  46. package/lib/ToolBottomBar/ProgressModal/index.d.ts +10 -0
  47. package/lib/ToolBottomBar/ProgressModal/index.js +73 -0
  48. package/lib/ToolBottomBar/ProgressModal/index.less +16 -0
  49. package/lib/ToolBottomBar/index.d.ts +33 -0
  50. package/lib/ToolBottomBar/index.js +235 -0
  51. package/lib/ToolBottomBar/index.less +75 -0
  52. package/lib/icon/ExportPDF.d.ts +3 -0
  53. package/lib/icon/ExportPDF.js +57 -0
  54. package/lib/icon/TextCopy.d.ts +3 -0
  55. package/lib/icon/TextCopy.js +39 -0
  56. package/lib/icon/TextFileIcon.d.ts +3 -0
  57. package/lib/icon/TextFileIcon.js +39 -0
  58. package/lib/icon/TextIcon.d.ts +3 -0
  59. package/lib/icon/TextIcon.js +39 -0
  60. package/lib/tools/exportPDF.d.ts +27 -0
  61. package/lib/tools/exportPDF.js +95 -0
  62. package/lib/tools/generateStylesFromSettings.d.ts +38 -0
  63. package/lib/tools/generateStylesFromSettings.js +77 -0
  64. package/lib/type.d.ts +21 -0
  65. package/package.json +8 -3
  66. package/ueditor-resource/dialogs/anchor/anchor.html +1 -1
  67. package/ueditor-resource/dialogs/attachment/attachment.html +3 -3
  68. package/ueditor-resource/dialogs/attachment/attachment.js +1 -1
  69. package/ueditor-resource/dialogs/audio/audio.js +1 -1
  70. package/ueditor-resource/dialogs/background/background.html +2 -2
  71. package/ueditor-resource/dialogs/background/background.js +1 -1
  72. package/ueditor-resource/dialogs/contentimport/contentimport.html +3 -3
  73. package/ueditor-resource/dialogs/contentimport/contentimport.js +1 -1
  74. package/ueditor-resource/dialogs/emotion/emotion.html +2 -2
  75. package/ueditor-resource/dialogs/emotion/emotion.js +1 -1
  76. package/ueditor-resource/dialogs/formula/formula.html +4 -4
  77. package/ueditor-resource/dialogs/formula/formula.js +1 -1
  78. package/ueditor-resource/dialogs/help/help.html +2 -2
  79. package/ueditor-resource/dialogs/help/help.js +1 -1
  80. package/ueditor-resource/dialogs/image/image.js +1 -1
  81. package/ueditor-resource/dialogs/insertframe/insertframe.html +1 -1
  82. package/ueditor-resource/dialogs/internal.js +1 -1
  83. package/ueditor-resource/dialogs/preview/preview.html +2 -2
  84. package/ueditor-resource/dialogs/scrawl/scrawl.html +2 -2
  85. package/ueditor-resource/dialogs/scrawl/scrawl.js +1 -1
  86. package/ueditor-resource/dialogs/searchreplace/searchreplace.html +2 -2
  87. package/ueditor-resource/dialogs/searchreplace/searchreplace.js +1 -1
  88. package/ueditor-resource/dialogs/spechars/spechars.html +2 -2
  89. package/ueditor-resource/dialogs/spechars/spechars.js +1 -1
  90. package/ueditor-resource/dialogs/table/edittable.html +2 -2
  91. package/ueditor-resource/dialogs/table/edittable.js +1 -1
  92. package/ueditor-resource/dialogs/table/edittd.html +1 -1
  93. package/ueditor-resource/dialogs/table/edittip.html +1 -1
  94. package/ueditor-resource/dialogs/template/template.html +2 -2
  95. package/ueditor-resource/dialogs/template/template.js +1 -1
  96. package/ueditor-resource/dialogs/video/video.js +1 -1
  97. package/ueditor-resource/dialogs/wordimage/wordimage.html +4 -4
  98. package/ueditor-resource/dialogs/wordimage/wordimage.js +1 -1
  99. package/ueditor-resource/plugins/browser-image-compression.js +9 -0
  100. package/ueditor-resource/plugins/demo/demo.js +3 -1
  101. package/ueditor-resource/themes/default/css/ueditor.css +1 -1
  102. package/ueditor-resource/third-party/SyntaxHighlighter/shCore.js +3 -3
  103. package/ueditor-resource/third-party/clipboard/clipboard.js +1 -1
  104. package/ueditor-resource/third-party/codemirror/codemirror.js +3 -2
  105. package/ueditor-resource/third-party/jquery-3.5.1.js +3 -3
  106. package/ueditor-resource/third-party/jquery-3.5.1_1.js +3 -3
  107. package/ueditor-resource/ueditor.all.js +22 -19
  108. package/ueditor-resource/ueditor.config.js +1 -1
  109. package/ueditor-resource/ueditor.parse.js +1 -1
@@ -0,0 +1,75 @@
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
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["const.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;8BAMR,MAAM;CAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ExportFile: () => JSX.Element;
3
+ export default ExportFile;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportPDF.d.ts","sourceRoot":"","sources":["ExportPDF.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,UAAU,mBAoBf,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,24 @@
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;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const TextIcon: () => JSX.Element;
3
+ export default TextIcon;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextCopy.d.ts","sourceRoot":"","sources":["TextCopy.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,25 @@
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;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const TextIcon: () => JSX.Element;
3
+ export default TextIcon;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextFileIcon.d.ts","sourceRoot":"","sources":["TextFileIcon.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,26 @@
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;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const TextIcon: () => JSX.Element;
3
+ export default TextIcon;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextIcon.d.ts","sourceRoot":"","sources":["TextIcon.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,QAAQ,mBAIb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,28 @@
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;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,WAAW,EACX,iBAAiB,GAClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UeditorResourceLoader.d.ts","sourceRoot":"","sources":["UeditorResourceLoader.ts"],"names":[],"mappings":"AAGA,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwB;IAG/C,OAAO,CAAC,MAAM,CAAC,aAAa;IAI5B,OAAO,CAAC,YAAY,CAAkB;IAEtC,OAAO,CAAC,iBAAiB,CAAkB;IAE3C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,SAAS,CAAkB;WAEf,SAAS,CAAE,MAAM,EAAE,MAAM,EAAE;WAgCjC,WAAW;IAWzB;;;OAGG;WACW,OAAO,CAAC,QAAQ,EAAE,QAAQ;IASxC;;;OAGG;WACW,WAAW,CAAC,QAAQ,EAAE,QAAQ;CAI7C;AAED,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,27 @@
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>;
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,146 @@
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
+ }();
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterHtmlNode.d.ts","sourceRoot":"","sources":["filterHtmlNode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,QAAS,MAAM;;;;CA2CzC,CAAC"}
@@ -0,0 +1,38 @@
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 {};
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,24 @@
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
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadScript.d.ts","sourceRoot":"","sources":["loadScript.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAgB,MAAM,EAAE,kBAUlD,CAAC"}
package/es/type.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { FormatSettings } from './tools/generateStylesFromSettings';
2
3
  interface IUeditorStype extends React.CSSProperties {
3
4
  toolbarColor?: string;
4
5
  }
@@ -68,6 +69,10 @@ export interface ILcdpUeditorProps {
68
69
  */
69
70
  videoAllowFiles?: string[];
70
71
  maximumWords?: number;
72
+ /**
73
+ * 导出文件名
74
+ */
75
+ exportFileName?: string;
71
76
  };
72
77
  toolbars?: string[][];
73
78
  /**
@@ -100,6 +105,22 @@ export interface ILcdpUeditorProps {
100
105
  * @param val 编辑器内容
101
106
  */
102
107
  onChange?(val: string): void;
108
+ /**
109
+ * 样式前缀
110
+ */
111
+ prefixCls?: string;
112
+ /**
113
+ * 格式设置变化
114
+ */
115
+ onFormatChange?(val: FormatSettings): void;
116
+ /**
117
+ * 默认格式设置
118
+ */
119
+ defaultFormatSetting?: FormatSettings;
120
+ /**
121
+ * 底部功能类型
122
+ */
123
+ bottomTypes?: Array<'chineseCount' | 'charCount' | 'pageWidth' | 'formatSetting' | 'exportPdf' | 'fullScreen' | 'copy'>;
103
124
  }
104
125
  export interface ILcdpUeditorInst {
105
126
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["type.ts"],"names":[],"mappings":"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"}
@@ -37,19 +37,20 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
37
37
  * 上传文件函数
38
38
  */
39
39
  private uploadFunction;
40
- /**
41
- * 是否加载完成
42
- */
43
- private isReady;
44
40
  /**
45
41
  * 保存 compositionend 事件处理器引用
46
42
  */
47
43
  private compositionEndHandler?;
44
+ /**
45
+ * 是否全屏
46
+ */
47
+ private prefixCls;
48
48
  /**
49
49
  * 初始加载失败
50
50
  */
51
51
  state: Readonly<{
52
52
  initError: boolean;
53
+ isReady: boolean;
53
54
  }>;
54
55
  /**
55
56
  * 编辑器配置项
@@ -58,6 +59,7 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
58
59
  constructor(props: ILcdpUeditorProps);
59
60
  componentDidMount(): void;
60
61
  componentWillReceiveProps(nextProps: ILcdpUeditorProps): void;
62
+ componentDidUpdate(prevProps: Readonly<ILcdpUeditorProps>): void;
61
63
  componentWillUnmount(): void;
62
64
  private onContentChange;
63
65
  private getExtString;
@@ -80,6 +82,10 @@ declare class LcdpUeditor extends React.Component<ILcdpUeditorProps, {}> {
80
82
  * 初始化编辑器实例
81
83
  */
82
84
  initUeditor(): Promise<void>;
85
+ /**
86
+ * 渲染状态栏
87
+ */
88
+ renderStatusBar(): void;
83
89
  render(): React.ReactNode;
84
90
  }
85
91
  export default LcdpUeditor;