mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-10 21:00:59 +01:00
Editor: Prevent adding javascript:
and data:
URLs through the inline link dialog.
Merge of [41393] to the 3.7 branch. Built from https://develop.svn.wordpress.org/branches/3.7@41411 git-svn-id: http://core.svn.wordpress.org/branches/3.7@41244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fe080e84db
commit
86b3a35dd7
@ -164,6 +164,13 @@ var wpLink;
|
||||
|
||||
attrs = wpLink.getAttrs();
|
||||
|
||||
var parser = document.createElement( 'a' );
|
||||
parser.href = attrs.href;
|
||||
|
||||
if ( 'javascript:' === parser.protocol || 'data:' === parser.protocol ) { // jshint ignore:line
|
||||
attrs.href = '';
|
||||
}
|
||||
|
||||
// If there's no href, return.
|
||||
if ( ! attrs.href || attrs.href == 'http://' )
|
||||
return;
|
||||
@ -174,7 +181,7 @@ var wpLink;
|
||||
if ( attrs.title )
|
||||
html += ' title="' + attrs.title + '"';
|
||||
if ( attrs.target )
|
||||
html += ' target="' + attrs.target + '"';
|
||||
html += ' rel="noopener" target="' + attrs.target + '"';
|
||||
|
||||
html += '>';
|
||||
|
||||
@ -221,6 +228,13 @@ var wpLink;
|
||||
tinyMCEPopup.restoreSelection();
|
||||
e = ed.dom.getParent(ed.selection.getNode(), 'A');
|
||||
|
||||
var parser = document.createElement( 'a' );
|
||||
parser.href = attrs.href;
|
||||
|
||||
if ( 'javascript:' === parser.protocol || 'data:' === parser.protocol ) { // jshint ignore:line
|
||||
attrs.href = '';
|
||||
}
|
||||
|
||||
// If the values are empty, unlink and return
|
||||
if ( ! attrs.href || attrs.href == 'http://' ) {
|
||||
if ( e ) {
|
||||
|
2
wp-includes/js/wplink.min.js
vendored
2
wp-includes/js/wplink.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user