I found a pretty "non straight forward" example for asp.net, but nothing for javascript. Isn't it possible to create an item in customTools which simply contains a list of texts and actions?
I came from trumbowyg, where this can be done pretty easy by something like:
code: {
dropdown: ['code1', 'code2', 'code3', 'code4', 'code5', 'code6', 'code7', 'code8', 'code9', 'code10'],
ico: 'preformatted',
text: 'Insert Special Placeholders'
},
code1: {
fn: function () {
trumbowyg.append('{link}');
},
text: 'Migration-Button',
hasIcon: false
},
code2: {
fn: function () {
trumbowyg.append('{serial}');
},
param: 'TextToInsert',
text: 'Device-Serial',
hasIcon: false
},
Unfortunately, i found nothing similar in this RichTextEditor
<script type="text/javascript" class="jsScript">
var items = [{ value: "1", text: "Migration-Button" }, { value: "2", text: "Device-Serial" }, { value: "3", text: "Insert" }, { value: "4", text: "Test" }]
var rteObj;
$(function () {
$("#rteSample").ejRTE({
width: "100%",
minWidth: "150px",
cssClass: "custom",
isResponsive: true,
toolsList: ["formatStyle", "font", "customTools", "style"],
tools: {
formatStyle: ["format"],
font: ["fontName", "fontSize"],
style: ["bold", "italic"],
customTools: [{
name: "InsertImage",
tooltip: "InsertImage ",
css: "InsertImage",
}]
}
});
var input = document.createElement("input"); //create input
input.setAttribute("id", "dropdown"); //set id for input
$("div.InsertImage")[0].append(input); // append this input to custom tool
$("#dropdown").ejDropDownList({ dataSource: items }); // render this input as DropDownList.
});
</script> |
$("#dropdown").ejSplitButton({
size: "normal",
showRoundedCorner: true,
contentType: "imageonly",
prefixIcon: "e-icon e-handup",
buttonMode: ej.ButtonMode.Dropdown,
targetID: "menu",
itemSelected:function(args)
{
if(args.text=="Migration-Button")
{
var rteObj = $("#rteSample").data("ejRTE");
rteObj.setHtml("<a rel='nofollow' href='https://google.com'>Link</a>"); //set Html based on the selection of split button.
}
}
}); // render this custom tool as splitbutton dropdown. |