Skip to content

Commit 1eb477f

Browse files
committed
Sanitize pasted block data
1 parent b134fcc commit 1eb477f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

dist/editor.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- `Fix` - The problem with destroy() method [#1380](https://github.com/codex-team/editor.js/issues/1380).
66
- `Fix` - add getter keyword to `block.mergeable` method [#1415](https://github.com/codex-team/editor.js/issues/1415).
7+
- `Fix` - Sanitize pasted block data [#1396](https://github.com/codex-team/editor.js/issues/1396).
78

89

910
### 2.19

src/components/modules/paste.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,10 @@ export default class Paste extends Module {
760760
* @returns {void}
761761
*/
762762
private insertEditorJSData(blocks: Array<Pick<SavedData, 'data' | 'tool'>>): void {
763-
const { BlockManager, Tools } = this.Editor;
763+
const { BlockManager, Sanitizer, Tools } = this.Editor;
764+
const sanitizedBlocks = Sanitizer.sanitizeBlocks(blocks);
764765

765-
blocks.forEach(({ tool, data }, i) => {
766+
sanitizedBlocks.forEach(({ tool, data }, i) => {
766767
let needToReplaceCurrentBlock = false;
767768

768769
if (i === 0) {

0 commit comments

Comments
 (0)