-
Notifications
You must be signed in to change notification settings - Fork 10
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
Tasks are correctly represented by Deltas using attributes #1
Conversation
no more dummy updates and history should work as well
Awesome thanks! Will have a look. |
if (checkedAttributor.value(e.target)) | ||
checkedAttributor.remove(e.target); | ||
else | ||
checkedAttributor.add(e.target, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add parenthesis.
@@ -4,6 +4,10 @@ const Parchment = Quill.import('parchment'); | |||
const Module = Quill.import('core/module'); | |||
const Delta = Quill.import('delta'); | |||
|
|||
//create and register a new class Attributor for checked tasks | |||
var checkedAttributor = new Parchment.Attributor.Class('checked', 'checked'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var
-> let
@@ -15,8 +15,8 @@ | |||
cursor: default | |||
pointer-events: all | |||
|
|||
.ql-editor ul.task-list > li.checked | |||
.ql-editor ul.task-list > li.checked-true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what parchment produces? Is it possible to retain the class just as checked
?
Otherwise this is a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the way the Attributor is set now, that's what parchment creates. I think it would be possible to have it set the class to only "checked" but then the task's Delta would be represented weirdly (it wouldn't say whether or not the task's checked). At least, that's how I interpreted parchment's kinda confusing docs.
@@ -17,7 +21,7 @@ class TaskListItem extends ListItem { | |||
// when inserting a new list item, remove the 'checked' css class | |||
clone() { | |||
const clone = super.clone(); | |||
clone.domNode.classList.remove('checked'); | |||
checkedAttributor.remove(clone.domNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a ;
Works fine! |
except for the checked-true thing
no more dummy updates and history should work as well.