@squiz/formatted-text-editor 1.68.0 → 1.68.1
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/CHANGELOG.md +6 -0
- package/lib/Editor/Editor.js +4 -1
- package/package.json +1 -1
- package/src/Editor/Editor.tsx +6 -1
package/CHANGELOG.md
CHANGED
package/lib/Editor/Editor.js
CHANGED
@@ -38,7 +38,10 @@ const WrappedEditor = () => {
|
|
38
38
|
const preventImagePaste = (0, react_1.useCallback)((event) => {
|
39
39
|
const { clipboardData } = event;
|
40
40
|
const pastedData = clipboardData?.files[0];
|
41
|
-
if (pastedData?.type &&
|
41
|
+
if (pastedData?.type &&
|
42
|
+
pastedData?.type.startsWith('image/') &&
|
43
|
+
// Still allow paste of any text that came through (Word, etc)
|
44
|
+
!clipboardData?.types.includes('text/plain')) {
|
42
45
|
event.preventDefault();
|
43
46
|
}
|
44
47
|
// Allow other paste event handlers to be run.
|
package/package.json
CHANGED
package/src/Editor/Editor.tsx
CHANGED
@@ -25,7 +25,12 @@ const WrappedEditor = () => {
|
|
25
25
|
const preventImagePaste = useCallback((event) => {
|
26
26
|
const { clipboardData } = event;
|
27
27
|
const pastedData = clipboardData?.files[0];
|
28
|
-
if (
|
28
|
+
if (
|
29
|
+
pastedData?.type &&
|
30
|
+
pastedData?.type.startsWith('image/') &&
|
31
|
+
// Still allow paste of any text that came through (Word, etc)
|
32
|
+
!clipboardData?.types.includes('text/plain')
|
33
|
+
) {
|
29
34
|
event.preventDefault();
|
30
35
|
}
|
31
36
|
|