ep_disable_reset_authorship_colours 0.0.55 → 0.0.56

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
@@ -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
@@ -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
@@ -1,3 +1,20 @@
1
1
  ![Publish Status](https://github.com/ether/ep_disable_reset_authorship_colours/workflows/Node.js%20Package/badge.svg) [![Backend Tests Status](https://github.com/ether/ep_disable_reset_authorship_colours/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_disable_reset_authorship_colours/actions/workflows/test-and-release.yml)
2
2
 
3
3
  Disables the ability to reset authorship colors in Etherpad
4
+
5
+ ## Installation
6
+
7
+ Install from the Etherpad admin UI (**Admin → Manage Plugins**,
8
+ search for `ep_disable_reset_authorship_colours` and click *Install*), or from the Etherpad
9
+ root directory:
10
+
11
+ ```sh
12
+ pnpm run plugins install ep_disable_reset_authorship_colours
13
+ ```
14
+
15
+ > ⚠️ Don't run `npm i` / `npm install` yourself from the Etherpad
16
+ > source tree — Etherpad tracks installed plugins through its own
17
+ > plugin-manager, and hand-editing `package.json` can leave the
18
+ > server unable to start.
19
+
20
+ After installing, restart Etherpad.
package/ep.json CHANGED
@@ -2,7 +2,9 @@
2
2
  "parts":[
3
3
  {
4
4
  "name": "disable_reset_authorship_colours",
5
- "hooks": {},
5
+ "hooks": {
6
+ "clientVars": "ep_disable_reset_authorship_colours/index:clientVars"
7
+ },
6
8
  "client_hooks": {
7
9
  "postAceInit": "ep_disable_reset_authorship_colours/static/js/disable_reset_authorship_colours:postAceInit"
8
10
  }
package/index.js ADDED
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ // Disable the Ctrl+Shift+C keyboard shortcut that triggers clearauthorship.
4
+ // Hiding the toolbar button (done client-side in postAceInit) is not enough:
5
+ // Etherpad's ace2_inner.ts binds Ctrl+Shift+C to CMDS.clearauthorship when
6
+ // `clientVars.padShortcutEnabled.cmdShiftC` is truthy. Forcing that flag to
7
+ // false here stops the shortcut from reaching the clearauthorship command.
8
+ exports.clientVars = (hookName, {clientVars}) => {
9
+ if (clientVars && clientVars.padShortcutEnabled) {
10
+ clientVars.padShortcutEnabled.cmdShiftC = false;
11
+ }
12
+ return {};
13
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_disable_reset_authorship_colours",
3
3
  "description": "Disable The reset authorship colours button",
4
- "version": "0.0.55",
4
+ "version": "0.0.56",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/ether/ep_disable_reset_authorship_colours.git"
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "devDependencies": {
20
20
  "eslint": "^8.57.1",
21
- "eslint-config-etherpad": "^4.0.4",
22
- "typescript": "^6.0.2"
21
+ "eslint-config-etherpad": "^4.0.5",
22
+ "typescript": "^6.0.3"
23
23
  },
24
24
  "scripts": {
25
25
  "lint": "eslint .",
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert').strict;
4
+ const plugin = require('../../../..');
5
+
6
+ describe(__filename, function () {
7
+ it('disables cmdShiftC in clientVars (regression for #4)', function () {
8
+ const clientVars = {padShortcutEnabled: {cmdShiftC: true, cmdShiftB: true}};
9
+ plugin.clientVars('clientVars', {clientVars});
10
+ assert.equal(clientVars.padShortcutEnabled.cmdShiftC, false);
11
+ // Other shortcuts must be untouched.
12
+ assert.equal(clientVars.padShortcutEnabled.cmdShiftB, true);
13
+ });
14
+
15
+ it('tolerates clientVars without padShortcutEnabled', function () {
16
+ const clientVars = {};
17
+ assert.doesNotThrow(() => plugin.clientVars('clientVars', {clientVars}));
18
+ });
19
+ });