Changeset: Migrate to the new attribute API

This commit is contained in:
Richard Hansen 2021-11-19 00:51:25 -05:00
parent f40d285109
commit f1eb7a25a6
15 changed files with 175 additions and 210 deletions

View file

@ -19,6 +19,7 @@
* limitations under the License.
*/
const AttributeMap = require('../../static/js/AttributeMap');
const Changeset = require('../../static/js/Changeset');
exports.getPadPlainText = (pad, revNum) => {
@ -54,7 +55,8 @@ exports._analyzeLine = (text, aline, apool) => {
const opIter = Changeset.opIterator(aline);
if (opIter.hasNext()) {
const op = opIter.next();
let listType = Changeset.opAttributeValue(op, 'list', apool);
const attribs = AttributeMap.fromString(op.attribs, apool);
let listType = attribs.get('list');
if (listType) {
lineMarker = 1;
listType = /([a-z]+)([0-9]+)/.exec(listType);
@ -63,7 +65,7 @@ exports._analyzeLine = (text, aline, apool) => {
line.listLevel = Number(listType[2]);
}
}
const start = Changeset.opAttributeValue(op, 'start', apool);
const start = attribs.get('start');
if (start) {
line.start = start;
}