Hi, I want to open the scayt button from outside the editor. execCommand does not seems to work on the menu, only on the menu items like checlspell and scyatscheck.
How do I open (and close) the scayt menu through the API?
Hi, I want to open the scayt button from outside the editor. execCommand does not seems to work on the menu, only on the menu items like checlspell and scyatscheck.
How do I open (and close) the scayt menu through the API?
There isn't public access to
There isn't public access to open Scayt toolbar menu. But you can try to use work around.
To open scayt button(toolbar menu list) you should find the item on toolbar and run execute method.
CKEDITOR.instances.your_editor_name.toolbox.toolbars[2].items[6].execute()
toolbars[2] is your toolbar number where the icon exists and items[6] it's number of SCAYT button in toolbar
You can use following function to get SCAYT button:
function getScaytButton(){
var toolbox = CKEDITOR.instances.test1.toolbox;
for(var i = 0; i<toolbox.toolbars.length; i++){
for(var j = 0; j<toolbox.toolbars[i].items.length; j++){
//console.log(toolbox.toolbars[i].items[j].button);
if(toolbox.toolbars[i].items[j].button && toolbox.toolbars[i].items[j].button.className === "cke_button_scayt"){
return toolbox.toolbars[i].items[j];
}
}
}
}
var scaytBtn = getScaytButton();
scaytBtn.execute();
To remove menu you should change editor's focus.
Thanks a lot,
Thanks a lot,
className was not available as property on button object, but I used the name property.
var scaytBtn;
var toolbox = editor.toolbox;
for(var i = 0; i<toolbox.toolbars.length; i++){
for(var j = 0; j<toolbox.toolbars[i].items.length; j++){
if(toolbox.toolbars[i].items[j].button && toolbox.toolbars[i].items[j].button.name === "scayt"){
scaytBtn = toolbox.toolbars[i].items[j];
}
}
}
if(scaytBtn != null){
scaytBtn.execute();
}