discourse/docs
Alan Guo Xiang Tan 913fd3a7b3
DEV: Improve `addToolbarPopupMenuOptionsCallback` plugin api (#23769)
Why this change?

Previously just using the `addToolbarPopupMenuOptionsCallback` plugin
API itself was insufficient because it required the return object to
include an `action` key which only accepted a name of the action
function as a string. This was highly problematic because the action
function had to be defined on the `composer` service which means using
the `modifyClass` API to add the action function. This made the API
awkward to use leading to poor developer experiencec.

What does this change do?

This commit introduces a couple of improvemnts to the API.

1. First the API has been renamed to `addComposerToolbarPopupMenuOption` because
   the API no longer accepts a callback function which was quite
   redundant. Instead, it now accepts an Object. The
   `addToolbarPopupMenuOptionsCallback` API function is deprecated and
   will be dropped in Discourse 3.3. Note that passing the API a
   function is still supported but will be dropped when the `addToolbarPopupMenuOptionsCallback`
   is removed.

2. The `action` key in the Object passed to the function can now be a
   function and is passed the `toolbarEvent` object when called.

3. The `condition` on key in the Object passed to the function can now be a
   function and is passed the `composer` service when called.
2023-10-06 07:43:40 +08:00
..
ADMIN-QUICK-START-GUIDE.md Update ADMIN-QUICK-START-GUIDE.md (#22788) 2023-07-27 08:44:38 -07:00
AUTHORS.md HTTPSify links (#7046) 2019-02-22 16:29:27 +01:00
CHANGELOG-JAVASCRIPT-PLUGIN-API.md DEV: Improve `addToolbarPopupMenuOptionsCallback` plugin api (#23769) 2023-10-06 07:43:40 +08:00
DEVELOPER-ADVANCED.md Update DEVELOPER-ADVANCED.md (#15770) 2022-02-02 11:05:37 -05:00
DEVELOPMENT-OSX-NATIVE.md DEV: Swap out optipng with oxipng (#15013) 2021-11-22 10:16:35 -07:00
INSTALL-cloud.md DOCS: Update wrong link address (#23285) 2023-08-28 13:00:17 +08:00
INSTALL-email.md DEV: Include details for Mailjet SMTP configs (#22613) 2023-07-14 10:12:16 +03:00
INSTALL.md DEV: Update recommended Ruby to 3.2.1 (#20444) 2023-02-24 12:51:34 -03:00
PLUGINS.md discourse/discourse change from 'master' to 'main' 2021-07-19 11:46:15 -04:00
SECURITY.md FEATURE: Increase pbkdf2 iterations to 600k (#20981) 2023-04-11 11:56:20 +01:00
TESTING.md DEV: replace mailcatcher references with mailhog (#14500) 2021-10-05 15:48:06 +05:30
TROUBLESHOOTING.md for docs, normalize on space after code fence when specifying lang 2019-01-21 01:19:28 -08:00
code-of-conduct.md Update Code of Conduct to v2.0 (#12296) 2021-03-04 23:44:58 -05:00