AttributeManager: Fix attribute name during attribute removal

Before this change, the `author` attribute was silently discarded
during `.map()` iteration and the name of the attribute to remove was
included twice with two different values.
This commit is contained in:
Richard Hansen 2021-01-29 03:01:05 -05:00 committed by John McLear
parent 8efc87f33a
commit 462530eafb

View file

@ -352,10 +352,10 @@ AttributeManager.prototype = _(AttributeManager.prototype).extend({
const attribs = _(this.getAttributesOnLine(lineNum)).map((attrib) => { const attribs = _(this.getAttributesOnLine(lineNum)).map((attrib) => {
if (attrib[0] === attributeName && (!attributeValue || attrib[0] === attributeValue)) { if (attrib[0] === attributeName && (!attributeValue || attrib[0] === attributeValue)) {
found = true; found = true;
return [attributeName, '']; return [attrib[0], ''];
} else if (attrib[0] === 'author') { } else if (attrib[0] === 'author') {
// update last author to make changes to line attributes on this line // update last author to make changes to line attributes on this line
return [attributeName, this.author]; return [attrib[0], this.author];
} }
return attrib; return attrib;
}); });