首页 新闻 会员 周边

TinyMCE取值问题!

0
悬赏园豆:30 [已关闭问题]

在.NET C#中使用TinyMCE使用

<asp:TextBox ID="SiteKey" runat="server" TextMode="MultiLine">asp:TextBox>做为他的映射对象 ,如何后台CS文件中如何获取他的值呢?

 

无论是使用TinyMCE还是使用FCKeditor,在上传后内容中的图片和文字是否可以提取单独存放。方便删除时数据库中的内容后也将上传至服务器中相应图片删除!可以做个简单的DEMO!谢谢!

问题补充: 下面的老哥回答TINYMCE很实用!!! 还想知道如何将里面的文字内容和图片内容单独提取出来后单独保存!这样做是为了以后删除文章时顺便删除文章的使用的保存在服务器上的图片...不知道是否可以实现!·
看雪飘过的主页 看雪飘过 | 初学一级 | 园豆:50
提问于:2008-11-22 07:59
< >
分享
其他回答(1)
0

SiteKey.text取值

这是我以前用的笔记:

=============================

官方网站TinyMCE(http://tinymce.moxiecode.com/download.php)

 

将里面的jscripts目录拷到你的网站目录

<asp:TextBox ID="TxtTest" TextMode="MultiLine" runat="server" />

head里加入:

<script src="tiny_mce/tiny_mce_src.js" type="text/javascript"></script>

<script type="text/javascript">

    tinyMCE.init({

        mode:"exact",

        elements:"TxtTest",

        theme:"advanced",

        language : "ch"

    });

</script>

 

通过TxtTest.Text.ToString()来获取值(你可能会看到一个出错的提示这时只需要将.aspx最开始的<%@ Page 里加入ValidateRequest=”false”,即可)

页面中有多个textareas,你可能只希望某一个用编辑器代替,则上面的mode一行改为:

mode : "exact",elements : “对应的ID”

 

几个常用的参数说明:(在压缩包的docs里有详细的介绍)

mode: textareas/specific_textareas/exact

textareas: 替换当前页的所有textarea为编辑器

specific_textareas: 不是很明白(特定的textarea??),要配合 textarea_trigger使用

exact: 替换指定IDdiv或者textarea为编辑器,要配合elements使用。如例子里说的。

 

theme: advanced/simple

advanced: 高级模式,功能比较多一点。(默认)

simple: 基本模式,只有基本的功能。

 

plugins advhr/advimage/advlink/contextmenu/emotions/flash/autosave/style/layer/iespell/insertdatetime/paste/preview/print/save/noneditable/spellchecker/searchreplace/table/zoom/directionality/fullscreen/fullpage/inlinepopups/fullpage

这些是自带的一些插件,看名字基本上都能明白它的功能。在网站上还有一些其它功能的插件,可以自己去下,放在插件目录下就可以了。

"-"加上可以让MCE不试图从插件目录加载这个插件,如plugins : "table,contextmenu,paste,-externalplugin"

 

language: en/zh_cn/zh_cn_utf8……

设置使用的语言,网站上也有的下,需要注意的是中文简体和繁体都有两种uft8的,要确定你使用的页面的编码。(eg:language : "en"

 

width height设置编辑器的宽度和高度

 

relative_urls: false/true,(默认:true

remove_script_host: false/true,(默认:true

eg:relative_urls: false,  remove_script_host: false这样内容会使用绝对路径,也就是会加上域名。)

 

theme_advanced_toolbar_location: top/bottom(默认:bottom

theme_advanced_toolbar_align: left/center/right(默认:center

theme_advanced_buttons<1-n>

theme_advanced_buttons<1-n>_add

theme_advanced_buttons<1-n>_add_before

这里是advanced主题下的几个设置

theme_advanced_toolbar_locationtheme_advanced_toolbar_aligntheme_advanced_statusbar_location 分别设置工具栏的位置对齐方式状态栏的位置

theme_advanced_buttons<1-n>设置第N排的按钮

theme_advanced_buttons<1-n>_add 添加一个按钮到第N排的后面

theme_advanced_buttons<1-n>_add_before 添加一个按钮到第N排的前面

eg:theme_advanced_buttons3 : '',

theme_advanced_buttons2_add : "insertdate,inserttime",

theme_advanced_buttons2_add_before : "zoom"

这样就是第三排为空,也就是不显示,在第二排后面加入了插入日期和时间,第二排开始插入缩放)

 

 

支持中文

将下载的压缩包中的文件解压到javascript/tiny_mce目录中提示有同名文件选覆盖即可。

在页面的tinyMCE初始化语句 tinyMCE.init 中加上一行 language : "ch", 即可ch前后是单引号

 

tinymce中文字体过小解决方法

解决方案js\themes\advanced\css\editor_content.css中的

body, td, pre {

 font-family: Verdana, Arial, Helvetica, sans-serif;

 font-size: 12px;

}

10px改为12px就可以了。

 

 

相关资源收集:

TinyMCE 中文手册 http://www.inpeck.com/TinyMceManual/

tinymce中几个比较有用的插件: http://joom.org.ru/home/article/14-tinymce-plugin.html

在线编辑器 TinyMCE 3 的简体中文语言包: http://www.metalstar.net/?d=86

tinymce中文字体过小解决方法  http://www.humker.com/2008/03/07/tinymce-chinese-font-size

 

 

Astar | 园豆:40805 (高人七级) | 2008-11-22 10:20
0

xuexi

Jared.Nie | 园豆:1940 (小虾三级) | 2008-11-22 11:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册