-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
2,501 additions
and
1,456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,6 +147,30 @@ ClassicEditor | |
.catch( ... ); | ||
``` | ||
|
||
#### Adding default link protocol for the external links | ||
|
||
Default link protocol can be usefull when user forget to type a full URL address to an external source, site etc. Sometimes copying the text, like for example `ckeditor.com` and converting it to a link may cause some issues. When you do this, the created link will direct you to `yourdomain.com/ckeditor.com`, because you forgot to pass the right protocol which makes the link relative to the site where it appears. | ||
|
||
Enabling the `{@link module:link/link~LinkConfig#defaultProtocol config.link.defaultProtocol}`, the {@link module:link/link~Link} feature will handle this issue for you. By default it doesn't fix the passed link value, but when you set `{@link module:link/link~LinkConfig#defaultProtocol config.link.defaultProtocol}` to — for example — `http://`, the plugin will add the given protocol to the every link that may need it (like `ckeditor.com`, `example.com` etc. where `[protocol://]example.com` is missing). Here's the basic configuration example: | ||
|
||
```js | ||
ClassicEditor | ||
.create( document.querySelector( '#editor' ), { | ||
// ... | ||
link: { | ||
defaultProtocol: 'http://' | ||
} | ||
} ) | ||
.then( ... ) | ||
.catch( ... ); | ||
``` | ||
|
||
<info-box> | ||
Having `config.link.defaultProtocol` enabled you are still able to link things locally using `#` or `/`. Protocol won't be added to those links. | ||
|
||
Enabled feature also gives you an **email addresses auto-detection** feature. When you submit `[email protected]`, the plugin will change it automatically to `mailto:[email protected]`. | ||
</info-box> | ||
|
||
#### Adding attributes to links based on pre–defined rules (automatic decorators) | ||
|
||
Automatic link decorators match all links in the editor content against a {@link module:link/link~LinkDecoratorAutomaticDefinition function} which decides whether the link should receive some set of attributes, considering the URL (`href`) of the link. These decorators work silently and are being applied during the {@link framework/guides/architecture/editing-engine#conversion data downcast} only. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,28 @@ export default class Link extends Plugin { | |
* @interface LinkConfig | ||
*/ | ||
|
||
/** | ||
* When set, the editor will add the given protocol to the link when the user creates a link without one. | ||
* For example, when the user is creating a link and types `ckeditor.com` in the link form input — during link submission — | ||
* the editor will automatically add the `http://` protocol, so the link will be as follows: `http://ckeditor.com`. | ||
* | ||
* The feature also comes with an email auto-detection. When you submit `[email protected]` | ||
* the plugin will automatically change it to `mailto:[email protected]`. | ||
* | ||
* ClassicEditor | ||
* .create( editorElement, { | ||
* link: { | ||
* defaultProtocol: 'http://' | ||
* } | ||
* } ) | ||
* .then( ... ) | ||
* .catch( ... ); | ||
* | ||
* **NOTE:** In case no configuration is provided, the editor won't auto-fix the links. | ||
* | ||
* @member {String} module:link/link~LinkConfig#defaultProtocol | ||
*/ | ||
|
||
/** | ||
* When set to `true`, the `target="blank"` and `rel="noopener noreferrer"` attributes are automatically added to all external links | ||
* in the editor. "External links" are all links in the editor content starting with `http`, `https`, or `//`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.