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

View file

@ -228,7 +228,7 @@ var Sandbox = Backbone.View.extend({
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
intl.todo('Here is a link to the current state of the tree: ') + '\n' + url
);
command.finishWith(deferred);
},