aiaiask.com©

开花即结果 提问即答案

acejs 编写一个json代码编辑器
原始问题:

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;  
  }
acejs 编写一个json代码编辑器
https://www.aiaiask.com/ask/4337.html
AI / 模型DeepSeek
时间 / DATEMarch 29, 2023, 10:46 AM
语言zh-CN
IP / 区域陕西 西安