Editor: manually trigger `change` event when text is modified from JS.
Props westonruter. Fixes #40726. Built from https://develop.svn.wordpress.org/trunk@40615 git-svn-id: http://core.svn.wordpress.org/trunk@40485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
59c721dda0
commit
57ef33fa2a
|
@ -406,7 +406,7 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
|||
};
|
||||
|
||||
qt.insertContent = function(content) {
|
||||
var sel, startPos, endPos, scrollTop, text, canvas = document.getElementById(wpActiveEditor);
|
||||
var sel, startPos, endPos, scrollTop, text, canvas = document.getElementById(wpActiveEditor), event;
|
||||
|
||||
if ( !canvas ) {
|
||||
return false;
|
||||
|
@ -433,6 +433,15 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
|||
canvas.value += content;
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
if ( document.createEvent ) {
|
||||
event = document.createEvent( 'HTMLEvents' );
|
||||
event.initEvent( 'change', false, true );
|
||||
canvas.dispatchEvent( event );
|
||||
} else if ( canvas.fireEvent ) {
|
||||
canvas.fireEvent( 'onchange' );
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@ -515,7 +524,7 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
|||
return ret;
|
||||
};
|
||||
qt.TagButton.prototype.callback = function(element, canvas, ed) {
|
||||
var t = this, startPos, endPos, cursorPos, scrollTop, v = canvas.value, l, r, i, sel, endTag = v ? t.tagEnd : '';
|
||||
var t = this, startPos, endPos, cursorPos, scrollTop, v = canvas.value, l, r, i, sel, endTag = v ? t.tagEnd : '', event;
|
||||
|
||||
if ( document.selection ) { // IE
|
||||
canvas.focus();
|
||||
|
@ -590,6 +599,14 @@ function edButton(id, display, tagStart, tagEnd, access) {
|
|||
}
|
||||
canvas.focus();
|
||||
}
|
||||
|
||||
if ( document.createEvent ) {
|
||||
event = document.createEvent( 'HTMLEvents' );
|
||||
event.initEvent( 'change', false, true );
|
||||
canvas.dispatchEvent( event );
|
||||
} else if ( canvas.fireEvent ) {
|
||||
canvas.fireEvent( 'onchange' );
|
||||
}
|
||||
};
|
||||
|
||||
// removed
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -380,6 +380,7 @@ var wpLink;
|
|||
|
||||
wpLink.close();
|
||||
textarea.focus();
|
||||
$( textarea ).trigger( 'change' );
|
||||
|
||||
// Audible confirmation message when a link has been inserted in the Editor.
|
||||
wp.a11y.speak( wpLinkL10n.linkInserted );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.8-alpha-40614';
|
||||
$wp_version = '4.8-alpha-40615';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue