I am using a WYSIWYG Rich Text Editor from mindmup
I added a dropdown box in toolbar I use this dropdown to fetch the content from server and append/prepend to the existing content in the Editor where the cursor is pointing.
But it is not adding the data to the editor.
I referred Insert html at caret in a contenteditable div and Insert text at cursor in a content editable div
But they are not working for me.
This is the function i used to fetch the data when changing drop down
function loadJournalTemplate(journalTemplateId) {
$.post('/Journal/GetTemplate', { journalId: journalTemplateId },
function (data, textStatus) {
if (textStatus == "success") {
$('#editor1').html(data.content); //Here i need to append/prepend
}
}, "json");
}
How can we add HTML at a current cursor position?
Note: This Insert text at cursor in a content editable div adds the content in dropdown itself, when I directly choose a dropdown before clicking editor