ep_comments_page 1.0.37 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +38 -4
- package/package.json +11 -7
- package/static/js/index.js +1 -6
package/index.js
CHANGED
|
@@ -204,7 +204,7 @@ exports.clientVars = (hook, context, cb) => {
|
|
|
204
204
|
};
|
|
205
205
|
|
|
206
206
|
exports.expressCreateServer = (hookName, args, callback) => {
|
|
207
|
-
|
|
207
|
+
const handlePadRevComments = async (req, res) => {
|
|
208
208
|
const fields = req.query;
|
|
209
209
|
// check the api key
|
|
210
210
|
if (!apiUtils.validateApiKey(fields, res)) return;
|
|
@@ -222,9 +222,17 @@ exports.expressCreateServer = (hookName, args, callback) => {
|
|
|
222
222
|
}
|
|
223
223
|
if (data == null) return;
|
|
224
224
|
res.json({code: 0, data});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
args.app.get('/p/:pad/:rev/comments', async (req, res) => {
|
|
228
|
+
await handlePadRevComments(req, res)
|
|
225
229
|
});
|
|
226
230
|
|
|
227
|
-
args.app.
|
|
231
|
+
args.app.get('/p/:pad/comments', async (req, res) => {
|
|
232
|
+
await handlePadRevComments(req, res)
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const postRevision = async (req, res)=>{
|
|
228
236
|
const fields = await new Promise((resolve, reject) => {
|
|
229
237
|
new Formidable().parse(req, (err, fields) => err ? reject(err) : resolve(fields));
|
|
230
238
|
});
|
|
@@ -260,9 +268,18 @@ exports.expressCreateServer = (hookName, args, callback) => {
|
|
|
260
268
|
io.to(padIdReceived).emit('pushAddComment', commentIds[i], comments[i]);
|
|
261
269
|
}
|
|
262
270
|
res.json({code: 0, commentIds});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
args.app.post('/p/:pad/:rev/comments', async (req, res) => {
|
|
274
|
+
await postRevision(req, res);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
args.app.post('/p/:pad/comments', async (req, res) => {
|
|
278
|
+
await postRevision(req, res);
|
|
263
279
|
});
|
|
264
280
|
|
|
265
|
-
|
|
281
|
+
|
|
282
|
+
const getCommentReplies = async (req, res) => {
|
|
266
283
|
// it's the same thing as the formidable's fields
|
|
267
284
|
const fields = req.query;
|
|
268
285
|
// check the api key
|
|
@@ -282,9 +299,17 @@ exports.expressCreateServer = (hookName, args, callback) => {
|
|
|
282
299
|
}
|
|
283
300
|
if (data == null) return;
|
|
284
301
|
res.json({code: 0, data});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
args.app.get('/p/:pad/commentReplies', async (req, res) => {
|
|
305
|
+
await getCommentReplies(req, res);
|
|
285
306
|
});
|
|
286
307
|
|
|
287
|
-
args.app.
|
|
308
|
+
args.app.get('/p/:pad/:rev/commentReplies', async (req, res) => {
|
|
309
|
+
await getCommentReplies(req, res);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
const postCommentReplies = async (req, res) => {
|
|
288
313
|
const fields = await new Promise((resolve, reject) => {
|
|
289
314
|
new Formidable().parse(req, (err, fields) => err ? reject(err) : resolve(fields));
|
|
290
315
|
});
|
|
@@ -321,6 +346,15 @@ exports.expressCreateServer = (hookName, args, callback) => {
|
|
|
321
346
|
io.to(padIdReceived).emit('pushAddCommentReply', replyIds[i], replies[i]);
|
|
322
347
|
}
|
|
323
348
|
res.json({code: 0, replyIds});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
args.app.post('/p/:pad/:rev/commentReplies', async (req, res) => {
|
|
352
|
+
await postCommentReplies(req, res);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
args.app.post('/p/:pad/commentReplies', async (req, res) => {
|
|
356
|
+
await postCommentReplies(req, res);
|
|
324
357
|
});
|
|
358
|
+
|
|
325
359
|
return callback();
|
|
326
360
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Adds comments on sidebar and link it to the text. For no-skin use ep_page_view.",
|
|
3
3
|
"name": "ep_comments_page",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.39",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nicolas Lescop",
|
|
7
7
|
"email": "limplementeur@gmail.com"
|
|
@@ -23,27 +23,31 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"cheerio": "^1.0.0-rc.12",
|
|
26
|
-
"formidable": "^3.5.
|
|
26
|
+
"formidable": "^3.5.4",
|
|
27
27
|
"underscore": "^1.13.6"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"eslint": "^
|
|
30
|
+
"eslint": "^9.24.0",
|
|
31
31
|
"eslint-config-etherpad": "^4.0.4",
|
|
32
32
|
"socket.io-client": "*",
|
|
33
|
-
"superagent": "^
|
|
34
|
-
"typescript": "^5.4.
|
|
33
|
+
"superagent": "^10.2.0",
|
|
34
|
+
"typescript": "^5.4.3"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
37
|
+
"node": ">=20.0.0"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
|
-
"url": "https://github.com/ether/
|
|
41
|
+
"url": "https://github.com/ether/ether-plugins.git"
|
|
42
42
|
},
|
|
43
43
|
"funding": {
|
|
44
44
|
"type": "individual",
|
|
45
45
|
"url": "https://etherpad.org/"
|
|
46
46
|
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/ether/ether-plugins/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/ether/ether-plugins/tree/main/ep_comments_page#readme",
|
|
47
51
|
"scripts": {
|
|
48
52
|
"lint": "eslint .",
|
|
49
53
|
"lint:fix": "eslint --fix ."
|
package/static/js/index.js
CHANGED
|
@@ -791,12 +791,7 @@ EpComments.prototype.getCommentData = function () {
|
|
|
791
791
|
|
|
792
792
|
// Delete a pad comment
|
|
793
793
|
EpComments.prototype.deleteComment = function (commentId) {
|
|
794
|
-
|
|
795
|
-
$('iframe[name="ace_outer"]').contents().find(`#${commentId}`).remove();
|
|
796
|
-
}
|
|
797
|
-
while($('iframe[name="ace_outer"]').contents().find(`#icon-${commentId}`).length > 0){
|
|
798
|
-
$('iframe[name="ace_outer"]').contents().find(`#icon-${commentId}`).remove();
|
|
799
|
-
}
|
|
794
|
+
$('iframe[name="ace_outer"]').contents().find(`#${commentId}`).remove();
|
|
800
795
|
};
|
|
801
796
|
|
|
802
797
|
const cloneLine = (line) => {
|