MCPcopy
hub / github.com/GrapesJS/grapesjs / createViewer

Method createViewer

packages/core/src/code_manager/index.ts:141–155  ·  view source on GitHub ↗
(opts: any = {})

Source from the content-addressed store, hash-verified

139 }
140
141 createViewer(opts: any = {}) {
142 const type = !isUndefined(opts.type) ? opts.type : defaultViewer;
143 const viewer = this.getViewer(type) && this.getViewer(type).clone();
144 const cont = document.createElement('div');
145 const txtarea = document.createElement('textarea');
146 cont.appendChild(txtarea);
147 viewer.set({
148 ...this.config.optsCodeViewer,
149 ...opts,
150 });
151 viewer.init(txtarea);
152 viewer.setElement(cont);
153
154 return viewer;
155 }
156
157 /**
158 * Update code viewer content

Callers 1

buildEditorMethod · 0.80

Calls 6

getViewerMethod · 0.95
isUndefinedFunction · 0.85
setElementMethod · 0.80
cloneMethod · 0.45
setMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected