From bd9621d832f028455edf16405475c977bc811cae Mon Sep 17 00:00:00 2001 From: Jon Nolen Date: Thu, 19 May 2016 20:44:48 -0400 Subject: [PATCH] fixes issue #681 with pasteHtml incorrectly re-hydrating tabs. --- formats/indent.js | 7 +++++-- modules/toolbar.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) 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); }