ep_font_family 0.5.76 → 0.5.78

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,4 +1,4 @@
1
- ![Publish Status](https://github.com/ether/ep_font_family/workflows/Node.js%20Package/badge.svg) [![Backend Tests Status](https://github.com/ether/ep_font_family/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_font_family/actions/workflows/test-and-release.yml)
1
+ ![Demo](demo.gif) [![Backend Tests Status](https://github.com/ether/ep_font_family/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_font_family/actions/workflows/test-and-release.yml)
2
2
 
3
3
  [![Travis (.org)](https://api.travis-ci.org/JohnMcLear/ep_font_family.git.svg?branch=develop)](https://travis-ci.org/github/JohnMcLear/ep_font_family.git)
4
4
 
package/demo.gif ADDED
Binary file
package/demo.png ADDED
Binary file
package/index.js CHANGED
@@ -3,8 +3,10 @@
3
3
  const fonts = require('./fonts');
4
4
  const {template} = require('ep_plugin_helpers');
5
5
 
6
- exports.eejsBlock_editbarMenuLeft = template('ep_font_family/templates/editbarButtons.ejs');
7
- exports.eejsBlock_dd_format = template('ep_font_family/templates/fileMenu.ejs');
6
+ exports.eejsBlock_editbarMenuLeft = template(
7
+ 'ep_font_family/templates/editbarButtons.ejs', {vars: () => ({fonts})});
8
+ exports.eejsBlock_dd_format = template(
9
+ 'ep_font_family/templates/fileMenu.ejs', {vars: () => ({fonts})});
8
10
 
9
11
  // Server-side aceAttribClasses — maps font names to tag: prefix.
10
12
  // This must match the client-side mapping exactly.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "Add support for different Fonts",
3
3
  "name": "ep_font_family",
4
- "version": "0.5.76",
4
+ "version": "0.5.78",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
7
7
  "name": "John McLear",
@@ -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 .",
@@ -10,14 +10,12 @@ exports.aceRegisterBlockElements = fontFamily.aceRegisterBlockElements;
10
10
  exports.aceAttribClasses = fontFamily.aceAttribClasses;
11
11
 
12
12
  exports.postAceInit = (hook, context) => {
13
+ // Font options are rendered server-side by the editbarButtons.ejs and
14
+ // fileMenu.ejs templates (from ./fonts.js). Previously this hook
15
+ // appended them after Etherpad had already wrapped the <select> in
16
+ // niceSelect, so the File menu dropdown showed only the placeholder
17
+ // (#28). We just bind the change handler here.
13
18
  const select = $('select.family-selection');
14
- for (const font of fonts) {
15
- const name = font.substring(4);
16
- let label = name.charAt(0).toUpperCase() + name.slice(1);
17
- label = label.split('-').join(' ');
18
- select.append($('<option>').attr('value', font).text(label));
19
- }
20
- select.niceSelect('update');
21
19
  select.on('change', function () {
22
20
  const value = $(this).val();
23
21
  context.ace.callWithAce((ace) => {
@@ -0,0 +1,32 @@
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
+ const fonts = require('../../../..' + '/fonts');
8
+
9
+ const fileMenuTmpl = path.resolve(
10
+ __dirname, '..', '..', '..', '..', 'templates', 'fileMenu.ejs');
11
+ const editbarTmpl = path.resolve(
12
+ __dirname, '..', '..', '..', '..', 'templates', 'editbarButtons.ejs');
13
+
14
+ const render = (p) => ejs.render(fs.readFileSync(p, 'utf8'), {fonts});
15
+
16
+ describe(__filename, function () {
17
+ it('fileMenu.ejs renders an <option> per font (#28)', function () {
18
+ const html = render(fileMenuTmpl);
19
+ for (const font of fonts) {
20
+ assert(html.includes(`value="${font}"`),
21
+ `file menu template should render an option for font ${font}; got:\n${html}`);
22
+ }
23
+ });
24
+
25
+ it('editbarButtons.ejs renders an <option> per font (#28)', function () {
26
+ const html = render(editbarTmpl);
27
+ for (const font of fonts) {
28
+ assert(html.includes(`value="${font}"`),
29
+ `editbar template should render an option for font ${font}; got:\n${html}`);
30
+ }
31
+ });
32
+ });
@@ -6,5 +6,10 @@
6
6
  data-l10n-id="ep_font_family.font"
7
7
  data-l10n-attr="aria-label">
8
8
  <option value="dummy" selected data-l10n-id="ep_font_family.family">Font</option>
9
+ <% fonts.forEach((font) => {
10
+ const name = font.substring(4);
11
+ const label = (name.charAt(0).toUpperCase() + name.slice(1)).split('-').join(' '); %>
12
+ <option value="<%= font %>"><%= label %></option>
13
+ <% }); %>
9
14
  </select>
10
15
  </li>
@@ -2,6 +2,11 @@
2
2
  <ul class="submenu">
3
3
  <select class="family-selection">
4
4
  <option value="dummy" selected data-l10n-id="ep_font_family.family">family</option>
5
+ <% fonts.forEach((font) => {
6
+ const name = font.substring(4);
7
+ const label = (name.charAt(0).toUpperCase() + name.slice(1)).split('-').join(' '); %>
8
+ <option value="<%= font %>"><%= label %></option>
9
+ <% }); %>
5
10
  </select>
6
11
  </ul>
7
12
  </li>