[QUESTION] Select and focus an html element from a panel button
Hi everyone,
Is it possible to set focus in a section html with Grapes, like as an anchor? I have a panel button and it just select the section that I want but not focus to element. Here is the code:
panel.addButton('options', [{
id: 'link',
className: 'fa fa-th-list',
command: function linkChap(e) {
editor.DomComponents.getWrapper().find('section').forEach(model => {
const current = model.getAttributes()['id'] || '';
if(current == "chap10"){
editor.select(model); //Here just select the section, but not set focus
}
});
}
Thanks in advance. Regards.
If for focus you mean scrolling the view to the component, unfortunately, there is no such a method, but you can actually implement it by relying on editor.Canvas.getBody().scrollTop
Did you manage to make it work?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.