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> |
this
Generated markup
<a-codeeditor class="a-codeeditor">
<label class="field-label"></label>
<div class="code-editor"></div>
</a-codeeditor>
Methods
# insert(text)
Insert a text at the current cursor position
Parameters:
Name | Type | Description |
---|---|---|
text |
string
|
this
# setFieldWidth(width)
Set the color selector field width
Parameters:
Name | Type | Description |
---|---|---|
width |
*
|
this
# setLabelPosition(position)
Set label position
Parameters:
Name | Type | Description |
---|---|---|
position |
string
|
"left" (default) | "right" | "top" | "bottom" |
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 |
this