98 lines
4.1 KiB
JavaScript
98 lines
4.1 KiB
JavaScript
exports.__esModule = true;
|
|
module.exports = function (ActionAPI) {
|
|
ActionAPI.onExecute(function (properties, status) {
|
|
var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
|
|
var sectionName = properties.sectionName != undefined ? properties.sectionName : 'none';
|
|
if (connectionID != 'none') {
|
|
if (sectionName != 'none') {
|
|
var connection = ActionAPI.getConnection('channel', connectionID);
|
|
if (connection) {
|
|
var channel = connection.instance;
|
|
channel
|
|
.jumpToTimelineSections(sectionName, 'main')
|
|
.then(function () {
|
|
status("Jumped to section " + sectionName);
|
|
})["catch"](function () { return status('Unable to jump to section', 'error'); });
|
|
}
|
|
else
|
|
status("Connection doesn't exist", 'error');
|
|
}
|
|
else
|
|
status('No section name specfied', 'error');
|
|
}
|
|
else
|
|
status('No connection specfied', 'error');
|
|
});
|
|
ActionAPI.onOpenEditor(function (EditorAPI, properties) {
|
|
var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
|
|
var sectionName = properties.sectionName != undefined ? properties.sectionName : 'none';
|
|
var connectionField = {
|
|
id: 'connectionID',
|
|
name: 'Connection',
|
|
type: 'connection',
|
|
connectionType: 'channel',
|
|
value: connectionID
|
|
};
|
|
var sectionField = {
|
|
id: 'sectionName',
|
|
name: 'Section',
|
|
type: 'select',
|
|
value: sectionName,
|
|
values: []
|
|
};
|
|
var lastConnectionID = null;
|
|
var validate = function () {
|
|
if (connectionID != lastConnectionID) {
|
|
lastConnectionID = connectionID;
|
|
if (lastConnectionID != 'none') {
|
|
var connection = ActionAPI.getConnection('channel', lastConnectionID);
|
|
if (connection) {
|
|
var channel = connection.instance;
|
|
channel
|
|
.getTimelineSections()
|
|
.then(function (sections) {
|
|
sectionField.values = sections.map(function (sectionText) {
|
|
return { id: sectionText, text: sectionText };
|
|
});
|
|
EditorAPI.setFields([
|
|
connectionField,
|
|
sectionField
|
|
]);
|
|
})["catch"](function (error) {
|
|
sectionField.values = [];
|
|
EditorAPI.setFields([
|
|
connectionField,
|
|
sectionField
|
|
]);
|
|
});
|
|
}
|
|
else {
|
|
sectionField.values = [];
|
|
EditorAPI.setFields([
|
|
connectionField,
|
|
sectionField
|
|
]);
|
|
}
|
|
}
|
|
else {
|
|
sectionField.values = [];
|
|
EditorAPI.setFields([
|
|
connectionField,
|
|
sectionField
|
|
]);
|
|
}
|
|
}
|
|
};
|
|
EditorAPI.onFieldChanges(function (fields) {
|
|
var fieldObject = EditorAPI.tools.objectifyFieldsValues(fields);
|
|
connectionID = fieldObject.connectionID;
|
|
sectionName = fieldObject.sectionName;
|
|
connectionField.value = connectionID;
|
|
sectionField.value = sectionName;
|
|
EditorAPI.saveProperties({ connectionID: connectionID, sectionName: sectionName });
|
|
validate();
|
|
});
|
|
validate();
|
|
});
|
|
};
|
|
//# sourceMappingURL=jumpToTimelineSections.js.map
|