Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
d47c7271
Commit
d47c7271
authored
Dec 03, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the button hooks
parent
824bf2ed
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
13 deletions
+34
-13
CHANGES.md
CHANGES.md
+2
-0
src/components/message-actions.js
src/components/message-actions.js
+10
-10
src/components/toolbar.js
src/components/toolbar.js
+7
-0
src/plugins/chatview.js
src/plugins/chatview.js
+12
-0
src/plugins/modal.js
src/plugins/modal.js
+3
-3
No files found.
CHANGES.md
View file @
d47c7271
...
...
@@ -6,6 +6,8 @@
-
#2275: Allow punctuation to immediately precede a mention
-
Bugfix: Connection protocol not updated based on XEP-0156 connection methods
-
Bugfix:
`null`
inserted by emoji picker and can't switch between skintones
-
New hook:
[
getMessageActionButtons
](
https://conversejs.org/docs/html/api/-_converse.html#event:getMessageActionButtons
)
-
File structure reordering: All plugins are now in
`./plugins`
folders.
-
New configuration setting:
[
show_tab_notifications
](
https://conversejs.org/docs/html/configuration.html#show-tab-notifications
)
### Breaking Changes
...
...
src/components/message-actions.js
View file @
d47c7271
...
...
@@ -70,16 +70,16 @@ class MessageActions extends CustomElement {
* *Hook* which allows plugins to add more message action buttons
* @event _converse#getMessageActionButtons
* @example
api.listen.on('getMessageActionButtons', (el, buttons) => {
buttons.push({
'i18n_text': 'Foo',
'handler': ev => alert('Foo!'),
'button_class': 'chat-msg__action-foo',
'icon_class': 'fa fa-check',
'name': 'foo'
});
return buttons;
});
*
api.listen.on('getMessageActionButtons', (el, buttons) => {
*
buttons.push({
*
'i18n_text': 'Foo',
*
'handler': ev => alert('Foo!'),
*
'button_class': 'chat-msg__action-foo',
*
'icon_class': 'fa fa-check',
*
'name': 'foo'
*
});
*
return buttons;
*
});
*/
return
api
.
hook
(
'
getMessageActionButtons
'
,
this
,
buttons
);
}
...
...
src/components/toolbar.js
View file @
d47c7271
...
...
@@ -79,6 +79,13 @@ export class ChatToolbar extends CustomElement {
/**
* *Hook* which allows plugins to add more buttons to a chat's toolbar
* @event _converse#getToolbarButtons
* @example
* api.listen.on('getToolbarButtons', (toolbar_el, buttons) {
* buttons.push(html`
* <button @click=${() => alert('Foo!')}>Foo</button>`
* );
* return buttons;
* }
*/
return
_converse
.
api
.
hook
(
'
getToolbarButtons
'
,
this
,
buttons
);
}
...
...
src/plugins/chatview.js
View file @
d47c7271
...
...
@@ -333,6 +333,18 @@ export const ChatBoxView = View.extend({
/**
* *Hook* which allows plugins to add more buttons to a chat's heading.
* @event _converse#getHeadingButtons
* @example
* api.listen.on('getHeadingButtons', (view, buttons) => {
* buttons.push({
* 'i18n_title': __('Foo'),
* 'i18n_text': __('Foo Bar'),
* 'handler': ev => alert('Foo!'),
* 'a_class': 'toggle-foo',
* 'icon_class': 'fa-foo',
* 'name': 'foo'
* });
* return buttons;
* });
*/
return
_converse
.
api
.
hook
(
'
getHeadingButtons
'
,
this
,
buttons
);
},
...
...
src/plugins/modal.js
View file @
d47c7271
...
...
@@ -29,10 +29,10 @@ const modal_api = {
* Will create a new instance of that class if an existing one isn't
* found.
* @param { Class } ModalClass
* @param {
[Object] } properties
- Optional properties that will be
* @param {
Object } [properties]
- Optional properties that will be
* set on a newly created modal instance (if no pre-existing modal was
* found).
* @param {
[Event] } event
- The DOM event that causes the modal to be shown.
* @param {
Event } [event]
- The DOM event that causes the modal to be shown.
*/
show
(
ModalClass
,
properties
,
ev
)
{
const
modal
=
this
.
get
(
ModalClass
.
id
)
||
this
.
create
(
ModalClass
,
properties
);
...
...
@@ -51,7 +51,7 @@ const modal_api = {
/**
* Create a modal of the passed-in type.
* @param { Class } ModalClass
* @param {
[Object] } properties
- Optional properties that will be
* @param {
Object } [properties]
- Optional properties that will be
* set on the modal instance.
*/
create
(
ModalClass
,
properties
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment