Support » Plugin: ACF Medium Editor Field » Improvement request: cursor “jumping” in editor when empty

  • Resolved Robert Sæther

    (@robsat91)


    Hello!

    I have a small improvement request for this plugin.
    When the editor is empty and you hit backspace, then the cursor does this small jump.

    See this image:

    The first image is when backspace keydown is triggered, the second one (under the red line) is when backspace keyup is triggered.

    What i can see is that when the editor is visibly empty (no characters) and you push backspace, you will remove the non-visible empty p-tag inside that is re-inserted after keyup is triggered. Therefore you get this jump. This may be fixed best in JavaScript, but i made a simple CSS-fix. Is this something you find worthy of implementing? Thoughts?

    // Medium editor bugfix
    add_action('admin_head', function(){
    	?>
    	
    	<style type="text/css">
    	
    		/* Medium Editor field normalizing bugfix */
    		.medium-editor-element:empty {
    			padding-top: 8px;
    			padding-bottom: 8px;
    			font-size: 13px;
    			line-height: 1.5;
    		}
    		.medium-editor-element > p:first-child {
    			margin-top: 6px;
    		}
    		.medium-editor-element > p:last-child {
    			margin-bottom: 4px;
    		}
    	
    	</style>
    	
    	<?php
    });

    Best regards, Robert Sather.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Huebner

    (@hube2)

    Yes, I didn’t like that either. Unfortunately I don’t have much control over Medium Editor. This has actually been brought up in the issues over there. Your CSS work-around looks like the next best solution and I’ll put it into the next update.

    Plugin Author John Huebner

    (@hube2)

    this is in the latest update. I also added a “delay initialization” setting to help with performance when a lot of medium editors are added to a page.

    Thread Starter Robert Sæther

    (@robsat91)

    Perfect, works like intended.
    Cheers

    Thread Starter Robert Sæther

    (@robsat91)

    * Resolved *

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Improvement request: cursor “jumping” in editor when empty’ is closed to new replies.