Reputation: 443
I'm trying to open the hallo editor toolbar on document.ready
with focus
on the first element or anywhere, it doesn't really matter I just need to open it
I tried triggering a click event on the editable element, and a focus event, nothing worked. I have also tried to put the caret in the editable element:
var el = document.getElementById("content");
var range = document.createRange();
var sel = window.getSelection();
range.setStart(el.firstChild, 2);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
any other ideas?
Upvotes: 0
Views: 267
Reputation: 443
I got it, must insert the caret in the element and then trigger the event halloactivated
on document.ready
var range = rangy.createRange();
var sel = rangy.getSelection();
range.selectNode(el);
sel.removeAllRanges();
sel.addRange(range);
jQuery('#content').trigger('halloactivated');
Upvotes: 0