Namespace field-editor
The field-editor namespace provides an field-editor instance to manipulate
the value and model of a field in Content Studio. The field-editor instance
itself is an EventEmitter
which emits event when the field value is changed.
It also provides functionality to create a modal popup with some url specified by the user.
Constructor Attributes | Constructor Name and Description |
---|---|
<inner> |
The 'field-editor' namespace
|
Field Attributes | Field Name and Description |
---|---|
<static> |
field-editor.model
The model of the content in VDF format.
|
<static> |
field-editor.value
The value of the field.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
field-editor.createPopup(pUri, pData)
Shows a modal popup with the given
uri . |
Event Attributes | Event Name and Description |
---|---|
<static> |
field-editor.value-changed(value)
The
value-changed event is fired whenever the value
of the particular field is changed. |
Namespace Detail
<inner>
field-editor
The 'field-editor' namespace
window.onload = function (){ var editor = require("field-editor"); };
Field Detail
<static>
field-editor.model
The model of the content in VDF format.
var model = editor.model
<static>
field-editor.value
The value of the field.
The value can be set like below: editor.value = document.getElementById("value").value;
Method Detail
<static>
field-editor.createPopup(pUri, pData)
Shows a modal popup with the given
uri
.
var handle = editor.createPopup("./dialog.html", initial-value);
This handle is an EventEmitter
which can emit event for it's certain property change. We can listen to
the property change event in the field editor like below:
handle = editor.createDialog("./dialog.html");
handle.on("popup-value-changed", function (value) {
document.getElementById("value").value = value;
});
handle.show();
- Parameters:
- {String} pUri
- the uri which content will be shown in the modal popup.
- {Object} pData
- initial data for the popup.
Event Detail
<static>
field-editor.value-changed(value)
The
value-changed
event is fired whenever the value
of the particular field is changed. This event means that the Content Studio field
value is changed.
The event is passed with an object of String
type, which is the string representation
of the Content Studio field value.
editor.on("value-changed", function (value) { document.getElementById("value").value = value; });
- Parameters:
- {String} value
- the string representation of the value of a field .