angular.module('yds').directive('ydsWorkbenchNew', ['$ocLazyLoad', '$timeout', '$uibModal', 'Data', 'Basket',
    function ($ocLazyLoad, $timeout, $uibModal, Data, Basket) {
        return {
            restrict: 'E',
            scope: {
                lang: '@',
                userId: '@'
            },
            templateUrl: ((typeof Drupal != 'undefined') ? Drupal.settings.basePath + Drupal.settings.yds_project.modulePath + '/' : '') + 'templates/workbench-new.html',
            link: function (scope, element) {
                scope.ydsAlert = "";
                var editorContainer = angular.element(element[0].querySelector('.highcharts-editor-container'));

                //if userId is undefined or empty, stop the execution of the directive
                if (_.isUndefined(scope.userId) || scope.userId.trim().length == 0) {
                    scope.ydsAlert = "The YDS component is not properly configured." +
                        "Please check the corresponding documentation section";
                    return false;
                }

                //check if the language attr is defined, else assign default value
                if (_.isUndefined(scope.lang) || scope.lang.trim() == "")
                    scope.lang = "en";

                // Set user ID in the Basket service so the modal can access it
                Basket.setUserId(scope.userId);

                var editorOptions = {
                    features: "import templates customize export",
                    importer: {
                        options: "plugins",
                        plugins: [
                            "BasketImport"
                        ]
                    }
                };

                // Load the required CSS & JS files for the Editor
                $ocLazyLoad.load({
                    files: [
                        "css/highcharts-editor.min.css",
                        "lib/highcharts-editor.js"
                    ],
                    cache: true
                }).then(function () {
                    // Add plugin for basket import
                    addBasketImportPlugin();

                    // Start the Highcharts Editor
                    highed.ready(function () {
                        highed.Editor(editorContainer[0], editorOptions);
                    });
                });

                /**
                 * Install the Basket Import plugin for Highcharts Editor
                 */
                var addBasketImportPlugin = function() {
                    highed.plugins.import.install('BasketImport', {
                        description: "Standard Basket Import",
                        treatAs: "csv",
                        suppressURL: true,
                        fetchAs: false,
                        request: function(url, options, fn) {
                            // Show modal and give it function to call with data
                            openModal(fn);
                        }
                    });
                };

                var openModal = function (fn) {
                    var modalInstance = $uibModal.open({
                        animation: true,
                        ariaLabelledBy: "modal-title",
                        ariaDescribedBy: "modal-body",
                        templateUrl: "templates/workbench/workbench-modal.html",
                        controller: "WorkbenchModalController"
                    });

                    // Process result of modal
                    modalInstance.result.then(function (data) {
                        // console.log(data);

                        fn(false, data.chartConfig);
                    }, function () {
                        console.log("Modal dismissed at: " + new Date());
                    });
                };
            }
        }
    }
]);

@@ -71,16 +71,28 @@
 imeout',
+ '$compile',
  '$uibMo
@@ -151,16 +151,26 @@
 timeout,
+ $compile,
  $uibMod
@@ -1656,28 +1656,26 @@
        %22
-BasketImport
+My Library
 %22%0A      
@@ -2337,16 +2337,1338 @@
 ptions);
+%0A%0A                        // Get div which contains the parameters of our plugin%0A                        var divResults = $(%22.highed-plugin-details%22).children(%22.highed-customizer-table%22);%0A%0A                        // Replace the parameters table with a span that says %22Loading%22%0A                        $(divResults).replaceWith(%22%3Cspan id='library_item_loading_span'%3ELoading Library Items...%3C/span%3E%22);%0A%0A                        // Get basket items to show in a list%0A                        Basket.getBasketItems(scope.userId, %22dataset%22)%0A                            .then(function(response) %7B%0A                                // Get items from response and put them in scope%0A                                scope.libraryItems = response.items;%0A                                // console.log(scope.libraryItems);%0A%0A                                // Compile the template which will show all the items with ng-repeat%0A                                var templateHtml = %22%3Cdiv ng-repeat='item in libraryItems'%3E%7B%7B item.title %7D%7D%3C/div%3E%22;%0A%0A                                var compiledList = $compile(templateHtml)(scope);%0A%0A                                // Replace the loading span with the compiled list of items%0A                                $(%22#library_item_loading_span%22).replaceWith(compiledList);%0A                            %7D);
 %0A       
@@ -3756,22 +3756,23 @@
 all the 
-Basket
+Library
  Import 
@@ -3928,28 +3928,26 @@
 nstall('
-BasketImport
+My Library
 ', %7B%0A   
@@ -3986,27 +3986,59 @@
 : %22S
-tandard Basket Impo
+elect an item from the library to import to the cha
 rt%22,
@@ -4161,16 +4161,304 @@
  false,%0A
+                        options: %7B%0A                            val1: %7B%0A                                type: 'string',%0A                                label: 'String value',%0A                                default: 'a string 1234'%0A                            %7D%0A                        %7D,%0A
         

Make Editor plugin add library items list before import button