mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 08:26:16 -04:00
Changeset: Migrate from OpIter
to deserializeOps()
This commit is contained in:
parent
0eca0251f2
commit
89fe40e080
16 changed files with 147 additions and 179 deletions
|
@ -586,12 +586,7 @@ const handleUserChanges = async (socket, message) => {
|
|||
Changeset.checkRep(changeset);
|
||||
|
||||
// Validate all added 'author' attribs to be the same value as the current user
|
||||
const iterator = Changeset.opIterator(Changeset.unpack(changeset).ops);
|
||||
let op;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
op = iterator.next();
|
||||
|
||||
for (const op of Changeset.deserializeOps(Changeset.unpack(changeset).ops)) {
|
||||
// + can add text with attribs
|
||||
// = can change or add attribs
|
||||
// - can have attribs, but they are discarded and don't show up in the attribs -
|
||||
|
@ -741,10 +736,8 @@ const _correctMarkersInPad = (atext, apool) => {
|
|||
// collect char positions of line markers (e.g. bullets) in new atext
|
||||
// that aren't at the start of a line
|
||||
const badMarkers = [];
|
||||
const iter = Changeset.opIterator(atext.attribs);
|
||||
let offset = 0;
|
||||
while (iter.hasNext()) {
|
||||
const op = iter.next();
|
||||
for (const op of Changeset.deserializeOps(atext.attribs)) {
|
||||
const attribs = AttributeMap.fromString(op.attribs, apool);
|
||||
const hasMarker = AttributeManager.lineAttributes.some((a) => attribs.has(a));
|
||||
if (hasMarker) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue