8
0
Просмотр исходного кода

Merge branch 'master' into t/ckeditor5/1449

Krzysztof Krztoń 7 лет назад
Родитель
Сommit
58c727c58c

+ 1 - 0
packages/ckeditor5-ui/docs/_snippets/examples/bootstrap-ui-inner.js

@@ -171,6 +171,7 @@ class BootstrapEditorUI extends EditorUI {
 		this._elementReplacer.restore();
 		this._elementReplacer.restore();
 
 
 		// Destroy the view.
 		// Destroy the view.
+		this._view.editable.destroy();
 		this._view.destroy();
 		this._view.destroy();
 
 
 		super.destroy();
 		super.destroy();

+ 1 - 0
packages/ckeditor5-ui/docs/framework/guides/external-ui.md

@@ -306,6 +306,7 @@ class BootstrapEditorUI extends EditorUI {
 		this._elementReplacer.restore();
 		this._elementReplacer.restore();
 
 
 		// Destroy the view.
 		// Destroy the view.
+		this._view.editable.destroy();
 		this._view.destroy();
 		this._view.destroy();
 
 
 		super.destroy();
 		super.destroy();

+ 18 - 0
packages/ckeditor5-ui/lang/translations/az.po

@@ -0,0 +1,18 @@
+# Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
+msgid ""
+msgstr ""
+"Language-Team: Azerbaijani (https://www.transifex.com/ckeditor/teams/11143/az/)\n"
+"Language: az\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgctxt "Title of the CKEditor5 editor."
+msgid "Rich Text Editor, %0"
+msgstr "Rich Text Redaktoru, %0"
+
+msgctxt "Title of the CKEditor5 editor."
+msgid "Rich Text Editor"
+msgstr "Rich Text Redaktoru"
+
+msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
+msgid "Edit block"
+msgstr "Redaktə etmək bloku"

+ 2 - 2
packages/ckeditor5-ui/lang/translations/he.po

@@ -7,11 +7,11 @@ msgstr ""
 
 
 msgctxt "Title of the CKEditor5 editor."
 msgctxt "Title of the CKEditor5 editor."
 msgid "Rich Text Editor, %0"
 msgid "Rich Text Editor, %0"
-msgstr "עורך טקסט עשיר"
+msgstr "עורך טקסט עשיר, %0"
 
 
 msgctxt "Title of the CKEditor5 editor."
 msgctxt "Title of the CKEditor5 editor."
 msgid "Rich Text Editor"
 msgid "Rich Text Editor"
-msgstr ""
+msgstr "עורך טקסט עשיר"
 
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
 msgid "Edit block"

+ 1 - 1
packages/ckeditor5-ui/lang/translations/ku.po

@@ -15,4 +15,4 @@ msgstr "سەرنوسەری دەقی بەپیت"
 
 
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgctxt "Label of the block toolbar icon (a block toolbar is displayed next to each paragraph, heading, list item, etc. and contains e.g. block formatting options)"
 msgid "Edit block"
 msgid "Edit block"
-msgstr ""
+msgstr "دەستکاری بلۆک"

+ 5 - 2
packages/ckeditor5-ui/src/toolbar/balloon/balloontoolbar.js

@@ -254,9 +254,12 @@ export default class BalloonToolbar extends Plugin {
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	destroy() {
 	destroy() {
-		this._fireSelectionChangeDebounced.cancel();
-		this.stopListening();
 		super.destroy();
 		super.destroy();
+
+		this.stopListening();
+		this._fireSelectionChangeDebounced.cancel();
+		this.toolbarView.destroy();
+		this.focusTracker.destroy();
 	}
 	}
 
 
 	/**
 	/**

+ 12 - 0
packages/ckeditor5-ui/src/toolbar/block/blocktoolbar.js

@@ -150,6 +150,18 @@ export default class BlockToolbar extends Plugin {
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * @inheritDoc
+	 */
+	destroy() {
+		super.destroy();
+
+		// Destroy created UI components as they are not automatically destroyed (see ckeditor5#1341).
+		this.panelView.destroy();
+		this.buttonView.destroy();
+		this.toolbarView.destroy();
+	}
+
 	/**
 	/**
 	 * Creates the {@link #toolbarView}.
 	 * Creates the {@link #toolbarView}.
 	 *
 	 *

+ 5 - 0
packages/ckeditor5-ui/src/view.js

@@ -493,6 +493,11 @@ export default class View {
 		this.stopListening();
 		this.stopListening();
 
 
 		this._viewCollections.map( c => c.destroy() );
 		this._viewCollections.map( c => c.destroy() );
+
+		// Template isn't obligatory for views.
+		if ( this.template && this.template._revertData ) {
+			this.template.revert( this.element );
+		}
 	}
 	}
 
 
 	/**
 	/**

+ 2 - 0
packages/ckeditor5-ui/tests/view.js

@@ -325,6 +325,8 @@ describe( 'View', () => {
 		it( 'can be called multiple times', () => {
 		it( 'can be called multiple times', () => {
 			expect( () => {
 			expect( () => {
 				view.destroy();
 				view.destroy();
+				view.destroy();
+				view.destroy();
 			} ).to.not.throw();
 			} ).to.not.throw();
 		} );
 		} );