TinyMCE中的输入代码 [英] Input code in TinyMCE

查看:225
本文介绍了TinyMCE中的输入代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在博客上使用TinyMCE,似乎正在删除我要粘贴的代码.

I'm using TinyMCE on my blog and it seems to be removing the code I'm trying to paste.

我要添加这个:

<Files somefile.png>
    DefaultType application/x-httpd-php
</Files>

(这是.htaccess指令)

(it's a .htaccess directive)

这样可以保存(在html中为& lt和& gt;),但是当我重新打开用于编辑的表单时,它会转换为:

This gets saved ok (as &lt; and &gt; in the html), but when I reopen my form for editing, it gets transformed as :

DefaultType application/x-httpd-php

我正在以 Symfony 格式使用TinyMCE,并使用sfFormExtraPlugin.

Edit : I'm using TinyMCE in a Symfony form, using sfFormExtraPlugin.

我尝试了verify_html:false.... 现在我的代码被转换为:

Edit 2 : I tried verify_html: false .... now my code gets transformed as :

<p><files exec="" jpg=""><br /> DefaultType application/x-httpd-php<br /></files></p>

我的tinyMCE配置是:

Edit 3: My tinyMCE config is :

  tinyMCE.init({
    mode:                              "exact",
    elements:                          "content_contents",
    theme:                             "advanced",
    width:                             "500px",
    height:                            "400px",
    theme_advanced_toolbar_location:   "top",
    theme_advanced_toolbar_align:      "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_resizing:           true
    ,

    language : "fr",
        convert_urls : false,
        verify_html : false

  });

推荐答案

我在 TinyMCE MoxieCode论坛主题,它也是由@Manu打开的,但是我也想根据自己的想法更新这个主题.

I responded to this on the TinyMCE MoxieCode forums topic that was also opened by @Manu however I wanted to update this topic with my thoughts as well.

如果我正确理解@Manu,则问题在于HTML源代码在正确保存为& lt & gt 的同时被解释为 < > .

If I understand @Manu correctly, the problem is that the HTML source, while saving with &lt and &gt correctly is being interpreted as < and > when reloaded into TinyMCE.

如果是这种情况,那么我认为问题是 Symphony 插件在填充TinyMCE替换的TextArea之前未对HTML内容进行编码.换句话说,它在应加载& 时保留了& lt ,因此tinyMCE会收到& lt

If this is the case, then I believe the problem is that the Symphony plugin isn't encoding the HTML content prior to populating the TextArea that TinyMCE replaces. In other words, it leaves &lt when it should be loading &lt; so tinyMCE receives &lt

这篇关于TinyMCE中的输入代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