Skip to content

Commit 574e830

Browse files
authored
fix(FEV-1444): distinguish between playlist plugin and core playlist feature when adding and removing them from Studio (#136)
1 parent 3e6d35c commit 574e830

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

app/js/controllers/EditCtrl.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ KMCMenu.controller('EditCtrl', ['$scope','$http', '$timeout','PlayerData','Playe
175175
pluginIndex++;
176176
$scope.propertiesSearch.push({'label': p.label,'categoryIndex':categoryIndex, 'accIndex': pluginIndex, 'id': 'accHeader'+categoryIndex + "_" +pluginIndex}); // add accordion header to the search indexing
177177
var plugin = {'enabled': p.enabled, hideArrow: !p.children.length, 'label': p.label, 'description':p.description, 'isopen': !!p.isOpen, 'checkable': p.checkable !== false, 'model': p.model, 'id': 'accHeader'+categoryIndex + "_" + pluginIndex, 'componentName': p.componentName};
178-
plugin.properties = [];
178+
plugin.properties = [];
179179
// check for tabs
180180
var tabObj = {'type':'tabs', 'children':[]}; // create tab object
181181
if (p.sections){ // tabs found - create tabs
@@ -302,8 +302,10 @@ KMCMenu.controller('EditCtrl', ['$scope','$http', '$timeout','PlayerData','Playe
302302
if ($scope.playerData.config.plugins[plugin.model]) {
303303
delete $scope.playerData.config.plugins[plugin.model].disable;
304304
}else{
305-
// supporting plugins w/o config properties
306-
$scope.playerData.config.plugins[plugin.model] = {};
305+
// supporting plugins w/o config properties, don't override playlist
306+
if (plugin.model !== "playlist" || (plugin.model === "playlist" && plugin.componentName)) {
307+
$scope.playerData.config.plugins[plugin.model] = {};
308+
}
307309
}
308310
if (plugin.componentName) {
309311
window.KalturaPlayer = null;
@@ -654,12 +656,23 @@ KMCMenu.controller('EditCtrl', ['$scope','$http', '$timeout','PlayerData','Playe
654656
$scope.getPlayerProperties(properties);
655657
}else{ // plugin
656658
for (var plug in properties){
659+
657660
if (properties[plug].children){
658661
// save plugin name in a model
659662
properties[plug].model = plug;
660663
// check plugin enabled
661664
if (properties[plug].enabled || $scope.playerData.config[plug] || ($scope.playerData.config.plugins[plug] && !$scope.playerData.config.plugins[plug].disable) || ($scope.playerData.config.ui && $scope.playerData.config.ui.components && $scope.playerData.config.ui.components[plug]) || (plug === "receiver" && $scope.playerData.externals && $scope.playerData.externals[properties[plug].componentName])){
662665
properties[plug].enabled = true;
666+
// special fix for playlist as we use the same name for the plugin and the core feature
667+
if (plug === "playlist") {
668+
if (properties[plug].componentName === "playkit-playlist") {
669+
// this is the plugin
670+
properties[plug].enabled = $scope.playerData.config.plugins[plug] ? true : false;
671+
} else {
672+
// this is the core feature
673+
properties[plug].enabled = properties[plug].enabled === true;
674+
}
675+
}
663676
}else{
664677
properties[plug].enabled = false;
665678
}

0 commit comments

Comments
 (0)