Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force TinyMCE to keep the original source code format

I have a database, where several pages are stored from a CMS system. The pages have HTML, JavaScript and several PHP calls. In general the code looks like this (only a bit longer):

<div style="width:603px;height:446px;position:relative;">
    <div style="position:absolute;width:567px;border-bottom:1px solid rgb(200,200,200);">
        SOME TEXT GOES HERE
    </div>
    <?php somePhpCall(); ?>
    <script>hoverImages()</script>
</div>

What I need is a WYSIWYG editor, that allows me to modify that code and keep the elements in tact. TinyMCE makes the formatting like this:

<p>SOME TEXT GOES HERE</p>

and loses all CSS, JS and PHP code.

Can I configure TinyMCE to keep the original source code format and if not - what alternative WYSIWYG editor can I use.

P.S: I've downloaded the latest version and it keeps changing my <?php tags to <!--?php or &lt;?php and my <script> tags to <script type="text/javascript">// <![CDATA[. I've tried using apply_source_formatting : true

Thank you.

like image 258
Дамян Станчев Avatar asked Feb 04 '26 17:02

Дамян Станчев


1 Answers

you TinyMCE config only java script used. another WYSIWYG editor url link integrate your program automatically config WYSIWYG editor example code

    <script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
    <script type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</script>
like image 132
rajesh57 Avatar answered Feb 12 '26 10:02

rajesh57