Extend markdown support for LBRY urls #2521

Merged
btzr-io merged 27 commits from smart-links into master 2019-06-26 07:23:39 +02:00
Showing only changes of commit d6fae5c6ee - Show all commits

View file

@ -11,11 +11,12 @@ const createURI = (text, uri) => ({
children: [{ type: 'text', value: text }],
});
const validateURI = (match) => {
const validateURI = (match, eat) => {
if (match) {
try {
const text = match[0];
const uri = parseURI(text);
console.info(text);
// Create channel link
if (uri.isChannel) {
return eat(text)(createURI(uri.claimName, text));
@ -26,18 +27,18 @@ const validateURI = (match) => {
// Silent errors: console.error(err)
}
}
}
};
// Generate a markdown link from channel name
function tokenizeMention(eat, value, silent) {
const match = /^@(\w+)/.exec(value);
return validateURI(match);
return validateURI(match, eat);
}
// Generate a markdown link from lbry url
function tokenizeURI(eat, value, silent) {
const match = /^(lbry:\/\/)+([A-z0-9-_#@])+/.exec(value);
return validateURI(match);
const match = /^(lbry:\/\/)+([A-z0-9-_#@:])+/.exec(value);
return validateURI(match, eat);
}
neb-b commented 2019-06-12 17:31:49 +02:00 (Migrated from github.com)
Review

This should use regexValidUri and isValidUri() from lbry-redux

This should use `regexValidUri` and `isValidUri()` from `lbry-redux`
btzr-io commented 2019-06-13 07:21:13 +02:00 (Migrated from github.com)
Review

I can't find regexValidUri, did you mean regexInvalidURI ?
https://github.com/lbryio/lbry-redux/blob/master/src/lbryURI.js#L5

I can't find `regexValidUri`, did you mean `regexInvalidURI` ? https://github.com/lbryio/lbry-redux/blob/master/src/lbryURI.js#L5
btzr-io commented 2019-06-13 08:26:41 +02:00 (Migrated from github.com)
Review
this? https://github.com/lbryio/lbry-redux/blob/master/src/lbryURI.js#L32
neb-b commented 2019-06-17 18:18:52 +02:00 (Migrated from github.com)
Review

whoops. yes

whoops. yes
btzr-io commented 2019-06-20 23:29:07 +02:00 (Migrated from github.com)
Review

@seanyesmunt not sure how this is done on reach-ui tooltip 🙃

I mean the delay time to show / hide.

@seanyesmunt not sure how this is done on reach-ui tooltip :upside_down_face: I mean the delay time to show / hide.
btzr-io commented 2019-06-21 03:34:55 +02:00 (Migrated from github.com)
Review

this is are already implemented inside parseURI:
b7adc597e2/src/ui/util/remark-lbry.js (L23)

this is are already implemented inside `parseURI`: https://github.com/lbryio/lbry-desktop/blob/b7adc597e232f95dea200a6f49bf5d17c1af102c/src/ui/util/remark-lbry.js#L23
// Configure tokenizer for lbry urls