KahunaCoder
KahunaCoder

Reputation: 615

When using the Jodit Pro library with the pasteCode plugin installed any php tags stored as <?php and ?> in the database are removed

Jodit Pro Version: v4.2.34 Browser: Chrome OS: Mac Is React App: False Reproduced on xdsoft.net: N/A Since you can't save.

Steps to duplicate.

  1. Create a new document and click on the pasteCode button and choose PHP from the dropdown menu.
  2. Enter the following in the code view section and click the save button to close the dialog.
<?php echo "Hello World"; ?>
  1. Click on the change mode button and confirm the php tags have been converted like so.
    <pre><code class="language-php">&lt;?php echo "Hello World"; ?&gt;</code></pre>
  1. Open the new document and observe the syntax highlighting is displayed.
  2. Open the new document in Jodit Pro and the document appears empty.
  3. View the page source and in the now hidden <textarea> tags you will see this.
<textarea name="contents" autocomplete="off" ID="jodit_contents" rows = "7"  cols = "40" >
<pre><code class="language-php">&lt;?php echo "Hello World"; ?&gt;</code></pre>
</textarea>
  1. Click on the change mode button and you will see this:
<pre><code class="language-php"></code></pre>
  1. Doing undo from my keyboard while viewing the above source I saw this:
<pre><code class="language-php"><!--?php echo "Hello World"; ?--></code></pre>

ADDITIONAL: Pasting the php code directly in the editor as html without the pasteCode plugin results in this when viewing the above source I see this even before pressing undo

<div style="color: #cccccc;background-color: #1f1f1f;font-family: 'Cascadia Code', Menlo, Monaco, 'Courier New', monospace;font-weight: normal;font-size: 16.024px;line-height: 24px;white-space: pre;">
    <div><span style="color: #cccccc;">
            <!--?php echo "Hello World"; ?-->
        </span><br></div>

Somehow, at sometime, my code is being converted to this:

<!--?php echo "Hello World"; ?-->

How can I use php tags with the codePaste plugin?

Upvotes: 0

Views: 14

Answers (0)

Related Questions