diff options
author | Marcel Klehr <mklehr@gmx.net> | 2015-01-10 16:35:37 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2015-01-10 16:35:37 +0100 |
commit | 167e0aea5900e0dd4203ca457612112b3cdca346 (patch) | |
tree | ce008e7cf439e0addda39ca6ef020056a2de8899 | |
parent | 4f22f76cf667b3204bdb13ab060a7dd2af9899a3 (diff) | |
parent | 751adb24fde9a093e3bf57e2e8350b2ae67db52e (diff) | |
download | etherpad-lite-167e0aea5900e0dd4203ca457612112b3cdca346.zip |
Merge pull request #2442 from ether/fix/attribmanager-removeattribonline
Finally fix AttribManager#removeAttributeOnLine
-rw-r--r-- | src/static/js/AttributeManager.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/static/js/AttributeManager.js b/src/static/js/AttributeManager.js index a11f6cef..974d8ad9 100644 --- a/src/static/js/AttributeManager.js +++ b/src/static/js/AttributeManager.js @@ -164,12 +164,20 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({ var builder = Changeset.builder(this.rep.lines.totalWidth()); var hasMarker = this.lineHasMarker(lineNum); var attribs + var foundAttrib = false attribs = this.getAttributesOnLine(lineNum).map(function(attrib) { - if(attrib[0] === attributeName) return [attributeName, null] + if(attrib[0] === attributeName) { + foundAttrib = true + return [attributeName, null] // remove this attrib from the linemarker + } return attrib }) + if(!foundAttrib) { + return + } + if(hasMarker){ ChangesetUtils.buildKeepRange(this.rep, builder, loc, (loc = [lineNum, 0])); // If length == 4, there's [author, lmkr, insertorder, + the attrib being removed] thus we can remove the marker entirely |