4
基本上我想要一個按鈕添加到工具欄,允許用戶插入©到textangular編輯器(http://textangular.com/),但我無法理解怎麼加功能註冊到我的按鈕之後...由於textangular站點上所有自定義功能的示例都使用相同的語句「wrapSelection」,它具有非常簡單的文檔,下面將使用quote按鈕顯示此示例。如何從textAngular工具欄上的自定義按鈕插入文本/符號
taRegisterTool('quote', {
iconclass: 'fa fa-quote-right',
tooltiptext: taTranslations.quote.tooltip,
action: function(){
return this.$editor().wrapSelection("formatBlock", "<BLOCKQUOTE>");
},
activeState: function(){ return this.$editor().queryFormatBlockState('blockquote'); }
});
我對「formatBlock」被初始化的地方感到困惑,並且認爲找到它的源代碼會幫助我解決這個問題。正如你所看到的任何幫助,將不勝感激
taRegisterTool('insertCopyright', {
buttontext: '©',
tooltiptext: taTranslations.insertCopyright.tooltip,
action: function() {
//???
},
});
我會記下wrapSelection窮docs - 它基本上是'execCommand'的包裝,但我們修復了一些不一致的調用。 – 2014-10-07 21:18:19
@SimeonCheeseman很酷的感謝 – alsco77 2014-10-08 08:15:35