How to use react-ace - 10 common examples

To help you get started, we’ve selected a few react-ace examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Talend / ui / packages / forms / src / deprecated / widgets / CodeWidget / CodeWidget.component.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import TextareaWidget from 'react-jsonschema-form/lib/components/widgets/TextareaWidget';

let CodeWidget; // eslint-disable-line import/no-mutable-exports

try {
	// eslint-disable-next-line import/no-extraneous-dependencies, global-require
	const AceEditor = require('react-ace').default;

	const SET_OPTIONS = {
		enableBasicAutocompletion: true,
		enableLiveAutocompletion: true,
		enableSnippets: true,
	};

	class AceCodeWidget extends React.Component {
		static displayName = 'AceCodeWidget';

		constructor(props) {
			super(props);
			this.onChange = this.onChange.bind(this);
			this.onLoad = this.onLoad.bind(this);
		}
github bcvsolutions / CzechIdMng / Realization / frontend / czechidm-core / src / components / basic / ScriptArea / ScriptArea.js View on Github external
_getComponent(feedback) {
    const { labelSpan, label, componentSpan, required, mode, height } = this.props;
    const {showModalEditor} = this.state;
    //
    const className = classNames('form-control');
    const labelClassName = classNames(labelSpan, 'control-label');
    let showAsterix = false;
    if (required && !this.state.value) {
      showAsterix = true;
    }

    // Workaround - Import for AceEditor must be here. When was on start, then not working tests (error is in AceEditor);
    let AceEditor;
    AceEditor = require('react-ace').default;
    require('brace/mode/groovy');
    require('brace/mode/json');
    require('brace/mode/sqlserver');
    require('brace/theme/github');
    require('brace/ext/language_tools');
    const AceEditorInstance = this._getAceEditor(AceEditor, mode, className, height, showModalEditor);
    return (
      <div>
        {
          !label
          ||
          <label>
            {label}
            { this.renderHelpIcon() }
          </label></div>
github Datawheel / canon / packages / cms / src / components / editors / AceWrapper.jsx View on Github external
render() {
    const {isFullscreen} = this.state;

    if (typeof window !== "undefined") {
      const Ace = require("react-ace").default;
      require("brace/mode/javascript");

      const options = {
        fontSize: "14px"
        // enableBasicAutocompletion: true,
        // enableLiveAutocompletion: true
      };

      const editorProps = {
        $blockScrolling: Infinity
      };

      return (
        <div>
          </div>
github hez2010 / H-Judge / hjudge.WebHost / src / Frontend / src / components / contest / edit.tsx View on Github external
checked={!this.state.contest.hidden}
          onChange={(_, data) =&gt; this.handleChange(this.state.contest, 'hidden', !data.checked)}
        /&gt;
         this.handleChange(this.state.contest, 'hidden', data.checked)}
        /&gt;
      
      
        <label>题目列表</label>
         v.toString()).reduce((accu, next) =&gt; `${accu}; ${next}`)} onChange={e =&gt; this.handleChange(this.state.contest, 'problems', e.target.value.split(';').filter(v =&gt; !!v.trim()).map(v =&gt; parseInt(v.trim())))} /&gt;
      
    ;

    const AceEditor = require('react-ace').default;
    if (typeof window !== 'undefined' &amp;&amp; window) {
      let windowAsAny = window as any;
      windowAsAny.ace.config.set('basePath', '/lib/ace');
    }

    const description = 
      
        
          <div style="{{">
             this.renderPreview()} value={this.state.contest.description}&gt;
          </div>
        
        
          <div style="{{">
            
          </div>
github plasma-umass / Stopify / StopifyAce.js View on Github external
render() {
        return React.createElement(react_ace_1.default, { ref: (editor) => this.setupEditor(editor), onChange: (text) => this.props.onChange(text), width: "100%", theme: "eclipse", name: "the_editor", value: this.props.value, mode: languages_1.langs[this.props.language].aceMode });
    }
}
github hez2010 / H-Judge / hjudge.WebHost / src / Frontend / src / components / problem / edit.tsx View on Github external
{
        this.state.problem.config.useStdIO ? null :
          
            
              <label>输入文件名</label>
               this.handleChange(this.state.problem.config, 'inputFileName', e.target.value)} /&gt;
            
            
              <label>输出文件名</label>
               this.handleChange(this.state.problem.config, 'outputFileName', e.target.value)} /&gt;
            
          
      }
    ;

    const AceEditor = require('react-ace').default;
    if (typeof window !== 'undefined' &amp;&amp; window) {
      let windowAsAny = window as any;
      windowAsAny.ace.config.set('basePath', '/lib/ace');
    }

    const description = 
      
        
          <div style="{{">
             this.renderPreview()}&gt;
          </div>
        
        
          <div style="{{">
            
          </div>
