discourse/plugins/spoiler-alert/test/javascripts
Renato Atilio e8aeb272bb
UX: improvements to rich editor spoiler (#34149)
Adds `commands` and `state` keys to the `RichEditorExtension` and uses
them for the spoiler toolbar item, so it shows the current state when
inside a spoiler node, and toggles the state when triggered.

Improves the `keymap` key chaining mechanism to also include the base
keymap as part of the chain, so custom commands can be triggered before
getting to the base keymap.

Extends the ENTER key handling with a different behavior for inline
nodes such as `[spoiler]` or `<kbd>` (inline spoiler and inline html):
- if at the start of a node, moves the node to a paragraph below
- if in the middle of the node, splits it but strips the node from the
second half, keeping it "unstyled"
- if at the end of the node, adds and selects a new paragraph

Appends an empty space (" ") after these inline nodes when they happen
at the end of a block node, allowing to tap/right-arrow out of the
inline node.

Adds a `[spoiler]` input rule which adds an inline spoiler if
mid-sentence or a block spoiler if at the beginning of a text block.

Replaces the "toggle" for revealing the spoiler node, instead of using a
click handler we now track the cursor position and reveal when it's
inside a spoiler node.

Tweaks the `bbcode-block` markdown-it handler to avoid applying a bbcode
block for a scenario like `[spoiler]spoiled[/spoiler] `, with the
trailing space, otherwise our inline node on ProseMirror would be
re-parsed as block on the next markdown-it parsing.

Updates the styling using the default `--d-border-radius`.

<img width="725" height="234" alt="image"
src="https://github.com/user-attachments/assets/6a509fe0-73e8-4f01-98c9-ed96d087ce1c"
/>
2025-08-21 13:56:31 -03:00
..
acceptance DEV: Replace toolbar popup menu with DMenu (#33247) 2025-07-03 09:57:16 +10:00
integration UX: improvements to rich editor spoiler (#34149) 2025-08-21 13:56:31 -03:00
unit/lib Build(deps-dev): Bump the lint group across 1 directory with 4 updates (#33881) 2025-07-28 18:02:41 +02:00