首页 > 其他分享 >react 代码编辑器react-ace

react 代码编辑器react-ace

时间:2022-09-29 14:46:47浏览次数:75  
标签:github builds ace react 编辑器 import noconflict

npm install react-ace ace-builds
// or
yarn add react-ace ace-builds
  • Basic Usage
import React from "react";
import { render } from "react-dom";
import AceEditor from "react-ace";

import "ace-builds/src-noconflict/mode-java";
import "ace-builds/src-noconflict/theme-github";
import "ace-builds/src-noconflict/ext-language_tools";

function onChange(newValue) {
  console.log("change", newValue);
}

// Render editor
render(
  <AceEditor
    mode="java"
    theme="github"
    onChange={onChange}
    name="UNIQUE_ID_OF_DIV"
    editorProps={{ $blockScrolling: true }}
  />,
  document.getElementById("example")
);

标签:github,builds,ace,react,编辑器,import,noconflict
From: https://www.cnblogs.com/Running00/p/16741488.html

相关文章