Commit Graph

58963 Commits

Author SHA1 Message Date
5e8778ecf7 UX: Use core description of popular components when there's no description (#32286)
When an installed component doesn't have a description in its locale
files, we should fallback to the description that core has for the
component if it's one of the popular components that core features.
2025-04-15 16:07:22 +03:00
71b31604b5 PERF: Implement infinite scrolling for new components page (#32291)
On sites with many components, serializing and rendering all components
in one-go on a page can take quite a bit of time. The new components
listing page that was introduced in
https://github.com/discourse/discourse/pull/32164 currently loads all
components in one-go, so this commit implements infinite-scrolling
pagination for the page to address this performance issue for sites with
many components.
2025-04-15 16:05:10 +03:00
996a3493fe PERF: Prevent N+1 queries when loading theme/component descriptions (#32305)
Theme/component description is fetched via the `locale_fields` and
`theme_translation_overrides` associations on the `Theme` model. We're
currently not preloading these associations when serializing
themes/components, which causes an N+1 performance issue when accessing
the themes/components listing pages.
2025-04-15 16:02:41 +03:00
59ec86933a DEV: DMultiSelect (#32240)
The `DMultiSelect` component provides a customizable multi-select
dropdown with support for both mouse and keyboard interactions.

![Screenshot 2025-04-10 at 15 40
26](https://github.com/user-attachments/assets/277619db-6e56-4beb-8eda-f76360cd2ad8)

### Parameters

#### `@loadFn` (required)
An async function that returns the data to populate the dropdown
options.

```javascript
const loadFn = async () => {
  return [
    { id: 1, name: "Option 1" },
    { id: 2, name: "Option 2" },
  ];
};
```

#### `@compareFn`

A function used to determine equality between items. This is
particularly useful when working with complex objects. By default, `id`
will be used.

```javascript
const compareFn = (a, b) => {
  return a.name === b.name;
};
```

#### `@selection`
An array of pre-selected items that will be displayed as selected when
the component renders.

```javascript
const selection = [
  { id: 1, name: "Option 1" },
  { id: 2, name: "Option 2" },
];
```

#### `@label`
Text label displayed in the trigger element when no items are selected.

```javascript
@label="Select options"
```

### Named Blocks

#### :selection
Block for customizing how selected items appear in the trigger.

```javascript
<:selection as |result|>{{result.name}}</:selection>
```

#### :result
Block for customizing how items appear in the dropdown list.

```javascript
<:result as |result|>{{result.name}}</:result>
```

#### :result
Block for customizing how errors appear in the component.

```javascript
<:error as |error|>{{error}}</:error>
```

### Example Usage

```javascript
<DMultiSelect
  @loadFn={{this.loadOptions}}
  @selection={{this.selectedItems}}
  @compareFn={{this.compareItems}}
  @label="Select options">
  <:selection as |result|>{{result.name}}</:selection>
  <:result as |result|>{{result.name}}</:result>
  <:error as |error|>{{error}}</:error>
</DMultiSelect>
```

Co-Authored-By: Jordan Vidrine
<30537603+jordanvidrine@users.noreply.github.com>

---------

Co-authored-by: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com>
2025-04-15 14:56:57 +02:00
4510d1ad46 DEV: Update site spec for unregistering modifiers (#32310)
Adding some changes to site.rb, and seeing this error:

```
     Failure/Error: raise "Clearing modifiers during a plugin spec run will affect all future specs. Use unregister_modifier instead."
```

This is a standalone PR to update the usage here so that my future PR
won't be affected.
2025-04-15 20:07:48 +08:00
c97425d22b Build(deps): Bump prosemirror-commands from 1.7.0 to 1.7.1 in the prosemirror group (#32272)
Bumps the prosemirror group with 1 update:
[prosemirror-commands](https://github.com/prosemirror/prosemirror-commands).


Updates `prosemirror-commands` from 1.7.0 to 1.7.1
-
[Changelog](https://github.com/ProseMirror/prosemirror-commands/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/prosemirror/prosemirror-commands/compare/1.7.0...1.7.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 13:44:11 +02:00
248e9a341f Build(deps-dev): Bump lefthook from 1.11.8 to 1.11.10 (#32298)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.11.8
to 1.11.10.
- [Release notes](https://github.com/evilmartians/lefthook/releases)
-
[Changelog](https://github.com/evilmartians/lefthook/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/evilmartians/lefthook/compare/v1.11.8...v1.11.10)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 13:37:40 +02:00
59a79de00e Build(deps-dev): Bump @swc/core from 1.11.18 to 1.11.21 (#32299)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.18 to
1.11.21.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/swc-project/swc/compare/v1.11.18...v1.11.21)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 12:19:31 +02:00
ccf8ed5462 DEV: Fix linting (#32308) 2025-04-15 16:24:21 +08:00
9fa441cf19 Build(deps): Bump @faker-js/faker from 9.6.0 to 9.7.0 (#32275)
Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 9.6.0 to
9.7.0.
- [Release notes](https://github.com/faker-js/faker/releases)
- [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md)
- [Commits](https://github.com/faker-js/faker/compare/v9.6.0...v9.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 17:14:22 +10:00
31877f646f DEV: Add toggleTagInfo to discovery-list-controls-above outlet (#32302) 2025-04-15 16:43:54 +10:00
e3c37f3f0b Add a plugin outlet to the login splash screen (#32271)
Adds a plugin outlet below the login buttons in the login-required
splash screen.

Use case: adding a custom footer to the splash screen with links to tos
and privacy policy.
2025-04-15 13:55:23 +08:00
cdd5fa5b1a Build(deps): Bump csv from 3.3.3 to 3.3.4 (#32276)
Bumps [csv](https://github.com/ruby/csv) from 3.3.3 to 3.3.4.
- [Release notes](https://github.com/ruby/csv/releases)
- [Changelog](https://github.com/ruby/csv/blob/main/NEWS.md)
- [Commits](https://github.com/ruby/csv/compare/v3.3.3...v3.3.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 13:54:09 +08:00
7cc46da442 Build(deps-dev): Bump rubocop-ast from 1.44.0 to 1.44.1 (#32277)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.44.0
to 1.44.1.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
-
[Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop-ast/compare/v1.44.0...v1.44.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 13:53:50 +08:00
f21b0fee14 Build(deps): Bump parallel from 1.26.3 to 1.27.0 (#32301)
Bumps [parallel](https://github.com/grosser/parallel) from 1.26.3 to
1.27.0.
-
[Commits](https://github.com/grosser/parallel/compare/v1.26.3...v1.27.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 13:53:27 +08:00
fc6aaa3e49 DEV: Wizard step tweaks (#32304)
This makes two tweaks to the setup wizard:

1. Move the branding (site logo) step to after styling (look & feel).
2. Remove the corporate (your organization) step.
2025-04-15 13:53:01 +08:00
735bef9ea0 UX: Remove Ctrl+F search shortcut (#32281)
This commit removes the Ctrl+F search shortcut, which hijacks the
browser search shortcut in Discourse. We are doing this because there
has been many years of complaints around this behaviour, and now that
we have the new header search it has become even more annoying.

We originally added this because we lazy load posts in a topic, and it
might not have been immediately clear to users that they are not
searching
all the posts in the topic when pressing Ctrl+F. However, that was 10+
years
ago, most people are very familiar with lazy loading now, it doesn't
make sense
to keep this additional hijack for this one topic use case.

Search is still accessible by pressing the `/` shortcut.
2025-04-15 15:14:54 +10:00
7a6006f7aa FIX: Escape regex symbols when replaceText is called for ProseMirror (#32280)
When we do replaceText in the ProseMirror TextManipulation lib,
we are creating a regex for the provided markdown. However this markdown
can have things like * (which is valid for a markdown list), which also
doubles as a regex symbol. We can escape the markdown provided to
the regex first to fix the issue.
2025-04-15 14:04:33 +10:00
077649fafd FIX: bugs with refresh page after save fonts (#32282)
It takes a moment to sync site settings. Therefore, it is better to pass
new values to `refreshPage` function.

Also, it was not working for some fonts like `JetBrains Mono`.
SiteSetting key is `jet_brains_mono` but font family value should be
`JetBrains Mono`.
2025-04-15 12:02:28 +08:00
8b9da12bf2 FIX: Wizard logo step JS error (#32303)
`PreviewBase#drawPills` expects a `homepageStyle` option, but on the logo wizard page we weren't passing any. In this change we pass one of the possible values: `hot`.
2025-04-15 10:54:46 +08:00
2cd82abbe3 Build(deps-dev): Bump parser from 3.3.7.4 to 3.3.8.0 (#32300)
Bumps [parser](https://github.com/whitequark/parser) from 3.3.7.4 to
3.3.8.0.
-
[Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/whitequark/parser/compare/v3.3.7.4...v3.3.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-15 01:17:47 +02:00
c78a79bbf5 UX: keep content on rich editor footnote inputrule (#32296)
Instead of using the matched string, this PR uses the actual sliced
content from the ProseMirror document range as the content when creating
the footnote node.
2025-04-14 19:36:18 -03:00
79c642a446 UX: Quick mobile fix for quote styles (#32297) 2025-04-14 17:28:03 -05:00
d8d341ebf6 FIX: remove newline from rich editor's pasted img title/alt (#32295)
New lines on `alt`/`title` embedded media are not allowed, causing an
invalid serialized Markdown which is not supposed to contain new lines
for these attributes.

This PR removes them during HTML parsing – we are not creating this new
line scenario otherwise.
2025-04-14 19:24:21 -03:00
1da41e62cc UX: Use mixin for quote border radius (#32294) 2025-04-14 16:33:21 -05:00
fd6eacd93c UX: Border radius prose-mirror select node (#32292) 2025-04-14 15:10:23 -05:00
12f05181c7 FIX: Add helpers for title and content for application.html.erb and crawler.html.erb (#32290)
Previously, there was only those helpers in `crawler.html.erb` as we
added it in https://github.com/discourse/discourse/pull/32259

However, to keep it consistent, we need to add it in
`application.html.erb` as well.
2025-04-14 16:34:23 -03:00
dcef061651 UX: Remove z-index (#32289) 2025-04-14 12:53:46 -05:00
224d6f85ec FIX: rich editor insertBlock implementation (#32288)
Our `insertBlock` implementation was only taking the `firstChild` into
consideration.

We didn't notice this before because there's only one use of this in
core, quoting from a post, which has a single child.

This fix is necessary to support the `insert-block` call that the
https://github.com/discourse/discourse-templates plugin makes when
inserting a template.
2025-04-14 14:27:15 -03:00
fe20b52180 UX: keep the whisper editor font/color style consistent between editors (#32287)
Adds the whisper styling to the Markdown editor as well, keeping it
consistent with the preview and the rich editor.
2025-04-14 14:27:05 -03:00
29ca0ae0b1 FEATURE: add footnote (plugin) rich editor extension (#31719)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds a `footnote` node, parser, `^[inline]` input rule, toolbar button
item, and serializer.

Also adds a NodeView with an internal ProseMirror editor to edit the
footnote content.
2025-04-14 14:25:36 -03:00
a0a5b2889f DEV: replace rich editor input rules regex lookbehind (#31909)
Refactors the rich editor input rules matches that rely on a lookbehind,
it breaks on iOS <= 16.3.
2025-04-14 14:25:17 -03:00
381f6e64e8 FIX: click handler position on rich editor details node (#32268)
`pos` is the exact position of the click in the entire document

`nodePos` is the position of the clicked node itself

The idea is that we want the click to be the first position **within the
node**.

The previous code was checking for the first 2 positions of the entire
document.

I'd love to add a test for this, but it's very tricky.
2025-04-14 14:06:54 -03:00
b9cef22c2f UX: rich editor html_block without escaping and avoiding \n\n (#32269)
When using a html block within the rich editor (currently only possible
after parsing it from Markdown), it would get serialized with the
default escape=true processing.

Additionally, html blocks are a continuous block, if a `\n\n` is seen
during cooking the block is closed, so we make sure at most one
continuous `\n` is seen in the html block node on the ProseMirror doc.

EDIT: It turns out, it's not so simple. I'm merging this as is, but it's
important to link the actual behavior to close a paragraph from
markdown-it:


0fe7ccb4b7/lib/rules_block/html_block.mjs (L6-L17)
2025-04-14 13:53:26 -03:00
f03a6f3557 UX: Onebox & quote border radius (#32242) 2025-04-14 10:55:51 -05:00
f7d95a8fad DEV: [gjs-codemod] add codemod commit to git-blame-ignore-revs 2025-04-14 15:36:37 +01:00
7b2b08cf89 DEV: [gjs-codemod] Convert automation/styleguide/other to gjs
Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-04-14 15:36:16 +01:00
3462113bd4 DEV: [gjs-codemod] merge js and hbs 2025-04-14 15:27:52 +01:00
1eb953ca57 DEV: [gjs-codemod] renamed hbs to gjs 2025-04-14 15:27:47 +01:00
3ca507e008 DEV: [gjs-codemod] renamed js to gjs 2025-04-14 15:27:45 +01:00
b3f0c85d82 UX: avoid leading space when serializing some nodes from rich editor (#32270)
On some cases during serialization (like with headings), the previous
node is still "open" when it's the "turn" of the node we're serializing.

In this case, checking the boundaries before writing was getting the
wrong state, because the `write` call uses `flushClose()`, which makes
sure we have the newlines from closing the previous node.

This would create scenarios like (notice the space before each node
below the heading)

```markdown
# Heading

 🎉

# Heading

 @mention

# Heading

  #hashtag
```

This PR makes sure we call flushClose() before checking boundaries, and
adds tests for that.
2025-04-14 10:57:34 -03:00
d1ce861a6b DEV: Add usage example for anon cache cookie registration (#32283)
Adding an example for the plugin api `register_anonymous_cache_key`.
2025-04-14 21:03:05 +08:00
f0057c7353 DEV: Drop legacy topic-list and raw-handlebars compilation system (#32081) 2025-04-14 10:42:40 +01:00
13cb472ec8 FIX: Refresh disabled state when switching between site texts (#32262)
Repro steps:

1. Go to `/admin/customize/site_texts`
2. Click edit on any translation
3. Go back by clicking on "Back to search"
4. Click edit on another translation
5. Change the text field in any way

Expected results:

The disabled state on the "Save changes" button is removed and you're
able to click it

Actual results:

The "Save changes" button remains disabled

This happens because the computed property for the button's disabled
state doesn't get re-evaluated when navigating between translation
strings because it doesn't include on the `siteText` property in its
dependent properties, so changing the site text doesn't invalidate the
old value for the disabled state and it always stays the same.

Meta topic:
https://meta.discourse.org/t/i-cant-save-edit-on-site-texts/360990?u=osama
2025-04-14 08:00:08 +03:00
1a10adb089 UX: Add tooltip for markdown toggle shortcut (#32278)
Followup 198dc813750d7a0de98cc94372dea1222b97743b

Indicate the shortcut in the tooltip for the rich/markdown
editor toggle, and also add the control translation for mac
in `translateModKey`
2025-04-14 13:12:52 +10:00
ee035582e2 FIX: Rename branding to logo and fonts (#32264)
Change branding page into logo and fonts.

In addition, icon for email setting and email appearance were changed.
2025-04-14 10:49:47 +08:00
8b5da219d8 UX: header search mobile support (#31711)
## Requirements

Initially defined in
https://meta.discourse.org/t/software-engineer-frontend-ember-js-yuriy-kurant/353612/14?u=yaran.

1. On mobile devices and tablets, users can open the search input field
by tapping the search icon
2. When opened, the search input takes over the entire header area:
    - Users can tap the sliders icon to navigate to the advanced search page
(/search)
    - Users can tap Cancel to close search input
3. After submitting a search, results area will take over the entire
screen:
    - Users can tap the X icon to clear the search term from the input field
    - Users can tap Cancel to close search results area and return to their
previous page (i.e. search area overlays content)

## Implementation

1. When opened, the search input takes over the entire header area:
    - changed panel width from `90vw` to `100vw`
    - on initial render (when search input is empty), search panel hovers over the header section only (doesn't cover main content below)
    - quick tip and recent searches lists are not displayed on mobile view
2. Tap on the sliders icon navigates to the advanced search page
(`/search`)
3. Tap on the **Cancel** button:
    - closes search menu
    - if the search term is present, it is cleared
4. Tap on the left-hand side **Search** icon triggers a topics search

## Dev notes

1. Added `// TODO` questioning `search` service `noResults` default value of `false`
2. Added animation on toggling header search panel (created `delayed-destroy` custom modifier)
3. Extracted in-context search filters into a standalone component `search-menu/active-filters`:
    - mobile: active filters below search input
    - desktop: active filters inside search input
3. Removed unnecessary top padding when search results are empty
4. Added `data-test-` attrs for Ember tests. Benefits:
    - semantically `data-test-` attrs indicate that these parts of the layout are covered with tests
    - decouples selector dependency on `id/class` names for testing purposes - eliminates risk of broken tests due to `id/class` name changes
2025-04-14 10:27:48 +08:00
198dc81375 FEATURE: Ctrl+M to toggle between rich/markdown editor (#32266) 2025-04-12 09:01:41 -03:00
fdb805d131 UX: only toggle rich editor details on caret click (#32267) 2025-04-12 09:01:20 -03:00
bc070dcbe3 FIX: avoid double base path on push notification (#32228)
Our service worker concatenates `baseUrl` with `url` coming from the
payload:


e8f4433872/app/views/static/service-worker.js.erb (L96)

This PRs strips the base path before sending `url` to the push
notification to avoid having a URL with the base path duplicated,
causing a 404.
2025-04-12 08:16:53 +10:00