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

Method componentDidMount

src/ace.tsx:186–328  ·  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 onValidate,
191 mode,
192 focus,
193 theme,
194 fontSize,
195 lineHeight,
196 value,
197 defaultValue,
198 showGutter,
199 wrapEnabled,
200 showPrintMargin,
201 scrollMargin = [0, 0, 0, 0],
202 keyboardHandler,
203 onLoad,
204 commands,
205 annotations,
206 markers,
207 placeholder
208 } = this.props;
209
210 this.editor = ace.edit(this.refEditor) as IAceEditor;
211
212 if (onBeforeLoad) {
213 onBeforeLoad(ace);
214 }
215
216 const editorProps = Object.keys(this.props.editorProps);
217 for (let i = 0; i < editorProps.length; i++) {
218 this.editor[editorProps[i]] = this.props.editorProps[editorProps[i]];
219 }
220 if (this.props.debounceChangePeriod) {
221 this.onChange = this.debounce(
222 this.onChange,
223 this.props.debounceChangePeriod
224 );
225 }
226 this.editor.renderer.setScrollMargin(
227 scrollMargin[0],
228 scrollMargin[1],
229 scrollMargin[2],
230 scrollMargin[3]
231 );
232 if (this.isInShadow(this.refEditor)) {
233 this.editor.renderer.attachToShadowRoot();
234 }
235 this.editor
236 .getSession()
237 .setMode(
238 typeof mode === "string" ? `ace/mode/${mode}` : (mode as Ace.SyntaxMode)
239 );
240 if (theme && theme !== "") this.editor.setTheme(`ace/theme/${theme}`);
241 this.editor.setFontSize(
242 typeof fontSize === "number" ? `${fontSize}px` : fontSize
243 );

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected