ep_set_title_on_pad 0.7.4 → 0.7.6

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.
@@ -29,7 +29,7 @@ jobs:
29
29
  - uses: actions/setup-node@v6
30
30
  name: Install Node.js
31
31
  with:
32
- node-version: 22
32
+ node-version: 25
33
33
  - uses: pnpm/action-setup@v6
34
34
  name: Install pnpm
35
35
  with:
@@ -19,7 +19,7 @@ jobs:
19
19
  - uses: actions/setup-node@v6
20
20
  name: Install Node.js
21
21
  with:
22
- node-version: 22
22
+ node-version: 25
23
23
  - uses: pnpm/action-setup@v6
24
24
  name: Install pnpm
25
25
  with:
@@ -23,7 +23,7 @@ jobs:
23
23
  # OIDC trusted publishing needs npm >= 11.5.1, which requires
24
24
  # Node >= 20.17.0. setup-node's `20` resolves to the latest
25
25
  # 20.x, which satisfies that.
26
- node-version: 20
26
+ node-version: 25
27
27
  registry-url: https://registry.npmjs.org/
28
28
  - name: Upgrade npm to >=11.5.1 (required for trusted publishing)
29
29
  run: npm install -g npm@latest
package/handleMessage.js CHANGED
@@ -8,13 +8,10 @@
8
8
 
9
9
  const authorManager = require('ep_etherpad-lite/node/db/AuthorManager');
10
10
  const padMessageHandler = require('ep_etherpad-lite/node/handler/PadMessageHandler');
11
- const db = require('ep_etherpad-lite/node/db/DB').db;
11
+ const db = require('ep_etherpad-lite/node/db/DB');
12
12
 
13
- // Remove cache for this procedure
14
- db.dbSettings.cache = 0;
15
-
16
- const saveRoomTitle = (padId, message) => {
17
- db.set(`title:${padId}`, message);
13
+ const saveRoomTitle = async (padId, message) => {
14
+ await db.set(`title:${padId}`, message);
18
15
  };
19
16
 
20
17
  const sendToRoom = (message, msg) => {
@@ -66,7 +63,7 @@ exports.handleMessage = async (hookName, context, cb) => {
66
63
  },
67
64
  };
68
65
  sendToRoom(message, msg);
69
- saveRoomTitle(message.padId, message.message);
66
+ await saveRoomTitle(message.padId, message.message);
70
67
  return null; // handled by plugin
71
68
  }
72
69
  };
package/index.js CHANGED
@@ -1,12 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const db = require('ep_etherpad-lite/node/db/DB').db;
3
+ const db = require('ep_etherpad-lite/node/db/DB');
4
4
  const padMessageHandler = require('ep_etherpad-lite/node/handler/PadMessageHandler');
5
5
  const {padToggle} = require('ep_plugin_helpers/pad-toggle-server');
6
6
 
7
- // Remove cache for this procedure
8
- db.dbSettings.cache = 0;
9
-
10
7
  // Parallel User Settings + Pad Wide Settings checkboxes for "Show Title".
11
8
  // Helper owns the storage, broadcast, enforce, and i18n wiring. The pad
12
9
  // creator can enforce the pad-wide value to lock the title bar visible (or
