EnlighterJS / Plugin.WordPress

:package: Official WordPress Plugin of EnlighterJS
http://wordpress.org/plugins/enlighter/
GNU General Public License v2.0
115 stars 17 forks source link

Java generic interpreted as html #366

Closed simnation closed 1 year ago

simnation commented 1 year ago

Describe the bug As of recently, java generics are handled as html code, even within Enlighter blocks. Block looks fine on editing but bad on preview and display. Especially the "<" character seems to cause trouble.

Example: Message<AbstractAgent<?, ?>> msg=new Message<>(this,"Hello World!"); becomes: Message<abstractagent<?, ?="">> msg=new Message<>(this,"Hello World!");</abstractagent<?,>

WordPress Editing Mode Which WordPress editing mode you're using ? Gutenberg

Frontend or Backend Issue Frontend

To Reproduce Steps to reproduce the behavior: Insert java code for generic class signature in enlighter block.

Expected behavior I would expect clean java code to be displayed.

Screenshots If applicable, add screenshots to help explain your problem.

Example code See code blocks here: https://jsimplesim.org/advanced-topics/communication-messaging/ and here: https://jsimplesim.org/basic-tutorial/building-a-model/

Desktop (please complete the following information): Windows 10, Firefox, Edge

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

AndiDittrich commented 1 year ago

this is a common issue when using other editing modes then Gutenberg/TinyMCE - are your really using the block editor ? did you tried to reproduce the issue in a clean wordpress environment ?

simnation commented 1 year ago

Found the culprit: Disabling WP Optimize solved the issue.

There was no problem until the wordpress update to 6.1. and my provider switching to PHP 8, both occured in Nov/Dec 2022. I am going to look for an other optimizer...

Thanks for your quick response!

simnation commented 1 year ago

BTW: I have a very minimalistic plugin environment with vanilla Gutenberg edit, so the editor was not the issue.

AndiDittrich commented 1 year ago

i'm unable to reproduce your issue:

Testcode

protected Time doEvent(Time time) {
    Message<AbstractAgent<?,?>> msg=new Message<>(this,"Hello World!");
    getInport().write(msg);
    return getTimeOfNextEvent();
}

Editor

Screenshot_2023-01-31_09-43-25

Result

Screenshot_2023-01-31_09-43-11

Frontend HTML (DEV ENV)

Screenshot_2023-01-31_09-44-40

simnation commented 1 year ago

As I said: Obviously it was incompatibility with WP Optimize. I changed to another WP cache and everything works fine.