MCPcopy Create free account
hub / github.com/datapane/datapane / overwriteEditor

Function overwriteEditor

web-components/legacy/builder-component/src/utils.ts:36–49  ·  view source on GitHub ↗
(val: string)

Source from the content-addressed store, hash-verified

34};
35
36export 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};

Callers 2

formatDocumentFunction · 0.90
BuilderStoreClass · 0.90

Calls 2

codeMirrorFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected