MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / createPreview

Function createPreview

src/pages/themeSetting/themeSetting.js:49–63  ·  view source on GitHub ↗
(themeId)

Source from the content-addressed store, hash-verified

47 }
48
49 function createPreview(themeId) {
50 destroyPreview("create");
51 $themePreview.innerHTML = "";
52 const theme = getThemeExtensions(themeId, [oneDark]);
53 const fixedHeightTheme = EditorView.theme({
54 "&": { height: "100%", flex: "1 1 auto" },
55 ".cm-scroller": { height: "100%", overflow: "auto" },
56 });
57 const state = EditorState.create({
58 doc: previewDoc,
59 extensions: [basicSetup, javascript(), fixedHeightTheme, ...theme],
60 });
61 cmPreview = new EditorView({ state, parent: $themePreview });
62 cmPreview.contentDOM.setAttribute("aria-readonly", "true");
63 }
64
65 actionStack.push({
66 id: "appTheme",

Callers 1

renderEditorThemesFunction · 0.85

Calls 3

getThemeExtensionsFunction · 0.90
destroyPreviewFunction · 0.85
createMethod · 0.65

Tested by

no test coverage detected