When working with JavaScript, my goal is to add a call to insertContentControl() at the very end of the document, following any content in the main body. Initially, I believed this could be achieved through:
context.document.getSelection();
var cc = context.document.body.insertContentControl();
cc.color = 'orange';
cc.tag = 'wikindx-bibliography';
cc.title = 'Bibliography';
cc.insertHtml('A reference', "End");
However, this approach simply combines existing text within the content control and then adds 'A reference' to it.