Giter Site home page Giter Site logo

Comments (13)

maximebj avatar maximebj commented on June 16, 2024

Ah !

Which version of the Gutenberg plugin do you use ?

I'm only checking if you have the gut plugin enabled if WP version < 5 but I don't check if it's the latest release

(as I said on wp.org, it's difficult to be ready for every version because of a lot of changes)

Thanks for the donation!

from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

Gutenberg 4.6.1 (which should be the latest before WP5)

The html output on the edit post page stops abruptly as follows:

<!DOCTYPE html>
<!--[if IE 8]>
<html xmlns="http://www.w3.org/1999/xhtml" class="ie8 wp-toolbar"  lang="en-US">
<![endif]-->
<!--[if !(IE 8) ]><!-->
<html xmlns="http://www.w3.org/1999/xhtml" class="wp-toolbar"  lang="en-US">
<!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Edit Post &lsaquo; Theremin Academy &#8212; WordPress</title>
<script type="text/javascript">
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var ajaxurl = '/wp-admin/admin-ajax.php',
	pagenow = 'post',
	typenow = 'post',
	adminpage = 'post-php',
	thousandsSeparator = ',',
	decimalPoint = '.',
	isRtl = 0;
</script>
<meta name="viewport" content="width=device-width,initial-scale=1.0">

from agb.plugin.

maximebj avatar maximebj commented on June 16, 2024

Found the bug !

I use a function that was introduced on WP 5.0, so I must check it before.

It seems to work but I need further testing.

you can add this code to classes/WP/Gutenberg.php, line 49 (Get translation) and replace the line by theses 3 :

if ( function_exists('wp_set_script_translations') ) { wp_set_script_translations( Consts::BLOCKS_SCRIPT, 'advanced-gutenberg-blocks' ); }

from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

That fixed it, thank you!

Now I can see that the Google Maps plugin has still a problem. Backend works well, front end is still blank with a javascript error because of misplaced html <p> tags in the javascript:

<div class="wp-block-advanced-gutenberg-blocks-gmap">
	<script>
		function initMap1452836225() {</p>
<p>			var coords = { lat: 51.66094, lng: 8.348746 }</p>
<p>			var map = new google.maps.Map( document.querySelector( '#gutenblock-gmap-1452836225' ), {
				zoom: 15,
				center: coords,
				styles: "default"			} );</p>
<p>			var marker = new google.maps.Marker( {
				position: coords,
				map: map
			} );</p>
<p>			var infoWindow = new google.maps.InfoWindow( {
	    	content: "</p>
<p><strong>Musikschule Lippstadt</strong></p>
<p>Von-Galen-Platz 1, 59557 Lippstadt, Allemagne</p>
<p>"
	  	} )</p>
<p>			marker.addListener('click', function() {
	    	infoWindow.open( map, marker );
	  	} )
		}
	</script><br />
	<script async defer
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDEbdMf0xZbtiLpcrpWt2rNk_XDe5jNI98&#038;callback=initMap1452836225">
  </script></p>
<div class="wp-block-advanced-gutenberg-blocks-gmap__canvas" id="gutenblock-gmap-1452836225" style="height: 400px;"></div>
</div>


from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

Tried to remove unnecessary double line breaks from public/templates/gmap.php, which reduced the number of unwanted <p> and </p> tags, but that did not fix everything... There must be a rendering filter not working properly, somewhere.

from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

Found a workaround: Obviously, it's the <p> tags in the "content" string variable which mess everything up, so I took them off and put a simple <br /> tag:

var infoWindow = new google.maps.InfoWindow( {
	    	content: "<strong><?php echo htmlspecialchars($attributes['name']); ?></strong><br /><?php echo htmlspecialchars($attributes['address']); ?>"
	  	} )

from agb.plugin.

maximebj avatar maximebj commented on June 16, 2024

Something seems like to add closing tags everywhere : but it's not my plugin. The outputed code is normal on my side.

Can you try to change the theme ?
Maybe a plugin that add some security?

I tried on several browser and everything was working well

It's a script tag, there shouldn't be any p in it

In case, in public/templates/gmap.php just try to add type="text/javascript" to the 2 <script> tags.

It looks like the first p is a closing tag. Sure than there are no unclosed p tags before ?

Sometimes it's just the browser adding missing tags.

If you have opened a

before (for example in code/ html/ classic block) and didn't closed it, browser will add it, and as it close it after the beginning of the script tags, it thinks that thee was just text.

Please try and tell me !

from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

Ok, it's not your gmap block itself...
It happens with other themes, too. But it doesn't happen on a blank post or page. It happens only when several post blocks (I regularly use 5 of these) are in the same post or page. 2 of them do not break everything, but 3 do. Thus I'll have to have a closer look onto these posts.
But it's not as simple as an open or closed tag, because the problem appears, too, when such a "breaking" post block is inserted after/below the gmap plugin.

from agb.plugin.

maximebj avatar maximebj commented on June 16, 2024

Ok so there seems to be a pattern, I'll check on my side too. If we find the pattern, we find the bug.

from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

Ok, could narrow it down:

  1. create a new empty post, give it a title and publish
  2. create a new page
  3. add a Google Map Block (check with preview but this should always work without problems)
  4. add a Post Block and link it to your previously created post
  5. save draft and check with preview
    You'll see that the Gmap block is blank. Look at the source code of the page and you will see that a </p> has been automatically inserted by the browser at the line where
var infoWindow = new google.maps.InfoWindow( {
	    	content: "</p>

is located. And the browser will tell you "Syntax error: Unexpected EOF.
That does not explain why a few posts can be used in the Post block without breaking the Gmap block, though...
And that does not also explain why everything is fine when I remove the <p> and </p> tags from the InfoWindow template code and put a simple <br /> instead...
Hope this helps.

from agb.plugin.

Theremingenieur avatar Theremingenieur commented on June 16, 2024

Checked if this was related to the PHP short_open_tag directive: no change.

Will now stay with my <br /> fix:

			var infoWindow = new google.maps.InfoWindow( {
	    	content: "<strong><?php echo htmlspecialchars($attributes['name']); ?></strong><br /><?php echo htmlspecialchars($attributes['address']); ?>"
	  	} )

from agb.plugin.

GuidoDr avatar GuidoDr commented on June 16, 2024

just had the same problem in our WP 4.9.8 after I did the plugin update that I was informed by the WP installation.
After deactivating your original line 49 and adding your mentioned your "if ( function_exists('wp_set_script_translations') ) { wp_set_script_translations( Consts::BLOCKS_SCRIPT, 'advanced-gutenberg-blocks' ); }" it is working again. ;-)

from agb.plugin.

maximebj avatar maximebj commented on June 16, 2024

Fixed in 1.4.4 release

from agb.plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.