var editor = this.$editor[0];
if (current.nodeType !== Node.ELEMENT_NODE) current = current.parentNode;
- var tagName, tags = [];
- while (current !== editor) {
- tagName = current.nodeName.toLowerCase();
- if (tags.indexOf(tagName) === -1) {
- if (this.opts.activeButtonsStates.hasOwnProperty(tagName)) {
- this.button.setActive(this.opts.activeButtonsStates[tagName]);
+ if (current.closest('.redactor-layer') === editor) {
+ var tagName, tags = [];
+ while (current !== editor) {
+ tagName = current.nodeName.toLowerCase();
+ if (tags.indexOf(tagName) === -1) {
+ if (this.opts.activeButtonsStates.hasOwnProperty(tagName)) {
+ this.button.setActive(this.opts.activeButtonsStates[tagName]);
+ }
+
+ // mark as known
+ tags.push(tagName);
}
- // mark as known
- tags.push(tagName);
+ current = current.parentNode;
}
-
- current = current.parentNode;
}
-
}).bind(this);
this.observe.dropdowns = (function() {
var current = this.selection.current();
+ if (current && current.nodeType !== Node.ELEMENT_NODE) current = current.parentNode;
var editor = this.$editor[0];
- var isRedactor = this.utils.isRedactorParent(current);
var tagName, tags = [];
- if (current && isRedactor) {
- if (current.nodeType !== Node.ELEMENT_NODE) current = current.parentNode;
-
+ if (current && current.closest('.redactor-layer') === editor) {
while (current !== editor) {
tagName = current.nodeName.toLowerCase();
if (tags.indexOf(tagName) === -1) {