MCPcopy Create free account
hub / github.com/agent0ai/agent-zero / togglePreviewTask

Function togglePreviewTask

plugins/_editor/webui/editor-store.js:495–509  ·  view source on GitHub ↗
(taskIndex, checked)

Source from the content-addressed store, hash-verified

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();

Callers

nothing calls this directly

Calls 3

taskLineIndexesFunction · 0.85
replaceMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected