-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3421 from ckeditor/t/2227
Add link protocol field customization
- Loading branch information
Showing
6 changed files
with
89 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,17 @@ | |
linkPhoneRegExp: /^[0-9]{9}$/, | ||
linkPhoneMsg: 'Invalid number' | ||
} | ||
}, | ||
customProtocol: { | ||
config: { | ||
linkDefaultProtocol: 'https://' | ||
} | ||
}, | ||
|
||
otherProtocol: { | ||
config: { | ||
linkDefaultProtocol: '' | ||
} | ||
} | ||
}; | ||
|
||
|
@@ -627,7 +638,27 @@ | |
|
||
'test email address with "?" in domain': assertEmail( 'mailto:?ck?editor@cksou?rce.com' ), | ||
|
||
'test email address with "?" and arguments': assertEmail( 'mailto:[email protected]?subject=cke4&body=hello' ) | ||
'test email address with "?" and arguments': assertEmail( 'mailto:[email protected]?subject=cke4&body=hello' ), | ||
|
||
// (#2227) | ||
'test custom URL protocol': function() { | ||
var bot = this.editorBots.customProtocol; | ||
|
||
bot.dialog( 'link', function( dialog ) { | ||
assert.areEqual( 'https://', dialog.getContentElement( 'info', 'protocol' ).getValue() ); | ||
dialog.hide(); | ||
} ); | ||
}, | ||
|
||
// (#2227) | ||
'test other URL protocol': function() { | ||
var bot = this.editorBots.otherProtocol; | ||
|
||
bot.dialog( 'link', function( dialog ) { | ||
assert.areEqual( '', dialog.getContentElement( 'info', 'protocol' ).getValue() ); | ||
dialog.hide(); | ||
} ); | ||
} | ||
} ); | ||
|
||
function assertEmail( link ) { | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h2>First editor</h2> | ||
<div id="editor1"></div> | ||
|
||
<h2>Second editor</h2> | ||
<div id="editor2"</div> | ||
|
||
<script> | ||
CKEDITOR.replace( 'editor1', { | ||
linkDefaultProtocol: 'https://' | ||
} ); | ||
|
||
CKEDITOR.replace( 'editor2', { | ||
linkDefaultProtocol: 'https://' | ||
} ); | ||
</script> |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@bender-tags: feature, link, 2227, 4.13.0 | ||
@bender-ckeditor-plugins: link, toolbar, wysiwygarea | ||
@bender-ui: collapsed | ||
|
||
1. Click link button in the first editor. | ||
|
||
**Expected:** Protocol set to `https://`. | ||
|
||
2. Change protocol into `http://`. | ||
3. Fill URL field with `foo`. | ||
4. Click `OK`. | ||
5. Double click inserted link to open dialog. | ||
|
||
**Expected**: Link protocol remains `http://`. | ||
|
||
6. Repeat 1-5 test steps with the second editor using `<other>` protocol instead of `http://`. |