aico-image-editor
Version:
Combine multiple image into and create single combined image
29 lines • 1.2 kB
JavaScript
Alpine.data('tooltip', () => ({
tooltipInstance: null,
init() {
let self = this;
this.$nextTick(() => {
if(!window.bootstrap) {
const Tooltip = require('bootstrap/js/dist/tooltip');
self.tooltipInstance = new Tooltip(this.$el, {
container: self.$el
});
} else {
self.tooltipInstance = new bootstrap.Tooltip(this.$el, {
container: self.$el
})
}
})
window.addEventListener('language-updated', function(event) {
self.$nextTick(() => {
// this is bootstrap 5.1.3 way of updating bootstrap tooltip where nothing is available to properly update it
// and reinitialization is not needed
//self.$el.setAttribute('data-bs-original-title', self.$el.title)
if(self.tooltipInstance) {
self.tooltipInstance._config.title = self.$el.title;
self.tooltipInstance?.update();
}
})
}.bind(this))
}
}))