button positionning
This commit is contained in:
parent
22b5e75fde
commit
4b0663ecfd
3 changed files with 52 additions and 104 deletions
|
|
@ -1,29 +1,6 @@
|
|||
(function($) {
|
||||
$(document).ready(function() {
|
||||
// Funktion zum Hinzufügen des Buttons unter das Beschriftungsfeld
|
||||
const positionButton = () => {
|
||||
const captionFields = [
|
||||
$('#attachment-details-two-column-caption'),
|
||||
$('#attachment-details-caption'),
|
||||
$('#attachment_caption')
|
||||
];
|
||||
|
||||
captionFields.forEach(field => {
|
||||
if (field.length && !field.next('#openModal').length) {
|
||||
const buttonHtml = '<div id="openModal" class="bg-blue-500 text-white px-4 py-2 rounded-md">Bildrechte</div>';
|
||||
field.after(buttonHtml);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$('#attachment_caption').ready(positionButton);
|
||||
|
||||
// Event-Listener für das Öffnen der Mediathek
|
||||
$(document).on('click change focus keydown mousedown resize', '.media-modal .attachment, .upload-files-button, .attachment-info, .media-button, .edit-attachment', function() {
|
||||
setTimeout(positionButton, 1); // Warte, bis die Mediathek geladen ist
|
||||
});
|
||||
|
||||
// Event-Listener für das Öffnen des Modals
|
||||
// Event-Listener für das Öffnen des Modals
|
||||
$(document).on('click', '#openModal', function() {
|
||||
$('#modal').removeClass('hidden');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue