|
|
@@ -119,7 +119,7 @@ export default class Clipboard extends Plugin {
|
|
|
init() {
|
|
|
const editor = this.editor;
|
|
|
const doc = editor.model.document;
|
|
|
- const editingView = editor.editing.view;
|
|
|
+ const viewDocument = editor.editing.view.document;
|
|
|
|
|
|
/**
|
|
|
* Data processor used to convert pasted HTML to a view structure.
|
|
|
@@ -129,11 +129,11 @@ export default class Clipboard extends Plugin {
|
|
|
*/
|
|
|
this._htmlDataProcessor = new HtmlDataProcessor();
|
|
|
|
|
|
- editingView.addObserver( ClipboardObserver );
|
|
|
+ viewDocument.addObserver( ClipboardObserver );
|
|
|
|
|
|
// The clipboard paste pipeline.
|
|
|
|
|
|
- this.listenTo( editingView, 'clipboardInput', ( evt, data ) => {
|
|
|
+ this.listenTo( viewDocument, 'clipboardInput', ( evt, data ) => {
|
|
|
// Pasting and dropping is disabled when editor is read-only.
|
|
|
// See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26.
|
|
|
if ( editor.isReadOnly ) {
|
|
|
@@ -153,7 +153,7 @@ export default class Clipboard extends Plugin {
|
|
|
|
|
|
this.fire( 'inputTransformation', { content } );
|
|
|
|
|
|
- editingView.scrollToTheSelection();
|
|
|
+ viewDocument.scrollToTheSelection();
|
|
|
}, { priority: 'low' } );
|
|
|
|
|
|
this.listenTo( this, 'inputTransformation', ( evt, data ) => {
|
|
|
@@ -183,11 +183,11 @@ export default class Clipboard extends Plugin {
|
|
|
|
|
|
const content = editor.data.toView( editor.model.getSelectedContent( doc.selection ) );
|
|
|
|
|
|
- editingView.fire( 'clipboardOutput', { dataTransfer, content, method: evt.name } );
|
|
|
+ viewDocument.fire( 'clipboardOutput', { dataTransfer, content, method: evt.name } );
|
|
|
}
|
|
|
|
|
|
- this.listenTo( editingView, 'copy', onCopyCut, { priority: 'low' } );
|
|
|
- this.listenTo( editingView, 'cut', ( evt, data ) => {
|
|
|
+ this.listenTo( viewDocument, 'copy', onCopyCut, { priority: 'low' } );
|
|
|
+ this.listenTo( viewDocument, 'cut', ( evt, data ) => {
|
|
|
// Cutting is disabled when editor is read-only.
|
|
|
// See: https://github.com/ckeditor/ckeditor5-clipboard/issues/26.
|
|
|
if ( editor.isReadOnly ) {
|
|
|
@@ -197,7 +197,7 @@ export default class Clipboard extends Plugin {
|
|
|
}
|
|
|
}, { priority: 'low' } );
|
|
|
|
|
|
- this.listenTo( editingView, 'clipboardOutput', ( evt, data ) => {
|
|
|
+ this.listenTo( viewDocument, 'clipboardOutput', ( evt, data ) => {
|
|
|
if ( !data.content.isEmpty ) {
|
|
|
data.dataTransfer.setData( 'text/html', this._htmlDataProcessor.toData( data.content ) );
|
|
|
data.dataTransfer.setData( 'text/plain', viewToPlainText( data.content ) );
|