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

@ -665,6 +665,7 @@ Context properties:
Example:
```javascript
const AttributeMap = require('ep_etherpad-lite/static/js/AttributeMap');
const Changeset = require('ep_etherpad-lite/static/js/Changeset');
exports.getLineHTMLForExport = async (hookName, context) => {
@ -672,7 +673,7 @@ exports.getLineHTMLForExport = async (hookName, context) => {
const opIter = Changeset.opIterator(context.attribLine);
if (!opIter.hasNext()) return;
const op = opIter.next();
const heading = Changeset.opAttributeValue(op, 'heading', apool);
const heading = AttributeMap.fromString(op.attribs, context.apool).get('heading');
if (!heading) return;
context.lineContent = `<${heading}>${context.lineContent}</${heading}>`;
};