mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 17:36:14 -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
|
@ -527,12 +527,10 @@ exports.restoreRevision = async (padID, rev) => {
|
|||
atext.text += '\n';
|
||||
|
||||
const eachAttribRun = (attribs, func) => {
|
||||
const attribsIter = Changeset.opIterator(attribs);
|
||||
let textIndex = 0;
|
||||
const newTextStart = 0;
|
||||
const newTextEnd = atext.text.length;
|
||||
while (attribsIter.hasNext()) {
|
||||
const op = attribsIter.next();
|
||||
for (const op of Changeset.deserializeOps(attribs)) {
|
||||
const nextIndex = textIndex + op.chars;
|
||||
if (!(nextIndex <= newTextStart || textIndex >= newTextEnd)) {
|
||||
func(Math.max(newTextStart, textIndex), Math.min(newTextEnd, nextIndex), op.attribs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue