(val: string)
| 34 | }; |
| 35 | |
| 36 | export const overwriteEditor = (val: string): void => { |
| 37 | /** |
| 38 | * After the initial load, editor state should be set inside codemirror using this function instead of directly |
| 39 | * setting `store.editorContent`. This allows ctrl+z to undo the state set, and keeps the direction of data consistent |
| 40 | */ |
| 41 | try { |
| 42 | const cm = codeMirror(); |
| 43 | setTimeout(() => { |
| 44 | cm.setValue(val); |
| 45 | }, 0); |
| 46 | } catch (e) { |
| 47 | console.error("An error occurred while fetching CodeMirror", e); |
| 48 | } |
| 49 | }; |
no test coverage detected