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 from develop branch #4009

Merged
merged 4 commits into from
Feb 13, 2024
Merged
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
32 changes: 17 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
# [Unreleased]

- Fix toolbar button state not updated in some cases
- Narrower `BubbleTheme.tooltip` type

# 2.0.0-rc.1

- Remove unnecessary lodash usages.
- Fix toolbar button state not updated in some cases
- Remove unnecessary lodash usages

# 2.0.0-rc.0

- **Clipboard** Convert newlines between inline elements to a space.
- **Clipboard** Avoid generating unsupported formats on paste.
- **Clipboard** Improve support for pasting from Google Docs and Microsoft Word.
- **Clipboard** Ignore whitespace between pasted empty paragraphs.
- **Syntax** Support highlight.js v10 and v11.
- **Clipboard** Convert newlines between inline elements to a space
- **Clipboard** Avoid generating unsupported formats on paste
- **Clipboard** Improve support for pasting from Google Docs and Microsoft Word
- **Clipboard** Ignore whitespace between pasted empty paragraphs
- **Syntax** Support highlight.js v10 and v11

# 2.0.0-beta.2

- Fix IME not working correctly in Safari.
- **Clipboard** Support paste as plain text.
- Fix `Quill.getText()` not respecting `length` parameter.
- **History** Fix redo shortcut not working on Linux and Windows.
- Fix IME not working correctly in Safari
- **Clipboard** Support paste as plain text
- Fix `Quill.getText()` not respecting `length` parameter
- **History** Fix redo shortcut not working on Linux and Windows

# 2.0.0-beta.1

- Fix syntax label from "Javascript" to "JavaScript".
- Fix typing errors for emitter.
- Inline SVG images for easier bundler setup.
- Improve typing for Registry.
- Fix syntax label from "Javascript" to "JavaScript"
- Fix typing errors for emitter
- Inline SVG images for easier bundler setup
- Improve typing for Registry

# 2.0.0-beta.0

Expand Down
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 @@ -235,5 +235,14 @@ describe('Toolbar', () => {
expect(centerButton.getAttribute('aria-pressed')).toBe('false');
expect(leftButton.getAttribute('aria-pressed')).toBe('false');
});

test('update on format', () => {
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