ep_timesliderdiff 0.0.52 → 0.0.53

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.
@@ -26,7 +26,7 @@ jobs:
26
26
  with:
27
27
  repository: ether/etherpad-lite
28
28
  path: etherpad-lite
29
- - uses: pnpm/action-setup@v3
29
+ - uses: pnpm/action-setup@v6
30
30
  name: Install pnpm
31
31
  with:
32
32
  version: 10
@@ -35,7 +35,7 @@ jobs:
35
35
  shell: bash
36
36
  run: |
37
37
  echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38
- - uses: actions/cache@v4
38
+ - uses: actions/cache@v5
39
39
  name: Setup pnpm cache
40
40
  with:
41
41
  path: ${{ env.STORE_PATH }}
@@ -15,7 +15,7 @@ jobs:
15
15
  uses: actions/checkout@v6
16
16
  with:
17
17
  repository: ether/etherpad-lite
18
- - uses: pnpm/action-setup@v3
18
+ - uses: pnpm/action-setup@v6
19
19
  name: Install pnpm
20
20
  with:
21
21
  version: 10
@@ -24,7 +24,7 @@ jobs:
24
24
  shell: bash
25
25
  run: |
26
26
  echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
27
- - uses: actions/cache@v4
27
+ - uses: actions/cache@v5
28
28
  name: Setup pnpm cache
29
29
  with:
30
30
  path: ${{ env.STORE_PATH }}
@@ -31,7 +31,7 @@ jobs:
31
31
  uses: actions/checkout@v6
32
32
  with:
33
33
  repository: ether/etherpad-lite
34
- - uses: pnpm/action-setup@v5
34
+ - uses: pnpm/action-setup@v6
35
35
  name: Install pnpm
36
36
  with:
37
37
  version: 10
@@ -59,12 +59,20 @@ jobs:
59
59
  [ "${NEW_COMMITS}" -gt 0 ] || exit 0
60
60
  git config user.name 'github-actions[bot]'
61
61
  git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
62
- pnpm i
62
+ pnpm i --frozen-lockfile
63
63
  # `pnpm version patch` bumps package.json, makes a commit, and creates
64
64
  # a `v<new-version>` tag. Capture the new tag name from package.json
65
65
  # rather than parsing pnpm's output, which has historically varied.
66
- pnpm version patch
67
- NEW_TAG="v$(node -p "require('./package.json').version")"
66
+ # Bump the patch component directly with Node. pnpm/action-setup@v6
67
+ # sometimes installs pnpm 11 pre-releases even when version: 10.x is
68
+ # requested (pnpm/action-setup#225); those pre-releases either skip
69
+ # the git commit/tag or reject --no-git-tag-version as unknown.
70
+ # Doing the bump in Node sidesteps both failure modes.
71
+ NEW_VERSION=$(node -e "const fs=require('fs');const p=require('./package.json');const v=p.version.split('.');v[2]=String(Number(v[2])+1);p.version=v.join('.');fs.writeFileSync('./package.json',JSON.stringify(p,null,2)+'\n');console.log(p.version);")
72
+ NEW_TAG="v${NEW_VERSION}"
73
+ git add package.json
74
+ git commit -m "${NEW_TAG}"
75
+ git tag -a "${NEW_TAG}" -m "${NEW_TAG}"
68
76
  # CRITICAL: use --atomic so the branch update and the tag update
69
77
  # succeed (or fail) as a single transaction on the server. The old
70
78
  # `git push --follow-tags` was non-atomic per ref: if a concurrent
package/README.md CHANGED
@@ -20,3 +20,20 @@ Install via the /admin/plugins UI in Etherpad Lite.
20
20
  * UI polishing
21
21
  * Progress indicator
22
22
  * Test coverage
23
+
24
+ ## Installation
25
+
26
+ Install from the Etherpad admin UI (**Admin → Manage Plugins**,
27
+ search for `ep_timesliderdiff` and click *Install*), or from the Etherpad
28
+ root directory:
29
+
30
+ ```sh
31
+ pnpm run plugins install ep_timesliderdiff
32
+ ```
33
+
34
+ > ⚠️ Don't run `npm i` / `npm install` yourself from the Etherpad
35
+ > source tree — Etherpad tracks installed plugins through its own
36
+ > plugin-manager, and hand-editing `package.json` can leave the
37
+ > server unable to start.
38
+
39
+ After installing, restart Etherpad.
package/index.js CHANGED
@@ -3,6 +3,11 @@
3
3
  const eejs = require('ep_etherpad-lite/node/eejs');
4
4
 
