mirror of
https://github.com/codex-team/editor.js
synced 2024-06-10 18:03:25 +02:00
Merge pull request #42 from codex-team/sanitize_#29
Add sanitize for paste into block event.
This commit is contained in:
commit
e928701a1f
|
@ -288,6 +288,10 @@ cEditor.ui = {
|
|||
|
||||
}, false);
|
||||
|
||||
block.addEventListener('paste', function (event) {
|
||||
cEditor.callback.blockPaste(event, block);
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -601,6 +605,19 @@ cEditor.callback = {
|
|||
|
||||
},
|
||||
|
||||
blockPaste: function(event, block) {
|
||||
|
||||
var clipboardData, pastedData, nodeContent;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
clipboardData = event.clipboardData || window.clipboardData;
|
||||
pastedData = clipboardData.getData('Text');
|
||||
|
||||
nodeContent = document.createTextNode(pastedData);
|
||||
block.appendChild(nodeContent);
|
||||
},
|
||||
|
||||
/**
|
||||
* Clicks on block settings button
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue