ep_subscript_and_superscript 0.3.80 → 0.3.82
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/.github/workflows/backend-tests.yml +2 -2
- package/.github/workflows/frontend-tests.yml +2 -2
- package/.github/workflows/lint.yml +39 -0
- package/.github/workflows/npmpublish.yml +12 -8
- package/.github/workflows/test-and-release.yml +4 -0
- package/ep.json +1 -1
- package/index.js +1 -3
- package/locales/eu.json +2 -1
- package/package.json +6 -6
- package/pnpm-workspace.yaml +10 -0
- package/static/js/index.js +8 -2
- package/static/tests/backend/specs/filemenu.js +44 -0
- package/static/tests/frontend-new/specs/file_menu.spec.ts +34 -0
- package/templates/fileMenu.ejs +5 -2
|
@@ -26,11 +26,11 @@ jobs:
|
|
|
26
26
|
with:
|
|
27
27
|
repository: ether/etherpad-lite
|
|
28
28
|
path: etherpad-lite
|
|
29
|
-
- uses: actions/setup-node@
|
|
29
|
+
- uses: actions/setup-node@v7
|
|
30
30
|
name: Install Node.js
|
|
31
31
|
with:
|
|
32
32
|
node-version: 25
|
|
33
|
-
- uses: pnpm/action-setup@v6
|
|
33
|
+
- uses: pnpm/action-setup@v6.1.0
|
|
34
34
|
name: Install pnpm
|
|
35
35
|
with:
|
|
36
36
|
package_json_file: ./etherpad-lite/package.json
|
|
@@ -16,11 +16,11 @@ jobs:
|
|
|
16
16
|
with:
|
|
17
17
|
repository: ether/etherpad-lite
|
|
18
18
|
path: etherpad-lite
|
|
19
|
-
- uses: actions/setup-node@
|
|
19
|
+
- uses: actions/setup-node@v7
|
|
20
20
|
name: Install Node.js
|
|
21
21
|
with:
|
|
22
22
|
node-version: 25
|
|
23
|
-
- uses: pnpm/action-setup@v6
|
|
23
|
+
- uses: pnpm/action-setup@v6.1.0
|
|
24
24
|
name: Install pnpm
|
|
25
25
|
with:
|
|
26
26
|
package_json_file: ./etherpad-lite/package.json
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
lint:
|
|
8
|
+
name: ESLint
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
# `eslint .` executes .eslintrc.cjs and every installed ESLint plugin, so
|
|
11
|
+
# don't hand it the caller's contents:write / id-token:write token.
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- name: Check out plugin repository
|
|
16
|
+
uses: actions/checkout@v7
|
|
17
|
+
- uses: actions/setup-node@v7
|
|
18
|
+
name: Install Node.js
|
|
19
|
+
with:
|
|
20
|
+
node-version: 25
|
|
21
|
+
- uses: pnpm/action-setup@v6.1.0
|
|
22
|
+
name: Install pnpm
|
|
23
|
+
with:
|
|
24
|
+
version: 10
|
|
25
|
+
run_install: false
|
|
26
|
+
- name: Get pnpm store directory
|
|
27
|
+
shell: bash
|
|
28
|
+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
29
|
+
- uses: actions/cache@v6
|
|
30
|
+
name: Setup pnpm cache
|
|
31
|
+
with:
|
|
32
|
+
path: ${{ env.STORE_PATH }}
|
|
33
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
34
|
+
restore-keys: |
|
|
35
|
+
${{ runner.os }}-pnpm-store-
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: pnpm install --ignore-scripts
|
|
38
|
+
- name: Run ESLint
|
|
39
|
+
run: pnpm run lint
|
|
@@ -18,20 +18,24 @@ jobs:
|
|
|
18
18
|
contents: write # for the atomic version-bump push (branch + tag)
|
|
19
19
|
id-token: write # for npm OIDC trusted publishing
|
|
20
20
|
steps:
|
|
21
|
-
- uses: actions/setup-node@
|
|
21
|
+
- uses: actions/setup-node@v7
|
|
22
22
|
with:
|
|
23
|
-
# OIDC trusted publishing needs npm >= 11.5.1
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
|
|
23
|
+
# OIDC trusted publishing needs npm >= 11.5.1. Node 24 is an LTS
|
|
24
|
+
# line that every npm 11.x and 12.x supports; Node 25 is not —
|
|
25
|
+
# npm 12 requires ^22.22.2 || ^24.15.0 || >=26.0.0, so on Node 25
|
|
26
|
+
# the upgrade step below died with EBADENGINE and no plugin could
|
|
27
|
+
# publish.
|
|
28
|
+
node-version: 24
|
|
27
29
|
registry-url: https://registry.npmjs.org/
|
|
30
|
+
# Pinned to a range rather than @latest: the next npm major dropping
|
|
31
|
+
# this Node line would silently break publishing fleet-wide again.
|
|
28
32
|
- name: Upgrade npm to >=11.5.1 (required for trusted publishing)
|
|
29
|
-
run: npm install -g npm
|
|
33
|
+
run: npm install -g npm@^11.5.1
|
|
30
34
|
- name: Check out Etherpad core
|
|
31
35
|
uses: actions/checkout@v7
|
|
32
36
|
with:
|
|
33
37
|
repository: ether/etherpad-lite
|
|
34
|
-
- uses: pnpm/action-setup@v6
|
|
38
|
+
- uses: pnpm/action-setup@v6.1.0
|
|
35
39
|
name: Install pnpm
|
|
36
40
|
with:
|
|
37
41
|
run_install: false
|
|
@@ -73,7 +77,7 @@ jobs:
|
|
|
73
77
|
# `pnpm version patch` bumps package.json, makes a commit, and creates
|
|
74
78
|
# a `v<new-version>` tag. Capture the new tag name from package.json
|
|
75
79
|
# rather than parsing pnpm's output, which has historically varied.
|
|
76
|
-
# Bump the patch component directly with Node. pnpm/action-setup@v6
|
|
80
|
+
# Bump the patch component directly with Node. pnpm/action-setup@v6.0.10
|
|
77
81
|
# sometimes installs pnpm 11 pre-releases even when version: 10.x is
|
|
78
82
|
# requested (pnpm/action-setup#225); those pre-releases either skip
|
|
79
83
|
# the git commit/tag or reject --no-git-tag-version as unknown.
|
|
@@ -14,6 +14,9 @@ permissions:
|
|
|
14
14
|
id-token: write
|
|
15
15
|
|
|
16
16
|
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
uses: ./.github/workflows/lint.yml
|
|
19
|
+
secrets: inherit
|
|
17
20
|
backend:
|
|
18
21
|
uses: ./.github/workflows/backend-tests.yml
|
|
19
22
|
secrets: inherit
|
|
@@ -23,6 +26,7 @@ jobs:
|
|
|
23
26
|
release:
|
|
24
27
|
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
|
|
25
28
|
needs:
|
|
29
|
+
- lint
|
|
26
30
|
- backend
|
|
27
31
|
- frontend
|
|
28
32
|
permissions:
|
package/ep.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"eejsBlock_editbarMenuLeft": "ep_subscript_and_superscript/index",
|
|
16
16
|
"collectContentPre": "ep_subscript_and_superscript/static/js/shared",
|
|
17
17
|
"collectContentPost": "ep_subscript_and_superscript/static/js/shared",
|
|
18
|
-
"
|
|
18
|
+
"eejsBlock_dd_format_text":"ep_subscript_and_superscript/index",
|
|
19
19
|
"aceAttribClasses":"ep_subscript_and_superscript/index",
|
|
20
20
|
"exportHtmlAdditionalTags" : "ep_subscript_and_superscript/index",
|
|
21
21
|
"asyncLineHTMLForExport": "ep_subscript_and_superscript/index",
|
package/index.js
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const {template} = require('ep_plugin_helpers');
|
|
4
4
|
|
|
5
|
-
const eejs = require('ep_etherpad-lite/node/eejs/');
|
|
6
|
-
|
|
7
5
|
/** ******************
|
|
8
6
|
* UI
|
|
9
7
|
*/
|
|
10
8
|
exports.eejsBlock_editbarMenuLeft =
|
|
11
9
|
template('ep_subscript_and_superscript/templates/editbarButtons.ejs');
|
|
12
10
|
|
|
13
|
-
exports.
|
|
11
|
+
exports.eejsBlock_dd_format_text =
|
|
14
12
|
template('ep_subscript_and_superscript/templates/fileMenu.ejs');
|
|
15
13
|
|
|
16
14
|
|
package/locales/eu.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@metadata": {
|
|
3
3
|
"authors": [
|
|
4
|
+
"Atzerritik",
|
|
4
5
|
"Izendegi"
|
|
5
6
|
]
|
|
6
7
|
},
|
|
7
|
-
"ep_subscript_and_superscript.subscript.title": "
|
|
8
|
+
"ep_subscript_and_superscript.subscript.title": "Azpi-indizea",
|
|
8
9
|
"ep_subscript_and_superscript.superscript.title": "goi-indizea"
|
|
9
10
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"deprecated": false,
|
|
10
10
|
"description": "Add support for different Fonts",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
12
|
+
"node": ">=22.0.0"
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/ether/ep_subscript_and_superscript#readme",
|
|
15
15
|
"license": "Apache-2.0",
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "git+https://github.com/ether/ep_subscript_and_superscript.git"
|
|
20
20
|
},
|
|
21
|
-
"version": "0.3.
|
|
21
|
+
"version": "0.3.82",
|
|
22
22
|
"funding": {
|
|
23
23
|
"type": "individual",
|
|
24
24
|
"url": "https://etherpad.org/"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/mocha": "^10.0.10",
|
|
28
|
-
"@types/node": "^26.
|
|
28
|
+
"@types/node": "^26.6.1",
|
|
29
29
|
"eslint": "^8.57.1",
|
|
30
|
-
"eslint-config-etherpad": "^
|
|
31
|
-
"mocha": "^
|
|
32
|
-
"typescript": "
|
|
30
|
+
"eslint-config-etherpad": "^5.0.0",
|
|
31
|
+
"mocha": "^12.0.2",
|
|
32
|
+
"typescript": "~6.0.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"lint": "eslint .",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# js-yaml and brace-expansion arrive only as transitive dev dependencies (via
|
|
2
|
+
# eslint and minimatch@3), so `pnpm update` cannot move them. The selectors are
|
|
3
|
+
# scoped to the affected major line: an unbounded range would drag minimatch@3
|
|
4
|
+
# onto brace-expansion 5.x and eslint onto js-yaml 5.x.
|
|
5
|
+
#
|
|
6
|
+
# pnpm 11 no longer reads `pnpm.overrides` from package.json — these must live
|
|
7
|
+
# here or the lockfile and the install disagree (ERR_PNPM_LOCKFILE_CONFIG_MISMATCH).
|
|
8
|
+
overrides:
|
|
9
|
+
js-yaml@^4: '>=4.3.2 <5'
|
|
10
|
+
brace-expansion@^1: '>=1.1.16 <2'
|
package/static/js/index.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
// Bind the event handler to the toolbar buttons
|
|
4
4
|
exports.postAceInit = (hook, context) => {
|
|
5
|
-
$('.subscript').click(() => {
|
|
5
|
+
$('.subscript').click((e) => {
|
|
6
|
+
// The file menu entry is an <a href="#"> link; without this the click
|
|
7
|
+
// would also jump the browser to the top of the page.
|
|
8
|
+
e.preventDefault();
|
|
6
9
|
context.ace.callWithAce((ace) => {
|
|
7
10
|
if (ace.ace_getAttributeOnSelection('sub')) {
|
|
8
11
|
ace.ace_setAttributeOnSelection('sub', false);
|
|
@@ -11,7 +14,10 @@ exports.postAceInit = (hook, context) => {
|
|
|
11
14
|
}
|
|
12
15
|
}, 'insertsubscript', true);
|
|
13
16
|
});
|
|
14
|
-
$('.superscript').click(() => {
|
|
17
|
+
$('.superscript').click((e) => {
|
|
18
|
+
// The file menu entry is an <a href="#"> link; without this the click
|
|
19
|
+
// would also jump the browser to the top of the page.
|
|
20
|
+
e.preventDefault();
|
|
15
21
|
context.ace.callWithAce((ace) => {
|
|
16
22
|
if (ace.ace_getAttributeOnSelection('sup')) {
|
|
17
23
|
ace.ace_setAttributeOnSelection('sup', false);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert').strict;
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const ejs = require('ep_etherpad-lite/node_modules/ejs');
|
|
7
|
+
|
|
8
|
+
const root = path.resolve(__dirname, '..', '..', '..', '..');
|
|
9
|
+
const readTemplate = (name) => fs.readFileSync(path.join(root, 'templates', name), 'utf8');
|
|
10
|
+
const render = (name) => ejs.render(readTemplate(name), {});
|
|
11
|
+
const locales = JSON.parse(fs.readFileSync(path.join(root, 'locales', 'en.json'), 'utf8'));
|
|
12
|
+
const epJson = JSON.parse(fs.readFileSync(path.join(root, 'ep.json'), 'utf8'));
|
|
13
|
+
|
|
14
|
+
describe(__filename, function () {
|
|
15
|
+
let html;
|
|
16
|
+
|
|
17
|
+
before(async function () {
|
|
18
|
+
html = render('fileMenu.ejs');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// https://github.com/ether/ep_subscript_and_superscript/issues/17
|
|
22
|
+
for (const style of ['subscript', 'superscript']) {
|
|
23
|
+
it(`file menu offers ${style}`, async function () {
|
|
24
|
+
// The class is what postAceInit binds the click handler to.
|
|
25
|
+
assert.match(html, new RegExp(`<li[^>]*class="[^"]*\\b${style}\\b`),
|
|
26
|
+
`no <li class="${style}"> entry in the file menu:\n${html}`);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it(`the ${style} entry is localized`, async function () {
|
|
30
|
+
const id = `ep_subscript_and_superscript.${style}.title`;
|
|
31
|
+
assert(html.includes(`data-l10n-id="${id}"`),
|
|
32
|
+
`the ${style} entry should be labelled with ${id}:\n${html}`);
|
|
33
|
+
assert(locales[id], `${id} is missing from locales/en.json`);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
it('registers the entries in the character formatting group', async function () {
|
|
38
|
+
// dd_format_text is the block right below Strikethrough in
|
|
39
|
+
// ep_file_menu_toolbar's Format menu.
|
|
40
|
+
const hooks = epJson.parts[0].hooks;
|
|
41
|
+
assert.equal(hooks.eejsBlock_dd_format_text, 'ep_subscript_and_superscript/index');
|
|
42
|
+
assert.equal(typeof require(root).eejsBlock_dd_format_text, 'function');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {expect, test} from '@playwright/test';
|
|
2
|
+
import {clearPadContent, getPadBody, goToNewPad, selectAllText, writeToPad}
|
|
3
|
+
from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
|
|
4
|
+
|
|
5
|
+
test.beforeEach(async ({page}) => {
|
|
6
|
+
await goToNewPad(page);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// https://github.com/ether/ep_subscript_and_superscript/issues/17
|
|
10
|
+
test.describe('ep_subscript_and_superscript file menu', () => {
|
|
11
|
+
for (const [style, spanClass] of [
|
|
12
|
+
['superscript', 'sup'],
|
|
13
|
+
['subscript', 'sub'],
|
|
14
|
+
] as const) {
|
|
15
|
+
test(`Applies ${style} from the Format menu`, async ({page}) => {
|
|
16
|
+
test.skip(await page.locator('.dropdown-menu').count() === 0,
|
|
17
|
+
'ep_file_menu_toolbar is not installed');
|
|
18
|
+
|
|
19
|
+
const padBody = await getPadBody(page);
|
|
20
|
+
await padBody.click();
|
|
21
|
+
await clearPadContent(page);
|
|
22
|
+
await writeToPad(page, 'First Line!');
|
|
23
|
+
await selectAllText(page);
|
|
24
|
+
|
|
25
|
+
// The entry lives in the collapsed "Format" submenu, which the
|
|
26
|
+
// jquery-css dropdown plugin only expands on hover. dispatchEvent
|
|
27
|
+
// fires the click straight at the element regardless of visibility.
|
|
28
|
+
await page.locator(`.dropdown-menu li.${style} > a`).dispatchEvent('click');
|
|
29
|
+
|
|
30
|
+
await expect(padBody.locator('div').first().locator('span').first())
|
|
31
|
+
.toHaveClass(new RegExp(`\\b${spanClass}\\b`));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
package/templates/fileMenu.ejs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
<li class="
|
|
2
|
-
<a>
|
|
1
|
+
<li class="acl-write superscript">
|
|
2
|
+
<a href="#" data-l10n-id="ep_subscript_and_superscript.superscript.title">Superscript</a>
|
|
3
|
+
</li>
|
|
4
|
+
<li class="acl-write subscript">
|
|
5
|
+
<a href="#" data-l10n-id="ep_subscript_and_superscript.subscript.title">Subscript</a>
|
|
3
6
|
</li>
|