chore: run fixes (#8257)
* chore: run fixes * fix: type, just use hocuspocusservercontext * fix: codemod --------- Co-authored-by: Palanikannan M <akashmalinimurugu@gmail.com>
This commit is contained in:
parent
a9e9cb2983
commit
0ab94ed6d6
172 changed files with 1784 additions and 1798 deletions
|
|
@ -37,7 +37,7 @@ export const getEditorAssetDownloadSrc = (args: TEditorSrcArgs): string | undefi
|
|||
return url;
|
||||
};
|
||||
|
||||
export const getTextContent = (jsx: React.ReactNode | React.ReactNode | null | undefined): string => {
|
||||
export const getTextContent = (jsx: React.ReactNode | null | undefined): string => {
|
||||
if (!jsx) return "";
|
||||
|
||||
const div = document.createElement("div");
|
||||
|
|
|
|||
|
|
@ -33,24 +33,21 @@ function addSpacesToCheckboxes() {
|
|||
child.properties &&
|
||||
child.properties["data-type"] === "taskItem"
|
||||
) {
|
||||
const liElement = child as HASTElement;
|
||||
const liElement = child;
|
||||
|
||||
// Find the label and div elements
|
||||
const label = liElement.children?.find(
|
||||
(c) => c.type === "element" && (c as HASTElement).tagName === "label"
|
||||
) as HASTElement | undefined;
|
||||
const label = liElement.children?.find((c) => c.type === "element" && c.tagName === "label") as
|
||||
| HASTElement
|
||||
| undefined;
|
||||
|
||||
const contentDiv = liElement.children?.find(
|
||||
(c) => c.type === "element" && (c as HASTElement).tagName === "div"
|
||||
) as HASTElement | undefined;
|
||||
const contentDiv = liElement.children?.find((c) => c.type === "element" && c.tagName === "div") as
|
||||
| HASTElement
|
||||
| undefined;
|
||||
|
||||
if (label && contentDiv) {
|
||||
// Find the checkbox input
|
||||
const checkbox = label.children?.find(
|
||||
(c) =>
|
||||
c.type === "element" &&
|
||||
(c as HASTElement).tagName === "input" &&
|
||||
(c as HASTElement).properties?.type === "checkbox"
|
||||
(c) => c.type === "element" && c.tagName === "input" && c.properties?.type === "checkbox"
|
||||
) as HASTElement | undefined;
|
||||
|
||||
if (checkbox) {
|
||||
|
|
@ -58,9 +55,9 @@ function addSpacesToCheckboxes() {
|
|||
const textContent: ElementContent[] = [];
|
||||
if (contentDiv.children) {
|
||||
for (const child of contentDiv.children) {
|
||||
if (child.type === "element" && (child as HASTElement).tagName === "p") {
|
||||
if (child.type === "element" && child.tagName === "p") {
|
||||
// Unwrap paragraph - add its children directly
|
||||
const pElement = child as HASTElement;
|
||||
const pElement = child;
|
||||
if (pElement.children) {
|
||||
textContent.push(...pElement.children);
|
||||
}
|
||||
|
|
@ -80,7 +77,7 @@ function addSpacesToCheckboxes() {
|
|||
}
|
||||
}
|
||||
} else if (child && child.type === "element") {
|
||||
helper(child as HASTElement);
|
||||
helper(child);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue