Ver código fonte

Rename restricted mode plugins.

Maciej Gołaszewski 6 anos atrás
pai
commit
d450bca552

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

@@ -1,30 +0,0 @@
-/**
- * @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';
-import RestrictedEditingEditing from './restrictededitingediting';
-import RestrictedEditingUI from './restrictededitingui';
-
-import '../theme/restrictedediting.css';
-
-/**
- * @extends module:core/plugin~Plugin
- */
-export default class RestrictedEditing extends Plugin {
-	/**
-	 * @inheritDoc
-	 */
-	static get pluginName() {
-		return 'RestrictedEditing';
-	}
-
-	static get requires() {
-		return [ RestrictedEditingEditing, RestrictedEditingUI ];
-	}
-}

+ 37 - 0
packages/ckeditor5-restricted-editing/src/restrictedmode.js

@@ -0,0 +1,37 @@
+/**
+ * @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/restrictedmode
+ */
+
+import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
+import RestrictedModeEditing from './restrictedmodeediting';
+import RestrictedModeUI from './restrictedmodeui';
+
+import '../theme/restrictedediting.css';
+
+/**
+ * The restricted mode plugin.
+ *
+ * This is a "glue" plugin which loads the following plugins:
+ *
+ * * The restricted mode editing feature and
+ * * The restricted mode ui feature.
+ *
+ * @extends module:core/plugin~Plugin
+ */
+export default class RestrictedMode extends Plugin {
+	/**
+	 * @inheritDoc
+	 */
+	static get pluginName() {
+		return 'RestrictedMode';
+	}
+
+	static get requires() {
+		return [ RestrictedModeEditing, RestrictedModeUI ];
+	}
+}

+ 4 - 4
packages/ckeditor5-restricted-editing/src/restrictededitingediting.js

@@ -4,12 +4,12 @@
  */
 
 /**
- * @module restricted-editing/restrictededitingediting
+ * @module restricted-editing/restrictedmodeediting
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
 import Matcher from '@ckeditor/ckeditor5-engine/src/view/matcher';
-import RestrictedEditingNavigationCommand from './restrictededitingnavigationcommand';
+import RestrictedEditingNavigationCommand from './restrictedmodenavigationcommand';
 
 const HIGHLIGHT_CLASS = 'ck-restricted-editing-exception_selected';
 
@@ -22,12 +22,12 @@ const HIGHLIGHT_CLASS = 'ck-restricted-editing-exception_selected';
  *
  * @extends module:core/plugin~Plugin
  */
-export default class RestrictedEditingEditing extends Plugin {
+export default class RestrictedModeEditing extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
 	static get pluginName() {
-		return 'RestrictedEditingEditing';
+		return 'RestrictedModeEditing';
 	}
 
 	/**

+ 2 - 2
packages/ckeditor5-restricted-editing/src/restrictededitingnavigationcommand.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module restricted-editing/restrictededitingnavigationcommand
+ * @module restricted-editing/restrictedmodenavigationcommand
  */
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
@@ -14,7 +14,7 @@ import Command from '@ckeditor/ckeditor5-core/src/command';
  *
  * @extends module:core/command~Command
  */
-export default class RestrictedEditingNavigationCommand extends Command {
+export default class RestrictedModeNavigationCommand extends Command {
 	/**
 	 * Creates an instance of the command.
 	 *

+ 3 - 3
packages/ckeditor5-restricted-editing/src/restrictededitingui.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module restricted-editing/restrictededitingui
+ * @module restricted-editing/restrictedmodeui
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
@@ -21,12 +21,12 @@ import Collection from '@ckeditor/ckeditor5-utils/src/collection';
  *
  * @extends module:core/plugin~Plugin
  */
-export default class RestrictedEditingUI extends Plugin {
+export default class RestrictedModeUI extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
 	static get pluginName() {
-		return 'RestrictedEditingUI';
+		return 'RestrictedModeUI';
 	}
 
 	/**

+ 2 - 2
packages/ckeditor5-restricted-editing/tests/manual/restrictedediting.js

@@ -10,7 +10,7 @@ import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articleplugi
 import Table from '@ckeditor/ckeditor5-table/src/table';
 
 import RestrictedEditingException from '../../src/restrictededitingexception';
-import RestrictedEditing from '../../src/restrictedediting';
+import RestrictedMode from '../../src/restrictedmode';
 
 const restrictedModeButton = document.getElementById( 'mode-restricted' );
 const standardModeButton = document.getElementById( 'mode-standard' );
@@ -55,7 +55,7 @@ async function startStandardMode() {
 
 async function startRestrictedMode() {
 	await reloadEditor( {
-		plugins: [ ArticlePluginSet, Table, RestrictedEditing ],
+		plugins: [ ArticlePluginSet, Table, RestrictedMode ],
 		toolbar: [ 'bold', 'italic', 'link', '|', 'restrictedEditing', '|', 'undo', 'redo' ]
 	} );
 }

+ 10 - 10
packages/ckeditor5-restricted-editing/tests/restrictedediting.js

@@ -8,11 +8,11 @@
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 
-import RestrictedEditing from './../src/restrictedediting';
-import RestrictedEditingUI from './../src/restrictededitingui';
-import RestrictedEditingEditing from './../src/restrictededitingediting';
+import RestrictedMode from './../src/restrictedmode';
+import RestrictedModeUI from './../src/restrictedmodeui';
+import RestrictedModeEditing from './../src/restrictedmodeediting';
 
-describe( 'RestrictedEditing', () => {
+describe( 'RestrictedMode', () => {
 	let editor, element;
 
 	testUtils.createSinonSandbox();
@@ -21,7 +21,7 @@ describe( 'RestrictedEditing', () => {
 		element = document.createElement( 'div' );
 		document.body.appendChild( element );
 
-		editor = await ClassicTestEditor.create( element, { plugins: [ RestrictedEditing ] } );
+		editor = await ClassicTestEditor.create( element, { plugins: [ RestrictedMode ] } );
 	} );
 
 	afterEach( () => {
@@ -31,14 +31,14 @@ describe( 'RestrictedEditing', () => {
 	} );
 
 	it( 'should be named', () => {
-		expect( RestrictedEditing.pluginName ).to.equal( 'RestrictedEditing' );
+		expect( RestrictedMode.pluginName ).to.equal( 'RestrictedMode' );
 	} );
 
-	it( 'should load the RestrictedEditingEditing plugin', () => {
-		expect( editor.plugins.get( RestrictedEditingEditing ) ).to.be.instanceOf( RestrictedEditingEditing );
+	it( 'should load the RestrictedModeEditing plugin', () => {
+		expect( editor.plugins.get( RestrictedModeEditing ) ).to.be.instanceOf( RestrictedModeEditing );
 	} );
 
-	it( 'should load the RestrictedEditingUI plugin', () => {
-		expect( editor.plugins.get( RestrictedEditingUI ) ).to.be.instanceOf( RestrictedEditingUI );
+	it( 'should load the RestrictedModeUI plugin', () => {
+		expect( editor.plugins.get( RestrictedModeUI ) ).to.be.instanceOf( RestrictedModeUI );
 	} );
 } );

+ 3 - 3
packages/ckeditor5-restricted-editing/tests/restrictedediting-commands.js

@@ -10,7 +10,7 @@ import Typing from '@ckeditor/ckeditor5-typing/src/typing';
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
-import RestrictedEditingEditing from './../src/restrictededitingediting';
+import RestrictedModeEditing from './../src/restrictedmodeediting';
 import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
 
 describe( 'RestrictedEditingEditing - commands', () => {
@@ -22,7 +22,7 @@ describe( 'RestrictedEditingEditing - commands', () => {
 		let model, firstParagraph;
 
 		beforeEach( async () => {
-			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, RestrictedEditingEditing ] } );
+			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, RestrictedModeEditing ] } );
 			model = editor.model;
 
 			setModelData( model, '<paragraph>[]foo bar baz</paragraph>' );
@@ -549,7 +549,7 @@ describe( 'RestrictedEditingEditing - commands', () => {
 		let model, firstParagraph;
 
 		beforeEach( async () => {
-			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, UndoEditing, RestrictedEditingEditing ] } );
+			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, UndoEditing, RestrictedModeEditing ] } );
 			model = editor.model;
 
 			setModelData( model, '<paragraph>[]foo bar baz</paragraph>' );

+ 14 - 13
packages/ckeditor5-restricted-editing/tests/restrictededitingediting.js

@@ -5,8 +5,6 @@
 
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
-import RestrictedEditingEditing from './../src/restrictededitingediting';
-import RestrictedEditingNavigationCommand from '../src/restrictededitingnavigationcommand';
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
@@ -17,14 +15,17 @@ import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils'
 import Typing from '@ckeditor/ckeditor5-typing/src/typing';
 import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
 
-describe( 'RestrictedEditingEditing', () => {
+import RestrictedModeEditing from './../src/restrictedmodeediting';
+import RestrictedModeNavigationCommand from '../src/restrictedmodenavigationcommand';
+
+describe( 'RestrictedModeEditing', () => {
 	let editor;
 
 	testUtils.createSinonSandbox();
 
 	describe( 'plugin', () => {
 		beforeEach( async () => {
-			editor = await VirtualTestEditor.create( { plugins: [ RestrictedEditingEditing ] } );
+			editor = await VirtualTestEditor.create( { plugins: [ RestrictedModeEditing ] } );
 		} );
 
 		afterEach( async () => {
@@ -32,19 +33,19 @@ describe( 'RestrictedEditingEditing', () => {
 		} );
 
 		it( 'should be named', () => {
-			expect( RestrictedEditingEditing.pluginName ).to.equal( 'RestrictedEditingEditing' );
+			expect( RestrictedModeEditing.pluginName ).to.equal( 'RestrictedModeEditing' );
 		} );
 
 		it( 'should be loaded', () => {
-			expect( editor.plugins.get( RestrictedEditingEditing ) ).to.be.instanceOf( RestrictedEditingEditing );
+			expect( editor.plugins.get( RestrictedModeEditing ) ).to.be.instanceOf( RestrictedModeEditing );
 		} );
 
 		it( 'adds a "goToPreviousRestrictedEditingRegion" command', () => {
-			expect( editor.commands.get( 'goToPreviousRestrictedEditingRegion' ) ).to.be.instanceOf( RestrictedEditingNavigationCommand );
+			expect( editor.commands.get( 'goToPreviousRestrictedEditingRegion' ) ).to.be.instanceOf( RestrictedModeNavigationCommand );
 		} );
 
 		it( 'adds a "goToNextRestrictedEditingRegion" command', () => {
-			expect( editor.commands.get( 'goToNextRestrictedEditingRegion' ) ).to.be.instanceOf( RestrictedEditingNavigationCommand );
+			expect( editor.commands.get( 'goToNextRestrictedEditingRegion' ) ).to.be.instanceOf( RestrictedModeNavigationCommand );
 		} );
 	} );
 
@@ -52,7 +53,7 @@ describe( 'RestrictedEditingEditing', () => {
 		let model;
 
 		beforeEach( async () => {
-			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, RestrictedEditingEditing ] } );
+			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, RestrictedModeEditing ] } );
 			model = editor.model;
 		} );
 
@@ -144,7 +145,7 @@ describe( 'RestrictedEditingEditing', () => {
 		let model;
 
 		beforeEach( async () => {
-			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, RestrictedEditingEditing ] } );
+			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, RestrictedModeEditing ] } );
 			model = editor.model;
 		} );
 
@@ -329,7 +330,7 @@ describe( 'RestrictedEditingEditing', () => {
 		let model, viewDoc;
 
 		beforeEach( async () => {
-			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, Clipboard, RestrictedEditingEditing ] } );
+			editor = await VirtualTestEditor.create( { plugins: [ Paragraph, Typing, Clipboard, RestrictedModeEditing ] } );
 			model = editor.model;
 			viewDoc = editor.editing.view.document;
 		} );
@@ -387,7 +388,7 @@ describe( 'RestrictedEditingEditing', () => {
 
 		beforeEach( async () => {
 			editor = await VirtualTestEditor.create( {
-				plugins: [ Paragraph, RestrictedEditingEditing, BoldEditing ]
+				plugins: [ Paragraph, RestrictedModeEditing, BoldEditing ]
 			} );
 			model = editor.model;
 			view = editor.editing.view;
@@ -620,7 +621,7 @@ describe( 'RestrictedEditingEditing', () => {
 
 		beforeEach( async () => {
 			editor = await VirtualTestEditor.create( {
-				plugins: [ Paragraph, RestrictedEditingEditing, BoldEditing ]
+				plugins: [ Paragraph, RestrictedModeEditing, BoldEditing ]
 			} );
 
 			model = editor.model;

+ 4 - 4
packages/ckeditor5-restricted-editing/tests/restrictededitingnavigationcommand.js

@@ -6,9 +6,9 @@
 import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
 import { setData as setModelData, getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
-import RestrictedEditingNavigationCommand from '../src/restrictededitingnavigationcommand';
+import RestrictedModeNavigationCommand from '../src/restrictedmodenavigationcommand';
 
-describe( 'RestrictedEditingNavigationCommand', () => {
+describe( 'RestrictedModeNavigationCommand', () => {
 	let editor, forwardCommand, backwardCommand, model;
 
 	beforeEach( () => {
@@ -18,8 +18,8 @@ describe( 'RestrictedEditingNavigationCommand', () => {
 				editor = newEditor;
 				model = editor.model;
 
-				forwardCommand = new RestrictedEditingNavigationCommand( editor, 'forward' );
-				backwardCommand = new RestrictedEditingNavigationCommand( editor, 'backward' );
+				forwardCommand = new RestrictedModeNavigationCommand( editor, 'forward' );
+				backwardCommand = new RestrictedModeNavigationCommand( editor, 'backward' );
 
 				model.schema.register( 'paragraph', { inheritAllFrom: '$block' } );
 				editor.model.schema.extend( '$text', { allowAttributes: [ 'restrictedEditingException' ] } );

+ 13 - 17
packages/ckeditor5-restricted-editing/tests/restrictededitingui.js

@@ -8,44 +8,40 @@
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 
-import RestrictedEditingEditing from './../src/restrictededitingediting';
-import RestrictedEditingUI from './../src/restrictededitingui';
+import RestrictedModeEditing from './../src/restrictedmodeediting';
+import RestrictedModeUI from './../src/restrictedmodeui';
 import lockIcon from '../theme/icons/contentlock.svg';
 
-describe( 'RestrictedEditingUI', () => {
+describe( 'RestrictedModeUI', () => {
 	let editor, element, goToPreviousCommand, goToNextCommand;
 
 	testUtils.createSinonSandbox();
 
-	beforeEach( () => {
+	beforeEach( async () => {
 		element = document.createElement( 'div' );
 		document.body.appendChild( element );
 
-		return ClassicTestEditor
-			.create( element, {
-				plugins: [ RestrictedEditingEditing, RestrictedEditingUI ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
+		editor = await ClassicTestEditor.create( element, {
+			plugins: [ RestrictedModeEditing, RestrictedModeUI ]
+		} );
 
-				goToPreviousCommand = editor.commands.get( 'goToPreviousRestrictedEditingRegion' );
-				goToNextCommand = editor.commands.get( 'goToNextRestrictedEditingRegion' );
-			} );
+		goToPreviousCommand = editor.commands.get( 'goToPreviousRestrictedEditingRegion' );
+		goToNextCommand = editor.commands.get( 'goToNextRestrictedEditingRegion' );
 	} );
 
-	afterEach( () => {
+	afterEach( async () => {
 		element.remove();
 
-		return editor.destroy();
+		await editor.destroy();
 	} );
 
 	describe( 'plugin', () => {
 		it( 'should be named', () => {
-			expect( RestrictedEditingUI.pluginName ).to.equal( 'RestrictedEditingUI' );
+			expect( RestrictedModeUI.pluginName ).to.equal( 'RestrictedModeUI' );
 		} );
 
 		it( 'should be loaded', () => {
-			expect( editor.plugins.get( RestrictedEditingUI ) ).to.be.instanceOf( RestrictedEditingUI );
+			expect( editor.plugins.get( RestrictedModeUI ) ).to.be.instanceOf( RestrictedModeUI );
 		} );
 	} );