@procore/text-editor 0.5.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.jest/ckeditorMock.js +47 -23
  2. package/CHANGELOG.md +30 -0
  3. package/README.md +96 -7
  4. package/dist/TextEditor/CKTextEditor.d.ts +3 -0
  5. package/dist/TextEditor/CKTextEditor.js +312 -0
  6. package/dist/TextEditor/CKTextEditor.js.map +1 -0
  7. package/dist/TextEditor/Providers/FeatureFlagProvider.d.ts +5 -0
  8. package/dist/TextEditor/Providers/FeatureFlagProvider.js +34 -0
  9. package/dist/TextEditor/Providers/FeatureFlagProvider.js.map +1 -0
  10. package/dist/TextEditor/TextEditor.d.ts +1 -1
  11. package/dist/TextEditor/TextEditor.js +16 -232
  12. package/dist/TextEditor/TextEditor.js.map +1 -1
  13. package/dist/TextEditor/TextEditor.styles.d.ts +14 -1
  14. package/dist/TextEditor/TextEditor.styles.js +18 -5
  15. package/dist/TextEditor/TextEditor.styles.js.map +1 -1
  16. package/dist/TextEditor/TextEditor.types.d.ts +82 -1
  17. package/dist/TextEditor/TextEditor.types.js.map +1 -1
  18. package/dist/TextEditor/TextEditorI18nProvider.d.ts +2 -0
  19. package/dist/TextEditor/TextEditorI18nProvider.js +27 -0
  20. package/dist/TextEditor/TextEditorI18nProvider.js.map +1 -0
  21. package/dist/TextEditor/TinyMCETextEditor.d.ts +3 -0
  22. package/dist/TextEditor/TinyMCETextEditor.js +63 -0
  23. package/dist/TextEditor/TinyMCETextEditor.js.map +1 -0
  24. package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/NormalizeTableWidthPlugin.d.ts +15 -0
  25. package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/NormalizeTableWidthPlugin.js +72 -0
  26. package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/NormalizeTableWidthPlugin.js.map +1 -0
  27. package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/index.d.ts +1 -0
  28. package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/index.js +2 -0
  29. package/dist/TextEditor/plugins/NormalizeTableWidthPlugin/index.js.map +1 -0
  30. package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.d.ts +48 -0
  31. package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.js +441 -0
  32. package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/ProcoreImageUploadPlugin.js.map +1 -0
  33. package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/index.d.ts +1 -0
  34. package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/index.js +2 -0
  35. package/dist/TextEditor/plugins/ProcoreImageUploadPlugin/index.js.map +1 -0
  36. package/dist/TextEditor/utils/config.d.ts +6 -1
  37. package/dist/TextEditor/utils/config.js +25 -10
  38. package/dist/TextEditor/utils/config.js.map +1 -1
  39. package/dist/TextEditor/utils/imageAttributes.d.ts +6 -0
  40. package/dist/TextEditor/utils/imageAttributes.js +17 -0
  41. package/dist/TextEditor/utils/imageAttributes.js.map +1 -0
  42. package/dist/TextEditor/utils/imageUrls.d.ts +2 -0
  43. package/dist/TextEditor/utils/imageUrls.js +36 -0
  44. package/dist/TextEditor/utils/imageUrls.js.map +1 -0
  45. package/dist/TextEditor/utils/richTextEditorHandlers.d.ts +9 -0
  46. package/dist/TextEditor/utils/richTextEditorHandlers.js +234 -0
  47. package/dist/TextEditor/utils/richTextEditorHandlers.js.map +1 -0
  48. package/dist/TextEditorOutput/TextEditorOutput.styles.js +2 -2
  49. package/dist/TextEditorOutput/TextEditorOutput.styles.js.map +1 -1
  50. package/dist/TextEditorOutput/TextEditorOutput.utils.d.ts +1 -1
  51. package/dist/TextEditorOutput/TextEditorOutput.utils.js +150 -6
  52. package/dist/TextEditorOutput/TextEditorOutput.utils.js.map +1 -1
  53. package/dist/_typedoc/TextEditor/TextEditor.types.json +215 -17
  54. package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +2 -2
  55. package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +3 -3
  56. package/dist/ckeditor5-premium-features.d.js +2 -0
  57. package/dist/ckeditor5-premium-features.d.js.map +1 -0
  58. package/dist/locales/en.json +17 -0
  59. package/dist/locales/pseudo.json +17 -0
  60. package/dist/utils/debounce.js +4 -4
  61. package/dist/utils/debounce.js.map +1 -1
  62. package/package.json +8 -3
@@ -1,16 +1,148 @@
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
+ 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; }
3
+ 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; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ 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; } }
9
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
10
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
+ function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
13
+ 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."); }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
17
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
18
  import sanitizeHtml from 'sanitize-html';
19
+ import { RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE } from '../TextEditor/utils/imageAttributes';
20
+ import { canonicalizeTextEditorImageUrl } from '../TextEditor/utils/imageUrls';
21
+ export { isAllowedTextEditorImageUrl } from '../TextEditor/utils/imageUrls';
22
+ var CKEDITOR_IMAGE_CLASSES = new Set(['image', 'image-inline', 'image_resized', 'image-style-align-left', 'image-style-align-right', 'image-style-block-align-left', 'image-style-block-align-right', 'image-style-side']);
23
+ var IMAGE_TAGS = new Set(['figure', 'figcaption', 'picture', 'source', 'img']);
24
+ var sanitizeSrcset = function sanitizeSrcset(srcset) {
25
+ var candidates = srcset.split(',').map(function (candidate) {
26
+ return candidate.trim();
27
+ }).filter(Boolean);
28
+ if (candidates.length === 0) {
29
+ return undefined;
30
+ }
31
+ var sanitizedCandidates = candidates.map(function (candidate) {
32
+ var _candidate$split = candidate.split(/\s+/),
33
+ _candidate$split2 = _toArray(_candidate$split),
34
+ url = _candidate$split2[0],
35
+ descriptors = _candidate$split2.slice(1);
36
+ var canonicalUrl = canonicalizeTextEditorImageUrl(url);
37
+ if (!canonicalUrl || descriptors.some(function (descriptor) {
38
+ return !/^(?:\d+w|\d+(?:\.\d+)?x)$/.test(descriptor);
39
+ })) {
40
+ return undefined;
41
+ }
42
+ return [canonicalUrl].concat(_toConsumableArray(descriptors)).join(' ');
43
+ });
44
+ if (sanitizedCandidates.includes(undefined)) {
45
+ return undefined;
46
+ }
47
+ return sanitizedCandidates.join(', ');
48
+ };
49
+ var sanitizeImageClass = function sanitizeImageClass(className) {
50
+ var allowedClasses = className === null || className === void 0 ? void 0 : className.split(/\s+/).filter(function (name) {
51
+ return CKEDITOR_IMAGE_CLASSES.has(name);
52
+ });
53
+ return allowedClasses !== null && allowedClasses !== void 0 && allowedClasses.length ? allowedClasses.join(' ') : undefined;
54
+ };
55
+ var sanitizeImageSizes = function sanitizeImageSizes(sizes) {
56
+ if (!sizes || /url\(|javascript:|data:/i.test(sizes)) {
57
+ return undefined;
58
+ }
59
+ return /^[\w\s().,:+\-/%]+$/.test(sizes) ? sizes : undefined;
60
+ };
61
+ var sanitizeProstoreFileId = function sanitizeProstoreFileId(id) {
62
+ return id && /^[\w-]+$/.test(id) ? id : undefined;
63
+ };
2
64
 
3
- /** Sanitize HTML content while preserving custom styling */
65
+ // ImageResize writes inline `width: X%` (and occasionally `height`) on the
66
+ // containing <figure>/<img>. Keep only those declarations so resized images
67
+ // render at the user's chosen size, `allowedStyles` further validates the values.
68
+ var SAFE_IMAGE_STYLE_PROPERTIES = new Set(['width', 'height', 'aspect-ratio']);
69
+ var filterImageStyle = function filterImageStyle(style) {
70
+ if (!style) {
71
+ return undefined;
72
+ }
73
+ var safeDeclarations = style.split(';').map(function (declaration) {
74
+ return declaration.trim();
75
+ }).filter(Boolean).filter(function (declaration) {
76
+ var _property$trim$toLowe;
77
+ var _declaration$split = declaration.split(':', 1),
78
+ _declaration$split2 = _slicedToArray(_declaration$split, 1),
79
+ property = _declaration$split2[0];
80
+ return SAFE_IMAGE_STYLE_PROPERTIES.has((_property$trim$toLowe = property === null || property === void 0 ? void 0 : property.trim().toLowerCase()) !== null && _property$trim$toLowe !== void 0 ? _property$trim$toLowe : '');
81
+ });
82
+ return safeDeclarations.length ? "".concat(safeDeclarations.join('; '), ";") : undefined;
83
+ };
84
+ var setOrDeleteAttribute = function setOrDeleteAttribute(attributes, name, value) {
85
+ if (value) {
86
+ attributes[name] = value;
87
+ } else {
88
+ delete attributes[name];
89
+ }
90
+ };
91
+ var sanitizeImageTagAttributes = function sanitizeImageTagAttributes(tagName, attributes) {
92
+ if (!IMAGE_TAGS.has(tagName)) {
93
+ return;
94
+ }
95
+ setOrDeleteAttribute(attributes, 'style', filterImageStyle(attributes.style));
96
+ delete attributes.onclick;
97
+ delete attributes.onload;
98
+ };
99
+ var sanitizeClassAttribute = function sanitizeClassAttribute(attributes) {
100
+ setOrDeleteAttribute(attributes, 'class', sanitizeImageClass(attributes["class"]));
101
+ };
102
+ var sanitizeUrlAttribute = function sanitizeUrlAttribute(attributes, name, sanitize) {
103
+ if (attributes[name]) {
104
+ setOrDeleteAttribute(attributes, name, sanitize(attributes[name]));
105
+ }
106
+ };
107
+ var sanitizeImageUrlAttributes = function sanitizeImageUrlAttributes(attributes) {
108
+ sanitizeUrlAttribute(attributes, 'src', canonicalizeTextEditorImageUrl);
109
+ sanitizeUrlAttribute(attributes, 'srcset', sanitizeSrcset);
110
+ sanitizeUrlAttribute(attributes, 'sizes', sanitizeImageSizes);
111
+ };
112
+ var sanitizeProstoreFileIdAttribute = function sanitizeProstoreFileIdAttribute(attributes) {
113
+ setOrDeleteAttribute(attributes, RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE, sanitizeProstoreFileId(attributes[RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE]));
114
+ };
115
+ var addLazyImageLoadingAttributes = function addLazyImageLoadingAttributes(tagName, attributes) {
116
+ if (tagName === 'img' && attributes.src) {
117
+ attributes.loading = 'lazy';
118
+ attributes.decoding = 'async';
119
+ }
120
+ };
121
+ var transformImageTag = function transformImageTag(tagName, attribs) {
122
+ var sanitizedAttributes = _objectSpread({}, attribs);
123
+ sanitizeImageTagAttributes(tagName, sanitizedAttributes);
124
+ sanitizeClassAttribute(sanitizedAttributes);
125
+ sanitizeImageUrlAttributes(sanitizedAttributes);
126
+ sanitizeProstoreFileIdAttribute(sanitizedAttributes);
127
+ addLazyImageLoadingAttributes(tagName, sanitizedAttributes);
128
+ return {
129
+ tagName: tagName,
130
+ attribs: sanitizedAttributes
131
+ };
132
+ };
4
133
  export var sanitizeTextEditorHtml = function sanitizeTextEditorHtml(html) {
5
134
  if (!html) {
6
135
  return '';
7
136
  }
8
137
  return sanitizeHtml(html, {
9
- allowedTags: ['p', 'br', 'strong', 'b', 'em', 'i', 'u', 's', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'a', 'figure', 'figcaption', 'table', 'colgroup', 'col', 'thead', 'tbody', 'tr', 'td', 'th', 'blockquote', 'pre', 'code', 'hr', 'img', 'sub', 'sup'],
138
+ allowedTags: ['p', 'br', 'strong', 'b', 'em', 'i', 'u', 's', 'span', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'a', 'figure', 'figcaption', 'table', 'colgroup', 'col', 'thead', 'tbody', 'tr', 'td', 'th', 'blockquote', 'pre', 'code', 'hr', 'img', 'picture', 'source', 'sub', 'sup'],
10
139
  allowedAttributes: {
11
- '*': ['style', 'class', 'data-*'],
140
+ '*': ['style', 'class'],
12
141
  a: ['href', 'title', 'target', 'rel'],
13
- img: ['src', 'alt', 'title', 'width', 'height'],
142
+ figure: ['class', RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE],
143
+ picture: ['class', RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE],
144
+ source: ['srcset', 'sizes', 'type', 'media'],
145
+ img: ['src', 'srcset', 'sizes', 'alt', 'title', 'width', 'height', 'loading', 'decoding', 'class', RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE],
14
146
  table: ['border', 'cellpadding', 'cellspacing'],
15
147
  col: ['span'],
16
148
  td: ['colspan', 'rowspan'],
@@ -53,12 +185,24 @@ export var sanitizeTextEditorHtml = function sanitizeTextEditorHtml(html) {
53
185
  'border-style': [/^(?:none|solid|dashed|dotted|double)$/],
54
186
  'list-style-type': [/.*/],
55
187
  'vertical-align': [/.*/],
56
- 'white-space': [/.*/]
188
+ 'white-space': [/.*/],
189
+ 'aspect-ratio': [/^\d+(?:\.\d+)?(?:\s*\/\s*\d+(?:\.\d+)?)?$/]
57
190
  }
58
191
  },
59
192
  allowedSchemes: ['http', 'https', 'mailto', 'tel'],
60
193
  allowedSchemesByTag: {
61
- img: ['data', 'http', 'https']
194
+ img: ['http', 'https'],
195
+ source: ['http', 'https']
196
+ },
197
+ transformTags: {
198
+ figure: transformImageTag,
199
+ figcaption: transformImageTag,
200
+ picture: transformImageTag,
201
+ source: transformImageTag,
202
+ img: transformImageTag
203
+ },
204
+ exclusiveFilter: function exclusiveFilter(frame) {
205
+ return frame.tag === 'img' && !frame.attribs.src || frame.tag === 'source' && !frame.attribs.srcset;
62
206
  },
63
207
  allowedIframeHostnames: []
64
208
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditorOutput.utils.js","names":["sanitizeHtml","sanitizeTextEditorHtml","html","allowedTags","allowedAttributes","a","img","table","col","td","th","allowedStyles","color","width","height","margin","padding","border","allowedSchemes","allowedSchemesByTag","allowedIframeHostnames"],"sources":["../../src/TextEditorOutput/TextEditorOutput.utils.ts"],"sourcesContent":["import sanitizeHtml from 'sanitize-html'\n\n/** Sanitize HTML content while preserving custom styling */\nexport const sanitizeTextEditorHtml = (html: string) => {\n if (!html) {\n return ''\n }\n\n return sanitizeHtml(html, {\n allowedTags: [\n 'p',\n 'br',\n 'strong',\n 'b',\n 'em',\n 'i',\n 'u',\n 's',\n 'span',\n 'div',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'ul',\n 'ol',\n 'li',\n 'a',\n 'figure',\n 'figcaption',\n 'table',\n 'colgroup',\n 'col',\n 'thead',\n 'tbody',\n 'tr',\n 'td',\n 'th',\n 'blockquote',\n 'pre',\n 'code',\n 'hr',\n 'img',\n 'sub',\n 'sup',\n ],\n allowedAttributes: {\n '*': ['style', 'class', 'data-*'],\n a: ['href', 'title', 'target', 'rel'],\n img: ['src', 'alt', 'title', 'width', 'height'],\n table: ['border', 'cellpadding', 'cellspacing'],\n col: ['span'],\n td: ['colspan', 'rowspan'],\n th: ['colspan', 'rowspan', 'scope'],\n },\n allowedStyles: {\n '*': {\n color: [\n /^#[0-9a-fA-F]{3,6}$/,\n /^rgb\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*\\)$/,\n /^rgba\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*[\\d.]+\\s*\\)$/,\n ],\n 'background-color': [\n /^#[0-9a-fA-F]{3,6}$/,\n /^rgb\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*\\)$/,\n /^rgba\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*[\\d.]+\\s*\\)$/,\n ],\n 'font-size': [/^\\d+(?:px|pt|em|rem|%)$/],\n 'font-weight': [/^(?:normal|bold|bolder|lighter|\\d{1,3})$/],\n 'font-style': [/^(?:normal|italic|oblique)$/],\n 'font-family': [/.*/],\n 'text-decoration': [/^(?:none|underline|line-through|overline)$/],\n 'text-align': [/^(?:left|right|center|justify)$/],\n 'line-height': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)?$/],\n width: [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'min-width': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'max-width': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n height: [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'min-height': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'max-height': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n margin: [/^\\d+(?:px|pt|em|rem|%)?(?:\\s+\\d+(?:px|pt|em|rem|%)?)*$/],\n 'margin-top': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'margin-bottom': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'margin-left': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'margin-right': [/^\\d+(?:px|pt|em|rem|%)?$/],\n padding: [/^\\d+(?:px|pt|em|rem|%)?(?:\\s+\\d+(?:px|pt|em|rem|%)?)*$/],\n 'padding-top': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'padding-bottom': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'padding-left': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'padding-right': [/^\\d+(?:px|pt|em|rem|%)?$/],\n border: [/.*/],\n 'border-top': [/.*/],\n 'border-bottom': [/.*/],\n 'border-left': [/.*/],\n 'border-right': [/.*/],\n 'border-color': [\n /^#[0-9a-fA-F]{3,6}$/,\n /^rgb\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*\\)$/,\n /^rgba\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*[\\d.]+\\s*\\)$/,\n ],\n 'border-width': [/^\\d+(?:px|pt|em|rem)?$/],\n 'border-style': [/^(?:none|solid|dashed|dotted|double)$/],\n 'list-style-type': [/.*/],\n 'vertical-align': [/.*/],\n 'white-space': [/.*/],\n },\n },\n allowedSchemes: ['http', 'https', 'mailto', 'tel'],\n allowedSchemesByTag: {\n img: ['data', 'http', 'https'],\n },\n allowedIframeHostnames: [],\n })\n}\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,eAAe;;AAExC;AACA,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIC,IAAY,EAAK;EACtD,IAAI,CAACA,IAAI,EAAE;IACT,OAAO,EAAE;EACX;EAEA,OAAOF,YAAY,CAACE,IAAI,EAAE;IACxBC,WAAW,EAAE,CACX,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,IAAI,EACJ,GAAG,EACH,GAAG,EACH,GAAG,EACH,MAAM,EACN,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,UAAU,EACV,KAAK,EACL,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,IAAI,EACJ,KAAK,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A0B,CAAC;QAC1C,eAAe,EAAE,CAAC,0BAA0B,CAAC;QAC7C,aAAa,EAAE,CAAC,0BAA0B,CAAC;QAC3C,cAAc,EAAE,CAAC,0BAA0B,CAAC;QAC5CC,OAAO,EAAE,CAAC,wDAAwD,CAAC;QACnE,aAAa,EAAE,CAAC,0BAA0B,CAAC;QAC3C,gBAAgB,EAAE,CAAC,0BAA0B,CAAC;QAC9C,cAAc,EAAE,CAAC,0BAA0B,CAAC;QAC5C,eAAe,EAAE,CAAC,0BAA0B,CAAC;QAC7CC,MAAM,EAAE,CAAC,IAAI,CAAC;QACd,YAAY,EAAE,CAAC,IAAI,CAAC;QACpB,eAAe,EAAE,CAAC,IAAI,CAAC;QACvB,aAAa,EAAE,CAAC,IAAI,CAAC;QACrB,cAAc,EAAE,CAAC,IAAI,CAAC;QACtB,cAAc,EAAE,CACd,qBAAqB,EACrB,wCAAwC,EACxC,sDAAsD,CACvD;QACD,cAAc,EAAE,CAAC,wBAAwB,CAAC;QAC1C,cAAc,EAAE,CAAC,uCAAuC,CAAC;QACzD,iBAAiB,EAAE,CAAC,IAAI,CAAC;QACzB,gBAAgB,EAAE,CAAC,IAAI,CAAC;QACxB,aAAa,EAAE,CAAC,IAAI;MACtB;IACF,CAAC;IACDC,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC;IAClDC,mBAAmB,EAAE;MACnBb,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO;IAC/B,CAAC;IACDc,sBAAsB,EAAE;EAC1B,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"TextEditorOutput.utils.js","names":["sanitizeHtml","RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE","canonicalizeTextEditorImageUrl","isAllowedTextEditorImageUrl","CKEDITOR_IMAGE_CLASSES","Set","IMAGE_TAGS","sanitizeSrcset","srcset","candidates","split","map","candidate","trim","filter","Boolean","length","undefined","sanitizedCandidates","_candidate$split","_candidate$split2","_toArray","url","descriptors","slice","canonicalUrl","some","descriptor","test","concat","_toConsumableArray","join","includes","sanitizeImageClass","className","allowedClasses","name","has","sanitizeImageSizes","sizes","sanitizeProstoreFileId","id","SAFE_IMAGE_STYLE_PROPERTIES","filterImageStyle","style","safeDeclarations","declaration","_property$trim$toLowe","_declaration$split","_declaration$split2","_slicedToArray","property","toLowerCase","setOrDeleteAttribute","attributes","value","sanitizeImageTagAttributes","tagName","onclick","onload","sanitizeClassAttribute","sanitizeUrlAttribute","sanitize","sanitizeImageUrlAttributes","sanitizeProstoreFileIdAttribute","addLazyImageLoadingAttributes","src","loading","decoding","transformImageTag","attribs","sanitizedAttributes","_objectSpread","sanitizeTextEditorHtml","html","allowedTags","allowedAttributes","a","figure","picture","source","img","table","col","td","th","allowedStyles","color","width","height","margin","padding","border","allowedSchemes","allowedSchemesByTag","transformTags","figcaption","exclusiveFilter","frame","tag","allowedIframeHostnames"],"sources":["../../src/TextEditorOutput/TextEditorOutput.utils.ts"],"sourcesContent":["import sanitizeHtml from 'sanitize-html'\n\nimport { RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE } from '../TextEditor/utils/imageAttributes'\nimport { canonicalizeTextEditorImageUrl } from '../TextEditor/utils/imageUrls'\n\nexport { isAllowedTextEditorImageUrl } from '../TextEditor/utils/imageUrls'\n\ntype Attributes = Record<string, string>\n\nconst CKEDITOR_IMAGE_CLASSES = new Set([\n 'image',\n 'image-inline',\n 'image_resized',\n 'image-style-align-left',\n 'image-style-align-right',\n 'image-style-block-align-left',\n 'image-style-block-align-right',\n 'image-style-side',\n])\n\nconst IMAGE_TAGS = new Set(['figure', 'figcaption', 'picture', 'source', 'img'])\n\nconst sanitizeSrcset = (srcset: string) => {\n const candidates = srcset\n .split(',')\n .map((candidate) => candidate.trim())\n .filter(Boolean)\n\n if (candidates.length === 0) {\n return undefined\n }\n\n const sanitizedCandidates = candidates.map((candidate) => {\n const [url, ...descriptors] = candidate.split(/\\s+/)\n const canonicalUrl = canonicalizeTextEditorImageUrl(url)\n\n if (\n !canonicalUrl ||\n descriptors.some(\n (descriptor) => !/^(?:\\d+w|\\d+(?:\\.\\d+)?x)$/.test(descriptor)\n )\n ) {\n return undefined\n }\n\n return [canonicalUrl, ...descriptors].join(' ')\n })\n\n if (sanitizedCandidates.includes(undefined)) {\n return undefined\n }\n\n return sanitizedCandidates.join(', ')\n}\n\nconst sanitizeImageClass = (className?: string) => {\n const allowedClasses = className\n ?.split(/\\s+/)\n .filter((name) => CKEDITOR_IMAGE_CLASSES.has(name))\n\n return allowedClasses?.length ? allowedClasses.join(' ') : undefined\n}\n\nconst sanitizeImageSizes = (sizes?: string) => {\n if (!sizes || /url\\(|javascript:|data:/i.test(sizes)) {\n return undefined\n }\n\n return /^[\\w\\s().,:+\\-/%]+$/.test(sizes) ? sizes : undefined\n}\n\nconst sanitizeProstoreFileId = (id?: string) =>\n id && /^[\\w-]+$/.test(id) ? id : undefined\n\n// ImageResize writes inline `width: X%` (and occasionally `height`) on the\n// containing <figure>/<img>. Keep only those declarations so resized images\n// render at the user's chosen size, `allowedStyles` further validates the values.\nconst SAFE_IMAGE_STYLE_PROPERTIES = new Set(['width', 'height', 'aspect-ratio'])\n\nconst filterImageStyle = (style?: string) => {\n if (!style) {\n return undefined\n }\n\n const safeDeclarations = style\n .split(';')\n .map((declaration) => declaration.trim())\n .filter(Boolean)\n .filter((declaration) => {\n const [property] = declaration.split(':', 1)\n return SAFE_IMAGE_STYLE_PROPERTIES.has(\n property?.trim().toLowerCase() ?? ''\n )\n })\n\n return safeDeclarations.length ? `${safeDeclarations.join('; ')};` : undefined\n}\n\nconst setOrDeleteAttribute = (\n attributes: Attributes,\n name: string,\n value?: string\n) => {\n if (value) {\n attributes[name] = value\n } else {\n delete attributes[name]\n }\n}\n\nconst sanitizeImageTagAttributes = (\n tagName: string,\n attributes: Attributes\n) => {\n if (!IMAGE_TAGS.has(tagName)) {\n return\n }\n\n setOrDeleteAttribute(attributes, 'style', filterImageStyle(attributes.style))\n delete attributes.onclick\n delete attributes.onload\n}\n\nconst sanitizeClassAttribute = (attributes: Attributes) => {\n setOrDeleteAttribute(\n attributes,\n 'class',\n sanitizeImageClass(attributes.class)\n )\n}\n\nconst sanitizeUrlAttribute = (\n attributes: Attributes,\n name: string,\n sanitize: (value: string) => string | undefined\n) => {\n if (attributes[name]) {\n setOrDeleteAttribute(attributes, name, sanitize(attributes[name]))\n }\n}\n\nconst sanitizeImageUrlAttributes = (attributes: Attributes) => {\n sanitizeUrlAttribute(attributes, 'src', canonicalizeTextEditorImageUrl)\n sanitizeUrlAttribute(attributes, 'srcset', sanitizeSrcset)\n sanitizeUrlAttribute(attributes, 'sizes', sanitizeImageSizes)\n}\n\nconst sanitizeProstoreFileIdAttribute = (attributes: Attributes) => {\n setOrDeleteAttribute(\n attributes,\n RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE,\n sanitizeProstoreFileId(attributes[RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE])\n )\n}\n\nconst addLazyImageLoadingAttributes = (\n tagName: string,\n attributes: Attributes\n) => {\n if (tagName === 'img' && attributes.src) {\n attributes.loading = 'lazy'\n attributes.decoding = 'async'\n }\n}\n\nconst transformImageTag = (tagName: string, attribs: Attributes) => {\n const sanitizedAttributes: Attributes = { ...attribs }\n\n sanitizeImageTagAttributes(tagName, sanitizedAttributes)\n sanitizeClassAttribute(sanitizedAttributes)\n sanitizeImageUrlAttributes(sanitizedAttributes)\n sanitizeProstoreFileIdAttribute(sanitizedAttributes)\n addLazyImageLoadingAttributes(tagName, sanitizedAttributes)\n\n return {\n tagName,\n attribs: sanitizedAttributes,\n }\n}\n\nexport const sanitizeTextEditorHtml = (html: string) => {\n if (!html) {\n return ''\n }\n\n return sanitizeHtml(html, {\n allowedTags: [\n 'p',\n 'br',\n 'strong',\n 'b',\n 'em',\n 'i',\n 'u',\n 's',\n 'span',\n 'div',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'ul',\n 'ol',\n 'li',\n 'a',\n 'figure',\n 'figcaption',\n 'table',\n 'colgroup',\n 'col',\n 'thead',\n 'tbody',\n 'tr',\n 'td',\n 'th',\n 'blockquote',\n 'pre',\n 'code',\n 'hr',\n 'img',\n 'picture',\n 'source',\n 'sub',\n 'sup',\n ],\n allowedAttributes: {\n '*': ['style', 'class'],\n a: ['href', 'title', 'target', 'rel'],\n figure: ['class', RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE],\n picture: ['class', RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE],\n source: ['srcset', 'sizes', 'type', 'media'],\n img: [\n 'src',\n 'srcset',\n 'sizes',\n 'alt',\n 'title',\n 'width',\n 'height',\n 'loading',\n 'decoding',\n 'class',\n RICH_TEXT_EDITOR_FILE_ID_ATTRIBUTE,\n ],\n table: ['border', 'cellpadding', 'cellspacing'],\n col: ['span'],\n td: ['colspan', 'rowspan'],\n th: ['colspan', 'rowspan', 'scope'],\n },\n allowedStyles: {\n '*': {\n color: [\n /^#[0-9a-fA-F]{3,6}$/,\n /^rgb\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*\\)$/,\n /^rgba\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*[\\d.]+\\s*\\)$/,\n ],\n 'background-color': [\n /^#[0-9a-fA-F]{3,6}$/,\n /^rgb\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*\\)$/,\n /^rgba\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*[\\d.]+\\s*\\)$/,\n ],\n 'font-size': [/^\\d+(?:px|pt|em|rem|%)$/],\n 'font-weight': [/^(?:normal|bold|bolder|lighter|\\d{1,3})$/],\n 'font-style': [/^(?:normal|italic|oblique)$/],\n 'font-family': [/.*/],\n 'text-decoration': [/^(?:none|underline|line-through|overline)$/],\n 'text-align': [/^(?:left|right|center|justify)$/],\n 'line-height': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)?$/],\n width: [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'min-width': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'max-width': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n height: [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'min-height': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n 'max-height': [/^\\d+(?:\\.\\d+)?(?:px|pt|em|rem|%)$/],\n margin: [/^\\d+(?:px|pt|em|rem|%)?(?:\\s+\\d+(?:px|pt|em|rem|%)?)*$/],\n 'margin-top': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'margin-bottom': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'margin-left': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'margin-right': [/^\\d+(?:px|pt|em|rem|%)?$/],\n padding: [/^\\d+(?:px|pt|em|rem|%)?(?:\\s+\\d+(?:px|pt|em|rem|%)?)*$/],\n 'padding-top': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'padding-bottom': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'padding-left': [/^\\d+(?:px|pt|em|rem|%)?$/],\n 'padding-right': [/^\\d+(?:px|pt|em|rem|%)?$/],\n border: [/.*/],\n 'border-top': [/.*/],\n 'border-bottom': [/.*/],\n 'border-left': [/.*/],\n 'border-right': [/.*/],\n 'border-color': [\n /^#[0-9a-fA-F]{3,6}$/,\n /^rgb\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*\\)$/,\n /^rgba\\(\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*\\d+\\s*,\\s*[\\d.]+\\s*\\)$/,\n ],\n 'border-width': [/^\\d+(?:px|pt|em|rem)?$/],\n 'border-style': [/^(?:none|solid|dashed|dotted|double)$/],\n 'list-style-type': [/.*/],\n 'vertical-align': [/.*/],\n 'white-space': [/.*/],\n 'aspect-ratio': [/^\\d+(?:\\.\\d+)?(?:\\s*\\/\\s*\\d+(?:\\.\\d+)?)?$/],\n },\n },\n allowedSchemes: ['http', 'https', 'mailto', 'tel'],\n allowedSchemesByTag: {\n img: ['http', 'https'],\n source: ['http', 'https'],\n },\n transformTags: {\n figure: transformImageTag,\n figcaption: transformImageTag,\n picture: transformImageTag,\n source: transformImageTag,\n img: transformImageTag,\n },\n exclusiveFilter: (frame) =>\n (frame.tag === 'img' && !frame.attribs.src) ||\n (frame.tag === 'source' && !frame.attribs.srcset),\n allowedIframeHostnames: [],\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAOA,YAAY,MAAM,eAAe;AAExC,SAASC,kCAAkC,QAAQ,qCAAqC;AACxF,SAASC,8BAA8B,QAAQ,+BAA+B;AAE9E,SAASC,2BAA2B,QAAQ,+BAA+B;AAI3E,IAAMC,sBAAsB,GAAG,IAAIC,GAAG,CAAC,CACrC,OAAO,EACP,cAAc,EACd,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,+BAA+B,EAC/B,kBAAkB,CACnB,CAAC;AAEF,IAAMC,UAAU,GAAG,IAAID,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAEhF,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,MAAc,EAAK;EACzC,IAAMC,UAAU,GAAGD,MAAM,CACtBE,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAC,UAACC,SAAS;IAAA,OAAKA,SAAS,CAACC,IAAI,CAAC,CAAC;EAAA,EAAC,CACpCC,MAAM,CAACC,OAAO,CAAC;EAElB,IAAIN,UAAU,CAACO,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAOC,SAAS;EAClB;EAEA,IAAMC,mBAAmB,GAAGT,UAAU,CAACE,GAAG,CAAC,UAACC,SAAS,EAAK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