Skip to content

Commit 2fc06a0

Browse files
committed
Changeset: Add TODO comments for issues noticed
1 parent f1eb7a2 commit 2fc06a0

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/node/utils/padDiff.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
383383
const oldValue = oldAttribs.get(key);
384384
if (oldValue !== value) backAttribs.set(key, oldValue);
385385
}
386+
// TODO: backAttribs does not restore removed attributes (it is missing attributes that
387+
// are in oldAttribs but not in attribs). I don't know if that is intentional.
386388
return backAttribs.toString();
387389
});
388390

src/static/js/Changeset.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,8 @@ exports.inverse = (cs, lines, alines, pool) => {
20982098
const oldValue = oldAttribs.get(key) || '';
20992099
if (oldValue !== value) backAttribs.set(key, oldValue);
21002100
}
2101+
// TODO: backAttribs does not restore removed attributes (it is missing attributes that
2102+
// are in oldAttribs but not in attribs). I don't know if that is intentional.
21012103
return backAttribs.toString();
21022104
});
21032105
consumeAttribRuns(csOp.chars, (len, attribs, endsLine) => {

src/static/js/contentcollector.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
235235
// to enable the content collector to store key-value attributes
236236
// see https://github.com/ether/etherpad-lite/issues/2567 for more information
237237
// in long term the contentcollector should be refactored to get rid of this workaround
238+
//
239+
// TODO: This approach doesn't support changing existing values: if both 'foo::bar' and
240+
// 'foo::baz' are in state.attribs then the last one encountered while iterating will win.
238241
const ATTRIBUTE_SPLIT_STRING = '::';
239242

240243
// see if attributeString is splittable
@@ -265,6 +268,9 @@ const makeContentCollector = (collectStyles, abrowser, apool, className2Author)
265268
const attribs = new AttributeMap(apool)
266269
.set('lmkr', '1')
267270
.set('insertorder', 'first')
271+
// TODO: Converting all falsy values in state.lineAttributes into removals is awkward.
272+
// Better would be to never add 0, false, null, or undefined to state.lineAttributes in the
273+
// first place (I'm looking at you, state.lineAttributes.start).
268274
.update(Object.entries(state.lineAttributes).map(([k, v]) => [k, v || '']), true);
269275
lines.appendText('*', attribs.toString());
270276
};

0 commit comments

Comments
 (0)