@@ -31,35 +28,42 @@ exports.eejsBlock_padSettings = titleToggle.eejsBlock_padSettings;
31
28
  exports.clientVars = async (hookName, context) => {
32
29
  const padId = context.pad.id;
33
30
  // Fire the saved-title broadcast (legacy behavior — kept verbatim).
34
- db.get(`title:${padId}`, (err, value) => {
35
- const msg = {
36
- type: 'COLLABROOM',
37
- data: {
38
- type: 'CUSTOM',
39
- payload: {
40
- action: 'recieveTitleMessage',
41
- padId,
42
- message: value,
43
- },
31
+ let value;
32
+ try {
33
+ value = await db.get(`title:${padId}`);
34
+ } catch (err) {
35
+ console.error('ep_set_title_on_pad clientVars db.get failed:', err);
36
+ }
37
+ const msg = {
38
+ type: 'COLLABROOM',
39
+ data: {
40
+ type: 'CUSTOM',
41
+ payload: {
42
+ action: 'recieveTitleMessage',
43
+ padId,
44
+ message: value,
44
45
  },
45
- };
46
- setTimeout(() => {
47
- padMessageHandler.handleCustomObjectMessage(msg, false, () => {});
48
- }, 100);
49
- });
46
+ },
47
+ };
48
+ setTimeout(() => {
49
+ padMessageHandler.handleCustomObjectMessage(msg, false, () => {});
50
+ }, 100);
50
51
  // Return the padToggle's clientVars contribution so the helper picks up
51
52
  // pad-wide state on the client.
52
53
  return await titleToggle.clientVars(hookName, context);
53
54
  };
54
55
 
55
- exports.exportFileName = (hook, padId, callback) => {
56
- let title = padId;
57
- // Sets Export File Name to the same as the title
58
- db.get(`title:${padId}`, (err, value) => {
59
- console.log('Found ', value, ' for ', padId);
60
- if (value) title = value;
61
- callback(title);
62
- });
56
+ exports.exportFileName = async (hook, padId) => {
57
+ // ueberdb2 v6 is promise-only; the legacy db.get(key, cb) callback never
58
+ // fires, which previously hung the export pipeline when the export hook's
59
+ // callback was placed inside it.
60
+ try {
61
+ const value = await db.get(`title:${padId}`);
62
+ if (value) return value;
63
+ } catch (err) {
64
+ console.error('ep_set_title_on_pad exportFileName db.get failed:', err);
65
+ }
66
+ return padId;
63
67
  };
64
68
 
65
69
  exports.padRemove = async (hookName, {pad}) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ep_set_title_on_pad",
3
3
  "description": "Set the title on a pad in Etherpad, also includes real time updates to the UI",
4
- "version": "0.7.4",
4
+ "version": "0.7.6",
5
5
  "license": "Apache-2.0",
6
6
  "author": "johnyma22 (John McLear) <john@mclear.co.uk>",
7
7
  "keywords": [
@@ -6,20 +6,30 @@
6
6
  </div>
7
7
 
8
8
  <style type="text/css">
9
+ /* Bar height kept tight so the body-level title doesn't eat enough of the
10
+ editor viewport to break etherpad's auto-scroll on Enter (the bar pushes
11
+ the iframe down without the editor's scroll calculation accounting for
12
+ it — see ep_set_title_on_pad CI history vs etherpad-lite #7611). */
9
13
  #pad_title {
10
14
  flex-direction: row;
11
15
  align-items: center;
12
16
  border-bottom: 1px solid #ccc;
13
17
  margin: 0 !important;
14
- padding: 3px 10px;
18
+ padding: 0 10px;
19
+ height: 16px;
20
+ box-sizing: border-box;
21
+ line-height: 15px;
15
22
  }
16
23
  #input_title{
17
24
  display:none;
18
25
  flex: 1 auto;
19
- padding: 8px 10px !important;
26
+ padding: 0 8px !important;
27
+ height: 14px;
28
+ box-sizing: border-box;
29
+ font-size: 11px;
20
30
  }
21
31
  #title{
22
- line-height:30px;
32
+ line-height: 15px;
23
33
  max-width: calc(100% - 30px);
24
34
  white-space: nowrap;
25
35
  overflow: hidden;
@@ -29,18 +39,24 @@
29
39
  text-decoration:none;
30
40
  }
31
41
  #title h1{
32
- line-height:160%;
42
+ margin: 0;
43
+ padding: 0;
44
+ font-size: 11px;
45
+ line-height: 15px;
46
+ font-weight: 600;
33
47
  }
34
48
  #edit_title{
35
- padding-top: 5px;
49
+ padding: 0;
36
50
  margin-left: 10px;
37
51
  cursor:pointer;
38
52
  display:none;
53
+ line-height: 15px;
39
54
  }
40
55
  #save_title{
41
56
  display:none;
42
57
  cursor:pointer;
43
58
  margin-left:8px;
59
+ line-height: 15px;
44
60
  }
45
61
  #save_title button{
46
62
  margin-right: 0 !important;