Skip to content

Commit

Permalink
fix protocol checkbox to 'false' when url already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
roseline124 committed Aug 16, 2019
1 parent 646c85c commit 8f72620
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/js/base/module/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default class Editor {
} else if (checkProtocol) {
// if url doesn't have any protocol and not even a relative or a label, use http:// as default
linkUrl = /^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/.test(linkUrl)
? linkUrl : 'http://' + linkUrl;
? linkUrl : this.options.defaultProtocol + linkUrl;
}

let anchors = [];
Expand Down
4 changes: 2 additions & 2 deletions src/js/base/module/LinkDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export default class LinkDialog {

$openInNewWindow.prop('checked', isNewWindowChecked);

const useProtocolChecked = linkInfo.checkProtocol !== undefined
? linkInfo.checkProtocol : this.context.options.useProtocol;
const useProtocolChecked = linkInfo.url
? false : this.context.options.useProtocol;

$useProtocol.prop('checked', useProtocolChecked);

Expand Down
1 change: 1 addition & 0 deletions src/js/base/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ $.summernote = $.extend($.summernote, {
height: null,
linkTargetBlank: true,
useProtocol: true,
defaultProtocol: 'http://',

focus: false,
tabSize: 4,
Expand Down

0 comments on commit 8f72620

Please sign in to comment.