(taskIndex, checked)
| 493 | }, |
| 494 | |
| 495 | togglePreviewTask(taskIndex, checked) { |
| 496 | if (!this.session || !this.isMarkdown() || !this.isPreviewMode() || this.previewEditing) return false; |
| 497 | const page = this.currentPage(); |
| 498 | const lines = String(page.markdown || "").split("\n"); |
| 499 | const indexes = taskLineIndexes(page.markdown || ""); |
| 500 | const lineIndex = indexes[Number(taskIndex)]; |
| 501 | if (lineIndex == null || !lines[lineIndex]) return false; |
| 502 | const nextLine = lines[lineIndex].replace( |
| 503 | /^(\s*(?:[-*+]|\d+[.)])\s+\[)[ xX](\](?:\s+|$))/, |
| 504 | `$1${checked ? "x" : " "}$2`, |
| 505 | ); |
| 506 | if (nextLine === lines[lineIndex]) return false; |
| 507 | lines[lineIndex] = nextLine; |
| 508 | return this.replacePageMarkdown(page, lines.join("\n")); |
| 509 | }, |
| 510 | |
| 511 | clampActivePage() { |
| 512 | const pages = this.pages(); |
nothing calls this directly
no test coverage detected