Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cm update #681

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions app/resources/plugins/collectionService/js/CollectionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class CollectionService

buildTreeBlocks(child, rootPath)
{

if (typeof child.children !== "undefined") {
let node = {
name: child.name,
Expand All @@ -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;
Expand Down
38 changes: 35 additions & 3 deletions app/scripts/controllers/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -656,11 +657,11 @@ angular
}, 250);
}
};

$scope.duplicateSelected = function () {
graph.duplicateSelected();
};

$scope.removeSelected = function () {
graph.removeSelected();
};
Expand All @@ -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();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion app/scripts/services/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down