zoukankan      html  css  js  c++  java
  • [BBS]搭建开源论坛之JForum富文本编辑器更换

    本文作者:sushengmiyan 

    本文地址:http://blog.csdn.net/sushengmiyan/article/details/47866905


    上一节我们将开发环境搭建完成,我们会发现发布帖子的编辑器比较简单,格式支持比较少,现在我们将一个开源编辑器 ckeditor 替换。

    1.下载ckeditor

    http://ckeditor.com/ 免费的开源编辑器。

    2.加入到我们项目中。

    现在使用ckeditor特别简单,将下载到的包,解压到项目根目录,webroot下。然后在templatesdefault.htm文件中,头部加入如下引入js

    <script src="${contextPath}/ckeditor/ckeditor.js"></script>

    然后在约357行,标有teatarea注释的地方,嘎栋为如下:

    <!-- Textarea -->
    <tr>
    	<td valign="top">
    		<textarea name='editor1' id='editor1'class="message" onkeyup="storeCaret(this);" onclick="storeCaret(this);" onselect="storeCaret(this);" tabindex="3" name="message" rows="15"  cols="35"><#if post?exists><#if quote?exists>[quote=${quoteUser}]${post.text?html}[/quote]<#else>${post.text?html}</#if></#if></textarea>
    		<script>
    			// Replace the <textarea id="editor1"> with a CKEditor
    			// instance, using default configuration.
    			CKEDITOR.replace( 'editor1' );
    		</script>
    	</td>
    </tr>
    

    重新刷新项目,新发布文章的时候,ckeditor已经在起作用了,如下图:



    好的,到此,已经将编辑器纳入为我们的项目了。现在需要做的就是融合了,大家各显神通的时候到啦。

  • 相关阅读:
    6.让代码更具可读性
    5构造函数和析构函数
    4面向对象之类的继承
    3隐形的指针
    2面向对象之类的封装
    od快捷键
    1.纠结的c++
    101宏定义的其他用法
    100解剖宏定义函数
    99,printf scanf手动功能实现
  • 原文地址:https://www.cnblogs.com/muyuge/p/6152462.html
Copyright © 2011-2022 走看看