Selaa lähdekoodia

Docs: Autoling guide and API docs corrected. [skip ci]

godai78 5 vuotta sitten
vanhempi
commit
7fd013c562

+ 1 - 1
docs/builds/guides/migrate.md

@@ -118,7 +118,7 @@ Note: The number of options was reduced on purpose. We understood that configuri
 		</tr>
 		<tr>
 			<td><a href="../../../../ckeditor4/latest/api/CKEDITOR_config.html#cfg-autolink_commitKeystrokes">autolink_commitKeystrokes</a> <br> <a href="../../../../ckeditor4/latest/api/CKEDITOR_config.html#cfg-autolink_emailRegex">autolink_emailRegex</a> <br> <a href="../../../../ckeditor4/latest/api/CKEDITOR_config.html#cfg-autolink_urlRegex">autolink_urlRegex</a></td>
-			<td>N/A</td>
+			<td>Now covered by the new {@link features/link#autolink-feature autolink feature}.</td>
 		</tr>
 		<tr>
 			<td><a href="../../../../ckeditor4/latest/api/CKEDITOR_config.html#cfg-baseFloatZIndex">baseFloatZIndex</a></td>

+ 4 - 3
packages/ckeditor5-link/docs/_snippets/features/autolink.html

@@ -1,4 +1,5 @@
 <div id="snippet-autolink">
-	<p>Type space, or Enter or Shift+Enter after a link: https://ckeditor.com</p>
-	<p>Will link to E-mail addresses also: example@example.com</p>
-</div>
+	<p>Type <kbd>Space</kbd> after a link to see the magic of autolink: https://ckeditor.com</p>
+	<p>This function will link to e-mail addresses too: example@example.com</p>
+	<p>You can also use <kbd>Enter</kbd> or <kbd>Shift</kbd>+<kbd>Enter</kbd> to achieve the same result: https://ckeditor.com</p>
+</div>

+ 5 - 3
packages/ckeditor5-link/docs/features/link.md

@@ -240,15 +240,17 @@ ClassicEditor
 
 ## Autolink feature
 
-You can enable automatic linking of URLs typed or pasted into editor. The {@link module:link/autolink~AutoLink `AutoLink`} feature will automatically add turn URLs or e-mail addresses into real links.
+You can enable automatic linking of URLs typed or pasted into editor. The {@link module:link/autolink~AutoLink `AutoLink`} feature will automatically turn URLs or e-mail addresses into real links.
+
+To use the autolink function simply type <kbd>Space</kbd>, or <kbd>Enter</kbd> or <kbd>Shift</kbd>+<kbd>Enter</kbd> after a link.
 
 <info-box>
-	Autolink action can always be reverted by the undo feature (<kbd>CTRL</kbd>+<kbd>Z</kbd>).
+	Autolink action can always be reverted by the undo feature (<kbd>Ctrl/⌘</kbd>+<kbd>Z</kbd>).
 </info-box>
 
 {@snippet features/autolink}
 
-The `Autolink` plugin is not available in any of the builds. See the [Installation](#installation) section to learn how to enable it.
+Unlike the base link feature the `Autolink` plugin is not available in any of the builds. See the [Installation](#installation) section to learn how to enable it.
 
 ## Installation
 

+ 8 - 8
packages/ckeditor5-link/src/autolink.js

@@ -53,7 +53,7 @@ const URL_GROUP_IN_MATCH = 2;
 const EMAIL_REG_EXP = /^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i;
 
 /**
- * The auto link plugin.
+ * The autolink plugin.
  *
  * @extends module:core/plugin~Plugin
  */
@@ -89,7 +89,7 @@ export default class AutoLink extends Plugin {
 	}
 
 	/**
-	 * Enables auto-link on typing.
+	 * Enables autolink on typing.
 	 *
 	 * @private
 	 */
@@ -97,12 +97,12 @@ export default class AutoLink extends Plugin {
 		const editor = this.editor;
 
 		const watcher = new TextWatcher( editor.model, text => {
-			// 1. Detect "space" after a text with a potential link.
+			// 1. Detect "Space" after a text with a potential link.
 			if ( !isSingleSpaceAtTheEnd( text ) ) {
 				return;
 			}
 
-			// 2. Check text before last typed "space".
+			// 2. Check text before last typed "Space".
 			const url = getUrlAtTextEnd( text.substr( 0, text.length - 1 ) );
 
 			if ( url ) {
@@ -131,7 +131,7 @@ export default class AutoLink extends Plugin {
 	}
 
 	/**
-	 * Enables auto-link on <kbd>enter</kbd> key.
+	 * Enables autolink on <kbd>Enter</kbd> key.
 	 *
 	 * @private
 	 */
@@ -157,7 +157,7 @@ export default class AutoLink extends Plugin {
 	}
 
 	/**
-	 * Enables auto-link on <kbd>shift</kbd>+<kbd>enter</kbd> key.
+	 * Enables autolink on <kbd>Shift</kbd>+<kbd>Enter</kbd> key.
 	 *
 	 * @private
 	 */
@@ -208,8 +208,8 @@ export default class AutoLink extends Plugin {
 	/**
 	 * Applies link on a given range.
 	 *
-	 * @param {String} url URL to link.
-	 * @param {module:engine/model/range~Range} range Text range to apply link attribute.
+	 * @param {String} url The URL to link.
+	 * @param {module:engine/model/range~Range} range Text range to apply the link attribute to.
 	 * @private
 	 */
 	_applyAutoLink( url, range ) {