github hez2010 / H-Judge / hjudge.WebHost / src / Frontend / src / components / problem / details.tsx View on Github external
;
    if (!this.state.loaded) return placeHolder;

    this.languageOptions = this.state.problem.languages.map((v, i) =&gt; ({
      key: i,
      value: i,
      text: v.name,
      information: v.information,
      highlight: v.syntaxHighlight
    } as LanguageOptions));
    const { languageChoice } = this.state;

    const AceEditor = require('react-ace').default;
    if (typeof window !== 'undefined' &amp;&amp; window) {
      let windowAsAny = window as any;
      windowAsAny.ace.config.set('basePath', '/lib/ace');
    }

    const panes = this.editors.map((v, i) =&gt; {
      let fileName = v.fileName.replace(/\${.*?}/g, '');
      return {
        menuItem: `${i + 1}. ${!!fileName ? fileName : 'default'}`,
        render: () =&gt; 
          <div style="{{">
             this.updateContent(i, this.editors[i].editor)} debounceChangePeriod={200} value={this.state.contents[i]} ref={this.editors[i].editor} mode={this.state.languageValue} theme="tomorrow"&gt;
          </div>
        
      }
    });
github expo / snack-web / snack / components / Editor / AceEditor.js View on Github external
render() {
    require('brace');
    const AceEditor = require('react-ace').default;
    require('brace/mode/jsx');
    require('brace/mode/json');
    require('brace/ext/language_tools');
    require('brace/ext/searchbox');
    require('brace/keybinding/vim');
    require('./themes/ace');

    const { onValueChange, path, value, annotations, lineNumbers, theme } = this.props;

    return (
      <div>
        </div>
github skypager / skypager / src / helpers / document / src / features / editor.js View on Github external
await Promise.all([
      this.loadBraceMode('javascript'),
      this.loadBraceMode('markdown'),
      this.loadBraceMode('css'),
      this.loadBraceMode('jsx'),
      this.loadBraceMode('sh'),
      this.loadBraceMode('html'),
      this.loadBraceTheme('vibrant_ink'),
      this.loadBraceTheme('dracula'),
      this.loadBraceTheme('tomorrow'),
      this.loadBraceTheme('solarized_light'),
      this.loadBraceTheme('solarized_dark'),
    ])

    const ReactAce = require('react-ace')
    return { ReactAce: ReactAce.default || ReactAce }
  }
github yinxin630 / fiora / client / modules / main / chatPanel / chat / CodeEditor.jsx View on Github external
require.ensure([], (require) => {
                    AceEditor = require('react-ace').default;
                    require('brace/theme/tomorrow');
                    require('brace/ext/language_tools');
                    this.setState({ editorReady: true });
                    loadFun.call(this);
                    langLoadEnd[lang] = true;
                }, 'react-ace');
                editorLoadEnd = true;

react-ace

A react component for Ace Editor

MIT
Latest version published 20 days ago

Package Health Score

94 / 100
Full package analysis

Popular react-ace functions