Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to use <pre><code> syntax in tinymce area #4058

Closed
Jimmi08 opened this issue Jan 2, 2020 · 11 comments
Closed

not able to use <pre><code> syntax in tinymce area #4058

Jimmi08 opened this issue Jan 2, 2020 · 11 comments
Labels
type: bug A problem that should not be happening
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Jan 2, 2020

Bug Description

For highlight.js I need to use code <pre><code> </pre></code> in tinymce area
Now it's changed to
<pre>&lt;code&gt;pre2&lt;/code&gt;</pre>
by e107.
I already know that
<pre> and <code>
tags have exceptions and they should not be converted to HTML entities, but if you combine them, this happens

How to Reproduce

Steps to reproduce the behavior:

  1. Go to news with tinymce plugin activated
  2. Either use source button to insert needed code
  3. Or insert code, than use button for inserting <code> tags, and then button for <pre> tags
  4. Check source code before saving that code is inserted correctly
  5. After saving check source code again or saved value in database

Expected Behavior

tag shouldn't be converted to HTML entities

e107 Version

latest github 2.3

PHP Version

PHP Version 7.2.16
@Jimmi08 Jimmi08 added the type: bug A problem that should not be happening label Jan 2, 2020
@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Jan 2, 2020

Tested with simplemde plugin by lonalore that have already this script supported. Before 3 years ago it worked. Now the same result: <pre>&lt;code&gt;test&lt;/code&gt;</pre>

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Apr 27, 2020

@Moc change label to question, this is probably the intention. I don't need this anymore.

@Jimmi08 Jimmi08 closed this as completed Apr 27, 2020
@Moc Moc reopened this Apr 27, 2020
@CaMer0n
Copy link
Member

CaMer0n commented Apr 28, 2020

@Moc I believe this is the parser error we saw on e107.org. It should normally be fixed now.

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Apr 28, 2020

It is not. I tried it after that fix. You don't see it normally because HTML entities are displayed correctly, but you can't use it for js <pre><code> test doesn't work.
But as I said, I don't need this anymore.

@CaMer0n
Copy link
Member

CaMer0n commented Apr 28, 2020

TinyMce also seems to be adding <br> instead of \n inside the <pre> tag.

@CaMer0n
Copy link
Member

CaMer0n commented Apr 29, 2020

btw.

For highlight.js I need to use code <pre><code> </pre></code> in tinymce area

I think you mean:

<pre><code> </code></pre>

TinyMce Source:

[html]<p>To create a simple test script, create a new file called <code style="unicode-bidi: embed; direction: ltr;">test.php</code> in your root folder with the following php:</p>
<pre class="prettyprint linenums">require_once("class2.php");
require_once(HEADERF);
echo "Hello World";
require_once(FOOTERF);
</pre>
<p>Then point your browser to <code style="unicode-bidi: embed; direction: ltr;">www.yoursite.com/test.php</code></p>[/html]

Rendered Result:

See: https://e107.org/developer-manual/getting-started/hello-world

@CaMer0n CaMer0n added this to the e107 2.3.0 milestone Apr 29, 2020
@Jimmi08
Copy link
Contributor Author

Jimmi08 commented Apr 30, 2020

@CaMer0n
try to use

 /* {THEME_PREF: code=header_width&default=container} */
  /* way how to use theme prefs as shortcodes in HTML layout */

Result:
image

<pre>&lt;span&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span&gt;/*&nbsp;{THEME_PREF:&nbsp;code=header_width&amp;default=container}&nbsp;*/&lt;/span&gt;</pre>
<pre>&lt;span&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/span&gt;&lt;span&gt;/*&nbsp;way&nbsp;how&nbsp;to&nbsp;use&nbsp;theme&nbsp;prefs&nbsp;as&nbsp;shortcodes&nbsp;in&nbsp;HTML&nbsp;layout&nbsp;*/&lt;/span&gt;</pre>

@CaMer0n
Copy link
Member

CaMer0n commented May 1, 2020

@Jimmi08 I tried what you suggested:

image

TinyMce Source (before saving and after saving/re-editing):
[html]<pre class="line-numbers language-javascript">/* {THEME_PREF: code=header_width&amp;default=container} */ /* way how to use theme prefs as shortcodes in HTML layout */</pre>[/html]
I'm not seeing an issue. Can you provide more details?

CaMer0n added a commit that referenced this issue May 1, 2020
@Jimmi08
Copy link
Contributor Author

Jimmi08 commented May 1, 2020

It was adding spans after inserting text, before saving itself. I had to switch to source code, insert that text there, switch back, and then use preformatted code button.

Now I can't reproduce it. I don't understand. Closing.

@Jimmi08 Jimmi08 closed this as completed May 1, 2020
@CaMer0n
Copy link
Member

CaMer0n commented May 1, 2020

@Jimmi08 Maybe you copy/pasted from elsewhere? (so it pasted additional tags)

@Jimmi08
Copy link
Contributor Author

Jimmi08 commented May 1, 2020

@Jimmi08 Maybe you copy/pasted from elsewhere? (so it pasted additional tags)

Visual Code editor.
I tried PSPAD before (comment above) because I use it more, but after your comment, it hit me that I was cleaning code and then I used VC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

No branches or pull requests

3 participants