Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NcRichContenteditable): register props globally for new Tribute #5268

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/components/NcRichContenteditable/NcRichContenteditable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,9 @@ export default {

const tributesCollection = []
tributesCollection.push({
// Allow spaces in the middle of mentions
allowSpaces: true,
fillAttr: 'id',
// Search against id and label (display name) (fallback to title for v8.0.0..8.6.1 compatibility)
lookup: result => `${result.id} ${result.label ?? result.title}`,
// Where to inject the menu popup
menuContainer: this.menuContainer,
// Popup mention autocompletion templates
menuItemTemplate: item => renderMenuItem(this.renderComponentHtml(item.original, NcAutoCompleteResult)),
// Hide if no results
Expand All @@ -585,8 +581,6 @@ export default {
// Don't use the tribute search function at all
// We pass search results as values (see below)
lookup: (result, query) => query,
// Where to inject the menu popup
menuContainer: this.menuContainer,
// Popup mention autocompletion templates
menuItemTemplate: item => {
if (textSmiles.includes(item.original)) {
Expand Down Expand Up @@ -635,8 +629,6 @@ export default {
// Don't use the tribute search function at all
// We pass search results as values (see below)
lookup: (result, query) => query,
// Where to inject the menu popup
menuContainer: this.menuContainer,
// Popup mention autocompletion templates
menuItemTemplate: item => renderMenuItem(`<img class="${this.$style['tribute-item__icon']}" src="${item.original.icon_url}"> <span class="${this.$style['tribute-item__title']}">${item.original.title}</span>`),
// Hide if no results
Expand All @@ -651,7 +643,13 @@ export default {
})
}

this.tribute = new Tribute({ collection: tributesCollection })
this.tribute = new Tribute({
collection: tributesCollection,
// Allow spaces in the middle of mentions
allowSpaces: true,
// Where to inject the menu popup
menuContainer: this.menuContainer,
})
this.tribute.attach(this.$refs.contenteditable)
},

Expand Down Expand Up @@ -1093,6 +1091,9 @@ export default {
.tribute-container {
z-index: 9000;
overflow: auto;
// Hide container root element while initialising
position: absolute;
left: -10000px;
// Space it out a bit from the text
margin: var(--default-grid-baseline) 0;
padding: var(--default-grid-baseline);
Expand Down