Skip to content

Commit

Permalink
Fix regression in RTA: heading with a single level does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Sep 16, 2024
1 parent a3d4f7b commit 8b79c3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changes

1.5.3
* Fix: Regression in `RichtextArea`, heading with a single level does not work.

1.5.2
* Fix naming issue in interactive docs, preventing the dialog not to close.
* Fix in RichtextArea: Dropdown menu did not show up at the right position.
Expand Down
9 changes: 8 additions & 1 deletion client/django-formset/RichtextArea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,14 @@ namespace controls {
protected toggleItem(event: MouseEvent, editor: Editor) {
let element = event.target instanceof Element ? event.target : null;
while (element) {
if (element.role === 'menuitem') {
if (this.dropdownItems.length === 0) {
if (element === this.button) {
const level = this.extractLevel(element);
editor.chain().focus().setHeading({level: level}).run();
this.activate(editor);
break;
}
} else if (element.role === 'menuitem') {
const level = this.extractLevel(element);
editor.chain().focus().setHeading({level: level}).run();
this.activate(editor);
Expand Down

0 comments on commit 8b79c3d

Please sign in to comment.