Skip to content

Commit c34acb6

Browse files
committed
Sanitize pasted block data
1 parent 113e895 commit c34acb6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-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

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
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).
77
- `Fix` — Fix problem with entering to Editor.js by Tab key [#1393](https://github.com/codex-team/editor.js/issues/1393)
8+
- `Fix` - Sanitize pasted block data [#1396](https://github.com/codex-team/editor.js/issues/1396).
9+
810

911
### 2.19
1012

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)