Revert 'asyncLineHTMLForExport' hook
parent
aca745ddf6
commit
4c64b7a670
|
@ -245,7 +245,7 @@ Things in context:
|
||||||
2. attribLine - line attributes
|
2. attribLine - line attributes
|
||||||
3. text - line text
|
3. text - line text
|
||||||
|
|
||||||
This hook will allow a plug-in developer to re-write each line when exporting to HTML. Note that you problably don't want to use this plugin and will probably get better results from `asyncLineHTMLForExport`
|
This hook will allow a plug-in developer to re-write each line when exporting to HTML.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```
|
```
|
||||||
|
@ -271,39 +271,6 @@ function _analyzeLine(alineAttrs, apool) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## asyncLineHTMLForExport
|
|
||||||
Called from: src/node/utils/ExportHtml.js
|
|
||||||
|
|
||||||
Things in context:
|
|
||||||
|
|
||||||
1. The context of the line
|
|
||||||
2. lineContents - The HTML of the line
|
|
||||||
3. Attribute pool
|
|
||||||
4. Attribute line
|
|
||||||
5. Line Text
|
|
||||||
|
|
||||||
This hook will allow functions to be returned to modify the HTML.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```
|
|
||||||
exports.asyncLineHTMLForExport = function (hook, context, cb) {
|
|
||||||
cb(rewriteLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
function rewriteLine(context){
|
|
||||||
var lineContent = context.lineContent;
|
|
||||||
sizes.forEach(function(size){
|
|
||||||
size = size.replace("fs","");
|
|
||||||
if(lineContent){
|
|
||||||
lineContent = lineContent.replace("<fs"+size, "<span style='font-size:"+size+"px'");
|
|
||||||
lineContent = lineContent.replace("</fs"+size, "</span");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return lineContent;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## stylesForExport
|
## stylesForExport
|
||||||
Called from: src/node/utils/ExportHtml.js
|
Called from: src/node/utils/ExportHtml.js
|
||||||
|
|
||||||
|
|
|
@ -419,18 +419,6 @@ function getHTMLFromAtext(pad, atext, authorColors)
|
||||||
text: textLines[i]
|
text: textLines[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/ether/etherpad-lite/issues/2486
|
|
||||||
hooks.aCallAll("asyncLineHTMLForExport", context, function(err, newLineFunction){
|
|
||||||
// For each function returned by the hook call
|
|
||||||
// Process the text based on the function
|
|
||||||
newLineFunction.forEach(function(fn){
|
|
||||||
context.lineContent = fn(context); // note the fn
|
|
||||||
});
|
|
||||||
// We now have a line that has been processed by each hook function
|
|
||||||
lineContent = context.lineContent; // modified lineContent here
|
|
||||||
});
|
|
||||||
|
|
||||||
// Old hook probably not to be used..
|
|
||||||
var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", context, " ", " ", "");
|
var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport", context, " ", " ", "");
|
||||||
|
|
||||||
if (lineContentFromHook)
|
if (lineContentFromHook)
|
||||||
|
|
Loading…
Reference in New Issue