From 6943524d5cebbe79d4c62e6f889bfe2def8829c4 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 1 Oct 2025 18:25:37 +0200 Subject: [PATCH] Allow plugins to add custom icons --- www/common/common-icons.js | 19 ++++++++----------- www/common/common-login.js | 3 +-- www/common/cryptpad-common.js | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/www/common/common-icons.js b/www/common/common-icons.js index 52e5899ed..7c9062108 100644 --- a/www/common/common-icons.js +++ b/www/common/common-icons.js @@ -1,8 +1,7 @@ define([ - 'jquery', '/common/hyperscript.js', '/customize/lucide.js' -], function ($, h, Lucide) { +], function (h, Lucide) { const Icons = {}; const map = { @@ -243,19 +242,17 @@ define([ "badge-moderator": "life-buoy", "badge-premium": "ticket-check", "badge-error": "circle-alert", - // Accounts - "pricing": "circle-star", - "subscribe": "ticket", - "trophy": "trophy", - "credit-card": "credit-card", - "circle-left": "circle-chevron-left", - "user": "user-round", - "notebook":"notepad-text", - "sso": "id-card", + // Other "maintenance": "construction", "release-notes": "notepad-text" }; + Icons.add = (newIcons) => { + Object.keys(newIcons).forEach(k => { + map[k] = newIcons[k]; + }); + }; + Icons.get = (name, attrs = {}) => { if (!map[name]) { alert(`Invalid icon: ${name}`); diff --git a/www/common/common-login.js b/www/common/common-login.js index 37cd08aa0..66ce9c034 100644 --- a/www/common/common-login.js +++ b/www/common/common-login.js @@ -11,7 +11,6 @@ define([ '/components/chainpad/chainpad.dist.js', '/common/common-realtime.js', '/common/common-constants.js', - '/common/common-interface.js', '/common/common-feedback.js', '/common/outer/local-store.js', '/customize/messages.js', @@ -22,7 +21,7 @@ define([ '/components/tweetnacl/nacl-fast.min.js', '/components/scrypt-async/scrypt-async.min.js', // better load speed -], function (Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants, UI, +], function (Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants, Feedback, LocalStore, Messages, nThen, Block, Hash, ServerCommand) { var Nacl = window.nacl; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index af9b61f07..a385266c9 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -17,7 +17,7 @@ define([ '/common/events-channel.js', '/common/outer/login-block.js', '/common/common-credential.js', - '/customize/login.js', + '/common/common-login.js', '/common/store-interface.js', '/common/pad-types.js',