Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

docs(markdown-editor): trim restatement/redundant comments

Sergey Kozyrenko831d9b8be2a4
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-field.tsx b/frontend/src/components/shared/markdown-editor/markdown-editor-field.tsx
index a26e6e66..b78cd352 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-field.tsx
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-field.tsx
@@ -22,10 +22,8 @@ const MarkdownEditor = lazy(() => import('./markdown-editor').then((module) => (
* each implement them — so a consumer drives the field the same way whether it renders raw source or rich.
*/
export interface MarkdownEditorFieldHandle {
- /** Select the next occurrence of `variable` and scroll it into view; `false` when it isn't used. */
cycleToVariable: (variable: string) => boolean;
focus: () => void;
- /** Insert `text` at the caret, replacing any selection. */
insertAtCursor: (text: string) => void;
}
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-textarea.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-textarea.ts
index 46f92ade..92e6518d 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-textarea.ts
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-textarea.ts
@@ -1,6 +1,5 @@
import { findVariableUseRanges, nextVariableRange } from './markdown-editor-variable-syntax';
-/** Select the next occurrence of `variable` in the textarea and scroll it to the middle. Returns false if none. */
export function cycleTextareaToVariable(textarea: HTMLTextAreaElement, variable: string): boolean {
const ranges = findVariableUseRanges(textarea.value, variable).map(({ index, length }) => ({
end: index + length,
@@ -19,7 +18,6 @@ export function cycleTextareaToVariable(textarea: HTMLTextAreaElement, variable:
return true;
}
-/** Splice `text` over the textarea selection, emit through `onChange`, and restore the caret after the value round-trips. */
export function insertTextareaText(
textarea: HTMLTextAreaElement,
text: string,
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor/markdown-editor.tsx
index f350a4b0..39bc95bf 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor.tsx
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor.tsx
@@ -103,7 +103,6 @@ function MarkdownEditor({
// eslint-disable-next-line react-hooks/exhaustive-deps
const extensions = useMemo(() => createMarkdownExtensions(placeholder), []);
- // tiptap invokes onBlur/onUpdate from its live options ref, so these closures always read the latest props.
const editor = useEditor({
content: initialContent,
contentType: 'markdown',
@@ -207,12 +206,8 @@ function MarkdownEditor({
// would re-emit the round-trip normalization as if it were an edit.
lastEmittedRef.current = editor.getMarkdown();
- // Clear the undo stack:
- // - on initial mount, to discard the construction-time
- // transactions dispatched by extensions like `trailingNode`;
- // - on every external `setContent` (e.g. parent calls
- // form.reset(serverDocument)), because that transaction is
- // not a user edit either.
+ // Clear the undo stack of the construction-time transactions (mount) and each external setContent
+ // (form.reset) — neither is a user edit, so neither should be undoable.
if (!hasResetInitialHistoryRef.current || isExternalChange) {
hasResetInitialHistoryRef.current = true;
resetUndoHistory(editor);