fix: fix checkbox in firefox, fix #251
This commit is contained in:
@@ -326,7 +326,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
> input {
|
> label {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ ul[data-type="taskList"] {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
> input {
|
> label {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
> input {
|
> label {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ ul[data-type="taskList"] {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
> input {
|
> label {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ ul[data-type="taskList"] {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
> input {
|
> label {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,11 +81,13 @@ export const TaskItem = Node.create<TaskItemOptions>({
|
|||||||
}) => {
|
}) => {
|
||||||
const { view } = editor
|
const { view } = editor
|
||||||
const listItem = document.createElement('li')
|
const listItem = document.createElement('li')
|
||||||
|
const checkboxWrapper = document.createElement('label')
|
||||||
|
const checkboxStyler = document.createElement('span')
|
||||||
const checkbox = document.createElement('input')
|
const checkbox = document.createElement('input')
|
||||||
const content = document.createElement('div')
|
const content = document.createElement('div')
|
||||||
|
|
||||||
|
checkboxWrapper.contentEditable = 'false'
|
||||||
checkbox.type = 'checkbox'
|
checkbox.type = 'checkbox'
|
||||||
checkbox.contentEditable = 'false'
|
|
||||||
checkbox.addEventListener('change', event => {
|
checkbox.addEventListener('change', event => {
|
||||||
const { checked } = event.target as any
|
const { checked } = event.target as any
|
||||||
|
|
||||||
@@ -101,9 +103,12 @@ export const TaskItem = Node.create<TaskItemOptions>({
|
|||||||
checkbox.setAttribute('checked', 'checked')
|
checkbox.setAttribute('checked', 'checked')
|
||||||
}
|
}
|
||||||
|
|
||||||
listItem.append(checkbox, content)
|
checkboxWrapper.append(checkbox, checkboxStyler)
|
||||||
|
listItem.append(checkboxWrapper, content)
|
||||||
|
|
||||||
Object.entries(HTMLAttributes).forEach(([key, value]) => {
|
Object
|
||||||
|
.entries(HTMLAttributes)
|
||||||
|
.forEach(([key, value]) => {
|
||||||
listItem.setAttribute(key, value)
|
listItem.setAttribute(key, value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user