GH-Elements

Code Editor

Code Editor is a gh-element that allows to enter, save, and edit code. That mean it provides an opportunity to add working code editor in your application.

Value Format

When the user enters the code, GudHub creates a new file where this code is saved. And exactly the ID of that file is a field value of the code editor element.

{
    "field_value": "940407"
}

All such files are contained in the file list of the application where the element is located.

Element Options

The code editor element has not a big number of settings that can configure it and all of them are contained in one group.

Field Settings

The only configuration settings of the code editor consist two standard and one additional options.

Settings of code editor field

Name Description
Code Mode allows to select the code mode

Code Mode

This is a mode that adjusts the code editor to one of two code types:

  • HTML
  • JavaScript

Element Style

Element style of the code editor does not have any additional options. It can only be configured using standard settings. The single interpretation type is shown in the end of the article.

Style of code editor element

Data Model

The half of properties in the data model cannot be configured. They have a constant default value.

{
    "data_model": {
        "code_mode": "htmlmixed",
        "interpretation": [],
        "save_file": true,
        "theme": "default"
    }
}
Name Type Description
code_mode string contains selected code mode
interpretation array contains all element interpretation types
save_file boolean shows whether the file will be saved or not
theme string contains the element theme

Filtration

This element cannot be filtered out.

Interpretation

The only interpretation type allows the element to be displayed the space where the code is entered and where it could be updated.

Types of code editor interpretation