Class

CodeEditor

kiss.ux.CodeEditor(config)

The Code Editor component derives from Component.

It allows to write code, embedding the famous Ace Editor.

Constructor

# new CodeEditor(config)

Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the 3 following methods:

Create the Web Component and call its init method:

const myCodeEditor = document.createElement("a-codeeditor").init(config)

Or use the shorthand for it:

const myCodeEditor = createCodeEditor({
  label: "Enter your code",
  height: 300
})

myCodeEditor.render()

Or directly declare the config inside a container component:

const myPanel = createPanel({
  title: "My panel",
  items: [
      {
          type: "codeEditor",
          label: "Enter your code",
          height: 300
      }
  ]
})
myPanel.render()
Parameters:
Name Type Attributes Description
config object
value * <optional>

Default value

label string <optional>
labelWidth string <optional>
fieldWidth string <optional>
fieldHeight string <optional>
labelPosition string <optional>

left | right | top | bottom

labelAlign string <optional>

left | right

readOnly boolean <optional>
disabled boolean <optional>
required boolean <optional>
draggable boolean <optional>
margin string <optional>
display string <optional>

flex | inline flex

width string | number <optional>
height string | number <optional>
border string | number <optional>
borderStyle string | number <optional>
borderWidth string | number <optional>
borderColor string | number <optional>
borderRadius string | number <optional>
boxShadow string | number <optional>
showMargin boolean <optional>

View Source client/ux/codeEditor/codeEditor.js, line 40

this

Generated markup

<a-codeeditor class="a-codeeditor">
 <label class="field-label"></label>
 <div class="code-editor"></div>
</a-codeeditor>

Methods

# blur()

Unset the focus of the input field

View Source client/ux/codeEditor/codeEditor.js, line 339

this

# clearSelection()

Clear the current selection

View Source client/ux/codeEditor/codeEditor.js, line 349

this

# focus()

Give focus to the input field

View Source client/ux/codeEditor/codeEditor.js, line 329

this

# getLabel() → {string}

Get the field label

View Source client/ux/codeEditor/codeEditor.js, line 373

string

# getLabelPosition() → {string}

Get the label position

View Source client/ux/codeEditor/codeEditor.js, line 418

"left" | "right" | "top"

string

# getValue() → {string}

Get the code

View Source client/ux/codeEditor/codeEditor.js, line 302

The image src

string

# insert(text)

Insert a text at the current cursor position

Parameters:
Name Type Description
text string

View Source client/ux/codeEditor/codeEditor.js, line 317

this

# setFieldWidth(width)

Set the color selector field width

Parameters:
Name Type Description
width *

View Source client/ux/codeEditor/codeEditor.js, line 395

this

# setLabel(newLabel)

Set the field label

Parameters:
Name Type Description
newLabel string

View Source client/ux/codeEditor/codeEditor.js, line 360

this

# setLabelPosition(position)

Set label position

Parameters:
Name Type Description
position string

"left" (default) | "right" | "top" | "bottom"

View Source client/ux/codeEditor/codeEditor.js, line 428

this

# setLabelWidth(width)

Set the label width

Parameters:
Name Type Description
width *

View Source client/ux/codeEditor/codeEditor.js, line 407

this

# setValue(newValue, fromBlurEventopt)

Set the code

Parameters:
Name Type Attributes Description
newValue string
fromBlurEvent boolean <optional>

If true, the update is only performed on binded record, not locally

View Source client/ux/codeEditor/codeEditor.js, line 279

this

# setWidth(width)

Set the field width

Parameters:
Name Type Description
width *

View Source client/ux/codeEditor/codeEditor.js, line 383

this