-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 branch to main #3994
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`Quill.getText()` is allowed to be called with no arguments, since it [defaults][1] to returning the whole document. However, the overload declarations require arguments, resulting in a compilation error when trying to call `getText()` with no arguments: ``` (method) Quill.getText(range: { index: number; length: number; }): string (+1 overload) Expected 1-2 arguments, but got 0.ts(2554) ``` This change makes all the arguments in the overloads optional to match the implementation. [1]: https://github.com/quilljs/quill/blob/d2f689fb4744cdada96c632a8bccf6d476932d7b/core/quill.ts#L501-L502
The `Block` blot inherits from `parchment`'s `ParentBlot`, where the `ref` argument [is optional][1]. This change updates the `Block` signature to match its parent. [1]: https://github.com/quilljs/parchment/blob/634e50f4d73a3351952250146510332dbc0af961/src/blot/abstract/parent.ts#L238
`Quill.getFormat()` is allowed to be called with no arguments, since it [defaults][1] to just getting the current selection. However, the overload declarations require arguments, resulting in a compilation error when trying to call `getFormat()` with no arguments: ``` (method) Quill.getFormat(index: number, length?: number): any (+1 overload) Expected 1-2 arguments, but got 0.ts(2554) ``` This change makes all the arguments in the overloads optional to match the implementation. [1]: https://github.com/quilljs/quill/blob/d2f689fb4744cdada96c632a8bccf6d476932d7b/core/quill.ts#L435
`Clipboard.dangerouslyPasteHTML()` is allowed to be called without an index as its first argument. At the moment, doing this results in a compilation error: ``` (method) Clipboard.dangerouslyPasteHTML(index: number, html: string, source?: EmitterSource): void Expected 2-3 arguments, but got 1.ts(2554) ``` This change adds the overload to allow this.
Consider a document with a single piece of bold text. As a `Delta`, this would be represented as: ```js const doc = new Delta().insert('a', {bold: true}) ``` Now consider the following `Delta` being applied: ```js const delta = new Delta().insert('\n1') ``` The above `Delta` will: - prepend the document with a newline - follow that newline with an **unformatted** string Indeed, using `doc.compose(delta)` yields: ```js const result = new Delta() .insert('\n1') .insert('a', {bold: true}) ``` However, the same result is not reached when using the Quill `editor.applyDelta()`, which instead results in bold formatting being incorrectly applied to our unformatted string: ```js const badResult = new Delta() .insert('\n') .insert('1a', {bold: true}) ``` This happens because Quill does an insert of the whole insertion, but doesn't handle the line splitting. This change fixes this issue by splitting ops on newlines, and handling them separately, which applies the correct formatting.
At the moment we try to reassign `lines: Blot` and `leaves: Blot` to `lines: {}` and `leaves: {}`. This change just creates new variables, so that we don't have these compiler errors.
At the moment, since `@ts-expect-error` [doesn't apply][1] to type definitions, we get a downstream compilation error: ``` TS2416: Property 'addModule' in type 'BaseTheme' is not assignable to the same property in base type 'Theme'. Type '(name: string) => unknown' is not assignable to type '{ (name: "clipboard"): Clipboard; (name: "keyboard"): Keyboard; (name: "uploader"): Uploader; (name: "history"): History; (name: "selection"): Selection; (name: string): unknown; }'. Type '{}' is missing the following properties from type 'Clipboard': matchers, addMatcher, convert, convertHTML, and 8 more. 10 addModule(name: string): unknown; ``` This change updates the `Base` class to have the same signature as for `addModule()` as its parent class. [1]: microsoft/TypeScript#38628
At the moment, the `BaseTooltip.edit()` signature has type: ```ts declare class BaseTooltip extends Tooltip { edit(mode?: string, preview?: null): void; } ``` This change tweaks the signature to be more accurate: ```ts declare class BaseTooltip extends Tooltip { edit(mode?: string, preview?: string | null): void; } ```
At the moment, if you paste the following HTML, the newline between the `<span>` elements is incorrectly discarded. ```html <span>foo</span> <span>bar</span> ``` This will currently insert `foobar` into Quill, when we'd expect `foo bar`, since newlines should [treated as spaces][1] between inline elements (such as `<span>`). This change updates the `matchText()` clipboard matcher to check if the text node is between inline elements or not before early-returning. [1]: https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
...as Quill 2.0 is in RC state.