Make WordPress Core

Changeset 41655


Ignore:
Timestamp:
10/01/2017 09:41:23 AM (9 years ago)
Author:
azaozz
Message:

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

See #42029

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/editor.js

    r41646 r41655  
    346346                 * Using DomQuery syntax to create it, since it's used as both text and as a DOM element.
    347347                 *
    348                  * @param {Object} editor The TinyMCE editor instance.
     348                 * @param {Object} domLib DOM library instance.
    349349                 * @param {string} content The content to insert into the cusror marker element.
    350350                 */
    351                 function getCursorMarkerSpan( editor, content ) {
    352                         return editor.$( '<span>' ).css( {
     351                function getCursorMarkerSpan( domLib, content ) {
     352                        return domLib( '<span>' ).css( {
    353353                                                display: 'inline-block',
    354354                                                width: 0,
    … …  
    435435                 *
    436436                 * @param {object} $textarea TinyMCE's textarea wrapped as a DomQuery object
    437                  * @param {object} jQuery A jQuery instance
    438                  */
    439                 function addHTMLBookmarkInTextAreaContent( $textarea, jQuery ) {
     437                 */
     438                function addHTMLBookmarkInTextAreaContent( $textarea ) {
    440439                        if ( ! $textarea || ! $textarea.length ) {
    441440                                // If no valid $textarea object is provided, there's nothing we can do.
    … …  
    457456
    458457                                selectedText = null,
    459                                 cursorMarkerSkeleton = getCursorMarkerSpan( { $: jQuery }, '&#65279;' );
     458                                cursorMarkerSkeleton = getCursorMarkerSpan( $$, '&#65279;' );
    460459
    461460                        if ( mode === 'range' ) {
    … …  
    647646                         * random content flickering in the editor when switching between modes.
    648647                         */
    649                         var spanSkeleton = getCursorMarkerSpan( editor, selectionID ),
     648                        var spanSkeleton = getCursorMarkerSpan( editor.$, selectionID ),
    650649                                startElement = spanSkeleton.clone().addClass( 'mce_SELRES_start' ),
    651650                                endElement = spanSkeleton.clone().addClass( 'mce_SELRES_end' );
Note: See TracChangeset for help on using the changeset viewer.