Cookbook needed?

0 views
Skip to first unread message

Ian C

unread,
Mar 30, 2016, 8:35:48 AM3/30/16
to CorinthiaTeam
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.
The key is the frmt["-corinthia-paragraph-style"]

I'm not sure that is entirely kosher? Should we be playing with "-corinthia-paragraph-style"?

How else can I add in my heading of a given class. Just manually supply the text that is in the style read?

And this then leads me to the idea that we need some sort of cookbook for how to do the various basic editing tasks.

The test cases do provide a lot but it is more than a little tedious searching them.


--
Cheers,

Ian C
Reply all
Reply to author
Forward
0 new messages