Skip to content

Commit

Permalink
Merge pull request #41 from Slid-Team/slid-release/v1.2.3
Browse files Browse the repository at this point in the history
Slid release/v1.2.3
  • Loading branch information
somangoi authored Mar 31, 2023
2 parents 05f3d3b + b69c439 commit cae7dc6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/editor.js

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions src/components/modules/paste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ export default class Paste extends Module {
const plainData = dataTransfer.getData('text/plain');
let htmlData = dataTransfer.getData('text/html');

// @SLID - onPaste hanlder for preventing pasting styled text
const tempDiv = document.createElement('div');

tempDiv.innerHTML = htmlData ;

tempDiv.querySelectorAll('*').forEach((node ) => {
if (node instanceof HTMLElement) {
node.style.color = 'inherit';
node.style.fontFamily = 'inherit';
node.style.fontSize = 'inherit';
node.style.backgroundColor = 'initial';
}
});

const modifiedHtmlContent = tempDiv.innerHTML;

htmlData = modifiedHtmlContent;

/**
* If EditorJS json is passed, insert it
*/
Expand Down
2 changes: 1 addition & 1 deletion src/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.2.2"
"version": "1.2.3"
}

0 comments on commit cae7dc6

Please sign in to comment.