pixel-react 1.22.12 → 1.23.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.
- package/lib/components/Excel/Data.js +72 -92
- package/lib/components/Excel/Data.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFile.js +8 -11
- package/lib/components/Excel/ExcelFile/ExcelFile.js.map +1 -1
- package/lib/components/Icon/iconList.js +14 -0
- package/lib/components/Icon/iconList.js.map +1 -1
- package/lib/components/RichTextEditor/DynamicValue.d.ts +8 -0
- package/lib/components/RichTextEditor/DynamicValue.js +90 -0
- package/lib/components/RichTextEditor/DynamicValue.js.map +1 -0
- package/lib/components/RichTextEditor/DynamicValueList.d.ts +11 -0
- package/lib/components/RichTextEditor/DynamicValueList.js +49 -0
- package/lib/components/RichTextEditor/DynamicValueList.js.map +1 -0
- package/lib/components/RichTextEditor/LinkPopover.d.ts +8 -0
- package/lib/components/RichTextEditor/LinkPopover.js +123 -0
- package/lib/components/RichTextEditor/LinkPopover.js.map +1 -0
- package/lib/components/RichTextEditor/RichTextEditor.d.ts +5 -0
- package/lib/components/RichTextEditor/RichTextEditor.js +242 -0
- package/lib/components/RichTextEditor/RichTextEditor.js.map +1 -0
- package/lib/components/RichTextEditor/Toolbar.d.ts +13 -0
- package/lib/components/RichTextEditor/Toolbar.js +186 -0
- package/lib/components/RichTextEditor/Toolbar.js.map +1 -0
- package/lib/components/RichTextEditor/constants.d.ts +4 -0
- package/lib/components/RichTextEditor/constants.js +33 -0
- package/lib/components/RichTextEditor/constants.js.map +1 -0
- package/lib/components/RichTextEditor/fileAttachment.d.ts +25 -0
- package/lib/components/RichTextEditor/fileAttachment.js +150 -0
- package/lib/components/RichTextEditor/fileAttachment.js.map +1 -0
- package/lib/components/RichTextEditor/imageUpload.d.ts +10 -0
- package/lib/components/RichTextEditor/imageUpload.js +46 -0
- package/lib/components/RichTextEditor/imageUpload.js.map +1 -0
- package/lib/components/RichTextEditor/index.d.ts +2 -0
- package/lib/components/RichTextEditor/index.js +2 -0
- package/lib/components/RichTextEditor/index.js.map +1 -0
- package/lib/components/RichTextEditor/pasteFormatting.d.ts +24 -0
- package/lib/components/RichTextEditor/pasteFormatting.js +203 -0
- package/lib/components/RichTextEditor/pasteFormatting.js.map +1 -0
- package/lib/components/RichTextEditor/types.d.ts +196 -0
- package/lib/components/RichTextEditor/types.js +2 -0
- package/lib/components/RichTextEditor/types.js.map +1 -0
- package/lib/components/RichTextEditor/uploadPosition.d.ts +31 -0
- package/lib/components/RichTextEditor/uploadPosition.js +107 -0
- package/lib/components/RichTextEditor/uploadPosition.js.map +1 -0
- package/lib/components/StepsLandingTable/Components/StepTableMainRow.js +2 -2
- package/lib/components/StepsLandingTable/Components/StepTableMainRow.js.map +1 -1
- package/lib/index.d.ts +203 -4
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/styles.css +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { mergeAttributes, Node } from '@tiptap/react';
|
|
2
|
+
import { SAFE_IMAGE_URL_REGEX } from './imageUpload';
|
|
3
|
+
import { insertAtTarget, trackRange } from './uploadPosition';
|
|
4
|
+
// Same rule as images: data URLs are limited to images so a pasted
|
|
5
|
+
// `data:text/html` link can't run script when opened
|
|
6
|
+
export const SAFE_ATTACHMENT_URL_REGEX = SAFE_IMAGE_URL_REGEX;
|
|
7
|
+
export const formatFileSize = (bytes) => {
|
|
8
|
+
if (bytes < 1024)
|
|
9
|
+
return `${bytes} B`;
|
|
10
|
+
const units = ['KB', 'MB', 'GB'];
|
|
11
|
+
let size = bytes / 1024;
|
|
12
|
+
let unit = 0;
|
|
13
|
+
while (size >= 1024 && unit < units.length - 1) {
|
|
14
|
+
size /= 1024;
|
|
15
|
+
unit += 1;
|
|
16
|
+
}
|
|
17
|
+
return `${size < 10 ? size.toFixed(1) : Math.round(size)} ${units[unit]}`;
|
|
18
|
+
};
|
|
19
|
+
// Same syntax as the `accept` attribute: `.pdf`, `image/*`, `application/pdf`
|
|
20
|
+
export const matchesAccept = (file, accept) => {
|
|
21
|
+
const rules = accept
|
|
22
|
+
.split(',')
|
|
23
|
+
.map((rule) => rule.trim().toLowerCase())
|
|
24
|
+
.filter(Boolean);
|
|
25
|
+
if (!rules.length)
|
|
26
|
+
return true;
|
|
27
|
+
const name = file.name.toLowerCase();
|
|
28
|
+
const type = file.type.toLowerCase();
|
|
29
|
+
return rules.some((rule) => {
|
|
30
|
+
if (rule.startsWith('.'))
|
|
31
|
+
return name.endsWith(rule);
|
|
32
|
+
if (rule.endsWith('/*'))
|
|
33
|
+
return type.startsWith(rule.slice(0, -1));
|
|
34
|
+
return type === rule;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Inline, non-editable chip linking to an uploaded file. Serialised as
|
|
39
|
+
* `<a data-type="fileAttachment" href="{url}" data-name="{name}" data-size="{bytes}" download="{name}">{name} ({size})</a>`
|
|
40
|
+
*/
|
|
41
|
+
export const FileAttachment = Node.create({
|
|
42
|
+
name: 'fileAttachment',
|
|
43
|
+
group: 'inline',
|
|
44
|
+
inline: true,
|
|
45
|
+
atom: true,
|
|
46
|
+
selectable: true,
|
|
47
|
+
draggable: true,
|
|
48
|
+
addAttributes() {
|
|
49
|
+
return {
|
|
50
|
+
href: {
|
|
51
|
+
default: null,
|
|
52
|
+
parseHTML: (element) => {
|
|
53
|
+
const href = element.getAttribute('href') ?? '';
|
|
54
|
+
return SAFE_ATTACHMENT_URL_REGEX.test(href) ? href : null;
|
|
55
|
+
},
|
|
56
|
+
renderHTML: () => ({}),
|
|
57
|
+
},
|
|
58
|
+
name: {
|
|
59
|
+
default: '',
|
|
60
|
+
parseHTML: (element) => element.getAttribute('data-name') ?? element.textContent ?? '',
|
|
61
|
+
renderHTML: () => ({}),
|
|
62
|
+
},
|
|
63
|
+
size: {
|
|
64
|
+
default: null,
|
|
65
|
+
parseHTML: (element) => {
|
|
66
|
+
const size = Number(element.getAttribute('data-size'));
|
|
67
|
+
return Number.isFinite(size) && size > 0 ? size : null;
|
|
68
|
+
},
|
|
69
|
+
renderHTML: () => ({}),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
parseHTML() {
|
|
74
|
+
// Above the link mark's `a[href]` rule
|
|
75
|
+
return [{ tag: 'a[data-type="fileAttachment"]', priority: 60 }];
|
|
76
|
+
},
|
|
77
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
78
|
+
const { href, name, size } = node.attrs;
|
|
79
|
+
return [
|
|
80
|
+
'a',
|
|
81
|
+
mergeAttributes(HTMLAttributes, {
|
|
82
|
+
'data-type': this.name,
|
|
83
|
+
class: 'ff-rich-text-editor__attachment',
|
|
84
|
+
href,
|
|
85
|
+
'data-name': name,
|
|
86
|
+
'data-size': size ?? undefined,
|
|
87
|
+
download: name,
|
|
88
|
+
target: '_blank',
|
|
89
|
+
rel: 'noopener noreferrer',
|
|
90
|
+
}),
|
|
91
|
+
size ? `${name} (${formatFileSize(size)})` : name,
|
|
92
|
+
];
|
|
93
|
+
},
|
|
94
|
+
renderText({ node }) {
|
|
95
|
+
return node.attrs.name;
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Uploads files and inserts them as attachment chips at `pos`, or over the
|
|
100
|
+
* selection when omitted. The target follows edits made while uploading.
|
|
101
|
+
* Resolves with the position after the last chip
|
|
102
|
+
*/
|
|
103
|
+
export const insertAttachmentFiles = async (view, files, { upload, accept, imagesOnly, maxFileSize, onError }, pos) => {
|
|
104
|
+
const { from, to } = view.state.selection;
|
|
105
|
+
const target = trackRange(view, pos === undefined ? { from, to } : { from: pos, to: pos });
|
|
106
|
+
const result = () => (pos === undefined ? undefined : target.get().from);
|
|
107
|
+
try {
|
|
108
|
+
for (const file of files) {
|
|
109
|
+
// Rejected before reading the file, which would only fail as 'upload' later
|
|
110
|
+
if (!matchesAccept(file, accept) ||
|
|
111
|
+
(imagesOnly && !file.type.startsWith('image/'))) {
|
|
112
|
+
onError?.(file, 'type');
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (maxFileSize && file.size > maxFileSize) {
|
|
116
|
+
onError?.(file, 'size');
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
let href;
|
|
120
|
+
try {
|
|
121
|
+
href = await upload(file);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
onError?.(file, 'upload');
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
// The editor may have been unmounted while uploading
|
|
128
|
+
const attachmentType = view.isDestroyed
|
|
129
|
+
? null
|
|
130
|
+
: view.state.schema.nodes.fileAttachment;
|
|
131
|
+
if (!attachmentType)
|
|
132
|
+
return result();
|
|
133
|
+
if (!SAFE_ATTACHMENT_URL_REGEX.test(href)) {
|
|
134
|
+
onError?.(file, 'upload');
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const node = attachmentType.create({
|
|
138
|
+
href,
|
|
139
|
+
name: file.name,
|
|
140
|
+
size: file.size,
|
|
141
|
+
});
|
|
142
|
+
insertAtTarget(view, target, node, pos === undefined ? 'selection' : 'position', false);
|
|
143
|
+
}
|
|
144
|
+
return result();
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
target.release();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=fileAttachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileAttachment.js","sourceRoot":"","sources":["../../../src/components/RichTextEditor/fileAttachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,mEAAmE;AACnE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I;gBACN,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;YAC3C,IAAI,CAAC,cAAc;gBAAE,OAAO,MAAM,EAAE,CAAC;YACrC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC1B,SAAS;YACX,CAAC;YACD,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC;gBACjC,IAAI;gBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;YACH,cAAc,CACZ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,EAC5C,KAAK,CACN,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
2
|
+
import { RichTextImageUpload, RichTextImageUploadError } from './types';
|
|
3
|
+
export declare const SAFE_IMAGE_URL_REGEX: RegExp;
|
|
4
|
+
export declare const readAsDataUrl: RichTextImageUpload;
|
|
5
|
+
export declare const getImageFiles: (files?: FileList | File[] | null) => File[];
|
|
6
|
+
export interface InsertImageOptions {
|
|
7
|
+
upload: RichTextImageUpload;
|
|
8
|
+
onError?: (file: File, reason: RichTextImageUploadError) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const insertImageFiles: (view: EditorView, files: File[], { upload, onError }: InsertImageOptions, pos?: number) => Promise<number | undefined>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { insertAtTarget, trackRange } from './uploadPosition';
|
|
2
|
+
export const SAFE_IMAGE_URL_REGEX = /^(https?:\/\/|data:image\/)/i;
|
|
3
|
+
// Used when no `onImageUpload` is given: embeds the file in the HTML
|
|
4
|
+
export const readAsDataUrl = (file) => new Promise((resolve, reject) => {
|
|
5
|
+
const reader = new FileReader();
|
|
6
|
+
reader.onload = () => resolve(reader.result);
|
|
7
|
+
reader.onerror = () => reject(reader.error);
|
|
8
|
+
reader.readAsDataURL(file);
|
|
9
|
+
});
|
|
10
|
+
export const getImageFiles = (files) => Array.from(files ?? []).filter((file) => file.type.startsWith('image/'));
|
|
11
|
+
// Inserts pasted/dropped images at `pos`, or over the selection when omitted.
|
|
12
|
+
// The target follows edits made while uploading. A failed file is reported
|
|
13
|
+
// and skipped, so the rest still upload. Resolves with the position after the
|
|
14
|
+
// last image
|
|
15
|
+
export const insertImageFiles = async (view, files, { upload, onError }, pos) => {
|
|
16
|
+
const { from, to } = view.state.selection;
|
|
17
|
+
const target = trackRange(view, pos === undefined ? { from, to } : { from: pos, to: pos });
|
|
18
|
+
const result = () => (pos === undefined ? undefined : target.get().from);
|
|
19
|
+
try {
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
let src;
|
|
22
|
+
try {
|
|
23
|
+
src = await upload(file);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
onError?.(file, 'upload');
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// The editor may have been unmounted while uploading
|
|
30
|
+
const imageType = view.isDestroyed ? null : view.state.schema.nodes.image;
|
|
31
|
+
if (!imageType)
|
|
32
|
+
return result();
|
|
33
|
+
if (!SAFE_IMAGE_URL_REGEX.test(src)) {
|
|
34
|
+
onError?.(file, 'upload');
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const node = imageType.create({ src, alt: file.name });
|
|
38
|
+
insertAtTarget(view, target, node, pos === undefined ? 'selection' : 'position', true);
|
|
39
|
+
}
|
|
40
|
+
return result();
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
target.release();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=imageUpload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageUpload.js","sourceRoot":"","sources":["../../../src/components/RichTextEditor/imageUpload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAEnE,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAwB,CAAC,IAAI,EAAE,EAAE,CACzD,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAgB,CAAC,CAAC;IACvD,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAgC,EAAE,EAAE,CAChE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AAO3E,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,aAAa;AACb,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,IAAgB,EAChB,KAAa,EACb,EAAE,MAAM,EAAE,OAAO,EAAsB,EACvC,GAAY,EACZ,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CAA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C,CAAC,CAAC,UAAU,EAC5C,IAAI,CACL,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/RichTextEditor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps only the allowed properties of an inline style; null when none are left
|
|
4
|
+
*/
|
|
5
|
+
export declare const sanitizeStyle: (style: string | null) => string | null;
|
|
6
|
+
/**
|
|
7
|
+
* Keeps inline styles and legacy layout attributes (common in email signatures)
|
|
8
|
+
* on blocks and tables, which the default schema drops
|
|
9
|
+
*/
|
|
10
|
+
export declare const PreservedHtmlAttributes: Extension<any, any>;
|
|
11
|
+
/**
|
|
12
|
+
* Inline image (so it can sit in a line of text or inside a link) that keeps its
|
|
13
|
+
* inline style, limited to the allowed properties
|
|
14
|
+
*/
|
|
15
|
+
export declare const InlineImage: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
|
|
16
|
+
/**
|
|
17
|
+
* Prepares pasted HTML (e.g. a copied email signature) so it keeps its look:
|
|
18
|
+
* converts `<font>` tags and line divs, copies inherited text styles onto the
|
|
19
|
+
* text, keeps only allowed inline style properties, and drops images the
|
|
20
|
+
* browser can't load (`file:`, `cid:`, `blob:`).
|
|
21
|
+
* All images are dropped when `keepImages` is false
|
|
22
|
+
*/
|
|
23
|
+
export declare const normalizePastedHtml: (html: string, keepImages: boolean) => string;
|
|
24
|
+
export declare const hasHtmlText: (html: string) => boolean;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import Image from '@tiptap/extension-image';
|
|
3
|
+
import { SAFE_IMAGE_URL_REGEX } from './imageUpload';
|
|
4
|
+
// Text styles a parent passes down to its text. Pasted wrappers (divs, cells)
|
|
5
|
+
// aren't kept as nodes, so these are copied onto the text itself
|
|
6
|
+
const INHERITED_STYLES = [
|
|
7
|
+
'color',
|
|
8
|
+
'font-family',
|
|
9
|
+
'font-size',
|
|
10
|
+
'font-weight',
|
|
11
|
+
'font-style',
|
|
12
|
+
'line-height',
|
|
13
|
+
'text-decoration',
|
|
14
|
+
];
|
|
15
|
+
const BLOCK_SELECTOR = 'address, article, aside, blockquote, dd, div, dl, dt, fieldset, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, li, main, nav, ol, p, pre, section, table, ul';
|
|
16
|
+
// <font size="1-7"> to the sizes browsers render them at
|
|
17
|
+
const FONT_TAG_SIZES = ['', '10px', '13px', '16px', '18px', '24px', '32px', '48px'];
|
|
18
|
+
// Inline style properties kept from pasted or loaded HTML: colour, font,
|
|
19
|
+
// spacing, border, size, alignment and display. Anything else (position,
|
|
20
|
+
// z-index, background images, transforms...) could cover the app or load
|
|
21
|
+
// tracking resources, so it is dropped
|
|
22
|
+
const ALLOWED_STYLE_PROPERTY = /^(color|background-color|font(-[a-z-]+)?|line-height|letter-spacing|word-spacing|white-space|text-(align|decoration(-[a-z]+)?|indent|transform)|vertical-align|(margin|padding)(-(top|right|bottom|left))?|border(-(top|right|bottom|left))?(-(width|style|color))?|border(-(top|bottom)-(left|right))?-radius|border-(collapse|spacing)|(min-|max-)?(width|height)|display|table-layout|list-style-type)$/;
|
|
23
|
+
const UNSAFE_STYLE_VALUE = /url\s*\(|expression\s*\(|image-set\s*\(/i;
|
|
24
|
+
/**
|
|
25
|
+
* Keeps only the allowed properties of an inline style; null when none are left
|
|
26
|
+
*/
|
|
27
|
+
export const sanitizeStyle = (style) => {
|
|
28
|
+
if (!style)
|
|
29
|
+
return null;
|
|
30
|
+
const source = document.createElement('span').style;
|
|
31
|
+
const result = document.createElement('span').style;
|
|
32
|
+
source.cssText = style;
|
|
33
|
+
// The browser expands shorthands, so each entry is a single property
|
|
34
|
+
for (let i = 0; i < source.length; i += 1) {
|
|
35
|
+
const property = source.item(i);
|
|
36
|
+
const value = source.getPropertyValue(property);
|
|
37
|
+
if (ALLOWED_STYLE_PROPERTY.test(property) && !UNSAFE_STYLE_VALUE.test(value)) {
|
|
38
|
+
result.setProperty(property, value, source.getPropertyPriority(property));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return result.cssText || null;
|
|
42
|
+
};
|
|
43
|
+
const preserveAttribute = (key, htmlName) => ({
|
|
44
|
+
[key]: {
|
|
45
|
+
default: null,
|
|
46
|
+
parseHTML: (element) => htmlName === 'style'
|
|
47
|
+
? sanitizeStyle(element.getAttribute('style'))
|
|
48
|
+
: element.getAttribute(htmlName),
|
|
49
|
+
renderHTML: (attributes) => attributes[key] ? { [htmlName]: attributes[key] } : {},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Keeps inline styles and legacy layout attributes (common in email signatures)
|
|
54
|
+
* on blocks and tables, which the default schema drops
|
|
55
|
+
*/
|
|
56
|
+
export const PreservedHtmlAttributes = Extension.create({
|
|
57
|
+
name: 'preservedHtmlAttributes',
|
|
58
|
+
addGlobalAttributes() {
|
|
59
|
+
return [
|
|
60
|
+
{
|
|
61
|
+
types: [
|
|
62
|
+
'paragraph',
|
|
63
|
+
'heading',
|
|
64
|
+
'blockquote',
|
|
65
|
+
'bulletList',
|
|
66
|
+
'orderedList',
|
|
67
|
+
'listItem',
|
|
68
|
+
'table',
|
|
69
|
+
'tableRow',
|
|
70
|
+
'tableCell',
|
|
71
|
+
'tableHeader',
|
|
72
|
+
],
|
|
73
|
+
attributes: preserveAttribute('htmlStyle', 'style'),
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
types: ['table'],
|
|
77
|
+
attributes: {
|
|
78
|
+
...preserveAttribute('htmlWidth', 'width'),
|
|
79
|
+
...preserveAttribute('htmlAlign', 'align'),
|
|
80
|
+
...preserveAttribute('htmlBorder', 'border'),
|
|
81
|
+
...preserveAttribute('htmlCellPadding', 'cellpadding'),
|
|
82
|
+
...preserveAttribute('htmlCellSpacing', 'cellspacing'),
|
|
83
|
+
...preserveAttribute('htmlBgColor', 'bgcolor'),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
// `align` is already handled by the table cell extensions
|
|
88
|
+
types: ['tableCell', 'tableHeader'],
|
|
89
|
+
attributes: {
|
|
90
|
+
...preserveAttribute('htmlWidth', 'width'),
|
|
91
|
+
...preserveAttribute('htmlVAlign', 'valign'),
|
|
92
|
+
...preserveAttribute('htmlBgColor', 'bgcolor'),
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
];
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Inline image (so it can sit in a line of text or inside a link) that keeps its
|
|
100
|
+
* inline style, limited to the allowed properties
|
|
101
|
+
*/
|
|
102
|
+
export const InlineImage = Image.extend({
|
|
103
|
+
addAttributes() {
|
|
104
|
+
return {
|
|
105
|
+
...this.parent?.(),
|
|
106
|
+
...preserveAttribute('style', 'style'),
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
const convertFontTags = (doc) => {
|
|
111
|
+
doc.querySelectorAll('font').forEach((font) => {
|
|
112
|
+
const span = doc.createElement('span');
|
|
113
|
+
const color = font.getAttribute('color');
|
|
114
|
+
const face = font.getAttribute('face');
|
|
115
|
+
const size = FONT_TAG_SIZES[Number(font.getAttribute('size'))];
|
|
116
|
+
if (color)
|
|
117
|
+
span.style.color = color;
|
|
118
|
+
if (face)
|
|
119
|
+
span.style.fontFamily = face;
|
|
120
|
+
if (size)
|
|
121
|
+
span.style.fontSize = size;
|
|
122
|
+
if (font.getAttribute('style')) {
|
|
123
|
+
span.style.cssText += font.getAttribute('style');
|
|
124
|
+
}
|
|
125
|
+
span.append(...Array.from(font.childNodes));
|
|
126
|
+
font.replaceWith(span);
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
// Divs holding only inline content are lines (Gmail writes one per line):
|
|
130
|
+
// keep them as paragraphs without the editor's paragraph spacing
|
|
131
|
+
const convertLineDivs = (doc) => {
|
|
132
|
+
Array.from(doc.querySelectorAll('div'))
|
|
133
|
+
.reverse()
|
|
134
|
+
.forEach((div) => {
|
|
135
|
+
if (Array.from(div.children).some((child) => child.matches(BLOCK_SELECTOR))) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const paragraph = doc.createElement('p');
|
|
139
|
+
Array.from(div.attributes).forEach(({ name, value }) => paragraph.setAttribute(name, value));
|
|
140
|
+
paragraph.style.cssText = `margin: 0; ${div.style.cssText}`;
|
|
141
|
+
paragraph.append(...Array.from(div.childNodes));
|
|
142
|
+
div.replaceWith(paragraph);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
const inlineInheritedStyles = (doc) => {
|
|
146
|
+
const walker = doc.createTreeWalker(doc.body, NodeFilter.SHOW_TEXT);
|
|
147
|
+
const textNodes = [];
|
|
148
|
+
while (walker.nextNode()) {
|
|
149
|
+
const node = walker.currentNode;
|
|
150
|
+
if (node.data.trim())
|
|
151
|
+
textNodes.push(node);
|
|
152
|
+
}
|
|
153
|
+
textNodes.forEach((text) => {
|
|
154
|
+
const styles = [];
|
|
155
|
+
const found = new Set();
|
|
156
|
+
// Nearest ancestor wins, as in CSS inheritance
|
|
157
|
+
for (let element = text.parentElement; element && element !== doc.body; element = element.parentElement) {
|
|
158
|
+
INHERITED_STYLES.forEach((property) => {
|
|
159
|
+
const value = element.style.getPropertyValue(property);
|
|
160
|
+
if (value && !found.has(property)) {
|
|
161
|
+
found.add(property);
|
|
162
|
+
styles.push(`${property}: ${value}`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (!styles.length)
|
|
167
|
+
return;
|
|
168
|
+
const span = doc.createElement('span');
|
|
169
|
+
span.setAttribute('style', styles.join('; '));
|
|
170
|
+
text.replaceWith(span);
|
|
171
|
+
span.append(text);
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Prepares pasted HTML (e.g. a copied email signature) so it keeps its look:
|
|
176
|
+
* converts `<font>` tags and line divs, copies inherited text styles onto the
|
|
177
|
+
* text, keeps only allowed inline style properties, and drops images the
|
|
178
|
+
* browser can't load (`file:`, `cid:`, `blob:`).
|
|
179
|
+
* All images are dropped when `keepImages` is false
|
|
180
|
+
*/
|
|
181
|
+
export const normalizePastedHtml = (html, keepImages) => {
|
|
182
|
+
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
183
|
+
doc.querySelectorAll('img').forEach((image) => {
|
|
184
|
+
if (!keepImages || !SAFE_IMAGE_URL_REGEX.test(image.getAttribute('src') ?? '')) {
|
|
185
|
+
image.remove();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
if (!keepImages)
|
|
189
|
+
doc.querySelectorAll('picture').forEach((node) => node.remove());
|
|
190
|
+
convertFontTags(doc);
|
|
191
|
+
convertLineDivs(doc);
|
|
192
|
+
inlineInheritedStyles(doc);
|
|
193
|
+
doc.body.querySelectorAll('[style]').forEach((element) => {
|
|
194
|
+
const style = sanitizeStyle(element.getAttribute('style'));
|
|
195
|
+
if (style)
|
|
196
|
+
element.setAttribute('style', style);
|
|
197
|
+
else
|
|
198
|
+
element.removeAttribute('style');
|
|
199
|
+
});
|
|
200
|
+
return doc.body.innerHTML;
|
|
201
|
+
};
|
|
202
|
+
export const hasHtmlText = (html) => !!new DOMParser().parseFromString(html, 'text/html').body.textContent?.trim();
|
|
203
|
+
//# sourceMappingURL=pasteFormatting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pasteFormatting.js","sourceRoot":"","sources":["../../../src/components/RichTextEditor/pasteFormatting.ts"],"names":[],"mappings":"AA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