Kaynağa Gözat

Docs: Basic docs cleanup, added guide for the remove format feature.

Marek Lewandowski 6 yıl önce
ebeveyn
işleme
1f86640363

+ 0 - 0
packages/ckeditor5-remove-format/docs/_snippets/features/build-remove-format-source.html


+ 13 - 0
packages/ckeditor5-remove-format/docs/_snippets/features/build-remove-format-source.js

@@ -0,0 +1,13 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals window */
+
+import ClassicEditor from '@ckeditor/ckeditor5-build-classic/src/ckeditor';
+import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat';
+
+ClassicEditor.builtinPlugins.push( RemoveFormat );
+
+window.ClassicEditor = ClassicEditor;

+ 5 - 0
packages/ckeditor5-remove-format/docs/_snippets/features/remove-format.html

@@ -0,0 +1,5 @@
+<div id="editor">
+	<p>
+		Some text with <strong>bold text</strong>.
+	</p>
+</div>

+ 20 - 0
packages/ckeditor5-remove-format/docs/_snippets/features/remove-format.js

@@ -0,0 +1,20 @@
+/**
+ * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals ClassicEditor, console, window, document */
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		toolbar: {
+			items: [ 'removeformat', 'italic', 'bold', 'link', '|', 'undo', 'redo' ],
+			viewportTopOffset: window.getViewportTopOffsetConfig()
+		}
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 34 - 0
packages/ckeditor5-remove-format/docs/api/remove-format.md

@@ -0,0 +1,34 @@
+---
+category: api-reference
+---
+
+# CKEditor 5 remove format feature
+
+[![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-remove-format.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-remove-format)
+
+This package implements the remove format feature for CKEditor 5.
+
+## Demo
+
+Check out the {@link features/remove-format#demo demo in the Text remove-format feature} guide.
+
+## Documentation
+
+See the {@link features/remove-format Text remove-format feature} guide and the {@link module:removeformat/removeformat~RemoveFormat} plugin documentation.
+
+## Installation
+
+```bash
+npm install --save @ckeditor/ckeditor5-remove-format
+```
+
+## Contribute
+
+The source code of this package is available on GitHub in https://github.com/ckeditor/ckeditor5-remove-format.
+
+## External links
+
+* [`@ckeditor/ckeditor5-remove-format` on npm](https://www.npmjs.com/package/@ckeditor/ckeditor5-remove-format)
+* [`ckeditor/ckeditor5-remove-format` on GitHub](https://github.com/ckeditor/ckeditor5-remove-format)
+* [Issue tracker](https://github.com/ckeditor/ckeditor5-remove-format/issues)
+* [Changelog](https://github.com/ckeditor/ckeditor5-remove-format/blob/master/CHANGELOG.md)

+ 18 - 0
packages/ckeditor5-remove-format/docs/features/remove-format.md

@@ -0,0 +1,18 @@
+---
+title: Remove Format
+category: features
+---
+
+The {@link module:removeformat/removeformat~RemoveFormat} feature allow to easily remove any formatting.
+
+Since it only clears formatting markup, this means that items like links, tables or images will not be removed.
+
+{@snippet features/build-remove-format-source}
+
+## Demo
+
+{@snippet features/remove-format}
+
+## Configuring the remove format feature
+
+Elements considered by remove format feature are determined by schema. Only elements marked with `isFormatting` property are removed by the remove format feature.

+ 1 - 1
packages/ckeditor5-remove-format/src/removeformat.js

@@ -15,7 +15,7 @@ import RemoveFormatCommand from './removeformatcommand';
 /**
  * The remove format plugin.
  *
- * For a detailed overview, check the {@glink features/removeformat Remove Format feature} documentation.
+ * For a detailed overview, check the {@glink features/remove-format Remove Format feature} documentation.
  *
  * This is a "glue" plugin which loads logic and UI of the remove format plugin.
  *

+ 2 - 5
packages/ckeditor5-remove-format/src/removeformatcommand.js

@@ -55,14 +55,11 @@ export default class RemoveFormatCommand extends Command {
 	}
 
 	/**
-	 * Yields elements from a selection range that contains styles to be removed by remove format feature.
-	 *
-	 * Finds any stylable items (including selection itself) in a given selection that contains any formatting that
-	 * could be removed by remove format feature.
+	 * Yields items from a selection (including selection itself) that contains styles to be removed by the remove format feature.
 	 *
 	 * @protected
 	 * @param {module:engine/model/documentselection~DocumentSelection} selection
-	 * @returns {Iterable.<module:engine/model/item~Item>|module:engine/model/documentselection~DocumentSelection}
+	 * @returns {Iterable.<module:engine/model/item~Item>|Iterable.<module:engine/model/documentselection~DocumentSelection>}
 	 */
 	* _getStylableElements( selection ) {
 		for ( const curRange of selection.getRanges() ) {

+ 1 - 1
packages/ckeditor5-remove-format/src/removeformatui.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module highlight/removeformatui
+ * @module removeformat/removeformatui
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';