Textangular 1.4.6と Angular 1.4.7を使用しています。ツールバーにドロップダウンを追加する必要があるため、次のコードを書きました。
$provide.decorator('taOptions', [
'taRegisterTool',
'$delegate',
function (taRegisterTool, taOptions) {
// $delegate is the taOptions we are decorating
// register the tool with textAngular
taRegisterTool('parameterscombo', {
display: '<button class="btn" type="button" data-animation="am-fade" bs-dropdown="content" aria-haspopup="true" aria-expanded="false">Select parameter</button>',
content: [
{
text: 1,
click: 'action(item)'
},
{
text: 2,
click: 'action(item)'
},
{
text: 3,
click: 'action(item)'
},
{
text: 4,
click: 'action(item)'
}
],
action: function (item) {
if (item.text) {
this.$editor().wrapSelection('insertHtml', item.text + '***');
}
}
});
// add the button to the default toolbar definition
taOptions.toolbar[1].push('parameterscombo');
return taOptions;
}
]);
ドロップダウンが表示され、値を選択してテキストエリアに挿入できます。問題は、最初に値を選択すると正しい場所 (カーソルがある場所) に挿入されますが、2 回目以降は常にテキストの先頭に値が配置されることです。
ここに plunkr があります: http://plnkr.co/edit/UZQk3jQ5xEpMJdNLonBO?p=preview