@elliemae/ds-wysiwygeditor 3.0.0-alpha.3 → 3.0.0-next.11

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.
@@ -53,6 +53,7 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
53
53
  })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
54
54
  var DSWYSIWYGEditor_exports = {};
55
55
  __export(DSWYSIWYGEditor_exports, {
56
+ DSWYSIWYGEditor: () => DSWYSIWYGEditor,
56
57
  WYSIWYWithSchema: () => WYSIWYWithSchema,
57
58
  default: () => DSWYSIWYGEditor_default
58
59
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSWYSIWYGEditor.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(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`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\n\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema };\nexport default DSWYSIWYGEditor;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2C;AAC3C,wBAAoC;AACpC,iCAAgC;AAEhC,MAAM,kBAAkB,CAAC,OAWnB;AAXmB,eACvB;AAAA,YAAQ;AAAA,IACR,WAAW,MAAM;AAAA,IACjB,cAAc,MAAM;AAAA,IACpB,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,MATuB,IAUpB,iBAVoB,IAUpB;AAAA,IATH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,cAAc,MAAM;AAAA;AAC1B,QAAM,CAAC,UAAU,eAAe,2BAAS;AAEzC,8BAAU,MAAM,YAAY,cAAc,CAAC;AAE3C,SACE,mDAAC,oCAAD;AAAA,IACE,eAAa;AAAA,IACb,wBAAwB;AAAA,IACxB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,YAAY,MAAM,YAAY,CAAC;AAAA,IAC/B;AAAA,IACA;AAAA,KACI;AAAA;AAKV,MAAM,qBAAqB;AAAA,EACzB,OAAO,4BAAU,OAAO,YAAY,iBAAiB;AAAA,EACrD,UAAU,4BAAU,KAAK,YACvB;AAAA;AAAA;AAAA;AAAA,gEAKA;AAAA,EACF,aAAa,4BAAU,KAAK,YAAY;AAAA,EACxC,cAAc,4BAAU,OAAO,YAAY;AAAA,EAC3C,eAAe,4BAAU,QAAQ,YAAY;AAAA,EAC7C,iBAAiB,4BAAU,OAAO,YAAY;AAAA,EAC9C,aAAa,4BAAU,KAAK,YAAY,uCAAuC,aAAa;AAAA,EAC5F,QAAQ,4BAAU,OAAO,YAAY;AAAA,EACrC,UAAU,4BAAU,OAAO,YACzB;AAAA,EAEF,WAAW,4BAAU,OAAO,YAAY,qDAAqD,aAAa;AAAA,EAC1G,QAAQ,4BAAU,OAAO,YACvB;AAAA;AAIJ,gBAAgB,YAAY;AAE5B,MAAM,mBAAmB,gCAAS;AAClC,iBAAiB,YAAY;AAG7B,IAAO,0BAAQ;",
4
+ "sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(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`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\n\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };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KAAK,YAAY,uCAAuC,aAAa;AAAA,EAC5F,QAAQ,4BAAU,OAAO,YAAY;AAAA,EACrC,UAAU,4BAAU,OAAO,YACzB;AAAA,EAEF,WAAW,4BAAU,OAAO,YAAY,qDAAqD,aAAa;AAAA,EAC1G,QAAQ,4BAAU,OAAO,YACvB;AAAA;AAIJ,gBAAgB,YAAY;AAE5B,MAAM,mBAAmB,gCAAS;AAClC,iBAAiB,YAAY;AAG7B,IAAO,0BAAQ;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -27,6 +27,7 @@ var __toCommonJS = /* @__PURE__ */ ((cache) => {
27
27
  })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
28
  var src_exports = {};
29
29
  __export(src_exports, {
30
+ DSWYSIWYGEditor: () => import_DSWYSIWYGEditor.DSWYSIWYGEditor,
30
31
  WYSIWYWithSchema: () => import_DSWYSIWYGEditor.WYSIWYWithSchema,
31
32
  default: () => import_DSWYSIWYGEditor.default
32
33
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["export { default, WYSIWYWithSchema } from './DSWYSIWYGEditor';\nexport * from './components/CustomToolbar';\nexport * from './components/CustomImageUploader';\nexport * from './constants';\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,6BAA0C;AAC1C,wBAAc;AACd,wBAAc;AACd,wBAAc;",
4
+ "sourcesContent": ["export { default, DSWYSIWYGEditor, WYSIWYWithSchema } from './DSWYSIWYGEditor';\nexport * from './components/CustomToolbar';\nexport * from './components/CustomImageUploader';\nexport * from './constants';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,6BAA2D;AAC3D,wBAAc;AACd,wBAAc;AACd,wBAAc;",
6
6
  "names": []
7
7
  }
@@ -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;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,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;",
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.construct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AS,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
  }
@@ -95,6 +95,7 @@ const WYSIWYWithSchema = describe(DSWYSIWYGEditor);
95
95
  WYSIWYWithSchema.propTypes = wysiwygEditorProps;
96
96
  var DSWYSIWYGEditor_default = DSWYSIWYGEditor;
97
97
  export {
98
+ DSWYSIWYGEditor,
98
99
  WYSIWYWithSchema,
99
100
  DSWYSIWYGEditor_default as default
100
101
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSWYSIWYGEditor.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(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`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\n\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema };\nexport default DSWYSIWYGEditor;\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport DSWYSIWYGEditorImpl from './components/DSWYSIWYGEditorImpl';\n\nconst DSWYSIWYGEditor = ({\n value = '',\n onChange = () => null,\n getQuillRef = () => null,\n quillModules = {},\n customToolbar,\n toolbarHandlers,\n showRawHTML = false,\n height,\n hideItems,\n ...rest\n}) => {\n const emptyAction = () => {};\n const [showHTML, setShowHTML] = useState(showRawHTML);\n\n useEffect(() => setShowHTML(showRawHTML), [showRawHTML]);\n\n return (\n <DSWYSIWYGEditorImpl\n forceHttpLink\n handleCustomFieldClick={emptyAction}\n handleImageClick={emptyAction}\n quillOverrides={[]}\n value={value}\n onChange={onChange}\n getQuillRef={getQuillRef}\n quillModules={quillModules}\n customToolbar={customToolbar}\n toolbarHandlers={toolbarHandlers}\n showRawHTML={showHTML}\n onShowHTML={() => setShowHTML(!showHTML)}\n height={height}\n hideItems={hideItems}\n {...rest}\n />\n );\n};\n\nconst wysiwygEditorProps = {\n value: PropTypes.string.description('editors value').isRequired,\n onChange: PropTypes.func.description(\n `(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`,\n ).isRequired,\n getQuillRef: PropTypes.func.description('function to use quill.js ref'),\n quillModules: PropTypes.object.description('object to override quill modules'),\n customToolbar: PropTypes.element.description('custom toolbar'),\n toolbarHandlers: PropTypes.object.description('object with toolbar handlers'),\n showRawHTML: PropTypes.bool.description('whether to display html view or not').defaultValue(false),\n height: PropTypes.string.description('heigth of the editors text area'),\n readOnly: PropTypes.string.description(\n \"If true, the editor won't allow changing its contents. Wraps the Quill disable API.\",\n ),\n hideItems: PropTypes.object.description('object of defaultItems to be removed from toolbar').defaultValue({}),\n zIndex: PropTypes.number.description(\n 'zIndex to be used (required when used in a modal for correct tooltips displaying)',\n ),\n};\n\nDSWYSIWYGEditor.propTypes = wysiwygEditorProps;\n\nconst WYSIWYWithSchema = describe(DSWYSIWYGEditor);\nWYSIWYWithSchema.propTypes = wysiwygEditorProps;\n\nexport { WYSIWYWithSchema, DSWYSIWYGEditor };\nexport default DSWYSIWYGEditor;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAEA,MAAM,kBAAkB,CAAC,OAWnB;AAXmB,eACvB;AAAA,YAAQ;AAAA,IACR,WAAW,MAAM;AAAA,IACjB,cAAc,MAAM;AAAA,IACpB,eAAe;AA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"react";
2
- import { default as default2, WYSIWYWithSchema } from "./DSWYSIWYGEditor";
2
+ import { default as default2, DSWYSIWYGEditor, WYSIWYWithSchema } from "./DSWYSIWYGEditor";
3
3
  export * from "./components/CustomToolbar";
4
4
  export * from "./components/CustomImageUploader";
5
5
  export * from "./constants";
6
6
  export {
7
+ DSWYSIWYGEditor,
7
8
  WYSIWYWithSchema,
8
9
  default2 as default
9
10
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default, WYSIWYWithSchema } from './DSWYSIWYGEditor';\nexport * from './components/CustomToolbar';\nexport * from './components/CustomImageUploader';\nexport * from './constants';\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default, DSWYSIWYGEditor, WYSIWYWithSchema } from './DSWYSIWYGEditor';\nexport * from './components/CustomToolbar';\nexport * from './components/CustomImageUploader';\nexport * from './constants';\n"],
5
5
  "mappings": "AAAA;ACAA;AACA;AACA;AACA;",
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;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;",
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-alpha.3",
3
+ "version": "3.0.0-next.11",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - WYSIWYG Editor",
6
6
  "files": [
@@ -99,15 +99,15 @@
99
99
  "indent": 4
100
100
  },
101
101
  "dependencies": {
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",
110
- "prop-types": "~15.7.2",
102
+ "@elliemae/ds-button": "3.0.0-next.11",
103
+ "@elliemae/ds-dropdownmenu": "3.0.0-next.11",
104
+ "@elliemae/ds-icons": "3.0.0-next.11",
105
+ "@elliemae/ds-imagelibrarymodal": "3.0.0-next.11",
106
+ "@elliemae/ds-modal": "3.0.0-next.11",
107
+ "@elliemae/ds-shared": "3.0.0-next.11",
108
+ "@elliemae/ds-tooltip": "3.0.0-next.11",
109
+ "@elliemae/ds-uploader": "3.0.0-next.11",
110
+ "prop-types": "~15.8.1",
111
111
  "quill-blot-formatter": "~1.0.5",
112
112
  "quill-delta": "4.2.2",
113
113
  "react-desc": "~4.1.3",