mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-17 17:23:41 +02:00
Solves #451 explain permalink and import tree now, and add command
This commit is contained in:
parent
f872840544
commit
c1854a0d96
4 changed files with 19 additions and 1 deletions
|
@ -125,7 +125,8 @@ var regexMap = {
|
|||
'importLevelNow': /^importLevelNow($|\s)/,
|
||||
'import tree': /^import +tree$/,
|
||||
'import level': /^import +level$/,
|
||||
'undo': /^undo($|\s)/
|
||||
'undo': /^undo($|\s)/,
|
||||
'share permalink': /^share( +permalink)?$/
|
||||
};
|
||||
|
||||
var getAllCommands = function() {
|
||||
|
|
|
@ -223,6 +223,16 @@ var Sandbox = Backbone.View.extend({
|
|||
});
|
||||
},
|
||||
|
||||
sharePermalink: function(command, deferred) {
|
||||
var treeJSON = JSON.stringify(this.mainVis.gitEngine.exportTree());
|
||||
var url =
|
||||
'https://learngitbranching.js.org/?NODEMO&command=importTreeNow%20' + escape(treeJSON);
|
||||
command.setResult(
|
||||
intl.todo('Here is a link to the current state of the tree: ') + url
|
||||
);
|
||||
command.finishWith(deferred);
|
||||
},
|
||||
|
||||
resetSolved: function(command, deferred) {
|
||||
LevelActions.resetLevelsSolved();
|
||||
command.addWarning(
|
||||
|
@ -253,6 +263,7 @@ var Sandbox = Backbone.View.extend({
|
|||
'importTreeNow': this.importTreeNow,
|
||||
'import level': this.importLevel,
|
||||
'importLevelNow': this.importLevelNow,
|
||||
'share permalink': this.sharePermalink,
|
||||
};
|
||||
|
||||
var method = commandMap[command.get('method')];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue