docs(fluent-editor): add mention module demo (#1888)
This commit is contained in:
parent
7602aa28bf
commit
e519280059
|
@ -16,6 +16,21 @@ const TOOLBAR_CONFIG = [
|
|||
['fullscreen', 'emoji', 'help', 'screenshot'],
|
||||
]
|
||||
|
||||
// @提醒
|
||||
const searchKey = 'name'
|
||||
const mentionList = [
|
||||
{
|
||||
name: 'Jack',
|
||||
age: 26,
|
||||
cn: 'Jack 杰克'
|
||||
},
|
||||
{
|
||||
name: 'Lucy',
|
||||
age: 22,
|
||||
cn: 'Lucy 露西'
|
||||
}
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
editor = new FluentEditor('#editor', {
|
||||
theme: 'snow',
|
||||
|
@ -23,6 +38,15 @@ onMounted(() => {
|
|||
toolbar: {
|
||||
container: TOOLBAR_CONFIG
|
||||
},
|
||||
mention: {
|
||||
itemKey: 'cn',
|
||||
searchKey,
|
||||
search: function(term) {
|
||||
return mentionList.filter(item => {
|
||||
return item[searchKey] && String(item[searchKey]).includes(term)
|
||||
})
|
||||
}
|
||||
},
|
||||
file: true
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue