TinyMCE: treat HTML comments same as tags when keeping cursor position. Fixes breaking the More and Nextpage tags when switching from Text to Visual.

Props iCaleb, jeremeylduvall.
Fixes #45947.
Built from https://develop.svn.wordpress.org/trunk@44649


git-svn-id: http://core.svn.wordpress.org/trunk@44480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2019-01-18 16:33:51 +00:00
parent 9fc53b8461
commit abcb59f860
3 changed files with 5 additions and 5 deletions

View File

@ -188,7 +188,7 @@ window.wp = window.wp || {};
}
/**
* Checks if a cursor is inside an HTML tag.
* Checks if a cursor is inside an HTML tag or comment.
*
* In order to prevent breaking HTML tags when selecting text, the cursor
* must be moved to either the start or end of the tag.
@ -211,7 +211,7 @@ window.wp = window.wp || {};
if ( lastLtPos > lastGtPos || content.substr( cursorPosition, 1 ) === '>' ) {
// find what the tag is
var tagContent = content.substr( lastLtPos ),
tagMatch = tagContent.match( /<\s*(\/)?(\w+)/ );
tagMatch = tagContent.match( /<\s*(\/)?(\w+|\!-{2}.*-{2})/ );
if ( ! tagMatch ) {
return null;
@ -382,7 +382,7 @@ window.wp = window.wp || {};
}
/**
* Gets adjusted selection cursor positions according to HTML tags/shortcodes
* Gets adjusted selection cursor positions according to HTML tags, comments, and shortcodes.
*
* Shortcodes and HTML codes are a bit of a special case when selecting, since they may render
* content in Visual mode. If we insert selection markers somewhere inside them, it's really possible

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-beta1-44648';
$wp_version = '5.1-beta1-44649';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.