@elliemae/ds-wysiwygeditor 2.3.1 → 3.0.0-alpha.3
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/dist/cjs/DSWYSIWYGEditor.js +128 -0
- package/dist/cjs/DSWYSIWYGEditor.js.map +7 -0
- package/dist/cjs/components/CustomImageUploader.js +123 -0
- package/dist/cjs/components/CustomImageUploader.js.map +7 -0
- package/dist/cjs/components/CustomToolbar.js +261 -0
- package/dist/cjs/components/CustomToolbar.js.map +7 -0
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js +255 -0
- package/dist/cjs/components/DSWYSIWYGEditorImpl.js.map +7 -0
- package/dist/cjs/components/ImageLibraryModal.js +108 -0
- package/dist/cjs/components/ImageLibraryModal.js.map +7 -0
- package/dist/cjs/components/InsertFieldModal.js +212 -0
- package/dist/cjs/components/InsertFieldModal.js.map +7 -0
- package/dist/cjs/components/TippedButton.js +91 -0
- package/dist/cjs/components/TippedButton.js.map +7 -0
- package/dist/cjs/components/TippedSelect.js +57 -0
- package/dist/cjs/components/TippedSelect.js.map +7 -0
- package/dist/cjs/components/colors.js +50 -0
- package/dist/cjs/components/colors.js.map +7 -0
- package/dist/cjs/components/customFields.js +76 -0
- package/dist/cjs/components/customFields.js.map +7 -0
- package/dist/cjs/constants.js +114 -0
- package/dist/cjs/constants.js.map +7 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +48 -0
- package/dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
- package/dist/cjs/quillOverrides/IndentStyle.js +51 -0
- package/dist/cjs/quillOverrides/IndentStyle.js.map +7 -0
- package/dist/cjs/quillOverrides/LinkFormat.js +86 -0
- package/dist/cjs/quillOverrides/LinkFormat.js.map +7 -0
- package/dist/cjs/quillOverrides/PlainClipboard.js +47 -0
- package/dist/cjs/quillOverrides/PlainClipboard.js.map +7 -0
- package/dist/cjs/utils.js +50 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/DSWYSIWYGEditor.js +101 -0
- package/dist/esm/DSWYSIWYGEditor.js.map +7 -0
- package/dist/esm/components/CustomImageUploader.js +94 -0
- package/dist/esm/components/CustomImageUploader.js.map +7 -0
- package/dist/esm/components/CustomToolbar.js +232 -0
- package/dist/esm/components/CustomToolbar.js.map +7 -0
- package/dist/esm/components/DSWYSIWYGEditorImpl.js +228 -0
- package/dist/esm/components/DSWYSIWYGEditorImpl.js.map +7 -0
- package/dist/esm/components/ImageLibraryModal.js +81 -0
- package/dist/esm/components/ImageLibraryModal.js.map +7 -0
- package/dist/esm/components/InsertFieldModal.js +185 -0
- package/dist/esm/components/InsertFieldModal.js.map +7 -0
- package/dist/esm/components/TippedButton.js +64 -0
- package/dist/esm/components/TippedButton.js.map +7 -0
- package/dist/esm/components/TippedSelect.js +28 -0
- package/dist/esm/components/TippedSelect.js.map +7 -0
- package/dist/esm/components/colors.js +21 -0
- package/dist/esm/components/colors.js.map +7 -0
- package/dist/esm/components/customFields.js +47 -0
- package/dist/esm/components/customFields.js.map +7 -0
- package/dist/esm/constants.js +85 -0
- package/dist/esm/constants.js.map +7 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js +19 -0
- package/dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js.map +7 -0
- package/dist/esm/quillOverrides/IndentStyle.js +22 -0
- package/dist/esm/quillOverrides/IndentStyle.js.map +7 -0
- package/dist/esm/quillOverrides/LinkFormat.js +57 -0
- package/dist/esm/quillOverrides/LinkFormat.js.map +7 -0
- package/dist/esm/quillOverrides/PlainClipboard.js +18 -0
- package/dist/esm/quillOverrides/PlainClipboard.js.map +7 -0
- package/dist/esm/utils.js +21 -0
- package/dist/esm/utils.js.map +7 -0
- package/package.json +64 -55
- package/cjs/DSWYSIWYGEditor.js +0 -82
- package/cjs/components/CustomImageUploader.js +0 -125
- package/cjs/components/CustomToolbar.js +0 -282
- package/cjs/components/DSWYSIWYGEditorImpl.js +0 -256
- package/cjs/components/ImageLibraryModal.js +0 -72
- package/cjs/components/InsertFieldModal.js +0 -218
- package/cjs/components/TippedButton.js +0 -56
- package/cjs/components/TippedSelect.js +0 -46
- package/cjs/components/colors.js +0 -30
- package/cjs/components/customFields.js +0 -57
- package/cjs/constants.js +0 -40
- package/cjs/index.js +0 -21
- package/cjs/quillMatchers/clipboardLinkWithTagMatcher.js +0 -33
- package/cjs/quillOverrides/IndentStyle.js +0 -29
- package/cjs/quillOverrides/LinkFormat.js +0 -68
- package/cjs/quillOverrides/PlainClipboard.js +0 -27
- package/cjs/utils.js +0 -27
- package/esm/DSWYSIWYGEditor.js +0 -72
- package/esm/components/CustomImageUploader.js +0 -115
- package/esm/components/CustomToolbar.js +0 -271
- package/esm/components/DSWYSIWYGEditorImpl.js +0 -245
- package/esm/components/ImageLibraryModal.js +0 -64
- package/esm/components/InsertFieldModal.js +0 -208
- package/esm/components/TippedButton.js +0 -46
- package/esm/components/TippedSelect.js +0 -38
- package/esm/components/colors.js +0 -26
- package/esm/components/customFields.js +0 -49
- package/esm/constants.js +0 -32
- package/esm/index.js +0 -4
- package/esm/quillMatchers/clipboardLinkWithTagMatcher.js +0 -29
- package/esm/quillOverrides/IndentStyle.js +0 -27
- package/esm/quillOverrides/LinkFormat.js +0 -66
- package/esm/quillOverrides/PlainClipboard.js +0 -25
- package/esm/utils.js +0 -23
- package/types/DSWYSIWYGEditor.d.ts +0 -75
- package/types/components/CustomImageUploader.d.ts +0 -8
- package/types/components/CustomToolbar.d.ts +0 -21
- package/types/components/DSWYSIWYGEditorImpl.d.ts +0 -15
- package/types/components/ImageLibraryModal.d.ts +0 -31
- package/types/components/InsertFieldModal.d.ts +0 -41
- package/types/components/TippedButton.d.ts +0 -12
- package/types/components/TippedSelect.d.ts +0 -13
- package/types/components/colors.d.ts +0 -1
- package/types/components/customFields.d.ts +0 -36
- package/types/constants.d.ts +0 -26
- package/types/index.d.ts +0 -4
- package/types/quillMatchers/clipboardLinkWithTagMatcher.d.ts +0 -2
- package/types/quillOverrides/IndentStyle.d.ts +0 -10
- package/types/quillOverrides/LinkFormat.d.ts +0 -12
- package/types/quillOverrides/PlainClipboard.d.ts +0 -8
- package/types/utils.d.ts +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/quillOverrides/LinkFormat.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { Quill } from 'react-quill';\n\nconst sanitizeProtocol = (value) => {\n if (typeof value === 'boolean') return value;\n let newVal = value;\n if (\n !value.startsWith('http') &&\n !value.startsWith('ftp') &&\n !value.startsWith('mailto:') &&\n !value.startsWith('{{')\n ) {\n if (!value.startsWith('www')) {\n newVal = `https://www.${value}`;\n } else newVal = `https://${value}`;\n }\n return newVal;\n};\n\nfunction getIsValidProtocol(url, protocols) {\n const anchor = document.createElement('a');\n anchor.href = url;\n const protocol = anchor.href.slice(0, anchor.href.indexOf(':'));\n return protocols.indexOf(protocol) > -1;\n}\n\nconst Link = Quill.import('formats/link');\n\nclass LinkFormat extends Link {\n blotName = 'link';\n\n tagName = 'A';\n\n SANITIZED_URL = 'about:blank';\n\n PROTOCOL_WHITELIST = ['http', 'ftp', 'https', 'mailto', 'tel'];\n\n static create(value) {\n const newVal = sanitizeProtocol(value);\n const node = super.create(newVal);\n node.setAttribute('href', newVal);\n return node;\n }\n\n static formats(domNode) {\n return domNode?.getAttribute?.('href');\n }\n\n static sanitize(url) {\n return getIsValidProtocol(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;\n }\n\n format(name, value) {\n const newVal = sanitizeProtocol(value);\n // Remove link case\n if (name === 'link' && value === false) {\n this.domNode.removeAttribute('href');\n } else if (name !== this.statics.blotName || !newVal) {\n super.format(name, newVal);\n } else {\n this.domNode.setAttribute('href', this.constructor.sanitize(newVal));\n }\n }\n}\n\nexport default LinkFormat;\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AAEA,MAAM,mBAAmB,CAAC,UAAU;AAClC,MAAI,OAAO,UAAU;AAAW,WAAO;AACvC,MAAI,SAAS;AACb,MACE,CAAC,MAAM,WAAW,WAClB,CAAC,MAAM,WAAW,UAClB,CAAC,MAAM,WAAW,cAClB,CAAC,MAAM,WAAW,OAClB;AACA,QAAI,CAAC,MAAM,WAAW,QAAQ;AAC5B,eAAS,eAAe;AAAA;AACnB,eAAS,WAAW;AAAA;AAE7B,SAAO;AAAA;AAGT,4BAA4B,KAAK,WAAW;AAC1C,QAAM,SAAS,SAAS,cAAc;AACtC,SAAO,OAAO;AACd,QAAM,WAAW,OAAO,KAAK,MAAM,GAAG,OAAO,KAAK,QAAQ;AAC1D,SAAO,UAAU,QAAQ,YAAY;AAAA;AAGvC,MAAM,OAAO,MAAM,OAAO;AAE1B,yBAAyB,KAAK;AAAA,EAA9B,cA5BA;AA4BA;AACE,oBAAW;AAEX,mBAAU;AAEV,yBAAgB;AAEhB,8BAAqB,CAAC,QAAQ,OAAO,SAAS,UAAU;AAAA;AAAA,SAEjD,OAAO,OAAO;AACnB,UAAM,SAAS,iBAAiB;AAChC,UAAM,OAAO,MAAM,OAAO;AAC1B,SAAK,aAAa,QAAQ;AAC1B,WAAO;AAAA;AAAA,SAGF,QAAQ,SAAS;AACtB,WAAO,SAAS,eAAe;AAAA;AAAA,SAG1B,SAAS,KAAK;AACnB,WAAO,mBAAmB,KAAK,KAAK,sBAAsB,MAAM,KAAK;AAAA;AAAA,EAGvE,OAAO,MAAM,OAAO;AAClB,UAAM,SAAS,iBAAiB;AAEhC,QAAI,SAAS,UAAU,UAAU,OAAO;AACtC,WAAK,QAAQ,gBAAgB;AAAA,eACpB,SAAS,KAAK,QAAQ,YAAY,CAAC,QAAQ;AACpD,YAAM,OAAO,MAAM;AAAA,WACd;AACL,WAAK,QAAQ,aAAa,QAAQ,KAAK,YAAY,SAAS;AAAA;AAAA;AAAA;AAKlE,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Quill } from "react-quill";
|
|
3
|
+
const Clipboard = Quill.import("modules/clipboard");
|
|
4
|
+
const Delta = Quill.import("delta");
|
|
5
|
+
class PlainClipboard extends Clipboard {
|
|
6
|
+
convert(html = null) {
|
|
7
|
+
if (typeof html === "string") {
|
|
8
|
+
this.container.innerHTML = html;
|
|
9
|
+
}
|
|
10
|
+
const text = this.container.innerText;
|
|
11
|
+
this.container.innerHTML = "";
|
|
12
|
+
return new Delta().insert(text);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
PlainClipboard as default
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=PlainClipboard.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/quillOverrides/PlainClipboard.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Quill } from 'react-quill';\n\nconst Clipboard = Quill.import('modules/clipboard');\nconst Delta = Quill.import('delta');\n\n/**\n * Just for the sake of an example. https://quilljs.com/docs/modules/\n */\nexport default class PlainClipboard extends Clipboard {\n convert(html = null) {\n if (typeof html === 'string') {\n this.container.innerHTML = html;\n }\n const text = this.container.innerText;\n this.container.innerHTML = '';\n return new Delta().insert(text);\n }\n}\n\n// Uncomment if adding custom clipboard, or add in the file you are importing this to\n// Quill.register('modules/clipboard', PlainClipboard)\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA,MAAM,YAAY,MAAM,OAAO;AAC/B,MAAM,QAAQ,MAAM,OAAO;AAK3B,6BAA4C,UAAU;AAAA,EACpD,QAAQ,OAAO,MAAM;AACnB,QAAI,OAAO,SAAS,UAAU;AAC5B,WAAK,UAAU,YAAY;AAAA;AAE7B,UAAM,OAAO,KAAK,UAAU;AAC5B,SAAK,UAAU,YAAY;AAC3B,WAAO,IAAI,QAAQ,OAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const formatHTML = (html) => {
|
|
3
|
+
const tab = " ";
|
|
4
|
+
let result = "";
|
|
5
|
+
let indent = "";
|
|
6
|
+
html.split(/>\s*</).forEach((element) => {
|
|
7
|
+
if (element.match(/^\/\w/)) {
|
|
8
|
+
indent = indent.substring(tab.length);
|
|
9
|
+
}
|
|
10
|
+
result += `${indent}<${element}>\r
|
|
11
|
+
`;
|
|
12
|
+
if (element.match(/^<?\w[^>]*[^/]$/)) {
|
|
13
|
+
indent += tab;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return result.substring(1, result.length - 3);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
formatHTML
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const formatHTML = (html) => {\n const tab = '\\t';\n let result = '';\n let indent = '';\n\n html.split(/>\\s*</).forEach((element) => {\n if (element.match(/^\\/\\w/)) {\n indent = indent.substring(tab.length);\n }\n\n result += `${indent}<${element}>\\r\\n`;\n\n if (element.match(/^<?\\w[^>]*[^/]$/)) {\n indent += tab;\n }\n });\n\n return result.substring(1, result.length - 3);\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,aAAa,CAAC,SAAS;AAClC,QAAM,MAAM;AACZ,MAAI,SAAS;AACb,MAAI,SAAS;AAEb,OAAK,MAAM,SAAS,QAAQ,CAAC,YAAY;AACvC,QAAI,QAAQ,MAAM,UAAU;AAC1B,eAAS,OAAO,UAAU,IAAI;AAAA;AAGhC,cAAU,GAAG,UAAU;AAAA;AAEvB,QAAI,QAAQ,MAAM,oBAAoB;AACpC,gBAAU;AAAA;AAAA;AAId,SAAO,OAAO,UAAU,GAAG,OAAO,SAAS;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,79 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wysiwygeditor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - WYSIWYG Editor",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"import": "./esm/index.js",
|
|
12
|
-
"require": "./cjs/index.js"
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
13
16
|
},
|
|
14
17
|
"./utils": {
|
|
15
|
-
"import": "./esm/utils.js",
|
|
16
|
-
"require": "./cjs/utils.js"
|
|
18
|
+
"import": "./dist/esm/utils.js",
|
|
19
|
+
"require": "./dist/cjs/utils.js"
|
|
17
20
|
},
|
|
18
21
|
"./quillOverrides/PlainClipboard": {
|
|
19
|
-
"import": "./esm/quillOverrides/PlainClipboard.js",
|
|
20
|
-
"require": "./cjs/quillOverrides/PlainClipboard.js"
|
|
22
|
+
"import": "./dist/esm/quillOverrides/PlainClipboard.js",
|
|
23
|
+
"require": "./dist/cjs/quillOverrides/PlainClipboard.js"
|
|
21
24
|
},
|
|
22
25
|
"./quillOverrides/LinkFormat": {
|
|
23
|
-
"import": "./esm/quillOverrides/LinkFormat.js",
|
|
24
|
-
"require": "./cjs/quillOverrides/LinkFormat.js"
|
|
26
|
+
"import": "./dist/esm/quillOverrides/LinkFormat.js",
|
|
27
|
+
"require": "./dist/cjs/quillOverrides/LinkFormat.js"
|
|
25
28
|
},
|
|
26
29
|
"./quillOverrides/IndentStyle": {
|
|
27
|
-
"import": "./esm/quillOverrides/IndentStyle.js",
|
|
28
|
-
"require": "./cjs/quillOverrides/IndentStyle.js"
|
|
30
|
+
"import": "./dist/esm/quillOverrides/IndentStyle.js",
|
|
31
|
+
"require": "./dist/cjs/quillOverrides/IndentStyle.js"
|
|
29
32
|
},
|
|
30
33
|
"./quillMatchers/clipboardLinkWithTagMatcher": {
|
|
31
|
-
"import": "./esm/quillMatchers/clipboardLinkWithTagMatcher.js",
|
|
32
|
-
"require": "./cjs/quillMatchers/clipboardLinkWithTagMatcher.js"
|
|
34
|
+
"import": "./dist/esm/quillMatchers/clipboardLinkWithTagMatcher.js",
|
|
35
|
+
"require": "./dist/cjs/quillMatchers/clipboardLinkWithTagMatcher.js"
|
|
33
36
|
},
|
|
34
37
|
"./DSWYSIWYGEditor": {
|
|
35
|
-
"import": "./esm/DSWYSIWYGEditor.js",
|
|
36
|
-
"require": "./cjs/DSWYSIWYGEditor.js"
|
|
38
|
+
"import": "./dist/esm/DSWYSIWYGEditor.js",
|
|
39
|
+
"require": "./dist/cjs/DSWYSIWYGEditor.js"
|
|
37
40
|
},
|
|
38
41
|
"./constants": {
|
|
39
|
-
"import": "./esm/constants.js",
|
|
40
|
-
"require": "./cjs/constants.js"
|
|
42
|
+
"import": "./dist/esm/constants.js",
|
|
43
|
+
"require": "./dist/cjs/constants.js"
|
|
41
44
|
},
|
|
42
45
|
"./components/TippedSelect": {
|
|
43
|
-
"import": "./esm/components/TippedSelect.js",
|
|
44
|
-
"require": "./cjs/components/TippedSelect.js"
|
|
46
|
+
"import": "./dist/esm/components/TippedSelect.js",
|
|
47
|
+
"require": "./dist/cjs/components/TippedSelect.js"
|
|
45
48
|
},
|
|
46
49
|
"./components/TippedButton": {
|
|
47
|
-
"import": "./esm/components/TippedButton.js",
|
|
48
|
-
"require": "./cjs/components/TippedButton.js"
|
|
50
|
+
"import": "./dist/esm/components/TippedButton.js",
|
|
51
|
+
"require": "./dist/cjs/components/TippedButton.js"
|
|
49
52
|
},
|
|
50
53
|
"./components/InsertFieldModal": {
|
|
51
|
-
"import": "./esm/components/InsertFieldModal.js",
|
|
52
|
-
"require": "./cjs/components/InsertFieldModal.js"
|
|
54
|
+
"import": "./dist/esm/components/InsertFieldModal.js",
|
|
55
|
+
"require": "./dist/cjs/components/InsertFieldModal.js"
|
|
53
56
|
},
|
|
54
57
|
"./components/ImageLibraryModal": {
|
|
55
|
-
"import": "./esm/components/ImageLibraryModal.js",
|
|
56
|
-
"require": "./cjs/components/ImageLibraryModal.js"
|
|
58
|
+
"import": "./dist/esm/components/ImageLibraryModal.js",
|
|
59
|
+
"require": "./dist/cjs/components/ImageLibraryModal.js"
|
|
57
60
|
},
|
|
58
61
|
"./components/DSWYSIWYGEditorImpl": {
|
|
59
|
-
"import": "./esm/components/DSWYSIWYGEditorImpl.js",
|
|
60
|
-
"require": "./cjs/components/DSWYSIWYGEditorImpl.js"
|
|
62
|
+
"import": "./dist/esm/components/DSWYSIWYGEditorImpl.js",
|
|
63
|
+
"require": "./dist/cjs/components/DSWYSIWYGEditorImpl.js"
|
|
61
64
|
},
|
|
62
65
|
"./components/CustomToolbar": {
|
|
63
|
-
"import": "./esm/components/CustomToolbar.js",
|
|
64
|
-
"require": "./cjs/components/CustomToolbar.js"
|
|
66
|
+
"import": "./dist/esm/components/CustomToolbar.js",
|
|
67
|
+
"require": "./dist/cjs/components/CustomToolbar.js"
|
|
65
68
|
},
|
|
66
69
|
"./components/CustomImageUploader": {
|
|
67
|
-
"import": "./esm/components/CustomImageUploader.js",
|
|
68
|
-
"require": "./cjs/components/CustomImageUploader.js"
|
|
70
|
+
"import": "./dist/esm/components/CustomImageUploader.js",
|
|
71
|
+
"require": "./dist/cjs/components/CustomImageUploader.js"
|
|
69
72
|
},
|
|
70
73
|
"./components/customFields": {
|
|
71
|
-
"import": "./esm/components/customFields.js",
|
|
72
|
-
"require": "./cjs/components/customFields.js"
|
|
74
|
+
"import": "./dist/esm/components/customFields.js",
|
|
75
|
+
"require": "./dist/cjs/components/customFields.js"
|
|
73
76
|
},
|
|
74
77
|
"./components/colors": {
|
|
75
|
-
"import": "./esm/components/colors.js",
|
|
76
|
-
"require": "./cjs/components/colors.js"
|
|
78
|
+
"import": "./dist/esm/components/colors.js",
|
|
79
|
+
"require": "./dist/cjs/components/colors.js"
|
|
77
80
|
}
|
|
78
81
|
},
|
|
79
82
|
"sideEffects": [
|
|
@@ -85,25 +88,25 @@
|
|
|
85
88
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
86
89
|
},
|
|
87
90
|
"engines": {
|
|
88
|
-
"
|
|
89
|
-
"node": ">=
|
|
91
|
+
"pnpm": ">=6",
|
|
92
|
+
"node": ">=16"
|
|
90
93
|
},
|
|
91
94
|
"author": "ICE MT",
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
95
|
+
"jestSonar": {
|
|
96
|
+
"sonar56x": true,
|
|
97
|
+
"reportPath": "reports",
|
|
98
|
+
"reportFile": "tests.xml",
|
|
99
|
+
"indent": 4
|
|
97
100
|
},
|
|
98
101
|
"dependencies": {
|
|
99
|
-
"@elliemae/ds-button": "
|
|
100
|
-
"@elliemae/ds-dropdownmenu": "
|
|
101
|
-
"@elliemae/ds-icons": "
|
|
102
|
-
"@elliemae/ds-imagelibrarymodal": "
|
|
103
|
-
"@elliemae/ds-modal": "
|
|
104
|
-
"@elliemae/ds-shared": "
|
|
105
|
-
"@elliemae/ds-tooltip": "
|
|
106
|
-
"@elliemae/ds-uploader": "
|
|
102
|
+
"@elliemae/ds-button": "3.0.0-alpha.3",
|
|
103
|
+
"@elliemae/ds-dropdownmenu": "3.0.0-alpha.3",
|
|
104
|
+
"@elliemae/ds-icons": "3.0.0-alpha.3",
|
|
105
|
+
"@elliemae/ds-imagelibrarymodal": "3.0.0-alpha.3",
|
|
106
|
+
"@elliemae/ds-modal": "3.0.0-alpha.3",
|
|
107
|
+
"@elliemae/ds-shared": "3.0.0-alpha.3",
|
|
108
|
+
"@elliemae/ds-tooltip": "3.0.0-alpha.3",
|
|
109
|
+
"@elliemae/ds-uploader": "3.0.0-alpha.3",
|
|
107
110
|
"prop-types": "~15.7.2",
|
|
108
111
|
"quill-blot-formatter": "~1.0.5",
|
|
109
112
|
"quill-delta": "4.2.2",
|
|
@@ -112,12 +115,18 @@
|
|
|
112
115
|
},
|
|
113
116
|
"publishConfig": {
|
|
114
117
|
"access": "public",
|
|
115
|
-
"
|
|
116
|
-
"generateSubmodules": true
|
|
118
|
+
"typeSafety": false
|
|
117
119
|
},
|
|
118
120
|
"peerDependencies": {
|
|
119
121
|
"lodash": "^4.17.21",
|
|
120
122
|
"react": "~17.0.2",
|
|
121
123
|
"react-dom": "^17.0.2"
|
|
124
|
+
},
|
|
125
|
+
"scripts": {
|
|
126
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
127
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
128
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
129
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
130
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
122
131
|
}
|
|
123
132
|
}
|
package/cjs/DSWYSIWYGEditor.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
13
|
-
var React = require('react');
|
|
14
|
-
var reactDesc = require('react-desc');
|
|
15
|
-
var DSWYSIWYGEditorImpl = require('./components/DSWYSIWYGEditorImpl.js');
|
|
16
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
-
|
|
18
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
|
-
|
|
20
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
21
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
22
|
-
|
|
23
|
-
const _excluded = ["value", "onChange", "getQuillRef", "quillModules", "customToolbar", "toolbarHandlers", "showRawHTML", "height", "hideItems"];
|
|
24
|
-
|
|
25
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
-
|
|
27
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
|
-
|
|
29
|
-
const DSWYSIWYGEditor = _ref => {
|
|
30
|
-
let {
|
|
31
|
-
value = '',
|
|
32
|
-
onChange = () => null,
|
|
33
|
-
getQuillRef = () => null,
|
|
34
|
-
quillModules = {},
|
|
35
|
-
customToolbar,
|
|
36
|
-
toolbarHandlers,
|
|
37
|
-
showRawHTML = false,
|
|
38
|
-
height,
|
|
39
|
-
hideItems
|
|
40
|
-
} = _ref,
|
|
41
|
-
rest = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
42
|
-
|
|
43
|
-
const emptyAction = () => {};
|
|
44
|
-
|
|
45
|
-
const [showHTML, setShowHTML] = React.useState(showRawHTML);
|
|
46
|
-
React.useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);
|
|
47
|
-
return /*#__PURE__*/jsxRuntime.jsx(DSWYSIWYGEditorImpl, _objectSpread({
|
|
48
|
-
forceHttpLink: true,
|
|
49
|
-
handleCustomFieldClick: emptyAction,
|
|
50
|
-
handleImageClick: emptyAction,
|
|
51
|
-
quillOverrides: [],
|
|
52
|
-
value: value,
|
|
53
|
-
onChange: onChange,
|
|
54
|
-
getQuillRef: getQuillRef,
|
|
55
|
-
quillModules: quillModules,
|
|
56
|
-
customToolbar: customToolbar,
|
|
57
|
-
toolbarHandlers: toolbarHandlers,
|
|
58
|
-
showRawHTML: showHTML,
|
|
59
|
-
onShowHTML: () => setShowHTML(!showHTML),
|
|
60
|
-
height: height,
|
|
61
|
-
hideItems: hideItems
|
|
62
|
-
}, rest));
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const wysiwygEditorProps = {
|
|
66
|
-
value: reactDesc.PropTypes.string.description('editors value').isRequired,
|
|
67
|
-
onChange: reactDesc.PropTypes.func.description("(content, delta, source, editor) : Called back with the new contents of the editor after change. \n It will be passed the HTML contents of the editor, a delta object expressing the change, the source of the change, and finally a read-only proxy to editor accessors such as getHTML(). \n \u26A0\uFE0F Do not use this delta object as value, as it will cause a loop. \n Use editor.getContents() instead. See Using Deltas for details. \n Read more: https://github.com/zenoamaro/react-quill#props").isRequired,
|
|
68
|
-
getQuillRef: reactDesc.PropTypes.func.description('function to use quill.js ref'),
|
|
69
|
-
quillModules: reactDesc.PropTypes.object.description('object to override quill modules'),
|
|
70
|
-
customToolbar: reactDesc.PropTypes.element.description('custom toolbar'),
|
|
71
|
-
toolbarHandlers: reactDesc.PropTypes.object.description('object with toolbar handlers'),
|
|
72
|
-
showRawHTML: reactDesc.PropTypes.bool.description('whether to display html view or not').defaultValue(false),
|
|
73
|
-
height: reactDesc.PropTypes.string.description('heigth of the editors text area'),
|
|
74
|
-
readOnly: reactDesc.PropTypes.string.description("If true, the editor won't allow changing its contents. Wraps the Quill disable API."),
|
|
75
|
-
hideItems: reactDesc.PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),
|
|
76
|
-
zIndex: reactDesc.PropTypes.number.description('zIndex to be used (required when used in a modal for correct tooltips displaying)')
|
|
77
|
-
};
|
|
78
|
-
const WYSIWYWithSchema = reactDesc.describe(DSWYSIWYGEditor);
|
|
79
|
-
WYSIWYWithSchema.propTypes = wysiwygEditorProps;
|
|
80
|
-
|
|
81
|
-
exports.WYSIWYWithSchema = WYSIWYWithSchema;
|
|
82
|
-
exports["default"] = DSWYSIWYGEditor;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
9
|
-
var DSUploader = require('@elliemae/ds-uploader');
|
|
10
|
-
var DSModal = require('@elliemae/ds-modal');
|
|
11
|
-
var TippedButton = require('./TippedButton.js');
|
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
-
var DSUploader__default = /*#__PURE__*/_interopDefaultLegacy(DSUploader);
|
|
18
|
-
var DSModal__default = /*#__PURE__*/_interopDefaultLegacy(DSModal);
|
|
19
|
-
|
|
20
|
-
const ALLOWED_TYPES_TEXT = 'JPG, JPEG, PNG, GIF, BMP, TIFF';
|
|
21
|
-
const ALLOWED_TYPES = /image\/(jpeg|jpg|png|gif|bmp|tiff)/;
|
|
22
|
-
const DEFAULT_MAX_SIZE = 1024 * 1024; // 1 MB
|
|
23
|
-
|
|
24
|
-
const CustomImageUploader = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
quillRef,
|
|
27
|
-
editorFieldName,
|
|
28
|
-
allowedImageTypes = ALLOWED_TYPES_TEXT,
|
|
29
|
-
uploadAsset = () => null,
|
|
30
|
-
zIndex = 1
|
|
31
|
-
} = _ref;
|
|
32
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
33
|
-
const [error, setError] = React.useState(null);
|
|
34
|
-
const [inProgress, setInProgress] = React.useState(false);
|
|
35
|
-
const [lastSelection, setLastSelection] = React.useState({
|
|
36
|
-
index: 0,
|
|
37
|
-
length: 0
|
|
38
|
-
});
|
|
39
|
-
const elementId = "uploadImage".concat(editorFieldName); // eslint-disable-next-line consistent-return
|
|
40
|
-
|
|
41
|
-
const handleFileChange = async files => {
|
|
42
|
-
if (!inProgress) {
|
|
43
|
-
setError(null);
|
|
44
|
-
const selectedFile = files[0];
|
|
45
|
-
|
|
46
|
-
if (!selectedFile) {
|
|
47
|
-
setError('Please select a file.');
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!selectedFile.type.match(ALLOWED_TYPES)) {
|
|
52
|
-
setError('File must be an image.');
|
|
53
|
-
} else if (selectedFile.size > DEFAULT_MAX_SIZE) {
|
|
54
|
-
setError('File is too large.');
|
|
55
|
-
} else {
|
|
56
|
-
const fr = new FileReader();
|
|
57
|
-
|
|
58
|
-
fr.onload = async () => {
|
|
59
|
-
setInProgress(true);
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const url = await uploadAsset({
|
|
63
|
-
name: selectedFile.name,
|
|
64
|
-
type: selectedFile.type,
|
|
65
|
-
description: selectedFile.name,
|
|
66
|
-
isSystemAsset: false,
|
|
67
|
-
file: fr.result
|
|
68
|
-
});
|
|
69
|
-
setIsOpen(false);
|
|
70
|
-
quillRef === null || quillRef === void 0 ? void 0 : quillRef.getEditor().insertEmbed((lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.index) || 0, 'image', url);
|
|
71
|
-
} catch (e) {
|
|
72
|
-
setError('An error has occurred, try again');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
setInProgress(false);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
fr.readAsArrayBuffer(selectedFile);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
84
|
-
children: [/*#__PURE__*/_jsx__default["default"](TippedButton.TippedButton, {
|
|
85
|
-
zIndex: zIndex,
|
|
86
|
-
tip: "Insert Image",
|
|
87
|
-
onClick: () => {
|
|
88
|
-
setLastSelection(quillRef === null || quillRef === void 0 ? void 0 : quillRef.getEditor().getSelection());
|
|
89
|
-
setIsOpen(true);
|
|
90
|
-
}
|
|
91
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](dsIcons.Image, {
|
|
92
|
-
color: ['neutral', 500],
|
|
93
|
-
size: "s"
|
|
94
|
-
})), /*#__PURE__*/_jsx__default["default"](DSModal__default["default"], {
|
|
95
|
-
isOpen: isOpen,
|
|
96
|
-
title: "",
|
|
97
|
-
onConfirm: () => {
|
|
98
|
-
setIsOpen(false);
|
|
99
|
-
},
|
|
100
|
-
onClose: () => {
|
|
101
|
-
setIsOpen(false);
|
|
102
|
-
},
|
|
103
|
-
showClose: true,
|
|
104
|
-
version: 2,
|
|
105
|
-
size: "xsmall",
|
|
106
|
-
modalType: DSModal.MODAL_TYPE_V2.DECISION,
|
|
107
|
-
confirmLabel: "Cancel",
|
|
108
|
-
message: ""
|
|
109
|
-
}, void 0, !inProgress && /*#__PURE__*/_jsx__default["default"](DSUploader__default["default"], {
|
|
110
|
-
containerProps: {
|
|
111
|
-
id: elementId
|
|
112
|
-
},
|
|
113
|
-
showAltAction: false,
|
|
114
|
-
acceptedTypesText: allowedImageTypes,
|
|
115
|
-
onDrop: handleFileChange
|
|
116
|
-
}), inProgress && 'Upload in progress...', error && /*#__PURE__*/_jsx__default["default"]("div", {
|
|
117
|
-
style: {
|
|
118
|
-
color: 'red',
|
|
119
|
-
marginTop: '10px'
|
|
120
|
-
}
|
|
121
|
-
}, void 0, error))]
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
exports.CustomImageUploader = CustomImageUploader;
|