婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 如何在.Net版本UEditor中添加一個普通按鈕

如何在.Net版本UEditor中添加一個普通按鈕

熱門標簽:t3出行地圖標注怎么做 關(guān)于宗地圖標注技術(shù)規(guī)范 寧夏機器人電銷 威海電銷 外呼電銷機器人軟件 河北網(wǎng)絡(luò)回撥外呼系統(tǒng) 河南語音外呼系統(tǒng)公司 400電話辦理最優(yōu)質(zhì) 400免費電話怎么辦理

第一步:找到ueditor.config.js文件中的toolbars數(shù)組,增加一個“hougelou”字符串,然后找到labelMap數(shù)組,對應(yīng)著添加一個labelMap,用于鼠標移上按鈕時的提示。

復(fù)制代碼 代碼如下:

//工具欄上的所有的功能按鈕和下拉框,可以在new編輯器的實例時選擇自己需要的從新定義
        , toolbars:[
            ['fullscreen', 'source', '|', 'undo', 'redo', '|',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'hougelou', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
                'directionalityltr', 'directionalityrtl', 'indent', '|',
                'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
                'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe','insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
                'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
                'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
                'print', 'preview', 'searchreplace', 'help']
        ]
        //當鼠標放在工具欄上時顯示的tooltip提示,留空支持自動多語言配置,否則以配置值為準
        ,labelMap:{
        'hougelou': 'hello,后閣樓'
        }

第二步:找到你所引用的ueditor.all.js文件中的btnCmds數(shù)組,在其中同樣增加一個“hougelou”字符串。

第三步:清空緩存刷新下頁面吧!工具欄的對應(yīng)位置是否出現(xiàn)了一個自己定義的按鈕呢?如下圖所示:

 

由于此時未設(shè)置對應(yīng)按鈕的圖片樣式,所以會顯示默認的“B”字符。要想讓其顯示成自己需要的圖標樣式,接著按照下面的步驟動手吧。

第四步:找到themes/default/css/ueditor.css文件,增加一條樣式定義:

復(fù)制代碼 代碼如下:

.edui-for-hougelou .edui-icon {
    background-position: -700px -40px;
}

 

此處的樣式定義了showmsg圖標在UEditor默認的精靈Icon圖片(themes/default/images/icons.png)中的位置偏移。如需更改成另外圖標,只需添加圖標到該圖片文件中,然后設(shè)置偏移值即可。

第五步:到此為止,在UI層面已經(jīng)完成了一個工具欄圖標的顯示和各種狀態(tài)變化的邏輯,但是我們發(fā)現(xiàn)點擊按鈕之后毫無反應(yīng)。那是必然的,我們還必須為該按鈕綁定屬于它自己的事件處理方法。

實質(zhì)上,此時一個默認的事件處理方法已經(jīng)被UEditor綁定到按鈕上了,只不過由于我們還沒有定義該方法的具體內(nèi)容,所以點擊之后無任何變化。

下面我們就來定義該方法的具體內(nèi)容:

在初始化編輯器的時候,加上自己的事件處理(插入一張圖片),如下代碼:

復(fù)制代碼 代碼如下:

ueditor = UE.getEditor('txtContent', {
            "initialFrameHeight": "200",
            toolbars: [['fullscreen', 'source', 'hougelou', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|', 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|', 'insertimage', 'emotion', 'insertvideo', 'music', 'insertcode', 'background', '|', 'horizontal', 'date', 'time', 'spechars', '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|', 'preview', 'searchreplace', 'help']],
            enterTag: "nbsp;"
        }); //回車的時候用換行不用段落標簽
        //實現(xiàn)插件的功能代碼
        baidu.editor.commands['hougelou'] = { execCommand: function() { this.execCommand('insertHtml', "img src='http://www.xxx.com/images/logo.png' />"); return true; }, queryCommandState: function() { } };

 

End

 -------------------------------------------------------------------------------

 在images.ashx里發(fā)現(xiàn)百度編輯器返回圖片路徑是用分隔符“ue_separate_ue”連起來的。

您可能感興趣的文章:
  • .NET UEditor使用方法說明
  • .NET下為百度文本編輯器UEditor增加圖片刪除功能示例
  • ASP.NET中集成百度編輯器UEditor
  • 利用ASP.NET MVC+Bootstrap搭建個人博客之修復(fù)UEditor編輯時Bug(四)
  • 一步步教你在Asp.net Mvc中使用UEditor編輯器
  • UEditor編輯器自定義上傳圖片或文件路徑的修改方法
  • 關(guān)于UEditor編輯器遠程圖片上傳失敗的解決辦法
  • ueditor編輯器不能上傳圖片問題的解決方法
  • ASP.NET百度Ueditor編輯器實現(xiàn)上傳圖片添加水印效果

標簽:樂山 賀州 咸寧 池州 吉林 淮北 固原 廣元

巨人網(wǎng)絡(luò)通訊聲明:本文標題《如何在.Net版本UEditor中添加一個普通按鈕》,本文關(guān)鍵詞  如,何在,.Net,版本,UEditor,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《如何在.Net版本UEditor中添加一個普通按鈕》相關(guān)的同類信息!
  • 本頁收集關(guān)于如何在.Net版本UEditor中添加一個普通按鈕的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 开平市| 云霄县| 临澧县| 怀集县| 连平县| 吴桥县| 桃园市| 保德县| 门源| 南和县| 法库县| 肃北| 公安县| 永川市| 抚顺县| 武川县| 台湾省| 宁国市| 广平县| 蓝田县| 隆德县| 定西市| 乌审旗| 馆陶县| 秦安县| 革吉县| 云阳县| 长沙市| 巴里| 麦盖提县| 玉田县| 筠连县| 庆安县| 筠连县| 天柱县| 饶平县| 从化市| 大邑县| 旌德县| 罗城| 枣阳市|