MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / insertEditor

Function insertEditor

src/pages/options/routes/script/ScriptEditor.tsx:482–490  ·  view source on GitHub ↗
(e: EditorState)

Source from the content-addressed store, hash-verified

480 const openScript = useCallback(
481 async (uuid?: string, template?: string, target?: string) => {
482 const insertEditor = (e: EditorState) => {
483 let insertIdx = editorFindIndex(selectedScript);
484 insertIdx = insertIdx >= 0 ? insertIdx + 1 : editorsRef.current.length;
485 setEditors((prev) => {
486 const ret = prev.map((e) => ({ ...e, active: false }));
487 ret.splice(insertIdx, 0, e);
488 return ret;
489 });
490 };
491
492 if (uuid) {
493 // 如果已在编辑器中,直接激活

Callers 1

ScriptEditorFunction · 0.85

Calls 1

editorFindIndexFunction · 0.85

Tested by

no test coverage detected