Skip to content

Commit

Permalink
pkp/pkp-lib#9773 removed rich text field associated tinymce paste_pre…
Browse files Browse the repository at this point in the history
…process method
  • Loading branch information
touhidurabir committed Jun 7, 2024
1 parent 108e81f commit 68f3a9f
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/components/Form/fields/FieldRichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,6 @@ export default {
invalid_elements: this.invalidElements,
valid_elements: this.validElements,
// Allow pasting while stripping all styles, tags, new lines and getting only text content
// More details at https://www.tiny.cloud/docs/tinymce/6/copy-and-paste/
// Note that not all options available to 5.0+ that being used right now
paste_preprocess: (editor, args) => {
// we need to have better control as tinymce is converting specials chars to html entities
// which in turn passed as html chars at final pasting
// e.g. '<img src="onerror=alert(1)">' turned into '&lt;img src=&quot;onerror=alert(1)&quot;&gt;'
// internally by tinymce and then final paste, it again become '<img src="onerror=alert(1)">'
let parsedPasteContent = $(
'<div>' + args.content + '</div>'
).text();
args.content = new DOMParser().parseFromString(
parsedPasteContent,
'text/html'
).documentElement.textContent;
},
setup: (editor) => {
// Disable new line by preventing enter key
editor.on('keyDown', (event) => {
Expand Down

0 comments on commit 68f3a9f

Please sign in to comment.