diff --git a/app/resources/plugins/collectionService/js/CollectionService.js b/app/resources/plugins/collectionService/js/CollectionService.js index dba15f4e7..4dcb51743 100644 --- a/app/resources/plugins/collectionService/js/CollectionService.js +++ b/app/resources/plugins/collectionService/js/CollectionService.js @@ -180,6 +180,7 @@ class CollectionService buildTreeBlocks(child, rootPath) { + if (typeof child.children !== "undefined") { let node = { name: child.name, @@ -192,15 +193,23 @@ class CollectionService }; for (let i = 0; i < child.children.length; i++) { - node.items.push(this.buildTreeBlocks(child.children[i], rootPath)); - if (node.items[node.items.length - 1].isFolder === false) { - this.queueIndexDB({ - id: this.id, - blockId: node.items[node.items.length - 1].id, - path: node.items[node.items.length - 1].path, - }); - } - } //-- for child.children.length + console.log(child.children[i].path.substring(child.children[i].path.indexOf('.'))); + + var ext = child.children[i].path.substring(child.children[i].path.indexOf('.')); + // Empeaches the problematic loading in CM treeview of .md, json, pdf files ( stored bellow collections "block" subfolders ) + if ( ext !='.md' && ext!='.json' && ext!='.pdf' ) { + + node.items.push(this.buildTreeBlocks(child.children[i], rootPath)); + if (node.items[node.items.length - 1].isFolder === false) { + this.queueIndexDB({ + id: this.id, + blockId: node.items[node.items.length - 1].id, + path: node.items[node.items.length - 1].path, + }); + } + } + + } //-- for child.children.length if (this.hasSubFolders(node)) node.hasSubFolders = true; return node; diff --git a/app/scripts/controllers/menu.js b/app/scripts/controllers/menu.js index 8b13eab3d..3770e15c4 100644 --- a/app/scripts/controllers/menu.js +++ b/app/scripts/controllers/menu.js @@ -410,6 +410,7 @@ angular gettextCatalog.getString( 'You are editing a submodule, so you will save just this submodule ("Save as" works like "Export \ module"). Do you want to continue?' + ), function () { $scope.doSaveProjectAs(localCallback); @@ -656,11 +657,11 @@ angular }, 250); } }; - + $scope.duplicateSelected = function () { graph.duplicateSelected(); }; - + $scope.removeSelected = function () { graph.removeSelected(); }; @@ -680,6 +681,16 @@ angular $scope.showToolBox = function() { showToolBox(); }; + + $scope.showCollectionManager = function() { + showCollectionManager(); + }; + + /* redundant: patched via $scope - @mgesteiro + function removeSelected() { + project.removeSelected(); // <- this is justa a wrapper of graph.removeSelected() + } + */ $scope.fitContent = function () { graph.fitContent(); @@ -915,7 +926,7 @@ angular newExternalCollections === "" || fs.existsSync(newExternalCollections) ) { - //-- The file is valida... + //-- The file is valid... //-- Set it in the profile profile.set("externalCollections", newExternalCollections); @@ -1608,6 +1619,9 @@ angular // -- Show Floating toolbox shortcuts.method("showToolBox", $scope.showToolBox); + + // -- Show colection Manager + shortcuts.method("showCollectionManager", $scope.showCollectionManager); shortcuts.method("back", function () { if (graph.isEnabled()) { @@ -2026,6 +2040,24 @@ angular toolbox.dom.addClass('opened'); } } + + + ////////////////////////////////////// + + //---------------------------------------------------- + //-- Callback function for launching CM from Menu + //---------------------------------------------------- + + function showCollectionManager() { + + //// TODO + + + + } + ///////////////////////////////////////////////////// + + //----------------------------------------------------------------- //-- Callback function for the ToolBox menu. Whenever an option diff --git a/app/scripts/services/shortcuts.js b/app/scripts/services/shortcuts.js index 564966269..0ffab5cd4 100644 --- a/app/scripts/services/shortcuts.js +++ b/app/scripts/services/shortcuts.js @@ -64,7 +64,11 @@ angular.module('icestudio') /* For easy keycode identification: https://keycode.info/ */ var shortcuts = { - + + showCollectionManager: { + linux: { label: 'Ctrl+M', ctrl: true, key: 77 }, + mac: { label: '⌘+M', meta: true, key: 77 } + }, showToolBox: { linux: { label: 'Ctrl+T', ctrl: true, key: 84 }, mac: { label: '⌘+T', meta: true, key: 84 }