Editor: pass the DOM library instance instead of a (fake) editor instance to `getCursorMarkerSpan()`.

See #42029
Built from https://develop.svn.wordpress.org/trunk@41655


git-svn-id: http://core.svn.wordpress.org/trunk@41489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2017-10-01 09:42:47 +00:00
parent eedca8f3da
commit 5335ba8c20
3 changed files with 8 additions and 9 deletions

View File

@ -345,11 +345,11 @@ window.wp = window.wp || {};
*
* Using DomQuery syntax to create it, since it's used as both text and as a DOM element.
*
* @param {Object} editor The TinyMCE editor instance.
* @param {Object} domLib DOM library instance.
* @param {string} content The content to insert into the cusror marker element.
*/
function getCursorMarkerSpan( editor, content ) {
return editor.$( '<span>' ).css( {
function getCursorMarkerSpan( domLib, content ) {
return domLib( '<span>' ).css( {
display: 'inline-block',
width: 0,
overflow: 'hidden',
@ -434,9 +434,8 @@ window.wp = window.wp || {};
* to run after the markers are added.
*
* @param {object} $textarea TinyMCE's textarea wrapped as a DomQuery object
* @param {object} jQuery A jQuery instance
*/
function addHTMLBookmarkInTextAreaContent( $textarea, jQuery ) {
function addHTMLBookmarkInTextAreaContent( $textarea ) {
if ( ! $textarea || ! $textarea.length ) {
// If no valid $textarea object is provided, there's nothing we can do.
return;
@ -456,7 +455,7 @@ window.wp = window.wp || {};
mode = htmlModeCursorStartPosition !== htmlModeCursorEndPosition ? 'range' : 'single',
selectedText = null,
cursorMarkerSkeleton = getCursorMarkerSpan( { $: jQuery }, '&#65279;' );
cursorMarkerSkeleton = getCursorMarkerSpan( $$, '&#65279;' );
if ( mode === 'range' ) {
var markedText = textArea.value.slice( htmlModeCursorStartPosition, htmlModeCursorEndPosition ),
@ -646,7 +645,7 @@ window.wp = window.wp || {};
* The elements have hardcoded style that makes them invisible. This is done to avoid seeing
* random content flickering in the editor when switching between modes.
*/
var spanSkeleton = getCursorMarkerSpan( editor, selectionID ),
var spanSkeleton = getCursorMarkerSpan( editor.$, selectionID ),
startElement = spanSkeleton.clone().addClass( 'mce_SELRES_start' ),
endElement = spanSkeleton.clone().addClass( 'mce_SELRES_end' );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41654';
$wp_version = '4.9-alpha-41655';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.