MCPcopy
hub / github.com/securingsincity/react-ace / componentDidMount

Method componentDidMount

src/split.tsx:186–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184 return false;
185 }
186 public componentDidMount() {
187 const {
188 className,
189 onBeforeLoad,
190 mode,
191 focus,
192 theme,
193 fontSize,
194 value,
195 defaultValue,
196 cursorStart,
197 showGutter,
198 wrapEnabled,
199 showPrintMargin,
200 scrollMargin = [0, 0, 0, 0],
201 keyboardHandler,
202 onLoad,
203 commands,
204 annotations,
205 markers,
206 splits
207 } = this.props;
208
209 this.editor = ace.edit(this.refEditor) as IAceEditor;
210 if (this.isInShadow(this.refEditor)) {
211 this.editor.renderer.attachToShadowRoot();
212 }
213 this.editor.setTheme(`ace/theme/${theme}`);
214
215 if (onBeforeLoad) {
216 onBeforeLoad(ace);
217 }
218
219 const editorProps = Object.keys(this.props.editorProps);
220
221 const split = new Split(
222 this.editor.container,
223 `ace/theme/${theme}`,
224 splits
225 );
226 this.editor.env.split = split;
227
228 this.splitEditor = split.getEditor(0);
229 this.split = split;
230 // in a split scenario we don't want a print margin for the entire application
231 this.editor.setShowPrintMargin(false);
232 this.editor.renderer.setShowGutter(false);
233 // get a list of possible options to avoid 'misspelled option errors'
234 const availableOptions = this.splitEditor.$options;
235 if (this.props.debounceChangePeriod) {
236 this.onChange = this.debounce(
237 this.onChange,
238 this.props.debounceChangePeriod
239 );
240 }
241 split.forEach((editor: IAceEditorClass, index: number) => {
242 for (let i = 0; i < editorProps.length; i++) {
243 editor[editorProps[i]] = this.props.editorProps[editorProps[i]];

Callers

nothing calls this directly

Calls 6

isInShadowMethod · 0.95
handleMarkersMethod · 0.95
handleOptionsMethod · 0.95
bindKeyMethod · 0.80
addCommandMethod · 0.80
onLoadFunction · 0.50

Tested by

no test coverage detected