欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

fckeditor 插件實(shí)例 制作步驟

 更新時(shí)間:2009年06月19日 18:13:23   作者:  
一:基于對(duì)話框的插件:一步一步創(chuàng)建基于對(duì)話框的fck插件。
以創(chuàng)建一個(gè)簡(jiǎn)單的超級(jí)鏈接為例??梢詮囊呀?jīng)存在的placeholder插件的目錄作為基本的骨架。

1. 命名插件名稱為:"InsertLink". ,并建立同名的目錄,并且在InsertLink目錄下創(chuàng)建一個(gè)Lang的目錄,lang目錄下至少有一個(gè)文件en.js。該文件中至少要有按鈕和對(duì)話框標(biāo)題的國(guó)際化信息,比如:
FCKLang.InsertLinkBtn = 'Insert/Edit Link' ; //按鈕的標(biāo)題
FCKLang.InsertLinkDlgTitle = 'Link Properties' ; //對(duì)話框的標(biāo)題
2:圖片,在InsertLink文件夾中添加圖片文件,最好將圖片文件命名為和插件名一樣的名稱。圖片的大小要求是20*21,并且是透明的。
3:javascript:
添加fckplugin.js文件到InsertLink目錄。
注冊(cè)相關(guān)命令:
注冊(cè)命令的方法是FCKCommands.RegisterCommand(命令名稱,對(duì)話框命令)
創(chuàng)建對(duì)話框命令的格式:new FCKDialogCommand( 命令名稱, 對(duì)話框標(biāo)題,url路徑, 寬度,高度)

FCKCommands.RegisterCommand( 'InsertLink', new FCKDialogCommand( 'InsertLink', FCKLang.InsertLinkDlgTitle,
FCKPlugins.Items['InsertLink'].Path + 'fck_InsertLink.html', 340, 200 ) ) ;

// 創(chuàng)建工具欄按鈕 new FCKToolbarButton( 按鈕名稱, 按鈕標(biāo)題 ) ;
var oInsertLinkItem = new FCKToolbarButton( 'InsertLink', FCKLang.InsertLinkBtn ) ;
oInsertLinkItem.IconPath = FCKPlugins.Items['InsertLink'].Path + 'InsertLink.gif' ;
FCKToolbarItems.RegisterItem( 'InsertLink', oInsertLinkItem ) ;

//創(chuàng)建用于所有InsertLink操作的對(duì)象
var FCKInsertLink = new Object() ;

//在當(dāng)前的選擇上插入一個(gè)超級(jí)鏈接
// 這個(gè)添加的方法將在彈出窗口點(diǎn)擊ok按鈕時(shí)被調(diào)用。
// 該方法將會(huì)接收從對(duì)話框中傳來(lái)的值。

FCKInsertLink.Add = function( linkname, caption )
{
if(linkname.substr(0,4) != "http" && linkname.substr(0,4) != "HTTP")
linkname = "http://"+linkname ;
FCK.InsertHtml("<a href='"+linkname+"'>"+caption+"</a>") ;
}

4:html
在InsertLink目錄下添加請(qǐng)求的文件。
請(qǐng)求文件的模板代碼:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Link Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script language="javascript">

var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKLang = oEditor.FCKLang ;
var FCKInsertLink = oEditor.FCKInsertLink ;

window.onload = function ()
{
LoadSelected() ; //see function below
window.parent.SetOkButton( true ) ;
}

//從編輯器中得到當(dāng)前的被選擇的元素,有以下兩種方法:

//1. 可用于image等元素的選擇。
//var eSelected = oEditor.FCKSelection.GetSelectedElement() ;

//2. 由于有內(nèi)部文本的元素
var eSelected = FCK.Selection.MoveToAncestorNode( 'A' )
if ( eSelected )
FCK.Selection.MoveToNode( eSelected ) ;

//如果超級(jí)練級(jí)被選擇,那么顯示超級(jí)鏈接的屬性
function LoadSelected()
{
if ( !eSelected )
return ;

txtHref.value = eSelected.href ;
txtCaption.value = eSelected.innerText ;

//適合于第一種選擇操作的代碼:
// if ( eSelected.tagName == 'IMG' ) {
// -- code for setting dialog values -- }
// else
// eSelected == null ; //this will replace the current selection if not the right type

}

//點(diǎn)擊ok按鈕發(fā)生的操作
function Ok()
{
if ( document.getElementById('txtHref').value.length > 0 )
FCKInsertLink.Add( txtHref.value, txtCaption.value ) ;

return true ;
}
</script>
</head>

<body scroll="no" style="OVERFLOW: hidden">
<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td>
<table cellSpacing="0" cellPadding="0" align="center" border="0">
<tr>
<td>
Type the URL for the link<br>
<input id="txtHref" type="text"><br>
Type the caption for the link<br>
<input id="txtCaption" type="text">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

<!-- End Code -->

