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

Tasks are correctly represented by Deltas using attributes #1

Closed
wants to merge 2 commits into from

Conversation

CJEnright
Copy link

no more dummy updates and history should work as well.

no more dummy updates and history should work as well
@koffeinfrei
Copy link
Owner

Awesome thanks! Will have a look.

if (checkedAttributor.value(e.target))
checkedAttributor.remove(e.target);
else
checkedAttributor.add(e.target, true)
Copy link
Owner

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');
Copy link
Owner

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
Copy link
Owner

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.

Copy link
Author

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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a ;

@koffeinfrei
Copy link
Owner

Works fine!

except for the checked-true thing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants