Commit Graph

205 Commits

Author SHA1 Message Date
JC Brand
be8a47b672 Avoid rendering borders for empty unfurl 2021-06-18 11:37:33 +02:00
JC Brand
f598b7d267 Fix function not being exported 2021-06-17 16:32:58 +02:00
JC Brand
619fb538d7 Show video download URL 2021-06-17 15:50:10 +02:00
JC Brand
095d9b60cd Render audio from URLs in messages 2021-06-17 15:24:25 +02:00
JC Brand
33b426c79e Render videos from URLs in messages 2021-06-17 14:06:18 +02:00
JC Brand
b6f2662ad7 Set 'scrolled' flag on model.ui
This prevents it from being persisted across page loads and makes more
sense logically.

Also move markScrolled to utils and MUC unread messages indicator to bottom panel.
2021-06-17 11:39:20 +02:00
JC Brand
5ea9564cc3 Add new configuration setting prune_messages_above
If set to a positive integer, the chat history will be kept to that size
by removing older messages.

This happens as new messages come in (as long as the chat isn't scrolled up)
and when the user scrolls down.

Also add the `pruning_behavior` setting
2021-06-17 11:39:20 +02:00
JC Brand
dc711d494f Add a placeholder to indicate a gap in the message history
The user can click the placeholder to fill in the gap.
2021-06-17 11:35:06 +02:00
JC Brand
c8304497b5 Remove onStatusMessageChanged handler
It's no longer necessary and calls a method that doesn't exist anymore.
2021-06-15 09:59:40 +02:00
JC Brand
68f0be996f Let chats be closed by calling close on the models
Instead of on the views/components.

We still have `close` methods on the components, but they are just
event handlers and not external API methods to be called by other code.
Instead `close` should be called on the model.
2021-06-15 09:59:40 +02:00
JC Brand
9fb92080f2 Get rid of the APIs to fetch chat views
This is largely a leftover from the Backbone.View days and makes less
sense now that the UI is componentized.

Ideally we don't want to call commands on the "views themselves, instead
we should be working on the the models and let the "views" update
themselves automatically.

Also, given that the `jid` attribute on the chat views might change,
especially when rendered declaratively in other frameworks like React,
a view might not be available at times where we previously might have
expected it to be (since it's been repurposed for a different JID).
2021-06-15 09:59:40 +02:00
JC Brand
ba1b712fee Move functions to utils 2021-06-14 12:03:27 +02:00
JC Brand
2bbb889196 Unfurls fix 2021-06-10 13:37:11 +02:00
JC Brand
39d60f05c3 Remove twitter link from homepage. Make navbar more visible 2021-06-10 10:07:19 +02:00
JC Brand
54d6a6af56 Unfurls: gracefully handle missing OGP data 2021-06-09 20:54:08 +02:00
JC Brand
878a3b49a7 Prevent multiple 'New messages' dividers from appearing
Would happen when scrolled up and a new message comes in
2021-06-07 19:58:55 +02:00
JC Brand
825e2643ae Use flex-direction: column-reverse
On the `<converse-chat-content>` element. This removes the need for all
the manual scrolling.

Firefox finally supports this feature. Unfortunately Firefox ESR doesn't
yet, but I can't wait anymore.
2021-06-07 19:26:16 +02:00
JC Brand
9bcf5f2947 Scrolling fixes
* Remove extra `_markScrolled` function
* Only try to maintain scrolling position when some non-scrolling change has happened.
2021-06-07 17:54:38 +02:00
JC Brand
90dff612c7 Re-initialize chat components when jid attribute changes 2021-06-07 12:53:35 +02:00
JC Brand
e3612e8c62 Turn the chats into Lit components
Previously they were of type ElementView from @converse/skeletor

The ElementView component is merely a helper to allow us to eventually
migrate everything to Lit
2021-06-04 15:22:52 +02:00
JC Brand
ff233a5b1c Merge branch 'jcbrand/declarative-scrolling' 2021-06-04 12:59:52 +02:00
JC Brand
f3efbba26c Create converse-message-form component
More work on making bottom panel sub-components declarative

- Handle auto-completion in the converse-muc-message-form element
- Make message limit indicator a component
- Rename template
2021-06-04 12:53:03 +02:00
ubermanu
2f7dcb6bbc Move decodeHTMLEntities util into headless 2021-06-03 19:23:49 +02:00
JC Brand
58d96c8594 Use intersection observer to remember scrolling position 2021-06-03 18:24:55 +02:00
JC Brand
279a3c3413 Add saveScrollPosition method on ChatContent 2021-06-03 15:32:39 +02:00
JC Brand
fe3e63d8c5 Declarative scrolling and rendering new messages indicator
- Increment `num_unread` when new messages appear while scrolled up
- Set scrolling state in model code (as opposed to view)
2021-06-03 14:16:03 +02:00
JC Brand
ec93e2fff3 Render chat messages loading spinner declaratively
instead of imperatively.

Add new non-persisted UI model for rendering UI changes. Currently only
being used for rendering the spinner
2021-06-03 00:02:33 +02:00
JC Brand
0756af2b30 Refactor chat close methods
- Remove the shared base-class method.
- Trigger `chatBoxClosed` on the model
- Send CSN from the model, not the view
2021-06-02 17:55:52 +02:00
JC Brand
1598640c80 Remove line-breaks from message image markup
We use `white-space: pre-wrap` to render the messages, so line-breaks in
the markup add unnecessary space.
2021-06-01 14:56:43 +02:00
JC Brand
ad53a3c9a1 Message styling fix
Don't parse text that falls within XEP-0372 references ranges for
message styling hints.
2021-05-13 11:20:03 +02:00
JC Brand
2b12f8e257 Use lodash-es everywhere 2021-05-12 12:14:28 +02:00
JC Brand
1fc44b9d8e Turn caps plugin into folder.
Move more test files to plugins
2021-05-11 16:18:34 +02:00
JC Brand
18e3b618b4 Some light chat views refactoring
- Move `showModeratorToolsModal` method from view to utils
- Move `getNicknameRequiredTemplate` method from view to utils
- Move common `close` code to base class
2021-05-07 11:23:52 +02:00
JC Brand
fdc81fa4ea Use .conversejs instead of .converse-root
as the class that designates standalone Converse components.
2021-05-06 12:21:35 +02:00
JC Brand
9c11e0dc32 Use .converse-root class instead of #conversejs id 2021-04-30 17:36:42 +02:00
JC Brand
4bdafb8ea3 Break Sass up into more files
And import where appropriate to allow for custom builds that are still styled properly
2021-04-30 17:36:40 +02:00
Shaun Wu
9ea8653ef7 Upgrade to Webpack 3
Had to make various other changes due to incompatibilities.

- Use the new `lit` package instead of `lit-html` or `lit-element`
- Drop `haunted` since it breaks the rules by specifying `type: module`
  but then doesn't import with file extensions
- Use Sass Dart instead of node-sass (fixes #2445)
- Upgrade Karma
2021-04-30 13:50:50 +02:00
Shaun Wu
1cb2b1f7a9 Adding configurable url history changing 2021-04-29 11:59:28 +02:00
JC Brand
57ccf4c20e Batched writes to IndexedDB
- Update to the latest @converse/skeletor (which uses mergebounce to batch writes)
- Flush storage before logging out
- Flush when reloading the tab
- Create initStorage method
2021-04-28 16:53:50 +02:00
JC Brand
1f7fecab21 Make show_images a prop of converse-chat-mesage-body
That way, when the setting changes and we call `requestUpdate` on
`converse-chat-message`, the body will rerender.
2021-04-26 12:08:16 +02:00
JC Brand
b2445d36d1 Bugfix. pretty_time was undefined 2021-04-23 10:59:50 +02:00
JC Brand
3558936b46 Refactor message component to require less attributes 2021-04-16 13:11:30 +02:00
ubermanu
649e813ee8 Fixes an endless loop when styling code blocks with a bad format 2021-04-16 09:44:40 +02:00
JC Brand
65742d32ec Move icons template to shared folder 2021-03-29 13:16:32 +02:00
JC Brand
ccd60f76c3 Cleanup
- Move top-level functinos to utils files
- Get rid of unused/obsolete overrides
- Only import components there where they're used
- Bump version in package.json
2021-03-26 10:58:51 +01:00
JC Brand
c2a6b09a25 Use converse-rich-text component to render unfurl descriptions 2021-03-24 12:41:17 +01:00
JC Brand
f897596215 Move files around to try and create some consistency and order 2021-03-24 12:41:17 +01:00
JC Brand
7f5a1d205e Rename MessageText to RichText
since it's now used to render more than just messages
2021-03-24 12:41:17 +01:00
JC Brand
b31eaadfab Add option to converse-rich-text for /me messages 2021-03-24 12:41:17 +01:00
JC Brand
bd8a57e0c3 Use the converse-rich-text component to render the topic 2021-03-24 12:41:17 +01:00
JC Brand
65efe5ad43 Let the message body be rendered with the rich-text directive 2021-03-24 11:27:19 +01:00
JC Brand
41d82a54b6 Create rich text component and directive 2021-03-24 11:13:11 +01:00
JC Brand
1fd3e3676a Update the MesageText class to not require a Model object
This allows us to use it to transform any piece of text and not just
text from a chat message.
2021-03-24 10:42:22 +01:00
JC Brand
b28594a976 Import toolbar styles in the component 2021-03-19 15:10:57 +01:00
JC Brand
fde371b90f Remove apparently unnecessary tooltip bootstrap scss 2021-03-19 12:47:32 +01:00
JC Brand
453b993cfb Split up CSS into more files 2021-03-19 12:47:32 +01:00
JC Brand
90ab412628 Move fullscreen styles into relevant plugin 2021-03-19 12:47:32 +01:00
JC Brand
1b91d9b69e Move roster, bookmarks and minimize styles to plugin folders 2021-03-19 11:53:22 +01:00
JC Brand
79a4006a61 Move headlines scss to plugin folder 2021-03-19 11:48:48 +01:00
JC Brand
73c4c21533 Move MUC styles to plugin folder 2021-03-19 11:47:13 +01:00
JC Brand
b189fc83b0 Move chatbox styles to plugin folder 2021-03-19 11:43:16 +01:00
JC Brand
005cf4dc96 Move controlbox styles to plugin folder 2021-03-19 11:36:19 +01:00
JC Brand
f805f0d1ef Move sass files into src and closer to the relevant components 2021-03-19 11:28:35 +01:00
JC Brand
e896361b2f Remove the No message history available message
It's misleading because it shows before MAM has finished (which also causes
flashing)

Showing it only after MAM has finished would be preferable but too much
work, so I'm removing it for now.
2021-03-17 12:36:56 +01:00
JC Brand
bd452a04e8 Fix more mangled i18n strings 2021-03-17 10:12:55 +01:00
JC Brand
001fe37059 Fix i18n message
Got mangled via search-and-replace
2021-03-17 09:48:16 +01:00
JC Brand
69a9adb459 Rename and move some files around 2021-03-12 09:58:17 +01:00
JC Brand
4646956922 Don't render hidden chats 2021-03-11 13:05:03 +01:00
JC Brand
4ca30c4b93 Create converse-muc-chatarea component 2021-03-11 10:26:09 +01:00
JC Brand
d3ab68011a Split core.js file into multiple smaller ones
Update storing of app settings. Store settings in a closured
`app_settings` object inside `@converse/headless/shared/settings`

Remove the `_converse.settings` object.
2021-03-09 14:11:28 +01:00
JC Brand
68d461bd42 Add the ability to show/hide unfurls 2021-03-05 18:42:14 +01:00
JC Brand
698ad90c43 Move insertIntoTextarea methods from view to bottom panel component
That way we further decouple the various components and make it easier
to use them indepenent of one another.
2021-03-04 15:53:04 +01:00
JC Brand
a778f3866a Show URL in unfurl card 2021-03-02 13:50:40 +01:00
JC Brand
c90b7a9691 Only render unfurl images from allowed domains
as specified by `show_images_inline` when it's set to an array of
domains.
2021-03-02 11:03:35 +01:00
JC Brand
8dd8c7d1dd Don't show unfurl card if there's nothing to show 2021-03-02 11:03:35 +01:00
JC Brand
68ca5dd279 Unfurl: JID wasn't defined 2021-03-01 22:21:45 +01:00
JC Brand
f4bcfa5c44 Move various template files into plugin folders 2021-02-22 20:37:13 +01:00
JC Brand
16edc2954d Add support for rendering unfurls via Prosody's mod_ogp
See here: https://modules.prosody.im/mod_ogp.html
2021-02-22 17:55:20 +01:00
JC Brand
a8a2bb4681 Componentize the chat headings 2021-02-12 14:32:55 +01:00
JC Brand
9ce4092a7c Turn the bottom panel into a custom element 2021-02-12 14:32:55 +01:00
JC Brand
95c14e5a26 Don't pass chatview object to converse-chat-content
and any child components.

This makes it easier to use these components independently of one
another and the overarching view.
2021-02-09 16:40:00 +01:00
JC Brand
f81292e955 Bugfix in window state change handler 2021-02-09 15:48:21 +01:00
JC Brand
790caf9f5a Render converse-chat-content declaratively 2021-02-09 15:48:21 +01:00
JC Brand
b8d710800a Move more methods from ChatBoxView to shared base class 2021-02-09 15:48:21 +01:00
JC Brand
704b50fb3e Turn HeadlinesBox into a custom element 2021-02-09 15:48:21 +01:00
JC Brand
a029ece808 Controlbox related bugfixes 2021-02-09 15:48:21 +01:00
JC Brand
a59920e6e5 Turn XMPPStatusView into the converse-user-profile component 2021-02-09 15:48:21 +01:00
JC Brand
1949356ede Work on turning chat views into custom elements
The eventual goal is to avoid UI-related stanza processing if the relevant chats
aren't in the DOM.

With the current architecture, chatboxes are created (and the stanzas
related to them processed) even if `#conversejs` isn't in the DOM.

* Initial work on making controlbox an element
* Create a shared base class
* Ceate ChatBoxViews proxy
* Update sass now that certain classes are moved to converse-chats element
2021-02-09 15:48:21 +01:00
JC Brand
1a88aff179 Decided to still collapse newlines...
and to solve the offset issue by replacing excessive newlines with
the zero-width space unicode character.
2021-01-18 12:18:33 +01:00
JC Brand
61bb0cfab7 Don't collapse newlines.
This causes index offset issues with any rich elements in the message.

We could try to fix the offsets, or alternatively replace the collapsed
newlines with spaces (to maintain the original offsets), but I don't
think it's worth the effort since I'm not sure that it's a good idea to
collapse newlines in the first place.
2021-01-18 11:27:01 +01:00
JC Brand
794a709690 Move converse-rosterview plugin into folder 2020-12-28 19:46:40 +01:00
JC Brand
23a4a20dc2 Bugfixes
Mesage versions modal didn't open on subsequent clicks
Autocomplete: avoid undefined error
2020-12-10 14:12:20 +01:00
JC Brand
bb3f52d2f2 Move the autocomplete code into ./shared
And remove it as a plugin.
2020-12-10 11:17:57 +01:00
JC Brand
9174be8ff3 Styling: Use only "local" offset for mentions 2020-12-09 18:09:38 +01:00
JC Brand
af2df84fc1 Styling: Fix offsetting of mentions mixed in with styles 2020-12-09 18:05:08 +01:00
JC Brand
8572c86941 Styling: Trim leading whitespace inside blockquote
As demanded by XEP-0393
2020-12-09 15:11:54 +01:00
JC Brand
58586ab2e4 Styling: quotes should start on newlines
And when nested, have no spaces between them.
2020-12-09 14:19:31 +01:00
JC Brand
240fab99f4 Split chatboxviews/index.js into multiple files 2020-12-08 10:16:34 +01:00
JC Brand
824bf2ed30 Move all plugin files to ./plugin folders
Rename converse-core.js to core.js
2020-12-03 16:41:15 +01:00
JC Brand
01ee942920 Styling fixes
* Calculate proper length for :geo URI matches
* Don't strip out line-break after quotes, instead use CSS `display: inline-block`
2020-12-01 10:21:21 +01:00
JC Brand
f86efca9a6 autocomplete: Use regex instead of hardcoded list...
to determine valid characters to form a boundary before an `@` mention

Also fixed an issue with mentions looking like they're part of URLs, by
first processing mentions separately.
2020-11-27 22:06:22 +01:00
JC Brand
35db01d316 Styling: Take offset into consideration when adding templates 2020-11-27 11:12:19 +01:00
JC Brand
fb316ff010 Styling: Remove line-break at end of blockquote
since the DOM element breaks the line already
2020-11-25 16:12:00 +01:00
JC Brand
d2074afe9a Document breaking changes to message transformation events 2020-11-25 14:53:27 +01:00
JC Brand
f9650f33be Add support for XEP-0393 message styling
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
2020-11-24 16:06:48 +01:00