Selaa lähdekoodia

Fixed manual test description and Autoformat class docs.

Szymon Kupś 9 vuotta sitten
vanhempi
commit
258b38c1b3

+ 9 - 20
packages/ckeditor5-autoformat/src/autoformat.js

@@ -38,31 +38,22 @@ export default class Autoformat extends Feature {
 	}
 
 	/**
-	 * Adds autoformats related to ListEngine commands.
+	 * Adds autoformatting related to ListEngine commands.
 	 *
 	 * When typed:
-	 *
-	 * 	`* ` or `- `
-	 *		Paragraph will be changed to a bulleted list.
-	 *
-	 * 	`1. ` or `1) `
-	 *		Paragraph will be changed to a numbered list (1 can be any digit or list of digits).
+	 * - `* ` or `- ` - paragraph will be changed to a bulleted list,
+	 * - `1. ` or `1) ` - paragraph will be changed to a numbered list (1 can be any digit or list of digits).
 	 *
 	 * @private
 	 */
 	_addListAutoformats() {
-		// Add support for __foo__ and _foo_
 		new BlockAutoformatEngine( this.editor, /^[\*\-]\s$/, 'bulletedList' );
 		new BlockAutoformatEngine( this.editor, /^\d+[\.|)]?\s$/, 'numberedList' );
 	}
 
 	/**
-	 * Adds autoformats related to HeadingEngine commands.
-	 *
-	 * When typed:
-	 *
-	 * 	`#` or `##` or `###`
-	 *		Paragraph will be changed to a corresponding heading level.
+	 * Adds autoformatting related to HeadingEngine commands.
+	 * When typed `# ` or `## ` or `### ` paragraph will be changed to a corresponding heading level.
 	 *
 	 * @private
 	 */
@@ -82,16 +73,14 @@ export default class Autoformat extends Feature {
 	 * Adds inline autoformatting capabilities to the editor.
 	 *
 	 * When typed:
-	 *
-	 *	`**foobar**`
-	 *		The `**` characters are removed, and `foobar` is set to bold.
-	 *	`*foobar*`
-	 *		The `*` characters are removed, and `foobar` is set to italic.
+	 * - `**foobar**`: `**` characters are removed, and `foobar` is set to bold,
+	 * - `__foobar__`: `__` characters are removed, and `foobar` is set to bold,
+	 * - `*foobar*`: `*` characters are removed, and `foobar` is set to italic,
+	 * - `_foobar_`: `_` characters are removed, and `foobar` is set to italic.
 	 *
 	 * @private
 	 */
 	_addInlineAutoformats() {
-		// Bold text between `**`, e.g. `**text to bold**`.
 		new InlineAutoformatEngine( this.editor, /(\*\*|__)([^\*_]+?)(\*\*|__)$/g, 'bold' );
 		new InlineAutoformatEngine( this.editor, /(?:^|[^\*_])(\*|_)([^\*_]+?)(\*|_)$/g, 'italic' );
 	}

+ 5 - 5
packages/ckeditor5-autoformat/tests/manual/autoformat.md

@@ -3,15 +3,15 @@
 
 ## Autoformat
 
-1. Type `#` and press space to replace current paragraph with the heading.
+1. Type `#` and press space in empty paragraph to replace it with the heading.
 
-2. Type `*` or `-` and press space to replace current paragraph with list item.
+2. Type `*` or `-` and press space in empty paragraph to replace it with list item.
 
-3. Type number from the range **1-3** to replace current paragraph with numbered list item.
+3. Type number from the range **1-3** to replace empty paragraph with numbered list item.
 
-4. Type `*foobar*` to italicize `foobar`. `*` should be removed.
+4. Type `*foobar*`/`_foobar_` to italicize `foobar`. `*`/`_` should be removed.
 
-5. Type `**foobar**` to bold `foobar`. `**` should be removed.
+5. Type `**foobar**`/`__foobar__` to bold `foobar`. `**`/`__` should be removed.
 
 6. For every autoformat pattern: Undo until you'll see just the pattern (e.g. `- `). Typing should be then possible  without triggering autoformatting again.