This PR introduces a heading/paragraph dropdown menu for the
composer toolbar, that works for both the new rich text editor, and
the old markdown editor.
Features include:
* Dynamically changing the icon based on the heading level
* Checking the current heading level in the dropdown list
* Applying the same heading level to multiple selections
---------
Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Renato Atilio <renatoat@gmail.com>
JS assets defined under `admin/` in plugins are compiled into a separate
bundle that should be loaded for staff users only, but we currently load
it for all users including normal users and anons. This is wasteful and
unexpected since it could cause errors if an asset in the admin bundle
of a plugin imports a module from the admin bundle in core (which
doesn't get loaded for non-staff users).
Fixes an issue where a URL like this:
```
https://meta.discourse.org/admin/site_settings/category/all_results?filter=discourse connect
```
Would appear to be broken when inserting into the composer via the
hyperlink modal. All we have to do is escape it before inserting,
and unescape before editing it in the modal.
Also in this commit I am renaming the InsertHyperlink modal to
UpsertHyperlink,
since it is used for both inserting and editing links.
We want to deprecate the enabled/disabled toggle for this setting and rely entirely on the presence of a URL.
This change:
- Deprecates and hides the enabled/disabled setting.
- Updates all code paths and tests that rely on the old setting.
- Adds a migration that clears the URL if the enabled/disabled setting is set to false.
This commit replaces the `toolbar-popup-menu-options`, which used
`select-kit` with a new implementation using `dmenu`.
---------
Co-authored-by: Renato Atilio <renato@discourse.org>
Co-authored-by: Martin Brennan <martin@discourse.org>
This fixes an issue where the YouTube thumbnail was huge in a chat
transcript, like in this scenario:
* Share a link to a youtube video in channel A
* See it onebox at a reasonable size
* Grab a link to your message
* Share the link to your message in channel B (e.g. a DM to yourself)
* ❌ See GIANT youtube image
This commit only fixes the issue visually though -- it does not apply
the LazyYoutube decorations that actually embed the video. We can do
this in a followup commit.
Followup 4fe85fdb53d32a4ceda2fffcadbf22d2cbf5de7e
It's not ideal, but currently the admin-sidebar modifies ADMIN_NAV_MAP,
and the admin search data source relies on this modification to include
plugin pages in search.
This commit removes the cloneJSON added in the previous one and adds a
test to ensure this doesn't regress.
A followup commit will do some refactoring to stop this behaviour of
modifying the global ADMIN_NAV_MAP.
Followup fb7fa2902cf685ee9d4002e5448b4817f2dbef98,
prevent opening the chat channel selector with Ctrl/Meta+K
in any inputs except the chat composer, most of the time you
do not want this, but especially in the topic composer.
In that case, you want the link insert modal to open.
- improve the contract a little
- use `model` where possible
- extract message existence logic to a dedicated policy, allowing easier
testing.
- remove unused code
- refactor specs to follow current guidelines/best practices
Fixes an issue where the admin search results was showing
breadcrumbs with a double up of the parent label. For example,
we would show "Plugins > Plugins > AI > Usage" or
"Advanced > Advanced > Backups > Logs".
Also adds a missing translation for the chat incoming webhooks
page.
Chat inline onebox links should open in a new tab with the help of chat
decorators by appending the `target="_blank"` attribute. I suspect this
may have been accidentally broken during a refactor in #31309
The issue was that the element that we pass into the decorator has
changed, meaning that the selector in the decorator would never find
inline links in cooked messages.
Adds the missing `style_type` that is used to decorate hashtags in core.
All chat channels currently use an icon by default, so declaring the
style type on the channel hashtag data source makes this more complete.
This would happen in the following scenario:
- select a tag
- save the automation
- unselect the tag
- save the automation
You would end up with a field having `[]` as value instead of `nil`.
This can cause issues in the logic of scripts and triggers as they might
consider the value as present.
When category lazy loading was disabled, chat channel CSS classes were
not being inserted into the page markup. This meant that they would not
be styled correctly in the markdown editor preview.
The `on_update` callback of triggers is called with previous fields and
new fields, values. However since a recent change:
https://github.com/discourse/discourse/pull/32810 this relationship is
cached and would cause previous fields to equal new fields. This commit
ensures we are refreshing the relationship before calling the
`on_update` callback.
This commit introduces a new property `hasNoPreferredMode` to the
chat state manager, which represents a user who has not purposely
set chat mode to drawer or full page, meaning they have no LocalStorage
value set.
This can be useful for themes to change the chat mode but only
if the user has no preference already.
c.f.
https://meta.discourse.org/t/full-screen-chat-as-default-for-collaboration-setup/369849
When uploading videos in chat using Safari the thumbnail isn't being
displayed
so we need to trick the browser to by adding the timestamp property so
that it
will fetch the metedata the html5 video tag needs to render the
thumbnail.
When your mouse was over the message actions container, not only it
wouldn't scroll your channel, but it would scroll the whole page, this
redirect ensures we correctly scroll the scroller associated with this
message actions container.
Changes the gear icon for the more menu to a circle-plus icon.
Changes the emoji icon to its outline version, to make it less similar
to the circle-plus icon.
Changes the styles (eg. icon sizes) of the toolbar, using a flexbox
instead of a grid, with some tweaks and animations to the toggle switch,
which occupies a smaller width now.
Removes the gray button-bar bottom border.
Moves the Insert Date/Time item to the more menu, and changes its icon
to a clock.
### Before, hovering more menu
<img width="758" alt="image"
src="https://github.com/user-attachments/assets/84d8f5aa-519e-40a2-ba44-d58d7294f6b0"
/>
### After, hovering more menu

---------
Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
For empty chats, a dummy message is created with `id=null` (an
unsaved Ember model).
The timer or placeholder's display is determined by the message ID's presence now (not the `createdAt` prop).
This is fairly minor because usually SVGs aren't focusable, but this
adds `aria-hidden='true'` to all SVGs by default unless either an
`aria-label` or `label` is provided. This gets reported to us in
automated tests from time to time.
So now:
1. SVG: `aria-hidden="true"` (new behavior, safe default when no label
is provided)
2. SVG with `label` param: `aria-hidden="true"` and `sr-only` label is
provided
3. SVG with `aria-label` param: `aria-hidden="false"` and `aria-label`
is provided
Improves the styles for the [details] caret pseudo-element on the rich
editor.
Additionally, having `summary` have no `pointer-events` is important so
Firefox doesn't mess with our caret positioning when clicking it.
The changes are:
- Chat Thread SDK can query up to 500 messages
- If you are above this number, we don't raise an error anymore but we
clamp it to 500
- The controller using this service is forced into the old limit of 50
to avoid abuses
When we first introduced the `discourse-details` plugin, the `<details>`
element was not supported in all browsers, so this `display: none`-based
polyfill had to be used.
Nowadays, there is no need for this. And in fact, the `details[open] >
summary:first-of-type ~ *` selector is showing as our most expensive CSS
selector during repaints.
Removing this `display: none` also means that browser find-in-page will
now be able to correctly find content inside `<details>` in discourse.

1. Changes default email format to llll (eg: Tue, May 8, 2018 2:00 AM)
from 2018-05-08T00:00:00Z UTC which is not nice on the eyes
2. Adds `discourse_local_dates_email_timezone` which allows configuring
default timezone in emails
3. Improved help text on site settings (format / timezone)
---------
Co-authored-by: Gary Pendergast <gary@pento.net>
- For `with_images`, ignore `<img>` tags representing emoji or a quote
avatar
- For `with_links` and `with_uploads`, exclude tags starting with the
letter "a" other than `<a>` (like `<aside>`)
- For `with_code`, the `<pre>` tag wasn't being detected because it was
expecting an extra char before the ">"