@elliemae/ds-wysiwygeditor 3.0.0-alpha.3 → 3.0.0-next.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.
|
@@ -32,7 +32,7 @@ __export(LinkFormat_exports, {
|
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
33
|
var import_react_quill = require("react-quill");
|
|
34
34
|
const sanitizeProtocol = (value) => {
|
|
35
|
-
if (typeof value === "boolean")
|
|
35
|
+
if (typeof value === "boolean" || value === null)
|
|
36
36
|
return value;
|
|
37
37
|
let newVal = value;
|
|
38
38
|
if (!value.startsWith("http") && !value.startsWith("ftp") && !value.startsWith("mailto:") && !value.startsWith("{{")) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/quillOverrides/LinkFormat.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,yBAAsB;AAEtB,MAAM,mBAAmB,CAAC,UAAU;AAClC,MAAI,OAAO,UAAU;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { Quill } from 'react-quill';\n\nconst sanitizeProtocol = (value) => {\n if (typeof value === 'boolean' || value === null) 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,yBAAsB;AAEtB,MAAM,mBAAmB,CAAC,UAAU;AAClC,MAAI,OAAO,UAAU,aAAa,UAAU;AAAM,WAAO;AACzD,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,yBAAM,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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Quill } from "react-quill";
|
|
3
3
|
const sanitizeProtocol = (value) => {
|
|
4
|
-
if (typeof value === "boolean")
|
|
4
|
+
if (typeof value === "boolean" || value === null)
|
|
5
5
|
return value;
|
|
6
6
|
let newVal = value;
|
|
7
7
|
if (!value.startsWith("http") && !value.startsWith("ftp") && !value.startsWith("mailto:") && !value.startsWith("{{")) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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;
|
|
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' || value === null) 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,aAAa,UAAU;AAAM,WAAO;AACzD,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
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-wysiwygeditor",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-next.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - WYSIWYG Editor",
|
|
6
6
|
"files": [
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
"indent": 4
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@elliemae/ds-button": "3.0.0-
|
|
103
|
-
"@elliemae/ds-dropdownmenu": "3.0.0-
|
|
104
|
-
"@elliemae/ds-icons": "3.0.0-
|
|
105
|
-
"@elliemae/ds-imagelibrarymodal": "3.0.0-
|
|
106
|
-
"@elliemae/ds-modal": "3.0.0-
|
|
107
|
-
"@elliemae/ds-shared": "3.0.0-
|
|
108
|
-
"@elliemae/ds-tooltip": "3.0.0-
|
|
109
|
-
"@elliemae/ds-uploader": "3.0.0-
|
|
102
|
+
"@elliemae/ds-button": "3.0.0-next.3",
|
|
103
|
+
"@elliemae/ds-dropdownmenu": "3.0.0-next.3",
|
|
104
|
+
"@elliemae/ds-icons": "3.0.0-next.3",
|
|
105
|
+
"@elliemae/ds-imagelibrarymodal": "3.0.0-next.3",
|
|
106
|
+
"@elliemae/ds-modal": "3.0.0-next.3",
|
|
107
|
+
"@elliemae/ds-shared": "3.0.0-next.3",
|
|
108
|
+
"@elliemae/ds-tooltip": "3.0.0-next.3",
|
|
109
|
+
"@elliemae/ds-uploader": "3.0.0-next.3",
|
|
110
110
|
"prop-types": "~15.7.2",
|
|
111
111
|
"quill-blot-formatter": "~1.0.5",
|
|
112
112
|
"quill-delta": "4.2.2",
|