I've developed a ribbon button to Sharepoint inside Media tab. This opens a dialog where I list loads of content. On click I'm calling a function to close the dialog and it is supposed to insert some html into the editor.
....
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback); SP.UI.ModalDialog.showModalDialog(options); } .... this is the function that I'm returning
function CloseCallback(result, target) { ExecuteOrDelayUntilScriptLoaded(RTEActions, "sp.ui.rte.js"); } function RTEActions() { RTE.Cursor.update(); var html = 'testing'; var rawRange = RTE.Selection.getSelectionRange().$C; RTE.DomHelper.pasteHtmlIntoRange(rawRange, html); } This is throwing an error: rawRange is undefined. Is there a better way to insert content into the editor?