具有内置语法突出显示的网站所见即所得编辑器 [英] WYSIWYG editor for website with built-in syntax highlighting
本文介绍了具有内置语法突出显示的网站所见即所得编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的论坛网站寻找所见即所得的编辑。它具有内置的语法突出显示,就像我们在www.stackoverflow.com或www.asp.net中一样。
以便我可以将[用户输入]的整个文本保存到数据库中,并可以在页面上突出显示语法。
请帮帮忙。
不要误会我的意思,我已经在Google和Stackoverflow上搜索过了,但我无法获得所需的答案。
如果它是开放源码的,我将不胜感激。:-)
推荐答案
我喜欢并使用tinymce编辑器,它的示例代码如下所示。
<script src="/javascripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "safari",
convert_urls : false,
width : "560",
height : "15",
// 'code' in 'theme_advanced_buttons1' is used for the HTML content
theme_advanced_buttons1 : "fontselect,fontsizeselect, separator, bold,italic,underline,separator,forecolor,backcolor,code, justifyleft,justifycenter,justifyright,justifyfull",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left", extended_valid_elements : "a[name|href|target|title|onclick],img[class|src| border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name], hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]" });
</script>
<textarea cols="40" id="template_content" name="template[content]" rows="20"></textarea>
这篇关于具有内置语法突出显示的网站所见即所得编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文