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.
- package/.github/workflows/backend-tests.yml +1 -1
- package/.github/workflows/frontend-tests.yml +1 -1
- package/.github/workflows/npmpublish.yml +12 -4
- package/README.md +1 -1
- package/demo.gif +0 -0
- package/demo.png +0 -0
- package/index.js +4 -2
- package/package.json +3 -3
- package/static/js/index.js +5 -7
- package/static/tests/backend/specs/filemenu_options.js +32 -0
- package/templates/editbarButtons.ejs +5 -0
- package/templates/fileMenu.ejs +5 -0
|
@@ -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@
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
 [](https://github.com/ether/ep_font_family/actions/workflows/test-and-release.yml)
|
|
2
2
|
|
|
3
3
|
[](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(
|
|
7
|
-
|
|
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.
|
|
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.
|
|
27
|
-
"typescript": "^6.0.
|
|
26
|
+
"eslint-config-etherpad": "^4.0.5",
|
|
27
|
+
"typescript": "^6.0.3"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"lint": "eslint .",
|
package/static/js/index.js
CHANGED
|
@@ -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>
|
package/templates/fileMenu.ejs
CHANGED
|
@@ -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>
|