/** * Theme Builder preview context handler. * * Adjusts the Elementor preview to properly display dynamic widgets * in the context of Theme Builder templates. * * @package King_Addons */ (function ($) { 'use strict'; /** * Apply preview context adjustments for Theme Builder widgets. * * @param {jQuery} $scope The widget element scope. */ const applyPreviewContext = ($scope) => { // Theme Builder widgets that need special handling in preview const tbWidgets = [ 'king-addons-tb-post-title', 'king-addons-tb-post-content', 'king-addons-tb-post-excerpt', 'king-addons-tb-featured-image', 'king-addons-tb-post-meta', 'king-addons-tb-author-box', 'king-addons-tb-post-comments', 'king-addons-tb-post-navigation', 'king-addons-tb-post-taxonomies', 'king-addons-tb-related-posts', 'king-addons-tb-archive-title', 'king-addons-tb-archive-description', 'king-addons-tb-archive-posts', 'king-addons-tb-archive-pagination', 'king-addons-tb-archive-result-count', 'king-addons-tb-404-title', 'king-addons-tb-404-description', 'king-addons-tb-404-search-form', 'king-addons-tb-back-to-home' ]; // Check if this is a TB widget const widgetType = $scope.data('widget_type'); if (!widgetType) { return; } const widgetName = widgetType.split('.')[0]; if (!tbWidgets.includes(widgetName)) { return; } // Add a visual indicator for TB widgets in editor if (!$scope.find('.ka-tb-preview-notice').length) { const $notice = $('