MCPcopy
hub / github.com/027xiguapi/code-box / handleOkModal

Function handleOkModal

component/ui/customDomSelector.tsx:115–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113 }
114
115 const handleOkModal = () => {
116 const selector = document.querySelector<HTMLElement>(".codebox-current")
117 if (!selector || !downloadType.current) return
118
119 selector.classList.remove("codebox-current")
120
121 switch (downloadType.current) {
122 case "downloadHtml":
123 saveHtml(selector, articleTitle)
124 break
125 case "downloadMarkdown":
126 const markdown = turndownService.turndown(selector)
127 saveMarkdown(markdown, articleTitle)
128 break
129 case "editMarkdown":
130 setEditContent(selector)
131 break
132 case "parseMarkdown":
133 setParseContent(selector, aiType)
134 break
135 case "downloadPdf":
136 Print.print(selector, { title: articleTitle })
137 .then(() => console.log("Printing complete"))
138 .catch((error) => console.error("Printing failed:", error))
139 break
140 }
141
142 resetState()
143 }
144
145 const handleConfirm = () => {
146 handleOkModal()

Callers 1

handleConfirmFunction · 0.85

Calls 4

saveHtmlFunction · 0.85
saveMarkdownFunction · 0.85
resetStateFunction · 0.85
printMethod · 0.80

Tested by

no test coverage detected