Skip to content

Commit 82404ac

Browse files
committed
Merge pull request jhollingworth#215 from koroban/master
New Link with target
2 parents 8d9e633 + 43de967 commit 82404ac

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/bootstrap-wysihtml5.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"</div>" +
5151
"<div class='modal-body'>" +
5252
"<input value='http://' class='bootstrap-wysihtml5-insert-link-url input-xlarge'>" +
53+
"<label class='checkbox'> <input type='checkbox' class='bootstrap-wysihtml5-insert-link-target' checked>" + locale.link.target + "</label>" +
5354
"</div>" +
5455
"<div class='modal-footer'>" +
5556
"<a href='#' class='btn' data-dismiss='modal'>" + locale.link.cancel + "</a>" +
@@ -282,6 +283,7 @@
282283
var self = this;
283284
var insertLinkModal = toolbar.find('.bootstrap-wysihtml5-insert-link-modal');
284285
var urlInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-url');
286+
var targetInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-target');
285287
var insertButton = insertLinkModal.find('a.btn-primary');
286288
var initialValue = urlInput.val();
287289
var caretBookmark;
@@ -294,10 +296,12 @@
294296
self.editor.composer.selection.setBookmark(caretBookmark);
295297
caretBookmark = null;
296298
}
299+
300+
var newWindow = targetInput.prop("checked");
297301
self.editor.composer.commands.exec("createLink", {
298-
href: url,
299-
target: "_blank",
300-
rel: "nofollow"
302+
'href' : url,
303+
'target' : (newWindow ? '_blank' : '_self'),
304+
'rel' : (newWindow ? 'nofollow' : '')
301305
});
302306
};
303307
var pressedEnter = false;
@@ -427,12 +431,10 @@
427431
}
428432
},
429433
"a": {
430-
set_attributes: {
431-
target: "_blank",
432-
rel: "nofollow"
433-
},
434434
check_attributes: {
435-
href: "url" // important to avoid XSS
435+
'href': "url", // important to avoid XSS
436+
'target': 'alt',
437+
'rel': 'alt'
436438
}
437439
},
438440
"span": 1,
@@ -471,7 +473,8 @@
471473
},
472474
link: {
473475
insert: "Insert link",
474-
cancel: "Cancel"
476+
cancel: "Cancel",
477+
target: "Open link in new window"
475478
},
476479
image: {
477480
insert: "Insert image",

src/locales/bootstrap-wysihtml5.de-DE.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
},
2323
link: {
2424
insert: "Link einfügen",
25-
cancel: "Abbrechen"
25+
cancel: "Abbrechen",
26+
target: "Link in neuen Fenster öffnen"
2627
},
2728
image: {
2829
insert: "Bild einfügen",

0 commit comments

Comments
 (0)