diff --git a/formats/indent.js b/formats/indent.js index 8d6de84be8..bc70eba136 100644 --- a/formats/indent.js +++ b/formats/indent.js @@ -3,8 +3,8 @@ import Parchment from 'parchment'; class IdentAttributor extends Parchment.Attributor.Class { add(node, value) { if (value === '+1' || value === '-1') { - let indent = parseInt(this.value(node) || 0); - value = value === '+1' ? (indent + 1) : (indent - 1); + let indent = this.value(node) || 0; + value = (value === '+1' ? (indent + 1) : (indent - 1)); } if (value === 0) { this.remove(node); @@ -13,6 +13,9 @@ class IdentAttributor extends Parchment.Attributor.Class { return super.add(node, value); } } + value(node){ + return parseInt(super.value(node)); + } } let IndentClass = new IdentAttributor('indent', 'ql-indent', { diff --git a/modules/toolbar.js b/modules/toolbar.js index 7d07eee35a..53a2160056 100644 --- a/modules/toolbar.js +++ b/modules/toolbar.js @@ -107,7 +107,7 @@ class Toolbar extends Module { option.selected = true; } } if (input.value) { - input.classList.toggle('ql-active', input.value == formats[format]); // Intentional == + input.classList.toggle('ql-active', input.value === formats[format]); } else { input.classList.toggle('ql-active', formats[format] || false); }