Skip to content

Commit

Permalink
feat: Implement widget flag for requesting interactive view
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Jan 15, 2024
1 parent e2b6224 commit 9ab82b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/components/NcRichText/NcReferenceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default {
type: Number,
default: 1,
},
interactive: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand All @@ -50,7 +54,12 @@ export default {
return this.values[0] ?? null
},
displayedReferences() {
return this.values.slice(0, this.limit)
return this.values.slice(0, this.limit).map(reference => {
return {
...reference,
interactive: this.interactive,
}
})
},
},
watch: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/NcRichText/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const registerWidget = (id, callback, onDestroy = (el) => {}) => {
}
}

const renderWidget = (el, { richObjectType, richObject, accessible }) => {
const renderWidget = (el, { richObjectType, richObject, accessible, interactive }) => {
if (richObjectType === 'open-graph') {
return
}
Expand All @@ -29,7 +29,7 @@ const renderWidget = (el, { richObjectType, richObject, accessible }) => {
return
}

window._vue_richtext_widgets[richObjectType].callback(el, { richObjectType, richObject, accessible })
window._vue_richtext_widgets[richObjectType].callback(el, { richObjectType, richObject, accessible, interactive })
}

const destroyWidget = (richObjectType, el) => {
Expand Down

0 comments on commit 9ab82b3

Please sign in to comment.