fix(richtext-lexical): unchecked list items were rendered as checked in html converter (#11747)
Previously, unchecked list items had the `checked="false"` attribute, which is not valid in HTML and renders them as checked. This PR omits the `checked` attribute if the list item is unchecked, which is the correct behavior.
This commit is contained in:
@@ -37,7 +37,7 @@ export const ListHTMLConverterAsync: HTMLConvertersAsync<
|
|||||||
${
|
${
|
||||||
hasSubLists
|
hasSubLists
|
||||||
? children
|
? children
|
||||||
: `<input checked="${node.checked}" id="${uuid}" readOnly="true" type="checkbox" />
|
: `<input${node.checked ? ' checked' : ''} id="${uuid}" readOnly="true" type="checkbox" />
|
||||||
<label htmlFor="${uuid}">${children}</label>
|
<label htmlFor="${uuid}">${children}</label>
|
||||||
<br />`
|
<br />`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const ListHTMLConverter: HTMLConverters<SerializedListItemNode | Serializ
|
|||||||
${
|
${
|
||||||
hasSubLists
|
hasSubLists
|
||||||
? children
|
? children
|
||||||
: `<input checked="${node.checked}" id="${uuid}" readOnly="true" type="checkbox" />
|
: `<input${node.checked ? ' checked' : ''} id="${uuid}" readOnly="true" type="checkbox" />
|
||||||
<label htmlFor="${uuid}">${children}</label>
|
<label htmlFor="${uuid}">${children}</label>
|
||||||
<br />`
|
<br />`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user