[QUESTION] Select and focus an html element from a panel button
Question
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.Answers (3)
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Issue #1787
[Question] Change HTML of Panel buttons from span to button
I have created some Panels and would like to change the element of panel buttons from span to button as its more appropriate and looks bett...
Issue #1576
Select element that has several blocks as one unit.
I've created new block (like form or dialog, etc) that has several blocks such as search box, button, text fields, ... This element doesn't...
Issue #1135
[Question] Two html tags as one (link/button)
Is it possible to have two elements (div and lnik) and consider as a single? For example: there is the my following link block: <div class=...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.