Change hastags in the editor, first step

This commit is contained in:
Wolfgang Huß 2021-03-31 17:10:41 +02:00
parent 0a08b94446
commit b3f3e60b02
2 changed files with 7 additions and 4 deletions

View File

@ -22,21 +22,24 @@ export default class Hashtag extends TipTapMention {
...super.schema,
toDOM: (node) => {
// use a dummy domain because URL cannot handle relative urls
// Wolle const url = new URL('/', 'https://example.org')
// Wolle url.searchParams.append('hashtag', node.attrs.id)
const url = new URL('/', 'https://example.org')
url.searchParams.append('hashtag', node.attrs.id)
url.searchParams.append('search', '%23' + node.attrs.id)
return [
'a',
{
class: this.options.mentionClass,
href: `/${url.search}`,
href: `/search/search-results${url.search}`,
'data-hashtag-id': node.attrs.id,
target: '_blank',
// Wolle target: '_blank',
},
`${this.options.matcher.char}${node.attrs.label}`,
]
},
parseDOM: [
// Wolle make sure that correct html goe to the database! after editing a post now the new 'href' goes to the database and it gets inconsistant
{
tag: 'a[data-hashtag-id]',
getAttrs: (dom) => {

View File

@ -87,7 +87,7 @@ export default {
},
mixins: [postListActions],
data() {
const { hashtag = null } = this.$route.query
const { hashtag = null } = this.$route.query // Wolle remove with the rest?
return {
links,
posts: [],