diff --git a/examples/Components/Routes/Mentions/index.vue b/examples/Components/Routes/Suggestions/index.vue
similarity index 80%
rename from examples/Components/Routes/Mentions/index.vue
rename to examples/Components/Routes/Suggestions/index.vue
index ec756fcd..e9d700df 100644
--- a/examples/Components/Routes/Mentions/index.vue
+++ b/examples/Components/Routes/Suggestions/index.vue
@@ -4,10 +4,13 @@
- Mentions
+ Suggestions
- Yeah Philipp Kühn and Hans Pagel.
+ Sometimes it's useful to mention someone. That's a feature we're very used to. Under the hood this technique can also be used for other features likes hashtags and commands – lets call it suggestions.
+
+
+ This is an example how to mention some users like Philipp Kühn or Hans Pagel. Try to type @ and a popup (rendered with tippy.js) will appear. You can navigate with arrow keys through a list of suggestions.
@@ -40,6 +43,9 @@ import {
HardBreakNode,
HeadingNode,
MentionNode,
+ CodeMark,
+ BoldMark,
+ ItalicMark,
} from 'tiptap-extensions'
export default {
@@ -62,25 +68,33 @@ export default {
name: 'Hans Pagel',
id: 2,
},
+ {
+ name: 'Kris Siepert',
+ id: 3,
+ },
+ {
+ name: 'Justin Schüler',
+ id: 4,
+ },
],
onEnter: ({ items, query, range, command, virtualNode }) => {
this.query = query
this.filteredUsers = items
this.pos = range
this.insertMention = command
- this.renderDropdown(virtualNode)
+ this.renderPopup(virtualNode)
},
onChange: ({ items, query, range, virtualNode }) => {
this.query = query
this.filteredUsers = items
this.pos = range
- this.renderDropdown(virtualNode)
+ this.renderPopup(virtualNode)
},
onExit: () => {
this.query = null
this.filteredUsers = []
this.pos = null
- this.destroyDropdown()
+ this.destroyPopup()
},
onKeyDown: ({ event }) => {
// pressing up arrow
@@ -116,6 +130,9 @@ export default {
return fuse.search(query)
},
}),
+ new CodeMark(),
+ new BoldMark(),
+ new ItalicMark(),
],
query: null,
pos: null,
@@ -147,12 +164,12 @@ export default {
},
})
},
- renderDropdown(node) {
- if (this.dropdown) {
+ renderPopup(node) {
+ if (this.popup) {
return
}
- this.dropdown = tippy(node, {
+ this.popup = tippy(node, {
content: this.$refs.suggestions,
trigger: 'mouseenter',
interactive: true,
@@ -166,10 +183,10 @@ export default {
arrowType: 'round',
})
},
- destroyDropdown() {
- if (this.dropdown) {
- this.dropdown.destroyAll()
- this.dropdown = null
+ destroyPopup() {
+ if (this.popup) {
+ this.popup.destroyAll()
+ this.popup = null
}
},
},
@@ -215,7 +232,6 @@ export default {
}
.tippy-tooltip.dark-theme {
-
background-color: $color-black;
padding: 0;
font-size: 1rem;
@@ -246,6 +262,5 @@ export default {
.tippy-popper[x-placement^=right] & .tippy-arrow {
border-right-color: $color-black;
}
-
}
diff --git a/examples/Components/Subnavigation/index.vue b/examples/Components/Subnavigation/index.vue
index 162ee95c..7f1305cf 100644
--- a/examples/Components/Subnavigation/index.vue
+++ b/examples/Components/Subnavigation/index.vue
@@ -33,8 +33,8 @@