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
2b6c56f1
Commit
2b6c56f1
authored
Dec 04, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move converse-chatview plugin into folder
parent
ecfaba07
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
296 additions
and
263 deletions
+296
-263
src/converse.js
src/converse.js
+1
-1
src/plugins/chatview/api.js
src/plugins/chatview/api.js
+35
-0
src/plugins/chatview/index.js
src/plugins/chatview/index.js
+84
-0
src/plugins/chatview/view.js
src/plugins/chatview/view.js
+165
-251
src/plugins/controlbox/index.js
src/plugins/controlbox/index.js
+1
-1
src/plugins/dragresize.js
src/plugins/dragresize.js
+1
-1
src/plugins/fullscreen.js
src/plugins/fullscreen.js
+1
-1
src/plugins/headlines-view.js
src/plugins/headlines-view.js
+5
-5
src/plugins/minimize.js
src/plugins/minimize.js
+1
-1
src/plugins/muc-views.js
src/plugins/muc-views.js
+2
-2
No files found.
src/converse.js
View file @
2b6c56f1
...
...
@@ -16,7 +16,7 @@ import "shared/registry.js";
*/
import
"
./plugins/autocomplete.js
"
;
import
"
./plugins/bookmark-views.js
"
;
// Views for XEP-0048 Bookmarks
import
"
./plugins/chatview.js
"
;
// Renders standalone chat boxes for single user chat
import
"
./plugins/chatview
/index
.js
"
;
// Renders standalone chat boxes for single user chat
import
"
./plugins/controlbox/index.js
"
;
// The control box
import
"
./plugins/dragresize.js
"
;
// Allows chat boxes to be resized by dragging them
import
"
./plugins/fullscreen.js
"
;
...
...
src/plugins/chatview/api.js
0 → 100644
View file @
2b6c56f1
import
{
_converse
}
from
'
@converse/headless/core
'
;
export
default
{
/**
* The "chatview" namespace groups methods pertaining to views
* for one-on-one chats.
*
* @namespace _converse.api.chatviews
* @memberOf _converse.api
*/
chatviews
:
{
/**
* Get the view of an already open chat.
* @method _converse.api.chatviews.get
* @param { Array.string | string } jids
* @returns { _converse.ChatBoxView|undefined } The chat should already be open, otherwise `undefined` will be returned.
* @example
* // To return a single view, provide the JID of the contact:
* _converse.api.chatviews.get('buddy@example.com')
* @example
* // To return an array of views, provide an array of JIDs:
* _converse.api.chatviews.get(['buddy1@example.com', 'buddy2@example.com'])
*/
get
(
jids
)
{
if
(
jids
===
undefined
)
{
return
Object
.
values
(
_converse
.
chatboxviews
.
getAll
());
}
if
(
typeof
jids
===
'
string
'
)
{
return
_converse
.
chatboxviews
.
get
(
jids
);
}
return
jids
.
map
(
jid
=>
_converse
.
chatboxviews
.
get
(
jid
));
}
}
}
src/plugins/chatview/index.js
0 → 100644
View file @
2b6c56f1
/**
* @module converse-chatview
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
import
'
../../components/chat_content.js
'
;
import
'
../../components/help_messages.js
'
;
import
'
../../components/toolbar.js
'
;
import
'
../chatboxviews/index.js
'
;
import
'
../modal.js
'
;
import
{
_converse
,
api
,
converse
}
from
'
@converse/headless/core
'
;
import
ChatBoxView
from
'
./view.js
'
;
import
chatview_api
from
'
./api.js
'
;
const
{
Strophe
}
=
converse
.
env
;
function
onWindowStateChanged
(
data
)
{
if
(
_converse
.
chatboxviews
)
{
_converse
.
chatboxviews
.
forEach
(
view
=>
{
if
(
view
.
model
.
get
(
'
id
'
)
!==
'
controlbox
'
)
{
view
.
onWindowStateChanged
(
data
.
state
);
}
});
}
}
function
onChatBoxViewsInitialized
()
{
const
views
=
_converse
.
chatboxviews
;
_converse
.
chatboxes
.
on
(
'
add
'
,
async
item
=>
{
if
(
!
views
.
get
(
item
.
get
(
'
id
'
))
&&
item
.
get
(
'
type
'
)
===
_converse
.
PRIVATE_CHAT_TYPE
)
{
await
item
.
initialized
;
views
.
add
(
item
.
get
(
'
id
'
),
new
_converse
.
ChatBoxView
({
model
:
item
}));
}
});
}
converse
.
plugins
.
add
(
'
converse-chatview
'
,
{
/* Plugin dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin.
*
* If the setting "strict_plugin_dependencies" is set to true,
* an error will be raised if the plugin is not found. By default it's
* false, which means these plugins are only loaded opportunistically.
*
* NB: These plugins need to have already been loaded via require.js.
*/
dependencies
:
[
'
converse-chatboxviews
'
,
'
converse-chat
'
,
'
converse-disco
'
,
'
converse-modal
'
],
initialize
()
{
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
api
.
settings
.
extend
({
'
auto_focus
'
:
true
,
'
debounced_content_rendering
'
:
true
,
'
filter_url_query_params
'
:
null
,
'
image_urls_regex
'
:
null
,
'
message_limit
'
:
0
,
'
muc_hats
'
:
[
'
xep317
'
],
'
show_images_inline
'
:
true
,
'
show_message_avatar
'
:
true
,
'
show_retraction_warning
'
:
true
,
'
show_send_button
'
:
true
,
'
show_toolbar
'
:
true
,
'
time_format
'
:
'
HH:mm
'
,
'
use_system_emojis
'
:
true
,
'
visible_toolbar_buttons
'
:
{
'
call
'
:
false
,
'
clear
'
:
true
,
'
emoji
'
:
true
,
'
spoiler
'
:
true
}
});
Object
.
assign
(
api
,
chatview_api
);
_converse
.
ChatBoxView
=
ChatBoxView
;
api
.
listen
.
on
(
'
chatBoxViewsInitialized
'
,
onChatBoxViewsInitialized
);
api
.
listen
.
on
(
'
windowStateChanged
'
,
onWindowStateChanged
);
api
.
listen
.
on
(
'
connected
'
,
()
=>
api
.
disco
.
own
.
features
.
add
(
Strophe
.
NS
.
SPOILER
));
}
});
src/plugins/chatview.js
→
src/plugins/chatview
/view
.js
View file @
2b6c56f1
This diff is collapsed.
Click to expand it.
src/plugins/controlbox/index.js
View file @
2b6c56f1
...
...
@@ -4,7 +4,7 @@
* @license Mozilla Public License (MPLv2)
*/
import
"
../../components/brand-heading
"
;
import
"
../chatview
"
;
import
"
../chatview
/index.js
"
;
import
ControlBoxMixin
from
'
./model.js
'
;
import
ControlBoxPane
from
'
./pane.js
'
;
import
ControlBoxToggle
from
'
./toggle.js
'
;
...
...
src/plugins/dragresize.js
View file @
2b6c56f1
...
...
@@ -3,7 +3,7 @@
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
import
"
./chatview.js
"
;
import
"
./chatview
/index
.js
"
;
import
"
./controlbox/index.js
"
;
import
{
debounce
}
from
"
lodash-es
"
;
import
{
_converse
,
api
,
converse
}
from
"
@converse/headless/core
"
;
...
...
src/plugins/fullscreen.js
View file @
2b6c56f1
...
...
@@ -3,7 +3,7 @@
* @license Mozilla Public License (MPLv2)
* @copyright 2020, the Converse.js contributors
*/
import
"
./chatview.js
"
;
import
"
./chatview
/index
.js
"
;
import
"
./controlbox/index.js
"
;
import
"
./singleton.js
"
;
import
"
@converse/headless/plugins/muc
"
;
...
...
src/plugins/headlines-view.js
View file @
2b6c56f1
...
...
@@ -3,9 +3,9 @@
* @copyright 2020, the Converse.js contributors
* @license Mozilla Public License (MPLv2)
*/
import
"
./chatview/index.js
"
;
import
tpl_chatbox
from
"
../templates/chatbox.js
"
;
import
tpl_headline_panel
from
"
../templates/headline_panel.js
"
;
import
{
ChatBoxView
}
from
"
./chatview
"
;
import
{
View
}
from
'
@converse/skeletor/src/view.js
'
;
import
{
__
}
from
'
../i18n
'
;
import
{
_converse
,
api
,
converse
}
from
"
@converse/headless/core
"
;
...
...
@@ -14,7 +14,7 @@ import { render } from "lit-html";
const
u
=
converse
.
env
.
utils
;
const
HeadlinesBoxView
=
ChatBoxView
.
extend
(
{
const
HeadlinesBoxView
Mixin
=
{
className
:
'
chatbox headlines hidden
'
,
events
:
{
...
...
@@ -100,10 +100,10 @@ const HeadlinesBoxView = ChatBoxView.extend({
return
_converse
.
api
.
hook
(
'
getHeadingButtons
'
,
this
,
buttons
);
},
// Override to avoid the methods in converse-chatview
.js
// Override to avoid the methods in converse-chatview
'
renderMessageForm
'
:
function
renderMessageForm
()
{},
'
afterShown
'
:
function
afterShown
()
{}
}
)
;
};
/**
...
...
@@ -210,7 +210,7 @@ converse.plugins.add('converse-headlines-view', {
Object
.
assign
(
_converse
.
ControlBoxView
.
prototype
,
viewWithHeadlinesPanel
);
}
_converse
.
HeadlinesBoxView
=
HeadlinesBoxView
;
_converse
.
HeadlinesBoxView
=
_converse
.
ChatBoxView
.
extend
(
HeadlinesBoxViewMixin
)
;
_converse
.
HeadlinesPanel
=
HeadlinesPanel
;
...
...
src/plugins/minimize.js
View file @
2b6c56f1
...
...
@@ -4,7 +4,7 @@
* @license Mozilla Public License (MPLv2)
*/
import
'
../components/minimized_chat.js
'
;
import
'
./chatview.js
'
;
import
'
./chatview
/index
.js
'
;
import
tpl_chats_panel
from
'
../templates/chats_panel.js
'
;
import
{
Model
}
from
'
@converse/skeletor/src/model.js
'
;
import
{
View
}
from
'
@converse/skeletor/src/view
'
;
...
...
src/plugins/muc-views.js
View file @
2b6c56f1
...
...
@@ -5,6 +5,7 @@
* @license Mozilla Public License (MPLv2)
*/
import
"
../components/muc-sidebar
"
;
import
"
./chatview/index.js
"
;
import
"
./modal.js
"
;
import
"
@converse/headless/utils/muc
"
;
import
AddMUCModal
from
'
../modals/add-muc.js
'
;
...
...
@@ -24,7 +25,6 @@ import tpl_muc_nickname_form from "../templates/muc_nickname_form.js";
import
tpl_muc_password_form
from
"
../templates/muc_password_form.js
"
;
import
tpl_room_panel
from
"
../templates/room_panel.js
"
;
import
tpl_spinner
from
"
../templates/spinner.js
"
;
import
{
ChatBoxView
}
from
"
./chatview.js
"
;
import
{
Model
}
from
'
@converse/skeletor/src/model.js
'
;
import
{
View
}
from
'
@converse/skeletor/src/view.js
'
;
import
{
__
}
from
'
../i18n
'
;
...
...
@@ -63,7 +63,7 @@ const COMMAND_TO_AFFILIATION = {
* @namespace _converse.ChatRoomView
* @memberOf _converse
*/
export
const
ChatRoomView
=
ChatBoxView
.
extend
({
export
const
ChatRoomView
=
_converse
.
ChatBoxView
.
extend
({
length
:
300
,
tagName
:
'
div
'
,
className
:
'
chatbox chatroom hidden
'
,
...
...
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