Skip to content

Commit

Permalink
dont allow checklist changes when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 8, 2018
1 parent b60b0c2 commit 6b6a4f7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions assets/core.styl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ resets(arr)
.ql-container.ql-disabled
.ql-tooltip
visibility: hidden
.ql-editor
li[data-list="checked"]:before,
li[data-list="unchecked"]:before
pointer-events: none

.ql-container:not(.ql-disabled)
li[data-list=checked],
li[data-list=unchecked]
> .ql-ui
cursor: pointer

.ql-clipboard
left: -100000px
Expand Down Expand Up @@ -78,8 +80,6 @@ resets(arr)
li[data-list=unchecked]
> .ql-ui
color: #777
cursor: pointer
pointer-events: all

li[data-list=bullet] > .ql-ui:before
content: '\2022'
Expand Down
4 changes: 4 additions & 0 deletions blots/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class Scroll extends ScrollBlot {
}
}

isEnabled() {
return this.domNode.getAttribute('contenteditable') === 'true';
}

leaf(index) {
return this.path(index).pop() || [null, -1];
}
Expand Down
2 changes: 1 addition & 1 deletion core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class Quill {
}

isEnabled() {
return !this.container.classList.contains('ql-disabled');
return this.scroll.isEnabled();
}

off(...args) {
Expand Down
1 change: 1 addition & 0 deletions formats/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ListItem extends Block {
super(scroll, domNode);
const ui = domNode.ownerDocument.createElement('span');
const listEventHandler = () => {
if (!scroll.isEnabled()) return;
const format = this.statics.formats(domNode, scroll);
if (format === 'checked') {
this.format('list', 'unchecked');
Expand Down

0 comments on commit 6b6a4f7

Please sign in to comment.