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

Add restricted editing plugin.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
2c414890db

+ 22 - 0
packages/ckeditor5-restricted-editing/src/restrictedediting.js

@@ -0,0 +1,22 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/**
+ * @module restricted-editing/restrictedediting
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+
+/**
+ * @extends module:core/plugin~Plugin
+ */
+export default class RestrictedEditing extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	static get pluginName() {
+		return 'RestrictedEditing';
+	}
+}

+ 38 - 0
packages/ckeditor5-restricted-editing/tests/restrictedediting.js

@@ -0,0 +1,38 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
+ */
+
+/* global document */
+
+import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+
+import RestrictedEditing from './../src/restrictedediting';
+
+describe( 'RestrictedEditing', () => {
+	let editor, element;
+
+	testUtils.createSinonSandbox();
+
+	beforeEach( async () => {
+		element = document.createElement( 'div' );
+		document.body.appendChild( element );
+
+		editor = await ClassicTestEditor.create( element, { plugins: [ RestrictedEditing ] } );
+	} );
+
+	afterEach( () => {
+		element.remove();
+
+		return editor.destroy();
+	} );
+
+	it( 'should be named', () => {
+		expect( RestrictedEditing.pluginName ).to.equal( 'RestrictedEditing' );
+	} );
+
+	it( 'should be loaded', () => {
+		expect( editor.plugins.get( RestrictedEditing ) ).to.be.instanceOf( RestrictedEditing );
+	} );
+} );