原始问题:
acejs 编写一个json代码编辑器
import { Editor } from 'ace';
class JSONEditor extends Editor {
constructor(container, options) {
super(container, options);
this.setTheme("ace/theme/monokai");
this.getSession().setMode("ace/mode/json");
// Set the font size and line height to match the container's size.
this.setFontSize(container.clientHeight / 2);
this.getSession().setOption("lineHeight", container.clientHeight / 2);
}
setJSON(jsonString) {
this.session.setValue(JSON.stringify(jsonString, null, 4)); // Indented with 4 spaces // Indented with 4 spaces per level of nesting; // Indented with 4 spaces // Indented with 4 spaces // Indented with 4 spaces // Indented with 4 spaces // Indented with 4 spaces // Indented with 4 spaces // Indented with 4 spaces per level of nesting; per level of nesting; per level of nesting; per level of nesting; per level of nesting; per level of nesting;
}
Prev:画一张拿着话筒的牛(1张)