ep_spellcheck 0.0.89 → 0.0.91

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.
@@ -22,11 +22,11 @@ jobs:
22
22
  version: 1.0
23
23
  -
24
24
  name: Install etherpad core
25
- uses: actions/checkout@v4
25
+ uses: actions/checkout@v6
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 }}
@@ -44,7 +44,7 @@ jobs:
44
44
  ${{ runner.os }}-pnpm-store-
45
45
  -
46
46
  name: Checkout plugin repository
47
- uses: actions/checkout@v4
47
+ uses: actions/checkout@v6
48
48
  with:
49
49
  path: plugin
50
50
  - name: Remove tests
@@ -12,10 +12,10 @@ jobs:
12
12
  steps:
13
13
  -
14
14
  name: Check out Etherpad core
15
- uses: actions/checkout@v4
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 }}
@@ -33,7 +33,7 @@ jobs:
33
33
  ${{ runner.os }}-pnpm-store-
34
34
  -
35
35
  name: Check out the plugin
36
- uses: actions/checkout@v4
36
+ uses: actions/checkout@v6
37
37
  with:
38
38
  path: ./node_modules/__tmp
39
39
  -
@@ -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
@@ -13,3 +13,20 @@ Toggle on/off 'SpellCheck' option in Settings. Uses your native browser spellch
13
13
  ## TODO
14
14
 
15
15
  * Remember user settings as cookies
16
+
17
+ ## Installation
18
+
19
+ Install from the Etherpad admin UI (**Admin → Manage Plugins**,
20
+ search for `ep_spellcheck` and click *Install*), or from the Etherpad
21
+ root directory:
22
+
23
+ ```sh
24
+ pnpm run plugins install ep_spellcheck
25
+ ```
26
+
27
+ > ⚠️ Don't run `npm i` / `npm install` yourself from the Etherpad
28
+ > source tree — Etherpad tracks installed plugins through its own
29
+ > plugin-manager, and hand-editing `package.json` can leave the
30
+ > server unable to start.
31
+
32
+ After installing, restart Etherpad.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ep_spellcheck",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "keywords": [
5
5
  "spell",
6
6
  "check",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.1",
26
- "eslint-config-etherpad": "^4.0.4",
27
- "typescript": "^6.0.2"
26
+ "eslint-config-etherpad": "^4.0.5",
27
+ "typescript": "^6.0.3"
28
28
  },
29
29
  "scripts": {
30
30
  "lint": "eslint .",
@@ -5,25 +5,16 @@ const padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
5
5
  const postAceInit = (hook, context) => {
6
6
  const $outer = $('iframe[name="ace_outer"]').contents().find('iframe');
7
7
  const $inner = $outer.contents().find('#innerdocbody');
8
+ // The `spellcheck` attribute is inherited from the nearest ancestor that
9
+ // sets it, so we only need to toggle it on #innerdocbody. The previous
10
+ // implementation walked every <div>/<span> descendant on every toggle,
11
+ // which is O(n) in line count and multiplied the browser's already-slow
12
+ // per-keystroke spellchecking work — observable as typing lag on pads
13
+ // with more than a few hundred lines (#26). Setting the attribute once
14
+ // on the contenteditable root is equivalent for the browser's checker.
8
15
  const spellcheck = {
9
- enable: () => {
10
- $inner.attr('spellcheck', 'true');
11
- $inner.find('div').each(function () {
12
- $(this).attr('spellcheck', 'true');
13
- $(this).find('div').each(function () {
14
- $(this).attr('spellcheck', 'true');
15
- });
16
- });
17
- },
18
- disable: () => {
19
- $inner.attr('spellcheck', 'false');
20
- $inner.find('div').each(function () {
21
- $(this).attr('spellcheck', 'false');
22
- $(this).find('span').each(function () {
23
- $(this).attr('spellcheck', 'false');
24
- });
25
- });
26
- },
16
+ enable: () => { $inner.attr('spellcheck', 'true'); },
17
+ disable: () => { $inner.attr('spellcheck', 'false'); },
27
18
  };
28
19
  /* init */
29
20
  if (padcookie.getPref('spellcheck') === false) {
@@ -49,7 +40,12 @@ const postAceInit = (hook, context) => {
49
40
  padcookie.setPref('spellcheck', false);
50
41
  spellcheck.disable();
51
42
  }
52
- if (window.browser.chrome) window.location.reload();
43
+ // The previous code force-reloaded the page on Chrome via
44
+ // `window.browser.chrome`. That check was always a no-op on Chrome
45
+ // (Chrome has no `window.browser` object — it's the Firefox
46
+ // WebExtension API) and would have thrown a TypeError on Firefox.
47
+ // Toggling the spellcheck attribute takes effect in every current
48
+ // browser without a reload, so just drop the reload.
53
49
  });
54
50
  };
55
51
  exports.postAceInit = postAceInit;
@@ -0,0 +1,18 @@
1
+ import {expect, test} from '@playwright/test';
2
+ import {goToNewPad} from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
3
+
4
+ test.beforeEach(async ({page}) => {
5
+ await goToNewPad(page);
6
+ });
7
+
8
+ test.describe('ep_spellcheck', () => {
9
+ test('Spellcheck is on by default when not disabled', async ({page}) => {
10
+ // ep_spellcheck flips the spellcheck attribute on the inner editor
11
+ // body. Wait up to 5s in case it's set asynchronously after pad init.
12
+ const innerFrame = page.frame('ace_inner')!;
13
+ await expect.poll(
14
+ async () => innerFrame.locator('body').getAttribute('spellcheck'),
15
+ {timeout: 5_000})
16
+ .toBe('true');
17
+ });
18
+ });
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- describe('Spellcheck', function () {
4
- // create a new pad before each test run
5
- beforeEach(function (cb) {
6
- helper.newPad(cb);
7
- this.timeout(60000);
8
- });
9
-
10
- it("Checks Spellcheck is on by default if it isn't disabled", function (done) {
11
- this.timeout(60000);
12
- const $inner = helper.padInner$;
13
- const shouldBeOn = true;
14
-
15
- helper.waitFor(() => ($inner.attr('spellcheck') === shouldBeOn)).done(() => {
16
- expect($inner.attr('spellcheck') === shouldBeOn);
17
- done();
18
- });
19
- });
20
- });