Skip to content

Commit 3089a92

Browse files
authored
refactor: adopt template helper for 1 simple eejsBlock_* hook(s) (#11)
Replaces hand-rolled exports.eejsBlock_X = (hookName, args, cb) => { args.content += eejs.require(path[, {}, module]); cb(); }; block(s) with template(path) from ep_plugin_helpers. Same runtime behavior — eejs renders the same template into the same section. Wave 2 of the template-adoption sweep — picks up hooks with explicit empty-vars and/or module argument that wave 1's strict regex skipped.
1 parent a34be3c commit 3089a92

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
const {template} = require('ep_plugin_helpers');
4+
35
const store = require('./lib/padLanguageStore');
46
const eejs = require('ep_etherpad-lite/node/eejs/');
57
const renderer = require('./lib/exportRenderer');
@@ -96,10 +98,8 @@ exports.socketio = (hookName, {io}) => {
9698
});
9799
};
98100

99-
exports.eejsBlock_editbarMenuLeft = (hookName, args, cb) => {
100-
args.content += eejs.require('ep_hljs/templates/editbarButtons.ejs', {}, module);
101-
cb();
102-
};
101+
exports.eejsBlock_editbarMenuLeft =
102+
template('ep_hljs/templates/editbarButtons.ejs');
103103

104104
exports.getLineHTMLForExport = async (hookName, context) => {
105105
if (!context || typeof context.lineContent !== 'string') return;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ep_hljs",
33
"version": "0.1.6",
4-
"description": "Whole-pad syntax highlighting for Etherpad via highlight.js. Auto-detect or pick a language; tokens are painted via the CSS Custom Highlights API no DOM mutation, no caret drift.",
4+
"description": "Whole-pad syntax highlighting for Etherpad via highlight.js. Auto-detect or pick a language; tokens are painted via the CSS Custom Highlights API \u2014 no DOM mutation, no caret drift.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "John McLear",

0 commit comments

Comments
 (0)