ep_font_size 0.4.100 → 0.4.102

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.
@@ -0,0 +1,30 @@
1
+ name: Dependabot Automerge
2
+ permissions:
3
+ contents: write
4
+ pull-requests: write
5
+ on:
6
+ workflow_run:
7
+ workflows:
8
+ - Node.js Package
9
+ types:
10
+ - completed
11
+
12
+ jobs:
13
+ automerge:
14
+ if: >
15
+ github.event.workflow_run.conclusion == 'success' &&
16
+ github.event.workflow_run.event == 'push' &&
17
+ github.event.workflow_run.actor.login == 'dependabot[bot]'
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v6
22
+
23
+ - name: Automerge
24
+ uses: "pascalgn/automerge-action@v0.16.4"
25
+ env:
26
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27
+ MERGE_METHOD: squash
28
+ MERGE_LABELS: ""
29
+ MERGE_RETRY_SLEEP: "100000"
30
+
@@ -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_size/workflows/Node.js%20Package/badge.svg) [![Backend Tests Status](https://github.com/ether/ep_font_size/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_font_size/actions/workflows/test-and-release.yml)
1
+ ![Demo](demo.gif) [![Backend Tests Status](https://github.com/ether/ep_font_size/actions/workflows/test-and-release.yml/badge.svg)](https://github.com/ether/ep_font_size/actions/workflows/test-and-release.yml)
2
2
 
3
3
  [![Travis (.com)](https://api.travis-ci.com/ether/ep_font_size.git.svg?branch=develop)](https://travis-ci.com/github/ether/ep_font_size.git)
4
4
 
package/demo.gif ADDED
Binary file
package/demo.png ADDED
Binary file
package/exportHTML.js CHANGED
@@ -1,20 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const eejs = require('ep_etherpad-lite/node/eejs/');
3
+ const {inlineAttributeExport} = require('ep_plugin_helpers/attributes-server');
4
4
 
5
- // Add the props to be supported in export
6
- exports.exportHtmlAdditionalTagsWithData = async (hookName, pad) => {
7
- const ret = [];
8
- pad.pool.eachAttrib((k, v) => { if (k === 'font-size') ret.push([k, v]); });
9
- return ret;
10
- };
5
+ const sizeExport = inlineAttributeExport({
6
+ attr: 'font-size',
7
+ exportCssFile: 'ep_font_size/static/css/size.css',
8
+ exportDataAttr: 'data-font-size',
9
+ });
11
10
 
12
- // Include CSS for HTML export
13
- exports.stylesForExport =
14
- async (hookName, padId) => eejs.require('ep_font_size/static/css/size.css');
15
-
16
- exports.getLineHTMLForExport = async (hookName, context) => {
17
- // Replace data-size="foo" with class="font-size:x".
18
- context.lineContent = context.lineContent.replace(
19
- /data-font-size=["|']([0-9a-zA-Z]+)["|']/gi, 'class="font-size:$1"');
20
- };
11
+ exports.exportHtmlAdditionalTagsWithData = sizeExport.exportHtmlAdditionalTagsWithData;
12
+ exports.stylesForExport = sizeExport.stylesForExport;
13
+ exports.getLineHTMLForExport = sizeExport.getLineHTMLForExport;
package/index.js CHANGED
@@ -1,27 +1,20 @@
1
1
  'use strict';
2
2
 
3
- const eejs = require('ep_etherpad-lite/node/eejs/');
4
3
  const settingsModule = require('ep_etherpad-lite/node/utils/Settings');
5
4
  const settings = settingsModule.default || settingsModule;
5
+ const {template, rawHTML} = require('ep_plugin_helpers');
6
+ const eejs = require('ep_etherpad-lite/node/eejs/');
6
7
  const shared = require('./static/js/shared');
7
8
 
8
- exports.eejsBlock_editbarMenuLeft = (hookName, args, cb) => {
9
- if (JSON.stringify(settings.toolbar).indexOf('fontSize') > -1) {
10
- return cb();
11
- }
12
- args.content += eejs.require('ep_font_size/templates/editbarButtons.ejs');
13
- return cb();
14
- };
9
+ exports.eejsBlock_editbarMenuLeft = template('ep_font_size/templates/editbarButtons.ejs', {
10
+ skip: () => settings.toolbar && JSON.stringify(settings.toolbar).indexOf('fontSize') > -1,
11
+ });
15
12
 
16
- exports.eejsBlock_dd_format = (hookName, args, cb) => {
17
- args.content += eejs.require('ep_font_size/templates/fileMenu.ejs');
18
- return cb();
19
- };
13
+ exports.eejsBlock_dd_format = template('ep_font_size/templates/fileMenu.ejs');
20
14
 
21
- exports.eejsBlock_timesliderStyles = (hookName, args, cb) => {
22
- args.content += `<style>${eejs.require('ep_font_size/static/css/size.css')}</style>`;
23
- return cb();
24
- };
15
+ exports.eejsBlock_timesliderStyles = rawHTML(
16
+ `<style>${eejs.require('ep_font_size/static/css/size.css')}</style>`
17
+ );
25
18
 
26
19
  exports.padInitToolbar = (hookName, args, cb) => {
27
20
  const toolbar = args.toolbar;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "Apply sizes to fonts",
3
3
  "name": "ep_font_size",
4
- "version": "0.4.100",
4
+ "version": "0.4.102",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
7
7
  "name": "John McLear",
@@ -27,9 +27,12 @@
27
27
  "type": "individual",
28
28
  "url": "https://etherpad.org/"
29
29
  },
30
+ "dependencies": {
31
+ "ep_plugin_helpers": "^0.2.0"
32
+ },
30
33
  "devDependencies": {
31
34
  "eslint": "^8.57.1",
32
- "eslint-config-etherpad": "^4.0.4",
35
+ "eslint-config-etherpad": "^4.0.5",
33
36
  "typescript": "^5.9.3"
34
37
  },
35
38
  "scripts": {
@@ -1,8 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ const {inlineAttribute} = require('ep_plugin_helpers/attributes');
3
4
  const shared = require('./shared');
4
5
 
5
- // Bind the event handler to the toolbar buttons
6
+ const fontSize = inlineAttribute({attr: 'font-size'});
7
+
8
+ exports.aceAttribsToClasses = fontSize.aceAttribsToClasses;
9
+ exports.aceCreateDomLine = fontSize.aceCreateDomLine;
10
+
6
11
  exports.postAceInit = (hookName, context) => {
7
12
  const hs = $('#font-size, select.size-selection');
8
13
  hs.on('change', function () {
@@ -13,42 +18,19 @@ exports.postAceInit = (hookName, context) => {
13
18
  ace.ace_doInsertsizes(intValue);
14
19
  }, 'insertsize', true);
15
20
  hs.val('dummy');
21
+ context.ace.focus();
16
22
  }
17
23
  });
18
24
  $('.font_size').hover(() => {
19
25
  $('.submenu > .size-selection').attr('size', 6);
20
26
  $('.submenu > #font-size').attr('size', 6);
21
27
  });
22
- $('.font-size-icon').click(() => {
28
+ $('.font-size-icon').on('click', () => {
23
29
  $('#font-size').toggle();
24
30
  });
25
31
  };
26
32
 
27
- exports.aceAttribsToClasses = (hookName, context) => {
28
- if (context.key.indexOf('font-size:') !== -1) {
29
- const size = /(?:^| )font-size:([A-Za-z0-9]*)/.exec(context.key);
30
- return [`font-size:${size[1]}`];
31
- }
32
- if (context.key === 'font-size') {
33
- return [`font-size:${context.value}`];
34
- }
35
- };
36
-
37
- exports.aceCreateDomLine = (hookName, context) => {
38
- const cls = context.cls;
39
- const [, sizesType] = /(?:^| )font-size:([A-Za-z0-9]*)/.exec(cls) || [];
40
- if (sizesType == null) return [];
41
- const tagIndex = shared.sizes.indexOf(sizesType);
42
- if (tagIndex < 0) return [];
43
- return [{
44
- extraOpenTags: '',
45
- extraCloseTags: '',
46
- cls,
47
- }];
48
- };
49
-
50
33
  exports.aceInitialized = (hookName, context) => {
51
- // Passing a level >= 0 will set a sizes on the selected lines, level < 0 will remove it
52
34
  context.editorInfo.ace_doInsertsizes = (level) => {
53
35
  const {rep, documentAttributeManager} = context;
54
36
  if (!(rep.selStart && rep.selEnd)) return;
@@ -61,7 +43,7 @@ exports.aceInitialized = (hookName, context) => {
61
43
  exports.aceEditorCSS = () => ['ep_font_size/static/css/size.css'];
62
44
 
63
45
  exports.postToolbarInit = (hookName, context) => {
64
- context.toolbar.registerCommand('fontSize', (buttonName, toolbar, item) => {
46
+ context.toolbar.registerCommand('fontSize', () => {
65
47
  $('#font-size').toggle();
66
48
  });
67
49
  };
@@ -1,17 +1,16 @@
1
1
  'use strict';
2
2
 
3
- // Starts at b, ends just before e, skipping s each time.
4
- const range = (b, e, s = 1) => [...Array(Math.ceil((e - b) / s)).keys()].map((x) => (x * s) + b);
3
+ const {inlineAttribute} = require('ep_plugin_helpers/attributes');
5
4
 
6
- exports.collectContentPre = (hookName, context) => {
7
- const size = /(?:^| )font-size:([A-Za-z0-9]*)/.exec(context.cls);
8
- if (size && size[1]) {
9
- context.cc.doAttrib(context.state, `font-size:${size[1]}`);
10
- }
11
- };
5
+ const range = (b, e, s = 1) => [...Array(Math.ceil((e - b) / s)).keys()].map((x) => (x * s) + b);
12
6
 
13
- exports.sizes = []
7
+ const sizes = []
14
8
  .concat(range(8, 20))
15
9
  .concat(range(20, 30, 2))
16
10
  .concat(range(30, 50, 5))
17
11
  .concat(range(50, 70, 10));
12
+
13
+ const fontSize = inlineAttribute({attr: 'font-size'});
14
+
15
+ exports.collectContentPre = fontSize.collectContentPre;
16
+ exports.sizes = sizes;
@@ -1,6 +1,9 @@
1
1
  <li class="separator acl-write"></li>
2
2
  <li class="acl-write">
3
- <select id="font-size" class="size-selection">
3
+ <select id="font-size" class="size-selection"
4
+ aria-label="Font size"
5
+ data-l10n-id="ep_font_size.size"
6
+ data-l10n-attr="aria-label">
4
7
  <option value="dummy" selected data-l10n-id="ep_font_size.size">Font Size</option>
5
8
  <option value="0">8</option>
6
9
  <option value="1">9</option>
@@ -1,5 +1,5 @@
1
1
  <hr>
2
- <li><a href="#" data-key="align" class="font_size">Font size</a>
2
+ <li><a href="#" data-key="fontSize" class="font_size" data-l10n-id="ep_font_size.size">Font size</a>
3
3
  <ul class="submenu">
4
4
  <select id="font-size" class="size-selection">
5
5
  <option value="dummy" selected data-l10n-id="ep_font_size.size">Font Size</option>