ep_comments_page 11.0.32 → 11.0.33

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/static/js/index.js +12 -0
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": "11.0.32",
4
+ "version": "11.0.33",
5
5
  "author": {
6
6
  "name": "Nicolas Lescop",
7
7
  "email": "limplementeur@gmail.com"
@@ -54,10 +54,16 @@ const EpComments = function (context) {
54
54
  // This probably needs some work for instances running on root or not on /p/
55
55
  const loc = document.location;
56
56
  const port = loc.port === '' ? (loc.protocol === 'https:' ? 443 : 80) : loc.port;
57
+
58
+ // Derive the socket.io path from the Etherpad base URL so that it works
59
+ // behind a reverse proxy with a path prefix (e.g. /etherpad/api/{group}/).
60
+ const pad = require('ep_etherpad-lite/static/js/pad');
61
+ const basePath = pad.baseURL || new URL('..', loc.href).pathname;
57
62
  const url = `${loc.protocol}//${loc.hostname}:${port}/comment`;
58
63
 
59
64
  this.padId = clientVars.padId;
60
65
  this.socket = io.connect(url, {
66
+ path: `${basePath}socket.io`,
61
67
  query: `padId=${this.padId}`,
62
68
  });
63
69
 
@@ -283,6 +289,12 @@ EpComments.prototype.init = async function () {
283
289
  // Write the new pad contents
284
290
  padCommentSpan.html(newString);
285
291
 
292
+ // Force ace to pick up the DOM change so it is committed to the
293
+ // changeset and propagated to other users.
294
+ self.ace.callWithAce((ace) => {
295
+ ace.ace_fastIncorp();
296
+ }, 'acceptOrRevertSuggestion', true);
297
+
286
298
  if (isRevert) {
287
299
  // Tell all users this change was reverted
288
300
  self._send('revertChange', data);