Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
[FIXED #60] Issue with Phone Number in Link Dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
w8tcha committed Jun 8, 2019
1 parent e12755f commit 2be5a27
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions CKEditor/plugins/dnnpages/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@
encodedEmailLinkRegex = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,
functionCallProtectedEmailLinkRegex = /^javascript:([^(]+)\(([^)]+)\)$/,
popupRegex = /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,
popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi;
popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi,
telRegex = /^tel:(.*)$/;

var advAttrNames = {
id: 'advId',
Expand Down Expand Up @@ -443,7 +444,7 @@
var href = (element && (element.data('cke-saved-href') || element.getAttribute('href'))) || '',
compiledProtectionFunction = editor.plugins.link.compiledProtectionFunction,
emailProtection = editor.config.emailProtection,
javascriptMatch, emailMatch, anchorMatch, urlMatch,
javascriptMatch, emailMatch, anchorMatch, urlMatch, telMatch,
retval = {};

if ((javascriptMatch = href.match(javascriptProtocolRegex))) {
Expand Down Expand Up @@ -484,6 +485,10 @@
retval.anchor = {};
retval.anchor.name = retval.anchor.id = anchorMatch[1];
}
else if ((telMatch = href.match(telRegex))) {
retval.type = 'tel';
retval.tel = telMatch[1];
}
// Protected email link as encoded string.
else if ((emailMatch = href.match(emailRegex))) {
var subjectMatch = href.match(emailSubjectRegex),
Expand Down Expand Up @@ -663,6 +668,9 @@
}

set['data-cke-saved-href'] = linkHref.join('');
break;
case 'tel':
set['data-cke-saved-href'] = 'tel:' + data.tel;
break;
}

Expand Down Expand Up @@ -861,7 +869,7 @@
var editor = ev.editor;
var linkTypeChanged = function() {
var dialog = this.getDialog();
var partIds = ['urlOptions', 'localPageOptions', 'anchorOptions', 'emailOptions'],
var partIds = ['urlOptions', 'localPageOptions', 'anchorOptions', 'emailOptions', 'telOptions'],
typeValue = this.getValue(),
uploadTab = dialog.definition.getContents('upload'),
uploadInitiallyHidden = uploadTab && uploadTab.hidden;
Expand Down Expand Up @@ -1016,7 +1024,8 @@
[urlTitle, 'url'],
[editor.lang.dnnpages.dnnpages, 'localPage'],
[editor.lang.link.toAnchor, 'anchor'],
[editor.lang.link.toEmail, 'email']
[editor.lang.link.toEmail, 'email'],
[editor.lang.link.toPhone, 'tel']
];
linkType.onChange = linkTypeChanged;
infoTab.add({
Expand Down

0 comments on commit 2be5a27

Please sign in to comment.