content icon indicating copy to clipboard operation
content copied to clipboard

How can I programmatically disable and enable liveEdit ?

Open azataiot opened this issue 4 years ago • 4 comments

How can I programmatically disable and enable liveEdit ? (So that I can use nuxt-content together with nuxt-auth, allowing only the authenticated people to live edit the content of the page?)

azataiot avatar Sep 04 '21 15:09 azataiot

@azataiot

There is currently no way to change liveEdit option dynamically in runtime (if I'm correct, this is same for all the options in nuxt.config.js).

One possible way would be to modify nuxt-content.dev.vue (link) to receive a prop like editable so that ancestor component of NuxtContent can have a control on the edit feature in runtime, with liveEdit enabled globally.

nozomuikuta avatar Sep 05 '21 06:09 nozomuikuta

as I know we can dynamically control the $vuetify object. For example we can enable or disable the dark them. The vuetify also is inside the config file but it can....

azataiot avatar Sep 05 '21 10:09 azataiot

@azataiot

Excuse me, I didn't know the case of Vuetify. As a result of quick research, you are right and it's possible to change properties of Vuetify instance. $vuetify object is an instance of Vue.observable(), so every component referring to same observable can be updated once (link).

Still, the fact is unfortunately that Nuxt Content doesn't support such feature at the moment.

Nuxt Content determines whether it installs Nuxt Content component with Editor component in build time, according to watch and liveEdit option (link).

nozomuikuta avatar Sep 05 '21 13:09 nozomuikuta

could it be possible to expose vue-content as it like vuetify so that we can dynamically enable and disable it's options ? (make some configurations based on user actions, authentications etc)

azataiot avatar Sep 06 '21 10:09 azataiot