Add mentions to message and Markdown to profiles
This commit is contained in:
parent
b938e3d702
commit
d8001e6d76
@ -35,6 +35,7 @@
|
||||
"ssb-logging": "^1.0.0",
|
||||
"ssb-markdown": "^5.0.2",
|
||||
"ssb-master": "^1.0.3",
|
||||
"ssb-mentions": "^0.5.0",
|
||||
"ssb-msgs": "^5.2.0",
|
||||
"ssb-no-auth": "^1.0.0",
|
||||
"ssb-onion": "^1.0.0",
|
||||
|
@ -239,3 +239,10 @@ summary {
|
||||
margin: 1rem 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.md-mention {
|
||||
-moz-user-select: all;
|
||||
-ms-user-select: all;
|
||||
-webkit-user-select: all;
|
||||
user-select: all;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ module.exports = async function (feedId) {
|
||||
const avatarUrl = `/image/128/${encodeURIComponent(image)}`
|
||||
|
||||
return authorView({
|
||||
feedId,
|
||||
messages,
|
||||
name,
|
||||
description,
|
||||
|
@ -17,6 +17,7 @@ module.exports = async function () {
|
||||
const avatarUrl = `/image/64/${encodeURIComponent(image)}`
|
||||
|
||||
return authorView({
|
||||
feedId,
|
||||
messages,
|
||||
name,
|
||||
description,
|
||||
|
@ -1,11 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
const post = require('./models/post')
|
||||
const ssbMentions = require('ssb-mentions')
|
||||
|
||||
module.exports = async function ({ message, text }) {
|
||||
|
||||
const mentions = ssbMentions(text) || undefined
|
||||
return post.publish({
|
||||
root: message,
|
||||
branch: message,
|
||||
text
|
||||
text,
|
||||
mentions
|
||||
})
|
||||
}
|
||||
|
@ -1,24 +1,32 @@
|
||||
'use strict'
|
||||
const template = require('./components/template')
|
||||
const highlightJs = require('highlight.js')
|
||||
const post = require('./components/post')
|
||||
|
||||
const {
|
||||
article,
|
||||
header,
|
||||
img,
|
||||
h1,
|
||||
section
|
||||
section,
|
||||
pre
|
||||
} = require('hyperaxe')
|
||||
|
||||
module.exports = ({ avatarUrl, name, description, messages }) => {
|
||||
const template = require('./components/template')
|
||||
|
||||
module.exports = ({ avatarUrl, name, description, messages, feedId }) => {
|
||||
const markdownMention = highlightJs.highlight('markdown', `[${name}](${feedId})`).value
|
||||
|
||||
const prefix = section({ class: 'message' },
|
||||
header({ class: 'profile' },
|
||||
img({ class: 'avatar', src: avatarUrl }),
|
||||
h1(name)
|
||||
),
|
||||
pre({
|
||||
class: 'md-mention',
|
||||
innerHTML: markdownMention
|
||||
}),
|
||||
description !== '<p>null</p>\n'
|
||||
? article({ innerHTML: description })
|
||||
: null
|
||||
: null,
|
||||
)
|
||||
|
||||
return template(
|
||||
|
15
yarn.lock
15
yarn.lock
@ -6025,11 +6025,24 @@ ssb-markdown@^5.0.2:
|
||||
markdown-it-hashtag "^0.4.0"
|
||||
node-emoji "^1.10.0"
|
||||
|
||||
ssb-marked@^0.7.0:
|
||||
version "0.7.4"
|
||||
resolved "https://registry.yarnpkg.com/ssb-marked/-/ssb-marked-0.7.4.tgz#31714f16548531c99a03a24e22c7e1ebbbce7875"
|
||||
integrity sha1-MXFPFlSFMcmaA6JOIsfh67vOeHU=
|
||||
|
||||
ssb-master@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/ssb-master/-/ssb-master-1.0.3.tgz#0d33e9ead15a97cd9b0b7b1773c6227757b93aea"
|
||||
integrity sha512-N1Cxm9WscGD9VEZrWbF2amyQai2U2g9gtq57W5zTqbhlQTLUUvl84U9A6fg6GPkECnUXadulnTw+mMYVkLLHjQ==
|
||||
|
||||
ssb-mentions@^0.5.0:
|
||||
version "0.5.0"
|
||||
resolved "https://registry.yarnpkg.com/ssb-mentions/-/ssb-mentions-0.5.0.tgz#6cef859594455308ed267d41a1f38e46ef9624a4"
|
||||
integrity sha512-tXFr8CSNPKwCkRftm8Z0H5mXhfHLNhwNgo7PdR8GobxCSSoaHXfxsGbAJVKDl/kCkgL92nPidS3SlsFqtjFE7Q==
|
||||
dependencies:
|
||||
ssb-marked "^0.7.0"
|
||||
ssb-ref "^2.11.0"
|
||||
|
||||
ssb-msgs@^5.0.0, ssb-msgs@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ssb-msgs/-/ssb-msgs-5.2.0.tgz#c681da5cd70c574c922dca4f03c521538135c243"
|
||||
@ -6094,7 +6107,7 @@ ssb-query@^2.4.2:
|
||||
flumeview-query "^7.0.0"
|
||||
pull-stream "^3.6.2"
|
||||
|
||||
ssb-ref@^2.0.0, ssb-ref@^2.12.0, ssb-ref@^2.13.3, ssb-ref@^2.13.9, ssb-ref@^2.3.0, ssb-ref@^2.6.2, ssb-ref@^2.7.1, ssb-ref@^2.9.0, ssb-ref@^2.9.1:
|
||||
ssb-ref@^2.0.0, ssb-ref@^2.11.0, ssb-ref@^2.12.0, ssb-ref@^2.13.3, ssb-ref@^2.13.9, ssb-ref@^2.3.0, ssb-ref@^2.6.2, ssb-ref@^2.7.1, ssb-ref@^2.9.0, ssb-ref@^2.9.1:
|
||||
version "2.13.9"
|
||||
resolved "https://registry.yarnpkg.com/ssb-ref/-/ssb-ref-2.13.9.tgz#1de8c5b4f12e5b743be95705656ad2706c0e3cd0"
|
||||
integrity sha512-TfatNqLvoP+eW/pMIbCmNcaoDq4R2k8jCtWkwDKx4AtluN/LwtyP931d5Mh+2gmzA04W7kxkr6f5ENGgdadMYg==
|
||||
|
Loading…
Reference in New Issue
Block a user