- md5
- f62b2dea4bf48be8a4d6f0bdf5ea7094
- sha1
- 8d5de569811d201bec4f5b4f061663359f9ed9e2
- sha256
- 7346672a4cc13808f0501bea2c912053bbfb715610ea5e628791cdef980b7f2d
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
<template>
<div class="media-modal-backdrop" @click="close()">
<div class="modal" @click.stop style="display: flex">
<tab-lock>
<slot name="backdrop-close"></slot>
<div class="modal-dialog" :class="modalClass" role="dialog" :aria-labelledby="labelElement">
<div class="modal-content">
<div class="modal-header">
<slot name="header"></slot>
<button type="button" v-if="showClose" class="close" @click="close()"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<slot name="body"></slot>
</div>
<div class="modal-footer">
<slot name="footer"></slot>
</div>
</div>
</div>
</tab-lock>
</div>
</div>
</template>
<script>
export default {
name: 'media-modal',
props: {
/* Whether or not the close button in the header should be shown */
showClose: {
type: Boolean,
default: true,
},
/* The size of the modal */
size: {
type: String,
},
labelElement: {
type: String,
required: true
}
},
computed: {
/* Get the modal css class */
modalClass() {
return {
'modal-sm': this.size === 'sm',
}
},
},
methods: {
/* Close the modal instance */
close() {
this.$emit('close');
},
/* Handle keydown events */
onKeyDown(event) {
if (event.keyCode === 27) {
this.close();
}
}
},
mounted() {
// Listen to keydown events on the document
document.addEventListener("keydown", this.onKeyDown);
},
beforeDestroy() {
// Remove the keydown event listener
document.removeEventListener('keydown', this.onKeyDown);
},
}
</script>
The same content is in 4 releases, Joomla 4.0.0-alpha9 to 4.0.0-alpha12. See them all, or every version of this file.