Bladeren bron

Merge pull request #280 from ckeditor/t/ckeditor5/1660

Internal: Added version checking to plenty of modules by adding it to the one of the most generic `EmitterMixin` module. Closes https://github.com/ckeditor/ckeditor5/issues/1660.
Piotr Jasiun 6 jaren geleden
bovenliggende
commit
83ec6345a1

+ 3 - 0
packages/ckeditor5-utils/src/emittermixin.js

@@ -11,6 +11,9 @@ import EventInfo from './eventinfo';
 import uid from './uid';
 import priorities from './priorities';
 
+// To check if component is loaded more than once.
+import './version';
+
 const _listeningTo = Symbol( 'listeningTo' );
 const _emitterId = Symbol( 'emitterId' );
 

+ 1 - 0
packages/ckeditor5-utils/tests/manual/duplicated-import/duplicated-import.html

@@ -0,0 +1 @@
+<div id="editor"></div>

+ 14 - 0
packages/ckeditor5-utils/tests/manual/duplicated-import/duplicated-import.js

@@ -0,0 +1,14 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* global document, console */
+
+import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
+
+import '@ckeditor/ckeditor5-core/src/editor/editor';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {} )
+	.catch( e => console.error( e ) );

+ 3 - 0
packages/ckeditor5-utils/tests/manual/duplicated-import/duplicated-import.md

@@ -0,0 +1,3 @@
+## Duplicated `core/editor/editor~Editor`
+
+Check the browser console, you should see the error about incorrect build.