Make the aceAttribClasses hook harder to misuse
parent
5aa318a09b
commit
ba6bdf35be
|
@ -679,18 +679,21 @@ exports.stylesForExport = function(hook, padId, cb){
|
||||||
## aceAttribClasses
|
## aceAttribClasses
|
||||||
Called from: src/static/js/linestylefilter.js
|
Called from: src/static/js/linestylefilter.js
|
||||||
|
|
||||||
Things in context:
|
This hook is called when attributes are investigated on a line. It is useful if
|
||||||
1. Attributes - Object of Attributes
|
you want to add another attribute type or property type to a pad.
|
||||||
|
|
||||||
This hook is called when attributes are investigated on a line. It is useful if you want to add another attribute type or property type to a pad.
|
An attributes object is passed to the aceAttribClasses hook functions instead of
|
||||||
|
the usual context object. A hook function can either modify this object directly
|
||||||
|
or provide an object whose properties will be assigned to the attributes object.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
exports.aceAttribClasses = function(hook_name, attr, cb){
|
exports.aceAttribClasses = (hookName, attrs, cb) => {
|
||||||
attr.sub = 'tag:sub';
|
return cb([{
|
||||||
cb(attr);
|
sub: 'tag:sub',
|
||||||
}
|
}]);
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
## exportFileName
|
## exportFileName
|
||||||
|
|
|
@ -59,8 +59,9 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun
|
||||||
{
|
{
|
||||||
|
|
||||||
// Plugin Hook to add more Attrib Classes
|
// Plugin Hook to add more Attrib Classes
|
||||||
const results = hooks.callAll('aceAttribClasses', linestylefilter.ATTRIB_CLASSES);
|
for (const attribClasses of hooks.callAll('aceAttribClasses', linestylefilter.ATTRIB_CLASSES)) {
|
||||||
if (results.length >= 1) linestylefilter.ATTRIB_CLASSES = results[0];
|
Object.assign(linestylefilter.ATTRIB_CLASSES, attribClasses);
|
||||||
|
}
|
||||||
|
|
||||||
if (lineLength == 0) return textAndClassFunc;
|
if (lineLength == 0) return textAndClassFunc;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue