Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to main #4008

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/quill/src/modules/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ class Toolbar extends Module<ToolbarProps> {
this.attach(input);
},
);
this.quill.on(Quill.events.EDITOR_CHANGE, (type, range) => {
if (type === Quill.events.SELECTION_CHANGE) {
this.update(range as Range);
}
});
this.quill.on(Quill.events.SCROLL_OPTIMIZE, () => {
this.quill.on(Quill.events.EDITOR_CHANGE, () => {
const [range] = this.quill.selection.getRange(); // quill.getSelection triggers update
this.update(range);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/quill/src/themes/bubble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class BubbleTooltip extends BaseTooltip {
}

class BubbleTheme extends BaseTheme {
tooltip: BubbleTooltip;

constructor(quill: Quill, options: ThemeOptions) {
if (
options.modules.toolbar != null &&
Expand Down
4 changes: 2 additions & 2 deletions packages/quill/test/unit/core/selection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Italic from '../../../src/formats/italic';
import Strike from '../../../src/formats/strike';
import { ColorStyle } from '../../../src/formats/color';
import { BackgroundStyle } from '../../../src/formats/background';
import { FontClass } from '../../../src/formats/font';
import { SizeClass } from '../../../src/formats/size';

const createSelection = (html: string, container = document.body) => {
const scroll = createScroll(
Expand All @@ -25,7 +25,7 @@ const createSelection = (html: string, container = document.body) => {
Link,
ColorStyle,
BackgroundStyle,
FontClass,
SizeClass,
]),
container,
);
Expand Down
9 changes: 9 additions & 0 deletions packages/quill/test/unit/modules/toolbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,14 @@
expect(centerButton.getAttribute('aria-pressed')).toBe('false');
expect(leftButton.getAttribute('aria-pressed')).toBe('false');
});

Check failure on line 239 in packages/quill/test/unit/modules/toolbar.spec.ts

View workflow job for this annotation

GitHub Actions / test / Unit Tests (chromium)

Unexpected function expression

Check failure on line 239 in packages/quill/test/unit/modules/toolbar.spec.ts

View workflow job for this annotation

GitHub Actions / test / Unit Tests (webkit)

Unexpected function expression

Check failure on line 239 in packages/quill/test/unit/modules/toolbar.spec.ts

View workflow job for this annotation

GitHub Actions / test / Unit Tests (firefox)

Unexpected function expression
test('update on format', function () {
const { container, quill } = setup();
const boldButton = container?.parentNode?.querySelector('button.ql-bold');
quill.setSelection(1, 2);
expect(boldButton?.classList.contains('ql-active')).toBe(false);
quill.format('bold', true, 'user');
expect(boldButton?.classList.contains('ql-active')).toBe(true);
});
});
});
Loading