5:編輯fckconfig.js文件,并加入下列代碼,注冊(cè)插件。
FCKConfig.Plugins.Add( 'InsertLink', 'en' ) ;
//在工具欄集合中定義命令名稱。
FCKConfig.ToolbarSets["Default"] = [ , ['InsertLink']

相關(guān)文章

  • myFocus 一個(gè)KindEditor的焦點(diǎn)圖插件

    myFocus 一個(gè)KindEditor的焦點(diǎn)圖插件

    使用KindEditor(富文本編輯器)提供的接口將myFocus(焦點(diǎn)圖庫(kù))集成在KindEditor上
    2011-04-04
  • 寶麗通實(shí)現(xiàn)連續(xù)播放實(shí)現(xiàn)代碼

    寶麗通實(shí)現(xiàn)連續(xù)播放實(shí)現(xiàn)代碼

    最近在研究如何才能實(shí)現(xiàn)連續(xù)播放功能,之前本打算用Asp生成asx播放列表,再交給寶利通播放, 不過(guò)看似有點(diǎn)麻煩,仔細(xì)翻閱官方開(kāi)發(fā)文檔,發(fā)現(xiàn)播放器有個(gè)事件
    2008-09-09
  • IE8 Fckedit2.6.X不兼容

    IE8 Fckedit2.6.X不兼容

    經(jīng)過(guò)測(cè)試IE8和FCKEditer出現(xiàn)不兼容的情況,表現(xiàn)在提交數(shù)據(jù)時(shí)Fckediter對(duì)象里面的數(shù)據(jù)為空
    2009-04-04
  • 添加FCKeditor插件需要注意的地方

    添加FCKeditor插件需要注意的地方

    今天,在做程序的時(shí)候發(fā)現(xiàn) FCKeditor功能并不強(qiáng)大(開(kāi)始還不知道可以用插件,汗~),至少?zèng)]有上傳視頻,專輯,音樂(lè),水印等功能(以前我也修改過(guò)DVBBS的編輯器,也自定義了很多使用按鈕).
    2009-11-11
  • 整合ckeditor+ckfinder,解決上傳文件路徑問(wèn)題

    整合ckeditor+ckfinder,解決上傳文件路徑問(wèn)題

    現(xiàn)在fckeditor已經(jīng)改名為ckeditor,上傳控件也分離為ckfinder,按照說(shuō)明文檔的默認(rèn)配置會(huì)出現(xiàn)上傳路徑不正確的情況,因?yàn)槲覀兊木W(wǎng)站可以通過(guò)定義默認(rèn)網(wǎng)站、虛擬目錄、以及放在網(wǎng)站的子目錄下進(jìn)行訪問(wèn)
    2011-11-11
  • eWebEditor 輯器按鈕失效 IE8下eWebEditor編輯器無(wú)法使用的解決方法

    eWebEditor 輯器按鈕失效 IE8下eWebEditor編輯器無(wú)法使用的解決方法

    最近我把IE瀏覽器更新到了IE8.0,在用eWebEditor在線HTML文本編輯器的時(shí)候點(diǎn)擊eWebEditor上的所有編輯按鈕都沒(méi)用,只看到瀏覽器狀態(tài)欄左下角顯示網(wǎng)頁(yè)上有錯(cuò)誤,于是上網(wǎng)查了一下。終于找到解決的方法,測(cè)試后正常。
    2009-06-06
  • CKEditor/FCKEditor 使用FCKeditor 2.6.5 快速使用教程(含插入圖片)

    CKEditor/FCKEditor 使用FCKeditor 2.6.5 快速使用教程(含插入圖片)

    CKEditor 是著名的 HTML 編輯器,IBM、Oracle、Adobe 等都在用。CKEditor 創(chuàng)建于 2003 年,其前身為 FCKEditor,在 2009 年的時(shí)候把“F”去掉了,更名為 CKEditor。
    2010-03-03
  • asp.net CKEditor和CKFinder的應(yīng)用

    asp.net CKEditor和CKFinder的應(yīng)用

    CKEditor和CKFinder在ASP.NET中的應(yīng)用,需要的朋友可以參考下。
    2010-01-01
  • js獲取UEditor富文本編輯器中的圖片地址

    js獲取UEditor富文本編輯器中的圖片地址

    這篇文章主要介紹了js獲取UEditor富文本編輯器中的圖片地址,最簡(jiǎn)單的思路應(yīng)該是先獲取UEditor中的內(nèi)容再將獲取到的字符串轉(zhuǎn)換成jquery對(duì)象,選擇器找到img元素,獲取src值
    2020-02-02
  • 將CKfinder 整合進(jìn) CKEditor3.0的方法

    將CKfinder 整合進(jìn) CKEditor3.0的方法

    CKFinder是一款基于AJAX的文件瀏覽器,這是ASP.NET專用版,它可以在線瀏覽文件、管理文件、上傳文件,以樹(shù)形Tree的方式展開(kāi)目錄,自動(dòng)檢測(cè)圖片并生成縮略圖,它是由Fckeditor公司出品,同時(shí)也可配合FckEditor來(lái)使用,可達(dá)到意想不到的效果。
    2010-01-01

最新評(píng)論