Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix linting
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Aug 25, 2022
commit a84270bb37d5bfffe1162ae4da74e5bd9c06c043
2 changes: 1 addition & 1 deletion src/components/Mention/AutoCompleteResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ $autocomplete-padding: 10px;
}
}

</style>
</style>
7 changes: 3 additions & 4 deletions src/components/Mention/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<div v-for="({ id, label }, index) in items"
:key="index"
:class="id === selectedIndex ? 'highlight' : null">
<AutoCompleteResult
:id="id"
<AutoCompleteResult :id="id"
:label="label"
icon="icon-user"
source="users"
Expand All @@ -20,7 +19,7 @@
</template>

<script>
import AutoCompleteResult from "./AutoCompleteResult.vue";
import AutoCompleteResult from './AutoCompleteResult.vue'
export default {
components: {
AutoCompleteResult,
Expand Down Expand Up @@ -120,4 +119,4 @@ export default {
border-color: #000;
}
}
</style>
</style>
6 changes: 3 additions & 3 deletions src/components/Mention/suggestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { generateUrl } from '@nextcloud/router'
import tippy from 'tippy.js'
import List from './List.vue'

const USERS_LIST_ENDPOINT_URL = generateUrl('apps/text/api/v1/users');
const USERS_LIST_ENDPOINT_URL = generateUrl('apps/text/api/v1/users')

export default {
items: async ({ query }) => {
const params = { filter: query }
const response = await axios.post(USERS_LIST_ENDPOINT_URL, params)
const users = JSON.parse(JSON.stringify(response.data))
let result = []
const result = []

Object.keys(users).map(key => result.push({
id: key,
Expand Down Expand Up @@ -75,4 +75,4 @@ export default {
},
}
},
}
}
26 changes: 13 additions & 13 deletions src/extensions/Mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ const getAvatarUrl = (user, size) => {
user,
size,
})
};
}

export default TipTapMention.extend({
parseHTML() {
return [
{
tag: `span[data-type="user"]`,
getAttrs: element => ((element.getAttribute('data-type') === "user")
&& (element.getAttribute('class') === "mention")
tag: 'span[data-type="user"]',
getAttrs: element => ((element.getAttribute('data-type') === 'user')
&& (element.getAttribute('class') === 'mention')
&& null),
priority: 100,
},
Expand All @@ -29,13 +29,13 @@ export default TipTapMention.extend({
'span',
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
'data-type': this.name,
'class': 'mention-bubble mention-bubble--primary',
'contenteditable': false,
class: 'mention-bubble mention-bubble--primary',
contenteditable: false,
}),
[
'span',
{
'class': 'mention-bubble__wrapper',
class: 'mention-bubble__wrapper',
},
[
'span',
Expand All @@ -45,16 +45,16 @@ export default TipTapMention.extend({
[
'span',
{
'class': `mention-bubble__icon mention-bubble__icon--with-avatar`,
'style': avatarUrl ? `background-image: url('${avatarUrl}')` : '',
class: 'mention-bubble__icon mention-bubble__icon--with-avatar',
style: avatarUrl ? `background-image: url('${avatarUrl}')` : '',
},
],
[
'span',
{
'role': 'heading',
'class': 'mention-bubble__title',
'title': node.attrs.id,
role: 'heading',
class: 'mention-bubble__title',
title: node.attrs.id,
},
],
],
Expand All @@ -67,4 +67,4 @@ export default TipTapMention.extend({
state.write(`@[${node.attrs.id}](mention://user/${node.attrs.id})`)
state.write(' ')
},
});
})
2 changes: 1 addition & 1 deletion src/extensions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Markdown from './Markdown.js'
import PlainText from './PlainText.js'
import RichText from './RichText.js'
import KeepSyntax from './KeepSyntax.js'
import Mention from './Mention'
import Mention from './Mention.js'

export {
Emoji,
Expand Down