@vtx/components 4.0.0-beta.2 → 4.0.0-beta.21
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/index.js +3 -1
- package/es/utils/filterSpecialCharacters.js +47 -46
- package/es/utils/index.js +1 -2
- package/es/vtx-color-picker/index.js +50 -39
- package/es/vtx-combogrid/Combogrid.js +11 -6
- package/es/vtx-combogrid/index.js +1 -1
- package/es/vtx-combogrid/style/index.js +4 -4
- package/es/vtx-datagrid/Store/Provide.js +6 -5
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +8 -3
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/es/vtx-datagrid/ToolBar/index.js +2 -2
- package/es/vtx-datagrid/index.js +26 -14
- package/es/vtx-datagrid/style/index.js +22 -7
- package/es/vtx-descriptions/Descriptions.js +30 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +6 -1
- package/es/vtx-export/index.js +24 -25
- package/es/vtx-export-async/index.js +28 -8
- package/es/vtx-form-layout/Card.js +10 -10
- package/es/vtx-form-layout/Divider.js +1 -1
- package/es/vtx-form-layout/Pane.js +23 -12
- package/es/vtx-form-layout/style/index.js +0 -1
- package/es/vtx-icon/index.js +41 -4
- package/es/vtx-image/Preview.js +11 -6
- package/es/vtx-import/index.js +78 -37
- package/es/vtx-import/result.js +2 -1
- package/es/vtx-import/style/index.js +11 -1
- package/es/vtx-import2/index.js +4 -2
- package/es/vtx-import2/style/index.js +1 -1
- package/es/vtx-input/TextArea/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -3
- package/es/vtx-page-layout/Content.js +1 -1
- package/es/vtx-page-layout/TabLayout.js +1 -7
- package/es/vtx-page-layout/TableLayout.js +14 -4
- package/es/vtx-page-layout/TableWrap.js +3 -2
- package/es/vtx-page-layout/TreeLayout.js +2 -8
- package/es/vtx-page-layout/container.js +6 -5
- package/es/vtx-provider/index.js +11 -4
- package/es/vtx-provider/locale/en_US.js +10 -2
- package/es/vtx-provider/locale/zh_CN.js +20 -2
- package/es/vtx-scrollable-row/index.js +38 -28
- package/es/vtx-search/index.js +5 -4
- package/es/vtx-search/style/index.js +2 -1
- package/es/vtx-select/index.js +25 -11
- package/es/vtx-signature/index.js +5 -4
- package/es/vtx-signature/style/index.js +1 -1
- package/es/vtx-split-pane/SplitPane.js +34 -24
- package/es/vtx-split-pane/style/index.js +7 -112
- package/es/vtx-transfer/Transfer.js +16 -233
- package/es/vtx-transfer/style/index.js +5 -28
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +104 -40
- package/es/vtx-tree-select/index.js +55 -92
- package/es/vtx-tree-select/style/index.js +4 -2
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +278 -108
- package/es/vtx-wang-editor/wangEditorUtil.js +59 -9
- package/lib/index.js +28 -4
- package/lib/utils/filterSpecialCharacters.js +48 -46
- package/lib/utils/index.js +0 -7
- package/lib/vtx-color-picker/index.js +50 -39
- package/lib/vtx-combogrid/Combogrid.js +11 -6
- package/lib/vtx-combogrid/index.js +1 -1
- package/lib/vtx-combogrid/style/index.js +4 -4
- package/lib/vtx-datagrid/Store/Provide.js +21 -19
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +8 -4
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +3 -0
- package/lib/vtx-datagrid/ToolBar/index.js +2 -2
- package/lib/vtx-datagrid/index.js +27 -14
- package/lib/vtx-datagrid/style/index.js +22 -7
- package/lib/vtx-descriptions/Descriptions.js +39 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +6 -1
- package/lib/vtx-export/index.js +25 -26
- package/lib/vtx-export-async/index.js +26 -6
- package/lib/vtx-form-layout/Card.js +9 -9
- package/lib/vtx-form-layout/Divider.js +1 -1
- package/lib/vtx-form-layout/Pane.js +22 -11
- package/lib/vtx-form-layout/style/index.js +0 -1
- package/lib/vtx-icon/index.js +59 -14
- package/lib/vtx-image/Preview.js +11 -6
- package/lib/vtx-import/index.js +77 -36
- package/lib/vtx-import/result.js +2 -1
- package/lib/vtx-import/style/index.js +11 -1
- package/lib/vtx-import2/index.js +4 -2
- package/lib/vtx-import2/style/index.js +1 -1
- package/lib/vtx-input/TextArea/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -3
- package/lib/vtx-page-layout/Content.js +1 -1
- package/lib/vtx-page-layout/TabLayout.js +3 -9
- package/lib/vtx-page-layout/TableLayout.js +14 -4
- package/lib/vtx-page-layout/TableWrap.js +3 -2
- package/lib/vtx-page-layout/TreeLayout.js +4 -10
- package/lib/vtx-page-layout/container.js +6 -5
- package/lib/vtx-provider/index.js +11 -4
- package/lib/vtx-provider/locale/en_US.js +10 -2
- package/lib/vtx-provider/locale/zh_CN.js +20 -2
- package/lib/vtx-scrollable-row/index.js +38 -28
- package/lib/vtx-search/index.js +5 -4
- package/lib/vtx-search/style/index.js +2 -1
- package/lib/vtx-select/index.js +25 -11
- package/lib/vtx-signature/index.js +4 -3
- package/lib/vtx-signature/style/index.js +1 -1
- package/lib/vtx-split-pane/SplitPane.js +32 -22
- package/lib/vtx-split-pane/style/index.js +7 -112
- package/lib/vtx-transfer/Transfer.js +15 -231
- package/lib/vtx-transfer/style/index.js +5 -28
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +102 -38
- package/lib/vtx-tree-select/index.js +55 -92
- package/lib/vtx-tree-select/style/index.js +4 -2
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +277 -109
- package/lib/vtx-wang-editor/wangEditorUtil.js +59 -10
- package/package.json +60 -33
- package/dist/1077.66b69576.async.js +0 -1
- package/dist/1572.2b90c634.async.js +0 -1
- package/dist/1632.03c8f7ad.async.js +0 -2
- package/dist/2267.aeefe75c.async.js +0 -137
- package/dist/2791.54c703a9.async.js +0 -5
- package/dist/2952.348f2c3f.async.js +0 -654
- package/dist/3421.4387ba14.async.js +0 -1264
- package/dist/3500.29895123.async.js +0 -1
- package/dist/404.html +0 -17
- package/dist/4195.93b9d34d.async.js +0 -1
- package/dist/4680.bca43384.async.js +0 -1
- package/dist/7965.a57e8f9a.async.js +0 -1
- package/dist/8300.66a39b1b.async.js +0 -1
- package/dist/8982.8e38e68e.async.js +0 -1
- package/dist/9877.87ec0c28.async.js +0 -11
- package/dist/VtxColorPicker__demos.60d61929.async.js +0 -1
- package/dist/VtxCombogrid__demos.8c798bc7.async.js +0 -1
- package/dist/VtxDatagrid__demos.e07857d0.async.js +0 -1
- package/dist/VtxEllipsisText__demos.2e269d20.async.js +0 -1
- package/dist/VtxExportAsync__demos.13e3bb1c.async.js +0 -1
- package/dist/VtxExport__demos.1cce5217.async.js +0 -1
- package/dist/VtxFormLayout__demos.b8bb038a.async.js +0 -1
- package/dist/VtxImage__demos.774c697e.async.js +0 -1
- package/dist/VtxImport2__demos.8182b8d2.async.js +0 -1
- package/dist/VtxImport__demos.3865c4e9.async.js +0 -1
- package/dist/VtxInput__demos.5fd77ccb.async.js +0 -1
- package/dist/VtxModal__demos.e0aae505.async.js +0 -1
- package/dist/VtxPageLayout__demos.b1cd7624.async.js +0 -1
- package/dist/VtxRpsFrame__demos.07c3fb5e.async.js +0 -1
- package/dist/VtxScrollableRow__demos.eeb18c3c.async.js +0 -1
- package/dist/VtxSearch__demos.f6b048ae.async.js +0 -1
- package/dist/VtxSelect__demos.0e8f1c52.async.js +0 -1
- package/dist/VtxSignature__demos.d0c4bcac.async.js +0 -1
- package/dist/VtxSplitPane__demos.6dda4f09.async.js +0 -1
- package/dist/VtxStatisticsColumn__demos.b2be3e4b.async.js +0 -1
- package/dist/VtxTimePicker__demos.ced305a6.async.js +0 -1
- package/dist/VtxTreeSelect__demos.daab9057.async.js +0 -1
- package/dist/VtxTree__demos.15550a80.async.js +0 -1
- package/dist/VtxUpload__demos.794c746a.async.js +0 -1
- package/dist/VtxWangEditor__demos.92b4daf1.async.js +0 -1
- package/dist/changelog/index.html +0 -17
- package/dist/components/index.html +0 -17
- package/dist/components/vtx-color-picker/index.html +0 -17
- package/dist/components/vtx-combogrid/index.html +0 -17
- package/dist/components/vtx-datagrid/index.html +0 -17
- package/dist/components/vtx-date-picker/index.html +0 -17
- package/dist/components/vtx-ellipsis-text/index.html +0 -17
- package/dist/components/vtx-export/index.html +0 -17
- package/dist/components/vtx-export-async/index.html +0 -17
- package/dist/components/vtx-form-layout/index.html +0 -17
- package/dist/components/vtx-image/index.html +0 -17
- package/dist/components/vtx-import/index.html +0 -17
- package/dist/components/vtx-import2/index.html +0 -17
- package/dist/components/vtx-input/index.html +0 -17
- package/dist/components/vtx-modal/index.html +0 -17
- package/dist/components/vtx-page-layout/index.html +0 -17
- package/dist/components/vtx-rps-frame/index.html +0 -17
- package/dist/components/vtx-scrollable-row/index.html +0 -17
- package/dist/components/vtx-search/index.html +0 -17
- package/dist/components/vtx-select/index.html +0 -17
- package/dist/components/vtx-signature/index.html +0 -17
- package/dist/components/vtx-split-pane/index.html +0 -17
- package/dist/components/vtx-statistics-column/index.html +0 -17
- package/dist/components/vtx-time-picker/index.html +0 -17
- package/dist/components/vtx-tree/index.html +0 -17
- package/dist/components/vtx-tree-select/index.html +0 -17
- package/dist/components/vtx-upload/index.html +0 -17
- package/dist/components/vtx-wang-editor/index.html +0 -17
- package/dist/demos.f6817f69.async.js +0 -1
- package/dist/docs/api-changes/index.html +0 -17
- package/dist/docs/index.html +0 -17
- package/dist/docs/migration-guide/index.html +0 -17
- package/dist/dumi__tmp-production__dumi__theme__ContextWrapper.aca58684.async.js +0 -1
- package/dist/favicon.ico +0 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +0 -17
- package/dist/meta__site.2e323023.async.js +0 -5392
- package/dist/meta__site.51651769.chunk.css +0 -9
- package/dist/meta__vtx-search.5ddbd36b.async.js +0 -5
- package/dist/nm__dumi-theme-vortex-style__dist__layouts__DemoLayout__index.7cea644e.async.js +0 -1
- package/dist/nm__dumi-theme-vortex-style__dist__layouts__DocLayout__index.eec80432.chunk.css +0 -1
- package/dist/nm__dumi__dist__client__pages__404.0d35bb9e.async.js +0 -1
- package/dist/nm__dumi__dist__client__pages__404.8b85f2d9.chunk.css +0 -1
- package/dist/nm__dumi__dist__client__pages__Demo__index.578aa5c0.chunk.css +0 -1
- package/dist/nm__dumi__dist__client__pages__Demo__index.88d92ec7.async.js +0 -1
- package/dist/preload_helper.214f203a.js +0 -1
- package/dist/site__changelog.md.33be0665.chunk.css +0 -1
- package/dist/site__changelog.md.ca6f70d0.async.js +0 -1
- package/dist/site__components__index.md.1c0dd566.async.js +0 -1
- package/dist/site__components__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-color-picker__index.md.0b5f09f9.async.js +0 -1
- package/dist/site__components__vtx-color-picker__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-combogrid__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-combogrid__index.md.5c184a19.async.js +0 -19
- package/dist/site__components__vtx-datagrid__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-datagrid__index.md.3b6b11a0.async.js +0 -58
- package/dist/site__components__vtx-date-picker__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-date-picker__index.md.e498db68.async.js +0 -1
- package/dist/site__components__vtx-ellipsis-text__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-ellipsis-text__index.md.3df8b85b.async.js +0 -1
- package/dist/site__components__vtx-export-async__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-export-async__index.md.7ad10351.async.js +0 -50
- package/dist/site__components__vtx-export__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-export__index.md.ae512624.async.js +0 -6
- package/dist/site__components__vtx-form-layout__index.md.26ce0de4.async.js +0 -1
- package/dist/site__components__vtx-form-layout__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-image__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-image__index.md.51d7fede.async.js +0 -7
- package/dist/site__components__vtx-import2__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-import2__index.md.3d03da86.async.js +0 -22
- package/dist/site__components__vtx-import__index.md.2706afc2.async.js +0 -1
- package/dist/site__components__vtx-import__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-input__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-input__index.md.dbe2e571.async.js +0 -1
- package/dist/site__components__vtx-modal__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-modal__index.md.6a9b2eda.async.js +0 -9
- package/dist/site__components__vtx-page-layout__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-page-layout__index.md.46cefa9b.async.js +0 -1
- package/dist/site__components__vtx-rps-frame__index.md.0126d79c.async.js +0 -1
- package/dist/site__components__vtx-rps-frame__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-scrollable-row__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-scrollable-row__index.md.83c9c112.async.js +0 -1
- package/dist/site__components__vtx-search__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-search__index.md.a36329f4.async.js +0 -5
- package/dist/site__components__vtx-select__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-select__index.md.d4b9a187.async.js +0 -6
- package/dist/site__components__vtx-signature__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-signature__index.md.e502b176.async.js +0 -1
- package/dist/site__components__vtx-split-pane__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-split-pane__index.md.744d87da.async.js +0 -1
- package/dist/site__components__vtx-statistics-column__index.md.106749e3.async.js +0 -1
- package/dist/site__components__vtx-statistics-column__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-time-picker__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-time-picker__index.md.c9f4700c.async.js +0 -1
- package/dist/site__components__vtx-tree-select__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-tree-select__index.md.49b56c10.async.js +0 -1
- package/dist/site__components__vtx-tree__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-tree__index.md.4c124fad.async.js +0 -1
- package/dist/site__components__vtx-upload__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-upload__index.md.57969550.async.js +0 -6
- package/dist/site__components__vtx-wang-editor__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-wang-editor__index.md.b98b12a6.async.js +0 -7
- package/dist/site__docs__api-changes.md.33be0665.chunk.css +0 -1
- package/dist/site__docs__api-changes.md.aaa38736.async.js +0 -6
- package/dist/site__docs__index.md.33be0665.chunk.css +0 -1
- package/dist/site__docs__index.md.586150c4.async.js +0 -53
- package/dist/site__docs__migration-guide.md.02f5996d.async.js +0 -194
- package/dist/site__docs__migration-guide.md.33be0665.chunk.css +0 -1
- package/dist/site__index.md.33be0665.chunk.css +0 -1
- package/dist/site__index.md.634bf57a.async.js +0 -1
- package/dist/sitemap.xml +0 -1
- package/dist/umi.f49a7748.css +0 -1
- package/dist/umi.f610424c.js +0 -877
- package/dist/vtx-search__index.md.33be0665.chunk.css +0 -1
- package/dist/vtx-search__index.md.37a39d66.async.js +0 -5
- package/dist/~demos/:id/index.html +0 -17
- package/dist/~demos/site-components-vtx-date-picker-demo-demo1/index.html +0 -17
- package/dist/~demos/site-components-vtx-date-picker-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxcolorpicker-demo-base/index.html +0 -17
- package/dist/~demos/vtxcolorpicker-demo-base-form/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo5/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo10/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo5/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo6/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo7/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo8/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo9/index.html +0 -17
- package/dist/~demos/vtxellipsistext-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxexport-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxexportasync-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo10/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo5/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo6/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo7/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo8/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo9/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo1/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo2/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo3/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo4/index.html +0 -17
- package/dist/~demos/vtximport-demo-base/index.html +0 -17
- package/dist/~demos/vtximport2-demo-base/index.html +0 -17
- package/dist/~demos/vtxinput-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxinput-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxinput-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxmodal-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxmodal-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxmodal-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxrpsframe-demo-base/index.html +0 -17
- package/dist/~demos/vtxscrollablerow-demo-demo/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxselect-demo-base/index.html +0 -17
- package/dist/~demos/vtxselect-demo-base-multiple/index.html +0 -17
- package/dist/~demos/vtxsignature-demo-demo/index.html +0 -17
- package/dist/~demos/vtxsignature-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxstatisticscolumn-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxstatisticscolumn-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxstatisticscolumn-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxtimepicker-demo-base/index.html +0 -17
- package/dist/~demos/vtxtree-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxtree-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxtree-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxtreeselect-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxtreeselect-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxtreeselect-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxupload-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxupload-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxupload-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxwangeditor-demo-demo1/index.html +0 -17
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "maxNumberOfFiles", "height", "status"];
|
|
2
|
+
var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "defaultMaxFileSize", "maxNumberOfFiles", "height", "status", "enableSanitization", "toolConfig", "editConfig"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -8,21 +8,22 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
14
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
16
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
17
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
19
|
/*eslint-disable*/
|
|
20
|
-
import React, { forwardRef, useState, useEffect, useContext } from 'react';
|
|
20
|
+
import React, { forwardRef, useState, useEffect, useContext, useCallback } from 'react';
|
|
21
21
|
import PropTypes from 'prop-types';
|
|
22
22
|
import { Editor, Toolbar } from '@wangeditor/editor-for-react';
|
|
23
23
|
import attachmentModule from '@wangeditor/plugin-upload-attachment';
|
|
24
24
|
import { Boot } from '@wangeditor/editor';
|
|
25
|
-
import
|
|
25
|
+
import getToken from "../utils/getToken";
|
|
26
|
+
import { withEmptyHtml, findAllImgSrcsFromHtml, extractImageDataFromRtf, replaceImagesFileSourceWithInlineRepresentation, replaceAllSpanFontSize, sanitizeHtml } from "./wangEditorUtil";
|
|
26
27
|
import { ConfigProvider } from 'antd';
|
|
27
28
|
import cls from 'classnames';
|
|
28
29
|
import { useStyle } from "./style/index";
|
|
@@ -44,13 +45,30 @@ var VtxWangEditor = function VtxWangEditor(props) {
|
|
|
44
45
|
var _useStyle = useStyle(prefixCls),
|
|
45
46
|
wrapSSR = _useStyle.wrapSSR,
|
|
46
47
|
hashId = _useStyle.hashId;
|
|
48
|
+
|
|
49
|
+
// 添加加载状态管理
|
|
50
|
+
var _useState = useState(false),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
loading = _useState2[0],
|
|
53
|
+
setLoading = _useState2[1];
|
|
54
|
+
var _useState3 = useState(null),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
error = _useState4[0],
|
|
57
|
+
setError = _useState4[1];
|
|
58
|
+
|
|
59
|
+
// 添加错误边界处理
|
|
60
|
+
var handleError = useCallback(function (error) {
|
|
61
|
+
console.error('VtxWangEditor Error:', error);
|
|
62
|
+
setError(error.message);
|
|
63
|
+
// 可以在这里添加错误上报逻辑
|
|
64
|
+
}, []);
|
|
47
65
|
var _React$useContext = React.useContext(FormItemInputContext),
|
|
48
66
|
contextStatus = _React$useContext.status,
|
|
49
67
|
hasFeedback = _React$useContext.hasFeedback,
|
|
50
68
|
isFormItemInput = _React$useContext.isFormItemInput,
|
|
51
69
|
feedbackIcon = _React$useContext.feedbackIcon;
|
|
52
70
|
var value = props.value,
|
|
53
|
-
|
|
71
|
+
onChange = props.onChange,
|
|
54
72
|
_props$downloadUrl = props.downloadUrl,
|
|
55
73
|
downloadUrl = _props$downloadUrl === void 0 ? '/cloudFile/common/downloadFile?id=' : _props$downloadUrl,
|
|
56
74
|
_props$uploadUrl = props.uploadUrl,
|
|
@@ -59,77 +77,273 @@ var VtxWangEditor = function VtxWangEditor(props) {
|
|
|
59
77
|
placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
|
|
60
78
|
_props$maxFileSize = props.maxFileSize,
|
|
61
79
|
maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
|
|
80
|
+
_props$defaultMaxFile = props.defaultMaxFileSize,
|
|
81
|
+
defaultMaxFileSize = _props$defaultMaxFile === void 0 ? 1024 * 1024 * 1024 : _props$defaultMaxFile,
|
|
62
82
|
_props$maxNumberOfFil = props.maxNumberOfFiles,
|
|
63
83
|
maxNumberOfFiles = _props$maxNumberOfFil === void 0 ? 5 : _props$maxNumberOfFil,
|
|
64
84
|
_props$height = props.height,
|
|
65
85
|
height = _props$height === void 0 ? 350 : _props$height,
|
|
66
86
|
customStatus = props.status,
|
|
87
|
+
_props$enableSanitiza = props.enableSanitization,
|
|
88
|
+
enableSanitization = _props$enableSanitiza === void 0 ? true : _props$enableSanitiza,
|
|
89
|
+
_props$toolConfig = props.toolConfig,
|
|
90
|
+
toolConfig = _props$toolConfig === void 0 ? {} : _props$toolConfig,
|
|
91
|
+
_props$editConfig = props.editConfig,
|
|
92
|
+
editConfig = _props$editConfig === void 0 ? {} : _props$editConfig,
|
|
67
93
|
rest = _objectWithoutProperties(props, _excluded);
|
|
68
94
|
var mergedStatus = getMergedStatus(contextStatus, customStatus);
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
editor =
|
|
72
|
-
setEditor =
|
|
95
|
+
var _useState5 = useState(null),
|
|
96
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
97
|
+
editor = _useState6[0],
|
|
98
|
+
setEditor = _useState6[1];
|
|
73
99
|
|
|
74
100
|
// 及时销毁 editor ,重要!
|
|
75
101
|
useEffect(function () {
|
|
76
102
|
return function () {
|
|
103
|
+
window.REGISTRY_UPLOAD_FILE = false;
|
|
104
|
+
if (editor == null) return;
|
|
77
105
|
if (editor) {
|
|
78
106
|
editor.destroy();
|
|
79
107
|
setEditor(null);
|
|
80
108
|
}
|
|
81
109
|
};
|
|
82
110
|
}, []);
|
|
111
|
+
|
|
112
|
+
// 修改安全的粘贴处理函数
|
|
113
|
+
var handleSafePaste = useCallback( /*#__PURE__*/function () {
|
|
114
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(editor, event) {
|
|
115
|
+
var html, rtf, plainText, imgSrcs, rtfImageData;
|
|
116
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
117
|
+
while (1) switch (_context.prev = _context.next) {
|
|
118
|
+
case 0:
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
_context.prev = 1;
|
|
121
|
+
// 获取粘贴内容
|
|
122
|
+
html = event.clipboardData.getData('text/html');
|
|
123
|
+
rtf = event.clipboardData.getData('text/rtf');
|
|
124
|
+
plainText = event.clipboardData.getData('text/plain'); // 如果没有HTML内容,直接粘贴纯文本
|
|
125
|
+
if (html) {
|
|
126
|
+
_context.next = 8;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (plainText) {
|
|
130
|
+
setTimeout(function () {
|
|
131
|
+
editor.insertText(plainText);
|
|
132
|
+
}, 0);
|
|
133
|
+
}
|
|
134
|
+
return _context.abrupt("return", false);
|
|
135
|
+
case 8:
|
|
136
|
+
// 安全过滤原始HTML内容
|
|
137
|
+
if (enableSanitization) {
|
|
138
|
+
html = sanitizeHtml(html);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// 处理Word粘贴(包含RTF数据)
|
|
142
|
+
if (!rtf) {
|
|
143
|
+
_context.next = 32;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
_context.prev = 10;
|
|
147
|
+
// 列表缩进会超出边框,直接过滤掉
|
|
148
|
+
html = html.replace(/text\-indent:\-(.*?)pt/gi, '');
|
|
149
|
+
|
|
150
|
+
// 从html内容中查找粘贴内容中是否有图片元素
|
|
151
|
+
imgSrcs = findAllImgSrcsFromHtml(html);
|
|
152
|
+
html = replaceAllSpanFontSize(html);
|
|
153
|
+
|
|
154
|
+
// 处理图片(如果有的话)
|
|
155
|
+
if (!(imgSrcs && Array.isArray(imgSrcs) && imgSrcs.length)) {
|
|
156
|
+
_context.next = 27;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
rtfImageData = extractImageDataFromRtf(rtf);
|
|
160
|
+
if (!rtfImageData.length) {
|
|
161
|
+
_context.next = 27;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
_context.prev = 17;
|
|
165
|
+
_context.next = 20;
|
|
166
|
+
return replaceImagesFileSourceWithInlineRepresentation(html, imgSrcs, rtfImageData, true, uploadUrl, downloadUrl);
|
|
167
|
+
case 20:
|
|
168
|
+
html = _context.sent;
|
|
169
|
+
// 对处理后的HTML再次进行安全过滤
|
|
170
|
+
if (enableSanitization) {
|
|
171
|
+
html = sanitizeHtml(html);
|
|
172
|
+
}
|
|
173
|
+
_context.next = 27;
|
|
174
|
+
break;
|
|
175
|
+
case 24:
|
|
176
|
+
_context.prev = 24;
|
|
177
|
+
_context.t0 = _context["catch"](17);
|
|
178
|
+
console.warn('图片处理失败,将跳过图片处理:', _context.t0.message);
|
|
179
|
+
// 图片处理失败时,保留原始HTML(不含图片)
|
|
180
|
+
// 不抛出错误,继续处理文字内容
|
|
181
|
+
case 27:
|
|
182
|
+
_context.next = 32;
|
|
183
|
+
break;
|
|
184
|
+
case 29:
|
|
185
|
+
_context.prev = 29;
|
|
186
|
+
_context.t1 = _context["catch"](10);
|
|
187
|
+
console.warn('Word内容处理失败,将粘贴原始内容:', _context.t1.message);
|
|
188
|
+
// 处理失败时,回退到原始HTML
|
|
189
|
+
case 32:
|
|
190
|
+
// 安全插入HTML(无论是处理过的还是原始的)
|
|
191
|
+
setTimeout(function () {
|
|
192
|
+
try {
|
|
193
|
+
editor.dangerouslyInsertHtml(html);
|
|
194
|
+
} catch (insertError) {
|
|
195
|
+
// 如果HTML插入失败,尝试插入纯文本作为备选
|
|
196
|
+
if (plainText) {
|
|
197
|
+
editor.insertText(plainText);
|
|
198
|
+
}
|
|
199
|
+
handleError(new Error('内容插入失败: ' + insertError.message));
|
|
200
|
+
}
|
|
201
|
+
}, 0);
|
|
202
|
+
return _context.abrupt("return", false);
|
|
203
|
+
case 36:
|
|
204
|
+
_context.prev = 36;
|
|
205
|
+
_context.t2 = _context["catch"](1);
|
|
206
|
+
// 最后的兜底处理
|
|
207
|
+
console.error('粘贴处理严重错误:', _context.t2);
|
|
208
|
+
if (event.clipboardData.getData('text/plain')) {
|
|
209
|
+
// 至少确保文字能够粘贴
|
|
210
|
+
setTimeout(function () {
|
|
211
|
+
editor.insertText(event.clipboardData.getData('text/plain'));
|
|
212
|
+
}, 0);
|
|
213
|
+
}
|
|
214
|
+
handleError(new Error('粘贴处理失败: ' + _context.t2.message));
|
|
215
|
+
return _context.abrupt("return", false);
|
|
216
|
+
case 42:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context.stop();
|
|
219
|
+
}
|
|
220
|
+
}, _callee, null, [[1, 36], [10, 29], [17, 24]]);
|
|
221
|
+
}));
|
|
222
|
+
return function (_x, _x2) {
|
|
223
|
+
return _ref.apply(this, arguments);
|
|
224
|
+
};
|
|
225
|
+
}(), [uploadUrl, downloadUrl, enableSanitization, handleError]);
|
|
226
|
+
|
|
227
|
+
// 添加安全的onChange处理
|
|
228
|
+
var handleEditorChange = useCallback(function (editor) {
|
|
229
|
+
try {
|
|
230
|
+
var newValue = editor.getHtml() || undefined;
|
|
231
|
+
// 对输出内容也进行安全过滤
|
|
232
|
+
var processedValue = enableSanitization && newValue !== undefined ? sanitizeHtml(newValue) : newValue;
|
|
233
|
+
console.log('编辑器内容变化,处理前内容:', newValue);
|
|
234
|
+
console.log('编辑器内容变化,处理后内容:', processedValue);
|
|
235
|
+
if (processedValue !== value) {
|
|
236
|
+
onChange(processedValue);
|
|
237
|
+
}
|
|
238
|
+
} catch (error) {
|
|
239
|
+
handleError(new Error('编辑器内容处理失败: ' + error.message));
|
|
240
|
+
}
|
|
241
|
+
}, [value, onChange, enableSanitization, handleError]);
|
|
242
|
+
|
|
83
243
|
// 编辑器配置
|
|
84
|
-
var editorConfig = {
|
|
244
|
+
var editorConfig = _objectSpread(_objectSpread({}, editConfig), {}, {
|
|
85
245
|
MENU_CONF: {
|
|
86
246
|
// 插入图片
|
|
87
247
|
uploadImage: {
|
|
88
248
|
server: uploadUrl,
|
|
89
|
-
maxFileSize:
|
|
249
|
+
maxFileSize: defaultMaxFileSize,
|
|
90
250
|
maxNumberOfFiles: maxNumberOfFiles,
|
|
251
|
+
headers: {
|
|
252
|
+
access_token: getToken(),
|
|
253
|
+
Authorization: 'Bearer ' + getToken()
|
|
254
|
+
},
|
|
91
255
|
// onSuccess(file, res) {},
|
|
256
|
+
onBeforeUpload: function onBeforeUpload(file) {
|
|
257
|
+
for (var key in file) {
|
|
258
|
+
if (file[key].size > maxFileSize) {
|
|
259
|
+
message.warn("\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236\uFF0C\u6700\u5927\u6587\u4EF6\u5927\u5C0F\u4E3A".concat(maxFileSize / 1024 / 1024, "M"));
|
|
260
|
+
// return { [key]: false };
|
|
261
|
+
return {};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return file;
|
|
265
|
+
},
|
|
266
|
+
onError: function onError(file, err, res) {
|
|
267
|
+
handleError(new Error(intl.getMessage('wangEditor.imageUploadFailed', '图片上传失败')));
|
|
268
|
+
},
|
|
92
269
|
customInsert: function customInsert(res, insertFn) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
res.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
270
|
+
try {
|
|
271
|
+
console.log(res, insertFn);
|
|
272
|
+
// res 即服务端的返回结果
|
|
273
|
+
// 从 res 中找到 url alt href ,然后插入图片
|
|
274
|
+
if (res.result == 0) {
|
|
275
|
+
res.data.map(function (item) {
|
|
276
|
+
insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
|
|
277
|
+
});
|
|
278
|
+
} else {
|
|
279
|
+
throw new Error(intl.getMessage('wangEditor.imageInsertionFailed', '插入图片失败'));
|
|
280
|
+
}
|
|
281
|
+
} catch (error) {
|
|
282
|
+
handleError(error);
|
|
103
283
|
}
|
|
104
284
|
}
|
|
105
285
|
},
|
|
106
286
|
// 插入视频
|
|
107
287
|
uploadVideo: {
|
|
108
288
|
server: uploadUrl,
|
|
289
|
+
maxFileSize: defaultMaxFileSize,
|
|
290
|
+
headers: {
|
|
291
|
+
access_token: getToken(),
|
|
292
|
+
Authorization: 'Bearer ' + getToken()
|
|
293
|
+
},
|
|
294
|
+
onError: function onError(file, err, res) {
|
|
295
|
+
handleError(new Error(intl.getMessage('wangEditor.videoUploadFailed', '视频上传失败')));
|
|
296
|
+
},
|
|
297
|
+
onBeforeUpload: function onBeforeUpload(file) {
|
|
298
|
+
for (var key in file) {
|
|
299
|
+
if (file[key].size > maxFileSize) {
|
|
300
|
+
message.warn("\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236\uFF0C\u6700\u5927\u6587\u4EF6\u5927\u5C0F\u4E3A".concat(maxFileSize / 1024 / 1024, "M"));
|
|
301
|
+
// return { [key]: false };
|
|
302
|
+
return {};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return file;
|
|
306
|
+
},
|
|
109
307
|
// onSuccess(file, res) {},
|
|
110
308
|
// 上传成功后,用户自定义插入文件
|
|
111
309
|
customInsert: function customInsert(res, insertFn) {
|
|
112
|
-
|
|
113
|
-
res.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
310
|
+
try {
|
|
311
|
+
if (res.result == 0) {
|
|
312
|
+
res.data.map(function (item) {
|
|
313
|
+
insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
|
|
314
|
+
});
|
|
315
|
+
} else {
|
|
316
|
+
throw new Error(intl.getMessage('wangEditor.videoInsertionFailed', '插入视频失败'));
|
|
317
|
+
}
|
|
318
|
+
} catch (error) {
|
|
319
|
+
handleError(error);
|
|
118
320
|
}
|
|
119
321
|
}
|
|
120
322
|
},
|
|
121
323
|
// 插入附件
|
|
122
324
|
uploadAttachment: {
|
|
123
325
|
server: uploadUrl,
|
|
326
|
+
headers: {
|
|
327
|
+
access_token: getToken(),
|
|
328
|
+
Authorization: 'Bearer ' + getToken()
|
|
329
|
+
},
|
|
330
|
+
onError: function onError(file, err, res) {
|
|
331
|
+
handleError(new Error(intl.getMessage('wangEditor.attachmentUploadFailed', '附件上传失败')));
|
|
332
|
+
},
|
|
124
333
|
// onSuccess(file, res) {},
|
|
125
334
|
// 上传成功后,用户自定义插入文件
|
|
126
335
|
customInsert: function customInsert(res, file, insertFn) {
|
|
127
|
-
|
|
128
|
-
res.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
336
|
+
try {
|
|
337
|
+
if (res.result == 0) {
|
|
338
|
+
res.data.map(function (item) {
|
|
339
|
+
console.log('插入附件:', item, insertFn);
|
|
340
|
+
insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
|
|
341
|
+
});
|
|
342
|
+
} else {
|
|
343
|
+
throw new Error(intl.getMessage('wangEditor.attachmentInsertionFailed', '插入附件失败'));
|
|
344
|
+
}
|
|
345
|
+
} catch (error) {
|
|
346
|
+
handleError(error);
|
|
133
347
|
}
|
|
134
348
|
}
|
|
135
349
|
}
|
|
@@ -141,74 +355,19 @@ var VtxWangEditor = function VtxWangEditor(props) {
|
|
|
141
355
|
menuKeys: ['downloadAttachment'] // “下载附件”菜单
|
|
142
356
|
}
|
|
143
357
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
148
|
-
while (1) switch (_context.prev = _context.next) {
|
|
149
|
-
case 0:
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
// 获取粘贴的html部分(??没错粘贴word时候,一部分内容就是html),该部分包含了图片img标签
|
|
152
|
-
html = event.clipboardData.getData('text/html'); // 获取rtf数据(从word、wps复制粘贴时有),复制粘贴过程中图片的数据就保存在rtf中
|
|
153
|
-
rtf = event.clipboardData.getData('text/rtf'); // 该条件分支即表示要自定义word粘贴
|
|
154
|
-
if (!(html && rtf)) {
|
|
155
|
-
_context.next = 17;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
// 列表缩进会超出边框,直接过滤掉
|
|
159
|
-
html = html.replace(/text\-indent:\-(.*?)pt/gi, '');
|
|
160
|
-
|
|
161
|
-
// 从html内容中查找粘贴内容中是否有图片元素,并返回img标签的属性src值的集合
|
|
162
|
-
imgSrcs = findAllImgSrcsFromHtml(html);
|
|
163
|
-
html = replaceAllSpanFontSize(html);
|
|
164
|
-
|
|
165
|
-
// 如果有图片
|
|
166
|
-
if (!(imgSrcs && Array.isArray(imgSrcs) && imgSrcs.length)) {
|
|
167
|
-
_context.next = 13;
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
// 从rtf内容中查找图片数据
|
|
171
|
-
// 从rtf内容中查找图片数据
|
|
172
|
-
rtfImageData = extractImageDataFromRtf(rtf);
|
|
173
|
-
if (!rtfImageData.length) {
|
|
174
|
-
_context.next = 13;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
_context.next = 12;
|
|
178
|
-
return replaceImagesFileSourceWithInlineRepresentation(html, imgSrcs, rtfImageData, true, uploadUrl, downloadUrl);
|
|
179
|
-
case 12:
|
|
180
|
-
html = _context.sent;
|
|
181
|
-
case 13:
|
|
182
|
-
editor.dangerouslyInsertHtml(html);
|
|
183
|
-
return _context.abrupt("return", false);
|
|
184
|
-
case 17:
|
|
185
|
-
if (!html) {
|
|
186
|
-
_context.next = 20;
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
editor.dangerouslyInsertHtml(html);
|
|
190
|
-
return _context.abrupt("return", false);
|
|
191
|
-
case 20:
|
|
192
|
-
case "end":
|
|
193
|
-
return _context.stop();
|
|
194
|
-
}
|
|
195
|
-
}, _callee);
|
|
196
|
-
}));
|
|
197
|
-
function customPaste(_x, _x2) {
|
|
198
|
-
return _customPaste.apply(this, arguments);
|
|
199
|
-
}
|
|
200
|
-
return customPaste;
|
|
201
|
-
}()
|
|
202
|
-
};
|
|
358
|
+
// 使用安全的粘贴处理函数
|
|
359
|
+
customPaste: handleSafePaste
|
|
360
|
+
});
|
|
203
361
|
// 工具栏配置
|
|
204
|
-
var toolbarConfig = {
|
|
362
|
+
var toolbarConfig = _objectSpread(_objectSpread({}, toolConfig), {}, {
|
|
363
|
+
// 自定义工具栏
|
|
205
364
|
insertKeys: {
|
|
206
365
|
// 自定义插入的位置
|
|
207
366
|
index: 24,
|
|
208
367
|
// “上传附件”菜单
|
|
209
368
|
keys: ['uploadAttachment']
|
|
210
369
|
}
|
|
211
|
-
};
|
|
370
|
+
});
|
|
212
371
|
return /*#__PURE__*/_jsxs("div", {
|
|
213
372
|
className: cls(prefixCls, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), props.prefixCls),
|
|
214
373
|
children: [/*#__PURE__*/_jsx(Toolbar, {
|
|
@@ -217,19 +376,14 @@ var VtxWangEditor = function VtxWangEditor(props) {
|
|
|
217
376
|
mode: "default"
|
|
218
377
|
}), /*#__PURE__*/_jsx(Editor, _objectSpread({
|
|
219
378
|
defaultConfig: editorConfig,
|
|
220
|
-
value: value ? value : '',
|
|
221
|
-
onCreated:
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
onChange: function onChange(editor) {
|
|
225
|
-
var nextValue = value ? value : undefined;
|
|
226
|
-
var prevValue = editor.getHtml() ? editor.getHtml() : undefined;
|
|
227
|
-
if (nextValue !== prevValue) {
|
|
228
|
-
_onChange(editor.getHtml());
|
|
229
|
-
}
|
|
230
|
-
},
|
|
379
|
+
value: value ? enableSanitization ? sanitizeHtml(value) : value : '',
|
|
380
|
+
onCreated: setEditor,
|
|
381
|
+
onChange: handleEditorChange,
|
|
231
382
|
mode: "default",
|
|
232
|
-
className: cls("".concat(prefixCls, "-content"), hashId)
|
|
383
|
+
className: cls("".concat(prefixCls, "-content"), hashId),
|
|
384
|
+
style: {
|
|
385
|
+
height: height
|
|
386
|
+
}
|
|
233
387
|
}, rest))]
|
|
234
388
|
});
|
|
235
389
|
};
|
|
@@ -241,5 +395,21 @@ VtxWangEditor.propTypes = {
|
|
|
241
395
|
placeholder: PropTypes.string,
|
|
242
396
|
downloadUrl: PropTypes.string,
|
|
243
397
|
uploadUrl: PropTypes.string,
|
|
244
|
-
height: PropTypes.number
|
|
398
|
+
height: PropTypes.number,
|
|
399
|
+
maxFileSize: PropTypes.number,
|
|
400
|
+
maxNumberOfFiles: PropTypes.number,
|
|
401
|
+
status: PropTypes.string,
|
|
402
|
+
prefixCls: PropTypes.string,
|
|
403
|
+
enableSanitization: PropTypes.bool // 是否启用HTML过滤
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
// 添加默认属性
|
|
407
|
+
VtxWangEditor.defaultProps = {
|
|
408
|
+
enableSanitization: true,
|
|
409
|
+
maxFileSize: 5 * 1024 * 1024,
|
|
410
|
+
maxNumberOfFiles: 5,
|
|
411
|
+
height: 350,
|
|
412
|
+
placeholder: '',
|
|
413
|
+
downloadUrl: '/cloudFile/common/downloadFile?id=',
|
|
414
|
+
uploadUrl: '/cloudFile/common/uploadFile'
|
|
245
415
|
};
|
|
@@ -5,6 +5,25 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
5
5
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
import DOMPurify from 'dompurify';
|
|
9
|
+
|
|
10
|
+
// 添加HTML安全过滤函数
|
|
11
|
+
export function sanitizeHtml(html) {
|
|
12
|
+
if (!html) return '';
|
|
13
|
+
|
|
14
|
+
// 配置DOMPurify白名单
|
|
15
|
+
var config = {
|
|
16
|
+
ALLOWED_TAGS: ['p', 'br', 'strong', 'em', 'u', 's', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'span', 'div', 'table', 'thead', 'tbody', 'tr', 'td', 'th', 'img', 'a', 'figure', 'figcaption'],
|
|
17
|
+
ALLOWED_ATTR: ['href', 'src', 'alt', 'title', 'class', 'style', 'width', 'height', 'target', 'rel', 'align', 'valign', 'colspan', 'rowspan', 'download'],
|
|
18
|
+
// 关键:允许所有data-*属性
|
|
19
|
+
ADD_ATTR: ['data-*'],
|
|
20
|
+
// 或者使用:
|
|
21
|
+
ALLOW_DATA_ATTR: true,
|
|
22
|
+
FORBID_PROTOCOLS: ['javascript:', 'data:', 'vbscript:'],
|
|
23
|
+
KEEP_CONTENT: true
|
|
24
|
+
};
|
|
25
|
+
return DOMPurify.sanitize(html, config);
|
|
26
|
+
}
|
|
8
27
|
export function replaceAllSpanFontSize(htmlData) {
|
|
9
28
|
var spanReg = /\<span([\s\S]+?)\<\/span\>/g;
|
|
10
29
|
var fontReg = /\<font([\s\S]+?)\<\/font\>/g;
|
|
@@ -132,6 +151,8 @@ export function extractImageDataFromRtf(rtfData) {
|
|
|
132
151
|
export function replaceImagesFileSourceWithInlineRepresentation(_x, _x2, _x3) {
|
|
133
152
|
return _replaceImagesFileSourceWithInlineRepresentation.apply(this, arguments);
|
|
134
153
|
}
|
|
154
|
+
|
|
155
|
+
// 验证base64数据有效性
|
|
135
156
|
function _replaceImagesFileSourceWithInlineRepresentation() {
|
|
136
157
|
_replaceImagesFileSourceWithInlineRepresentation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(htmlData, imageSrcs, imagesHexSources) {
|
|
137
158
|
var isBase64Data,
|
|
@@ -161,42 +182,53 @@ function _replaceImagesFileSourceWithInlineRepresentation() {
|
|
|
161
182
|
uploadUrl = _args.length > 4 ? _args[4] : undefined;
|
|
162
183
|
downloadUrl = _args.length > 5 ? _args[5] : undefined;
|
|
163
184
|
if (!(imageSrcs.length === imagesHexSources.length)) {
|
|
164
|
-
_context.next =
|
|
185
|
+
_context.next = 26;
|
|
165
186
|
break;
|
|
166
187
|
}
|
|
167
188
|
i = 0;
|
|
168
189
|
case 5:
|
|
169
190
|
if (!(i < imageSrcs.length)) {
|
|
170
|
-
_context.next =
|
|
191
|
+
_context.next = 26;
|
|
171
192
|
break;
|
|
172
193
|
}
|
|
173
194
|
url = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i = imageSrcs[i]) === null || _imageSrcs$i === void 0 ? void 0 : _imageSrcs$i.url;
|
|
174
195
|
width = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i2 = imageSrcs[i]) === null || _imageSrcs$i2 === void 0 ? void 0 : _imageSrcs$i2.width;
|
|
175
196
|
height = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i3 = imageSrcs[i]) === null || _imageSrcs$i3 === void 0 ? void 0 : _imageSrcs$i3.height;
|
|
176
197
|
img = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i4 = imageSrcs[i]) === null || _imageSrcs$i4 === void 0 ? void 0 : _imageSrcs$i4.img;
|
|
177
|
-
newSrc = isBase64Data ? "data:".concat(imagesHexSources[i].type, ";base64,").concat(_convertHexToBase64(imagesHexSources[i].hex)) : imagesHexSources[i];
|
|
198
|
+
newSrc = isBase64Data ? "data:".concat(imagesHexSources[i].type, ";base64,").concat(_convertHexToBase64(imagesHexSources[i].hex)) : imagesHexSources[i]; // 安全检查:验证base64数据的有效性
|
|
199
|
+
if (isValidBase64(newSrc)) {
|
|
200
|
+
_context.next = 14;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
console.warn('Invalid base64 image data detected, skipping...');
|
|
204
|
+
return _context.abrupt("continue", 23);
|
|
205
|
+
case 14:
|
|
178
206
|
formData = new FormData();
|
|
179
207
|
blob = convertBase64UrlToBlob(newSrc);
|
|
180
208
|
imgName = ((_url$split = url.split('\\')) === null || _url$split === void 0 || (_url$split = _url$split.slice(-1)) === null || _url$split === void 0 ? void 0 : _url$split[0]) || 'image.jpg';
|
|
181
209
|
file = new File([blob], imgName);
|
|
182
210
|
formData.append('file', file);
|
|
183
|
-
_context.next =
|
|
211
|
+
_context.next = 21;
|
|
184
212
|
return window.fetch(uploadUrl, {
|
|
185
213
|
method: 'POST',
|
|
214
|
+
headers: {
|
|
215
|
+
access_token: getToken(),
|
|
216
|
+
Authorization: 'Bearer ' + getToken()
|
|
217
|
+
},
|
|
186
218
|
body: formData
|
|
187
219
|
}).then(function (response) {
|
|
188
220
|
return response.json();
|
|
189
221
|
});
|
|
190
|
-
case
|
|
222
|
+
case 21:
|
|
191
223
|
res = _context.sent;
|
|
192
|
-
htmlData = htmlData.replace(img, "<img src=\"".concat(downloadUrl).concat(res.data[0].id, "\" style=\"width:").concat(width, "px;height:").concat(height, "px\""));
|
|
193
|
-
case
|
|
224
|
+
htmlData = htmlData.replace(img, "<img src=\"".concat(downloadUrl).concat(res.data[0].id, "\" style=\"width:").concat(width, "px;height:").concat(height, "px\" alt=\"").concat(res.data[0].fileName || imgName, "\" />"));
|
|
225
|
+
case 23:
|
|
194
226
|
i++;
|
|
195
227
|
_context.next = 5;
|
|
196
228
|
break;
|
|
197
|
-
case
|
|
229
|
+
case 26:
|
|
198
230
|
return _context.abrupt("return", htmlData);
|
|
199
|
-
case
|
|
231
|
+
case 27:
|
|
200
232
|
case "end":
|
|
201
233
|
return _context.stop();
|
|
202
234
|
}
|
|
@@ -204,6 +236,24 @@ function _replaceImagesFileSourceWithInlineRepresentation() {
|
|
|
204
236
|
}));
|
|
205
237
|
return _replaceImagesFileSourceWithInlineRepresentation.apply(this, arguments);
|
|
206
238
|
}
|
|
239
|
+
function isValidBase64(str) {
|
|
240
|
+
try {
|
|
241
|
+
// 检查是否包含有效的base64前缀
|
|
242
|
+
if (!str.startsWith('data:image/')) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// 检查base64编码的有效性
|
|
247
|
+
var base64Part = str.split(',')[1];
|
|
248
|
+
if (!base64Part) return false;
|
|
249
|
+
|
|
250
|
+
// 尝试解码验证
|
|
251
|
+
atob(base64Part);
|
|
252
|
+
return true;
|
|
253
|
+
} catch (e) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
207
257
|
function _convertHexToBase64(hexString) {
|
|
208
258
|
return btoa(hexString.match(/\w{2}/g).map(function (char) {
|
|
209
259
|
return String.fromCharCode(parseInt(char, 16));
|