RichTextEditor 对 PHP 代码片段友好
我似乎找不到一个 js RTE 可以与其中交织的 php 片段友好地运行。 我想要一个用于多个网站后端的迷你 CMS。 这些视图在这里和那里都有一些 php 片段。
是否有任何 RTE 可以单独保留 php,甚至将其与良好的格式混合显示?
即使以 html 模式输入并来回切换,TinyMCE 也会杀死标签。 如果粘贴到源模式,FCKEdit 似乎会保持代码完整,但它不会显示在编辑端,因此如果有人删除其中包含某些 php 的元素,bop,它就会消失。
没有一个编辑器喜欢创建漂亮的缩进代码,这也是一个很好的加分,但可能有点过分了,呵呵。
I can't seem to find a js RTE that will play friendly with snippets of php intertwined in it. I want a mini CMS for the backend of a number of sites. The views have some snippets of php here and there
Are there any RTE's that will leave the php alone, and even show it mixed with the nice formatting?
TinyMCE kills the tags even when entered in html mode and switched back and forth. FCKEdit seems to keep the code intact if pasted into source mode, but it isn't shown in the editing side, so if someone deletes an element with some php in it, bop, it's gone.
And none of the editors like creating nicely indented code, that would be a nice plus as well, but probably over the top to ask, heh.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Javascript富文本编辑器利用浏览器内置的DesignMode或ContentEditable功能来实现内联HTML编辑,并且不支持嵌入的PHP标签。
解决方案必须将它们转换为其他形式,这样浏览器的 HTML 编辑器不会混淆这些形式,然后在提交时将它们转换回 PHP 标签。
这是可以做到的。 然而,我不知道有任何这样做。
至于创建良好缩进的代码,这是一个类似的问题。 浏览器在其内联 HTML 编辑器中对其进行处理。
The Javascript rich text editors make use of the browsers' in-built DesignMode or ContentEditable features in order to implement in-line HTML editing, and these do not support embedded PHP tags.
The solution would have to convert these to some other form, which is not going to get mushed by the browser's HTML editor, then convert them back to PHP tags upon submission.
It could be done. I don't know of any that do, however.
As for creating nicely indented code, it is a similar issue. The browsers munge it in their in-line HTML editors.
几周前我有一个类似的问题:
可以即时进行语法突出显示的文本区域?
这可能适合您:
http://marijn.haverbeke.nl/codemirror/
他们甚至混合了 PHP 和 HTML 突出显示。
I had a similar question a few weeks back:
Textarea that can do syntax highlighting on the fly?
This may be the right thing for you:
http://marijn.haverbeke.nl/codemirror/
They even have mixed PHP and HTML highlighting.