Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
Resolving #3 Preview Images Missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jameelmoses committed Dec 2, 2019
1 parent 266ce3b commit 6673b97
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions assets/js/acf-flexible-content-preview.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Delete the flexible content preview popup if only one layout
$(document).ready(function($) {
jQuery(document).ready(function(jQuery) {
var flexible_content_open = acf.getField('acf-field-flexible-content');
flexible_content_open._open = function(e) {
var $popup = $(this.$el.children('.tmpl-popup').html());
var $popup = jQuery(this.$el.children('.tmpl-popup').html());
if ($popup.find('a').length == 1) {
// Only one layout
flexible_content_open.add($popup.find('a').attr('data-layout'));
Expand All @@ -13,11 +13,11 @@ $(document).ready(function($) {
});

// Transform a link into a div for styling purpose
$('body').on('click', 'a[data-name="add-layout"]', function() {
jQuery('body').on('click', 'a[data-name="add-layout"]', function() {
setTimeout(function() {
$('.acf-fc-popup a').each(function() {
var html = '<div class="acf-fc-popup-label">' + $(this).text() + '</div><div class="acf-fc-popup-image"></div>';
$(this).html(html);
jQuery('.acf-fc-popup a').each(function() {
var html = '<div class="acf-fc-popup-label">' + jQuery(this).text() + '</div><div class="acf-fc-popup-image"></div>';
jQuery(this).html(html);
});
}, 0);
});

0 comments on commit 6673b97

Please sign in to comment.