FCKeditor ???鸺记?
时间:2021-04-22 09:14:38|栏目:|点击: 次
FCKeditor至今已?到了2.3.1版本了,??於???鹊?WEB?_?l者?碚f,也基本上都已?「??L知多少」了,很多人?⑵淙诜诺阶约旱捻?目中,更有很多大型的?W站?闹谐缘搅颂痤^。今天?_始,我?⒁稽c?c的介?B自己在使用FCKeditor?^程中??Y的一些技巧,??然?@些其??是FCK本?砭陀械模?只是很多人用FCK的?r候?]?l?F而已 :P
1、?m?r打?_??器
很多?r候,我??在打?_?面的?r候不需要直接打?_??器,而在用到的?r候才打?_,?@?右?碛泻芎玫挠?趔w?,另一方面可以消除FCK在加?d?r???面打?_速度的影?,如?D所示
?c?簟?Open Editor"按?o後才打?_??器界面
???F原理:使用JAVASCRIPT版的FCK,在?面加?d?r(未打?_FCK),??建一???[藏的TextArea域,?@??TextArea的name和ID要和??建的FCK??例名?Q一致,然後?c??"Open Editor"按?o?r,通?^?{用一段函?担?使用FCK的ReplaceTextarea()方法???建FCKeditor,代?a如下:
2、使用FCKeditor 的 API
FCKeditor??器,提供了非常?S富的API,用於?oEnd User???F很多想要定制的功能,比如最基本的?????C,如何在提交的?r候用JS判?喈?前??器?^域?仁欠裼?热荩?FCK的API提供了GetLength()方法;
再比如如何通?^?_本向FCK?e插入?热荩?使用InsertHTML()等;
?有,在用?舳ㄖ乒δ?r,中?g步?E可能要?绦?FCK的一些?惹恫僮鳎?那就用ExecuteCommand()方法。
??的API列表,?查看FCKeditor的Wiki。而常用的API,?查看FCK?嚎s包?e的_samples/html/sample08.html。此?就不?N代?a了。
3、外????l(多????域共用一?????l)
?@??功能是2.3版本才?_始提供的,以前版本的FCKeditor要在同一???面?e用多????器的?,得一??????建,?F在有了?@??外?功能,就不用那?N麻?┝耍?只需要把工具?l放在一???m??的位置,後面就可以?o限制的??建??域了,如?D:
要???F?@?N功能呢,需要先在?面中定?x一??工具?l的容器:<divid="xToolbar"></div>,然後再根???@??容器的id?傩赃M行?O置。
ASP???F代?a:
JAVASCRIPT???F代?a:
此部分的??DEMO??⒄眨?
_samples/html/sample11.html
_samples/html/sample11_frame.html
4、文件管理功能、文件上?鞯?嘞???}
一直以後FCKeditor的文件管理部分的安全是??值得注意,但很多人?]注意到的地方,?m然FCKeditor在各??Release版本中一直存在的一??功能就是?ι?魑募??型?M行?^?V,但是她?]考?]?^另一?????}:到底允?S?l能上?鳎康降渍l能?g?[服?掌魑募??
之前???_始用FCKeditor?r,我就出?F?^?@?????},?好NetRube(FCKeditor中文化以及FCKeditor ASP版上?鞒绦虻淖髡撸┘?r提醒了我,做法是去修改FCK上?鞒绦颍?在?e面?M行?嘞夼?啵??K且再在fckconfig.js?e把相??的一些功能去掉。但?S之FCK版本的不?嗌??,每升一次都要去改一次配置程序fckconfig.js,我?l?X???┝耍?就?]什?N?k法能更好的控制?@?N配置?N?事??上,是有的。
在fckconfig.js?e面,有?P於是否打?_上?骱?g?[服?掌鞯脑O置,在??建FCKeditor?r,通?^程序?砼?嗍欠??建有上??g?[功能的??器。首先,我先在fckconfig.js?e面把所有的上?骱?g?[?O置全?O??false,接著我使用的代?a如下:
ASP版本:
JAVASCRIPT版本:
1、?m?r打?_??器
很多?r候,我??在打?_?面的?r候不需要直接打?_??器,而在用到的?r候才打?_,?@?右?碛泻芎玫挠?趔w?,另一方面可以消除FCK在加?d?r???面打?_速度的影?,如?D所示
?c?簟?Open Editor"按?o後才打?_??器界面
???F原理:使用JAVASCRIPT版的FCK,在?面加?d?r(未打?_FCK),??建一???[藏的TextArea域,?@??TextArea的name和ID要和??建的FCK??例名?Q一致,然後?c??"Open Editor"按?o?r,通?^?{用一段函?担?使用FCK的ReplaceTextarea()方法???建FCKeditor,代?a如下:
<script type="text/javascript">
<!--
function showFCK(){
var oFCKeditor = new FCKeditor( 'fbContent' ) ;
oFCKeditor.BasePath = '/FCKeditor/' ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '200' ;
oFCKeditor.ReplaceTextarea() ;
}
//-->
</script>
<textarea name="fbContent" id="fbContent">textarea>
<!--
function showFCK(){
var oFCKeditor = new FCKeditor( 'fbContent' ) ;
oFCKeditor.BasePath = '/FCKeditor/' ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '200' ;
oFCKeditor.ReplaceTextarea() ;
}
//-->
</script>
<textarea name="fbContent" id="fbContent">textarea>
2、使用FCKeditor 的 API
FCKeditor??器,提供了非常?S富的API,用於?oEnd User???F很多想要定制的功能,比如最基本的?????C,如何在提交的?r候用JS判?喈?前??器?^域?仁欠裼?热荩?FCK的API提供了GetLength()方法;
再比如如何通?^?_本向FCK?e插入?热荩?使用InsertHTML()等;
?有,在用?舳ㄖ乒δ?r,中?g步?E可能要?绦?FCK的一些?惹恫僮鳎?那就用ExecuteCommand()方法。
??的API列表,?查看FCKeditor的Wiki。而常用的API,?查看FCK?嚎s包?e的_samples/html/sample08.html。此?就不?N代?a了。
3、外????l(多????域共用一?????l)
?@??功能是2.3版本才?_始提供的,以前版本的FCKeditor要在同一???面?e用多????器的?,得一??????建,?F在有了?@??外?功能,就不用那?N麻?┝耍?只需要把工具?l放在一???m??的位置,後面就可以?o限制的??建??域了,如?D:
要???F?@?N功能呢,需要先在?面中定?x一??工具?l的容器:<divid="xToolbar"></div>,然後再根???@??容器的id?傩赃M行?O置。
ASP???F代?a:
<div id="fckToolBar"></div>
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
with oFCKeditor
.BasePath = fckPath
.Config("ToolbarLocation") = "Out:fckToolBar"
.ToolbarSet = "Basic"
.Width = "100%"
.Height = "200"
.Value = ""
.Create "jcontent"
.Height = "150"
.Value = ""
.Create "jreach"
end with
%>
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
with oFCKeditor
.BasePath = fckPath
.Config("ToolbarLocation") = "Out:fckToolBar"
.ToolbarSet = "Basic"
.Width = "100%"
.Height = "200"
.Value = ""
.Create "jcontent"
.Height = "150"
.Value = ""
.Create "jreach"
end with
%>
JAVASCRIPT???F代?a:
<div id="xToolbar"></div>
FCKeditor 1:
<script type="text/javascript">
<!--
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ;
var oFCKeditor = new FCKeditor( 'FCKeditor_1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 100 ;
oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)' ;
oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using FCKeditor.' ;
oFCKeditor.Create() ;
//-->
</script>
<br />
FCKeditor 2:
<script type="text/javascript">
<!--
oFCKeditor = new FCKeditor( 'FCKeditor_2' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 100 ;
oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)' ;
oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using FCKeditor.' ;
oFCKeditor.Create() ;
//-->
</script>\
FCKeditor 1:
<script type="text/javascript">
<!--
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ;
var oFCKeditor = new FCKeditor( 'FCKeditor_1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 100 ;
oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)' ;
oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using FCKeditor.' ;
oFCKeditor.Create() ;
//-->
</script>
<br />
FCKeditor 2:
<script type="text/javascript">
<!--
oFCKeditor = new FCKeditor( 'FCKeditor_2' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = 100 ;
oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:parent(xToolbar)' ;
oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using FCKeditor.' ;
oFCKeditor.Create() ;
//-->
</script>\
此部分的??DEMO??⒄眨?
_samples/html/sample11.html
_samples/html/sample11_frame.html
4、文件管理功能、文件上?鞯?嘞???}
一直以後FCKeditor的文件管理部分的安全是??值得注意,但很多人?]注意到的地方,?m然FCKeditor在各??Release版本中一直存在的一??功能就是?ι?魑募??型?M行?^?V,但是她?]考?]?^另一?????}:到底允?S?l能上?鳎康降渍l能?g?[服?掌魑募??
之前???_始用FCKeditor?r,我就出?F?^?@?????},?好NetRube(FCKeditor中文化以及FCKeditor ASP版上?鞒绦虻淖髡撸┘?r提醒了我,做法是去修改FCK上?鞒绦颍?在?e面?M行?嘞夼?啵??K且再在fckconfig.js?e把相??的一些功能去掉。但?S之FCK版本的不?嗌??,每升一次都要去改一次配置程序fckconfig.js,我?l?X???┝耍?就?]什?N?k法能更好的控制?@?N配置?N?事??上,是有的。
在fckconfig.js?e面,有?P於是否打?_上?骱?g?[服?掌鞯脑O置,在??建FCKeditor?r,通?^程序?砼?嗍欠??建有上??g?[功能的??器。首先,我先在fckconfig.js?e面把所有的上?骱?g?[?O置全?O??false,接著我使用的代?a如下:
ASP版本:
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
with oFCKeditor
.BasePath = fckPath
.Config("ToolbarLocation") = "Out:fckToolBar"
if request.cookies(site_sn)("issuper")="yes" then
.Config("LinkBrowser") = "true"
.Config("ImageBrowser") = "true"
.Config("FlashBrowser") = "true"
.Config("LinkUpload") = "true"
.Config("ImageUpload") = "true"
.Config("FlashUpload") = "true"
end if
.ToolbarSet = "Basic"
.Width = "100%"
.Height = "200"
.Value = ""
.Create "jcontent"
%>
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
with oFCKeditor
.BasePath = fckPath
.Config("ToolbarLocation") = "Out:fckToolBar"
if request.cookies(site_sn)("issuper")="yes" then
.Config("LinkBrowser") = "true"
.Config("ImageBrowser") = "true"
.Config("FlashBrowser") = "true"
.Config("LinkUpload") = "true"
.Config("ImageUpload") = "true"
.Config("FlashUpload") = "true"
end if
.ToolbarSet = "Basic"
.Width = "100%"
.Height = "200"
.Value = ""
.Create "jcontent"
%>
JAVASCRIPT版本:
var oFCKeditor = new FCKeditor( 'fbContent' ) ;
<%if power = powercode then%>
oFCKeditor.Config['LinkBrowser'] = true ;
oFCKeditor.Config['ImageBrowser'] = true ;
oFCKeditor.Config['FlashBrowser'] = true ;
oFCKeditor.Config['LinkUpload'] = true ;
oFCKeditor.Config['ImageUpload'] = true ;
oFCKeditor.Config['FlashUpload'] = true ;
<%end if%>
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '200' ;
oFCKeditor.Value = '' ;
oFCKeditor.Create() ;
<%if power = powercode then%>
oFCKeditor.Config['LinkBrowser'] = true ;
oFCKeditor.Config['ImageBrowser'] = true ;
oFCKeditor.Config['FlashBrowser'] = true ;
oFCKeditor.Config['LinkUpload'] = true ;
oFCKeditor.Config['ImageUpload'] = true ;
oFCKeditor.Config['FlashUpload'] = true ;
<%end if%>
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '200' ;
oFCKeditor.Value = '' ;
oFCKeditor.Create() ;
[最後??於 Admin, at 2006-09-22 18:49:12]









