Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix simple checklist not working in firefox

Abdullah Atta6eef65952d6a
diff --git a/packages/editor/src/extensions/check-list-item/check-list-item.ts b/packages/editor/src/extensions/check-list-item/check-list-item.ts
index bfb5b77ee..5c9869231 100644
--- a/packages/editor/src/extensions/check-list-item/check-list-item.ts
+++ b/packages/editor/src/extensions/check-list-item/check-list-item.ts
@@ -96,10 +96,12 @@ export const CheckListItem = Node.create<CheckListItemOptions>({
addNodeView() {
return ({ node, getPos, editor }) => {
const listItem = document.createElement("li");
+ const checkboxWrapper = document.createElement("label");
+ const checkboxStyler = document.createElement("span");
const checkbox = document.createElement("input");
const content = document.createElement("div");
- checkbox.contentEditable = "false";
+ checkboxWrapper.contentEditable = "false";
checkbox.type = "checkbox";
checkbox.addEventListener("mousedown", (event) => {
@@ -148,7 +150,8 @@ export const CheckListItem = Node.create<CheckListItemOptions>({
checkbox.setAttribute("checked", "checked");
}
- listItem.append(checkbox, content);
+ checkboxWrapper.append(checkbox, checkboxStyler);
+ listItem.append(checkboxWrapper, content);
return {
dom: listItem,
diff --git a/packages/editor/styles/styles.css b/packages/editor/styles/styles.css
index f39ba1938..a5c157686 100644
--- a/packages/editor/styles/styles.css
+++ b/packages/editor/styles/styles.css
@@ -645,7 +645,7 @@ p > *::selection {
display: flex;
}
-.ProseMirror ul.simple-checklist > li > input {
+.ProseMirror ul.simple-checklist > li input {
flex: 0 0 auto;
margin-right: 0.5rem;
user-select: none;