Parcourir la source

Docs: Autolink guide and API docs corrected. Updated entry in the migration guide. [skip ci]

Kamil Piechaczek il y a 5 ans
Parent
commit
b528524af7

+ 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>Refer to the {@link features/link#autolink-feature Autolink section} of the Link guide to learn more about support for automatic linking in CKEditor 5.</td>
 		</tr>
 		<tr>
 			<td><a href="../../../../ckeditor4/latest/api/CKEDITOR_config.html#cfg-baseFloatZIndex">baseFloatZIndex</a></td>

+ 3 - 2
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>
+	<p>Press <i>Space</i> after a link to see the magic of autolinking: https://ckeditor.com/</p>
+	<p>This feature also works with e-mail addresses: example@example.com</p>
+	<p>You can use <i>Enter</i> or <i>Shift+Enter</i> to achieve the same result: https://ckeditor.com/</p>
 </div>

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

@@ -7,6 +7,8 @@ category: features
 
 The {@link module:link/link~Link} feature brings support for link editing to the rich-text editor. It allows for inserting hyperlinks into the edited content and offers the UI to create and edit them.
 
+After you enable the optional [autolink](#autolink-feature) plugin, typed or pasted URL and e-mail addresses will be automatically turned into working links as you type.
+
 ## Demo
 
 You can edit existing links by clicking them and using the balloon. Use the Link toolbar button or press <kbd>Ctrl/⌘</kbd>+<kbd>K</kbd> to create a new link.
@@ -240,15 +242,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 the editor. The {@link module:link/autolink~AutoLink `AutoLink`} feature will automatically turn URLs or e-mail addresses into real, working links.
+
+To use the autolink function simply press <kbd>Space</kbd>, <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. Refer to the [Installation](#installation) section to learn how to enable it.
 
 ## Installation
 

+ 10 - 10
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 autolinking 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 autolinking on the <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 autolinking on the <kbd>Shift</kbd>+<kbd>Enter</kbd> keyboard shortcut.
 	 *
 	 * @private
 	 */
@@ -184,7 +184,7 @@ export default class AutoLink extends Plugin {
 	}
 
 	/**
-	 * Checks passed range if it contains a linkable text.
+	 * Checks if the passed range contains a linkable text.
 	 *
 	 * @param {module:engine/model/range~Range} rangeToCheck
 	 * @private
@@ -206,10 +206,10 @@ export default class AutoLink extends Plugin {
 	}
 
 	/**
-	 * Applies link on a given range.
+	 * Applies a 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 The text range to apply the link attribute to.
 	 * @private
 	 */
 	_applyAutoLink( url, range ) {