Hi Peter,
one of my next test cases was to insert a new Heading at the start of a document.
I came up with...
function autoEdit(api) {
var posRef = api.input.documentStartAnchor();
api.input.setSelectedTextRange(posRef, posRef);
var frmt = api.formatting.getFormatting();
api.cursor.enterPressed();
api.cursor.moveLeft();
api.cursor.insertCharacter("New Shiny Header");
api.formatting.applyFormattingChanges(frmt["-corinthia-paragraph-style"],{});
}
After some reverse engineering of some of the editor test cases.