From 4ee6dd16d81ee487a9d5ca44f736afe0493df71f Mon Sep 17 00:00:00 2001 From: Mateusz Baginski Date: Fri, 20 Sep 2024 13:59:33 +0200 Subject: [PATCH] Apply CR remarks --- packages/ckeditor5-clipboard/src/clipboardpipeline.ts | 2 +- .../ckeditor5-clipboard/tests/utils/viewtoplaintext.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/ckeditor5-clipboard/src/clipboardpipeline.ts b/packages/ckeditor5-clipboard/src/clipboardpipeline.ts index 1bf8b863c1e..c420d030242 100644 --- a/packages/ckeditor5-clipboard/src/clipboardpipeline.ts +++ b/packages/ckeditor5-clipboard/src/clipboardpipeline.ts @@ -323,7 +323,7 @@ export default class ClipboardPipeline extends Plugin { this.listenTo( viewDocument, 'clipboardOutput', ( evt, data ) => { if ( !data.content.isEmpty ) { data.dataTransfer.setData( 'text/html', this.editor.data.htmlProcessor.toData( data.content ) ); - data.dataTransfer.setData( 'text/plain', viewToPlainText( editor.editing.view.domConverter, data.content ) ); + data.dataTransfer.setData( 'text/plain', viewToPlainText( editor.data.htmlProcessor.domConverter, data.content ) ); } if ( data.method == 'cut' ) { diff --git a/packages/ckeditor5-clipboard/tests/utils/viewtoplaintext.js b/packages/ckeditor5-clipboard/tests/utils/viewtoplaintext.js index 46555c14f87..8ded6a9a0b9 100644 --- a/packages/ckeditor5-clipboard/tests/utils/viewtoplaintext.js +++ b/packages/ckeditor5-clipboard/tests/utils/viewtoplaintext.js @@ -9,14 +9,17 @@ import viewToPlainText from '../../src/utils/viewtoplaintext.js'; import { parse as parseView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view.js'; describe( 'viewToPlainText()', () => { - let converter; + let converter, viewDocument; beforeEach( () => { - const viewDocument = new ViewDocument( new StylesProcessor() ); - + viewDocument = new ViewDocument( new StylesProcessor() ); converter = new DomConverter( viewDocument ); } ); + afterEach( () => { + viewDocument.destroy(); + } ); + function testViewToPlainText( viewString, expectedText ) { const view = parseView( viewString ); const text = viewToPlainText( converter, view );