Skip to content

Commit

Permalink
Add support for v1 list attributes (#4082)
Browse files Browse the repository at this point in the history
Co-authored-by: Zihua Li <[email protected]>
  • Loading branch information
justinbhopper and luin authored Mar 26, 2024
1 parent fecbc6f commit d5ac335
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# [Unreleased]

- **Clipboard** Add support for Quill v1 list attributes
- Fix overload declarations for `quill.formatText()` and other methods

# 2.0.0-rc.4
Expand Down
10 changes: 8 additions & 2 deletions packages/quill/src/modules/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,14 @@ function matchIndent(node: Node, delta: Delta, scroll: ScrollBlot) {
}

function matchList(node: Node, delta: Delta, scroll: ScrollBlot) {
// @ts-expect-error
const list = node.tagName === 'OL' ? 'ordered' : 'bullet';
const element = node as Element;
let list = element.tagName === 'OL' ? 'ordered' : 'bullet';

const checkedAttr = element.getAttribute('data-checked');
if (checkedAttr) {
list = checkedAttr === 'true' ? 'checked' : 'unchecked';
}

return applyFormat(delta, 'list', list, scroll);
}

Expand Down

0 comments on commit d5ac335

Please sign in to comment.