5
5
  exports.eejsBlock_timesliderEditbarRight = (hook_name, args, cb) => {
6
+ // The diff view relies on endpoints that the read-only timeslider cannot
7
+ // reach, so suppress the button entirely for read-only viewers (regression
8
+ // for #4). `renderContext.isReadOnly` is set by specialpages.ts when
9
+ // rendering `/p/:pad/timeslider`.
10
+ if (args.renderContext && args.renderContext.isReadOnly) return cb();
6
11
  args.content += eejs.require('ep_timesliderdiff/templates/timesliderDiff.ejs');
7
12
  cb();
8
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep_timesliderdiff",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "description": "See a diff view showing the changes between the latest pad and a revision",
5
5
  "author": {
6
6
  "name": "John McLear",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.1",
29
- "eslint-config-etherpad": "^4.0.4",
30
- "typescript": "^6.0.2"
29
+ "eslint-config-etherpad": "^4.0.5",
30
+ "typescript": "^6.0.3"
31
31
  },
32
32
  "scripts": {
33
33
  "lint": "eslint .",
@@ -30,8 +30,7 @@ or implied, of Chas Emerick.
30
30
  table.diff {
31
31
  border-collapse:collapse;
32
32
  border:1px solid darkgray;
33
- white-space:pre-wrap
34
- height:400px;
33
+ white-space:pre-wrap;
35
34
  }
36
35
  table.diff tbody {
37
36
  font-family:Courier, monospace
@@ -91,3 +90,17 @@ tbody {
91
90
  overflow:scroll;
92
91
  overflow-x:hidden;
93
92
  }
93
+
94
+ /* Keep the diff popup inside the viewport on long pads — otherwise the
95
+ form (inline/try-again) gets pushed off the bottom and the user sees no
96
+ controls (#3). Clamp the popup to the viewport and let the content
97
+ scroll inside it. */
98
+ .timesliderDiffSettings.popup.toolbar-popup {
99
+ max-width: calc(100vw - 40px);
100
+ max-height: calc(100vh - 80px);
101
+ box-sizing: border-box;
102
+ overflow: auto;
103
+ }
104
+ .timesliderDiffSettings.popup.toolbar-popup #timesliderDiffOutput {
105
+ max-width: 100%;
106
+ }
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert').strict;
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const cssPath = path.resolve(__dirname, '..', '..', '..', '..', 'static', 'css', 'diffview.css');
8
+
9
+ describe(__filename, function () {
10
+ let src;
11
+ before(function () { src = fs.readFileSync(cssPath, 'utf8'); });
12
+
13
+ it('clamps the diff popup to the viewport (#3)', function () {
14
+ // Long pads previously pushed the popup beyond the viewport so the
15
+ // inline checkbox + "try again" button got clipped. The popup has to
16
+ // have both width and height caps and allow its own overflow so the
17
+ // controls stay reachable.
18
+ const popupBlock = src.match(
19
+ /\.timesliderDiffSettings\.popup\.toolbar-popup\s*\{([\s\S]*?)\}/);
20
+ assert(popupBlock, 'expected a rule block for .timesliderDiffSettings.popup.toolbar-popup');
21
+ const body = popupBlock[1];
22
+ assert(/max-width\s*:/.test(body), 'popup must declare max-width');
23
+ assert(/max-height\s*:/.test(body), 'popup must declare max-height');
24
+ assert(/overflow\s*:\s*auto/.test(body), 'popup must set overflow: auto so content scrolls');
25
+ });
26
+
27
+ it('does not leave a missing semicolon in the table.diff rule (#3)', function () {
28
+ const rule = src.match(/table\.diff\s*\{([\s\S]*?)\}/);
29
+ assert(rule, 'expected a rule for table.diff');
30
+ // The original source had `white-space:pre-wrap` with no trailing
31
+ // semicolon immediately followed by `height:400px;`, so the `height`
32
+ // declaration was lost to a CSS parse error. Every declaration inside
33
+ // the block must be terminated with ';'.
34
+ const body = rule[1].trim();
35
+ for (const line of body.split('\n').map((l) => l.trim()).filter(Boolean)) {
36
+ assert(line.endsWith(';') || line.endsWith('{') || line.endsWith('}'),
37
+ `every declaration in table.diff should end with a semicolon — saw: ${line}`);
38
+ }
39
+ });
40
+ });
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert').strict;
4
+ const plugin = require('../../../..');
5
+
6
+ describe(__filename, function () {
7
+ it('emits the diff button in a writable timeslider', function (done) {
8
+ const args = {content: '', renderContext: {isReadOnly: false}};
9
+ plugin.eejsBlock_timesliderEditbarRight('eejsBlock_timesliderEditbarRight', args, () => {
10
+ assert(args.content.includes('updateDiffView'),
11
+ `expected diff button to be emitted, got: ${args.content}`);
12
+ done();
13
+ });
14
+ });
15
+
16
+ it('does not emit the diff button in read-only mode (regression for #4)', function (done) {
17
+ const args = {content: '', renderContext: {isReadOnly: true}};
18
+ plugin.eejsBlock_timesliderEditbarRight('eejsBlock_timesliderEditbarRight', args, () => {
19
+ assert.equal(args.content, '',
20
+ `expected no button output in read-only mode, got: ${args.content}`);
21
+ done();
22
+ });
23
+ });
24
+
25
+ it('still works when renderContext is missing', function (done) {
26
+ const args = {content: ''};
27
+ plugin.eejsBlock_timesliderEditbarRight('eejsBlock_timesliderEditbarRight', args, () => {
28
+ assert(args.content.includes('updateDiffView'));
29
+ done();
30
+ });
31
+ });
32
+ });
@@ -1,8 +1,8 @@
1
1
  <ul>
2
2
  <li onclick='updateDiffView();$(".timesliderDiffSettings").toggleClass("popup-show");return false;'>
3
3
  <a id="exportlink" title="See the diff between this revision and the latest revision">
4
- <div class="buttonicon" style="font-size:14px;color:black;width:80px;background-image:none;">
5
- <u>Diff View</u>
4
+ <div class="buttonicon" style="font-size:14px;width:80px;background-image:none;">
5
+ Diff View
6
6
  </div>
7
7
  </a>
8
8
  </li>