Skip to content

Commit

Permalink
Merge pull request #5118 from nextcloud-libraries/fix/nc-actions--sup…
Browse files Browse the repository at this point in the history
…port-new-slots-api

fix(NcActions): use new slots api
  • Loading branch information
susnux committed Jan 23, 2024
2 parents 99aebc3 + b94ff04 commit d244701
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/mixins/actionGlobal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import Vue from 'vue'

export default {
before() {
// all actions requires a valid text content
// if none, forbid the component mount and throw error
if (!this.$slots.default || this.text.trim() === '') {
Vue.util.warn(`${this.$options.name} cannot be empty and requires a meaningful text content`, this)
this.$destroy()
this.$el.remove()
}
},

beforeUpdate() {
this.text = this.getText()
},
Expand All @@ -52,7 +40,7 @@ export default {

methods: {
getText() {
return this.$slots.default ? this.$slots.default[0].text.trim() : ''
return this.$scopedSlots.default ? this.$scopedSlots.default()?.[0].text.trim() : ''
},
},
}

0 comments on commit d244701

Please sign in to comment.