Resolves #488 -- make https-y things links in the console

This commit is contained in:
Peter Cottle 2018-10-19 15:08:14 +09:00
parent 85ae115fc2
commit c801f9ed46
2 changed files with 21 additions and 9 deletions

View file

@ -100,6 +100,17 @@ var CommandView = React.createClass({
var paragraphs = this.state.result.split("\n"); var paragraphs = this.state.result.split("\n");
var result = []; var result = [];
for (var i = 0; i < paragraphs.length; i++) { for (var i = 0; i < paragraphs.length; i++) {
if (paragraphs[i].startsWith('https://')) {
result.push(
<a
href={paragraphs[i]}
key={'paragraph_' + i}
dangerouslySetInnerHTML={{
__html: paragraphs[i]
}}
/>
);
} else {
result.push( result.push(
<p <p
key={'paragraph_' + i} key={'paragraph_' + i}
@ -109,6 +120,7 @@ var CommandView = React.createClass({
/> />
); );
} }
}
return ( return (
<div className={'commandLineResult'}> <div className={'commandLineResult'}>
{result} {result}

View file

@ -228,7 +228,7 @@ var Sandbox = Backbone.View.extend({
var url = var url =
'https://learngitbranching.js.org/?NODEMO&command=importTreeNow%20' + escape(treeJSON); 'https://learngitbranching.js.org/?NODEMO&command=importTreeNow%20' + escape(treeJSON);
command.setResult( command.setResult(
intl.todo('Here is a link to the current state of the tree: ') + url intl.todo('Here is a link to the current state of the tree: ') + '\n' + url
); );
command.finishWith(deferred); command.finishWith(deferred);
}, },