Преглед изворни кода

Secured the InlineEditor#destroy by caching the data beforehand.

Aleksander Nowodzinski пре 8 година
родитељ
комит
32b773ea73
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      packages/ckeditor5-editor-inline/src/inline.js

+ 6 - 1
packages/ckeditor5-editor-inline/src/inline.js

@@ -11,6 +11,7 @@ import StandardEditor from '@ckeditor/ckeditor5-core/src/editor/standardeditor';
 import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
 import InlineEditorUI from './inlineeditorui';
 import InlineEditorUIView from './inlineeditoruiview';
+import setDataInElement from '@ckeditor/ckeditor5-utils/src/dom/setdatainelement';
 
 import '../theme/theme.scss';
 
@@ -42,9 +43,13 @@ export default class InlineEditor extends StandardEditor {
 	 * @returns {Promise}
 	 */
 	destroy() {
+		// Cache the data, then destroy. There's no way to tell whether model->view
+		// conversion will still work properly after StandardEditor#destroy().
+		const data = this.getData();
+
 		return this.ui.destroy()
 			.then( () => super.destroy() )
-			.then( () => this.updateEditorElement() );
+			.then( () => setDataInElement( this.element, data ) );
 	}
 
 	/**