There is also one alternative approach more.
Ext.ComponentQuery.query("htmleditor").length > 0
The approach presented above works as expected but it has a performance problem, since it will navigate through all items, as shown below:
Ext.ComponentQuery.query uses Ext.ComponentQuery.filterByXType
filterByXType = function (items, xtype, shallow) {
if (xtype === '*') {
return items.slice();
}
else {
var result = [],
i = 0,
length = items.length,
candidate;
for (; i < length; i++) {
candidate = items[i];
if (candidate.isXType(xtype, shallow)) {
result.push(candidate);
}
}
return result;
}
}
Items passed to Ext.ComponentQuery.filterByXType:
Ext.ComponentManager.getAll()
CPA1158139's requirement is to know whether a HtmlEditor is presented on the page, so, in my opinion it's not good to navigate through all elements, although we are talking about milliseconds.