' +
- 'Many entrepreneurs idolize Steve Jobs. He’s such a perfectionist, they say. Nothing leaves the doors of 1 Infinite Loop in Cupertino without a polish and finish that makes geeks everywhere drool. No compromise!
-
- I like Apple for the opposite reason: they’re not afraid of getting a rudimentary 1.0 out into the world.
@@ -39,10 +39,10 @@The discovery sets a new record for greatest number of habitable-zone planets found around a single star outside our solar system. All of these seven planets could have liquid water—key to life as we know it—under the right atmospheric conditions, but the chances are highest with the three in the habitable zone.
-
-
@@ -54,9 +54,9 @@ Okay, now let’s take an interstellar road trip:
-And this is the end of another editor block prototype.
diff --git a/tinymce-single/tinymce/block.js b/tinymce-single/tinymce/block.js index e8edcb6d319f39..1ec488162483b6 100644 --- a/tinymce-single/tinymce/block.js +++ b/tinymce-single/tinymce/block.js @@ -46,6 +46,20 @@ editor.addButton( name, settings ); } ); + editor.on( 'setContent', function( event ) { + $blocks = editor.$( editor.getBody() ).find( '*[data-wp-block-type]' ); + $blocks.attr( 'contenteditable', 'false' ); + $blocks.each( function( i, block ) { + var settings = wp.blocks.getBlockSettingsByElement( block ); + + if ( settings && settings.editable ) { + settings.editable.forEach( function( selector ) { + editor.$( block ).find( selector ).attr( 'contenteditable', 'true' ); + } ); + } + } ); + } ); + // Attach block UI. editor.on( 'preinit', function() { @@ -251,8 +265,16 @@ function onClick( callback ) { return function( block ) { var content = callback.apply( this, arguments ); + var args = { + format: 'html', + set: true, + selection: true, + content: content + }; if ( content ) { + editor.fire( 'beforeSetContent', args ); + if ( typeof content === 'string' ) { var temp = document.createElement( 'div' ); temp.innerHTML = content; @@ -261,11 +283,13 @@ } block.parentNode.replaceChild( content, block ); + + editor.fire( 'setContent', args ); } window.wp.blocks.selectBlock( content ); - setTimeout( showBlockUI ) + setTimeout( showBlockUI, 50 ) } }