Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions blocks/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ export default class Editable extends Component {
}

this.pastedPlainText = dataTransfer ? dataTransfer.getData( 'text/plain' ) : '';
this.isPlainTextPaste = ( dataTransfer &&
dataTransfer.types.length === 1 &&
dataTransfer.types[ 0 ] === 'text/plain' );
}

/**
Expand All @@ -308,8 +311,9 @@ export default class Editable extends Component {
* @param {PrePasteProcessEvent} event The PrePasteProcess event as triggered by tinyMCE.
*/
onPastePreProcess( event ) {
const HTML = this.isPlainTextPaste ? this.pastedPlainText : event.content;
// Allows us to ask for this information when we get a report.
window.console.log( 'Received HTML:\n\n', this.pastedContent || event.content );
window.console.log( 'Received HTML:\n\n', this.pastedContent || HTML );
window.console.log( 'Received plain text:\n\n', this.pastedPlainText );

// There is a selection, check if a link is pasted.
Expand Down Expand Up @@ -345,7 +349,7 @@ export default class Editable extends Component {
}

const content = rawHandler( {
HTML: this.pastedContent || event.content,
HTML: this.pastedContent || HTML,
plainText: this.pastedPlainText,
mode,
} );
Expand Down