Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0f6322d
Step 1: Locate widget form inside the post-editor iframe
Misplon Apr 30, 2026
1f649b4
Step 2: Clone editor, quicktags, iris, wp-color-picker, jquery-touch-…
Misplon Apr 30, 2026
6fc88d1
Step 3: Make clone helper read source nodes from an explicit document
Misplon Apr 30, 2026
d039480
Step 4: Read clone sources from parent doc and only latch after succe…
Misplon Apr 30, 2026
3dfb537
Step 1: Restore PHP Asset Hook Baseline
Misplon May 3, 2026
d54b599
Step 2: Restore Clone Semantics, Keep Effect-Based Init
Misplon May 3, 2026
fa4f1b9
Step 3: Remove Repeater-Wide Iframe Broadcasts
Misplon May 3, 2026
c8be588
Step 5: Finish TinyMCE Identity Hardening
Misplon May 3, 2026
b4f56c4
Step 4: Cover Repeater TinyMCE Chrome In Iframe Editor
Misplon May 3, 2026
a50eecd
Step 3: Stabilize Repeater Field Setup Triggers
Misplon May 3, 2026
020d2ca
Step 5: Stabilize Site Editor TinyMCE Setup Timing
Misplon May 3, 2026
2037c00
Step 4: Stabilize Icon Picker Selection Coverage
Misplon May 3, 2026
fc310d8
Step 5: Stabilize Late Field Script Initialization
Misplon May 3, 2026
08f2a63
Step 5: Harden Date Range Iframe Bootstrap
Misplon May 3, 2026
ae4c8e0
Step 1: Add dynamic TinyMCE external-plugin asset cloning
Misplon May 6, 2026
6062d22
Step 2: Add conditional Premium regression coverage
Misplon May 6, 2026
d115451
Step 3: Clone TinyMCE external-plugin dependencies
Misplon May 7, 2026
1c71fce
Step 1: Harden TinyMCE initialized detection
Misplon May 8, 2026
e61c67b
Step 2: Make iframe asset cloning per-frame
Misplon May 8, 2026
e5999ae
Step 3: Clean up delayed iframe form init messages
Misplon May 8, 2026
83032b0
Step 4: Narrow repeater visibility setup
Misplon May 8, 2026
8481857
Step 3: Avoid latching skipped iframe form init
Misplon May 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 87 additions & 7 deletions base/inc/fields/js/date-range-field.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
/* global jQuery, pikaday */
( function( factory ) {
let initialized = false;
const bootstrap = function() {
if ( initialized || typeof window.jQuery === 'undefined' ) {
return initialized;
}

initialized = true;
factory( window.jQuery );

return true;
};

if ( ! bootstrap() ) {
let attempts = 0;
const interval = setInterval( function() {
attempts++;

if ( bootstrap() || attempts >= 40 ) {
clearInterval( interval );
}
}, 50 );

document.addEventListener( 'DOMContentLoaded', bootstrap );
}
} )( function( $ ) {
let dateRangeSetupAttempts = 0;
let dateRangeSetupScheduled = false;
const scheduleInitializeDateRangeFields = function() {
if ( dateRangeSetupScheduled || dateRangeSetupAttempts >= 40 ) {
return;
}

dateRangeSetupAttempts++;
dateRangeSetupScheduled = true;
setTimeout( function() {
dateRangeSetupScheduled = false;
initializeDateRangeFields();
}, 100 );
};

( function( $ ) {
const setupDateRangeField = function( e ) {
const $dateRangeField = $( this );
const valField = $dateRangeField.find( 'input[type="hidden"][class="siteorigin-widget-input"]' );
Expand All @@ -10,6 +48,10 @@
}

if ( $dateRangeField.find( '[class*="sowb-specific-date"]' ).length > 0 ) {
if ( typeof window.Pikaday === 'undefined' ) {
scheduleInitializeDateRangeFields();
return;
}

const createPikadayInput = function( inputName, initVal ) {
const $field = $dateRangeField.find( '.' + inputName + '-picker' );
Expand Down Expand Up @@ -44,7 +86,7 @@
valField.trigger( 'change', { silent: true } );
};

const picker = new Pikaday( {
const picker = new window.Pikaday( {
field: $field[0],
blurFieldOnSelect: false,
toString: dateToString,
Expand Down Expand Up @@ -125,12 +167,50 @@
$( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-date-range', setupDateRangeField );
}

const initializeDateRangeFields = function() {
$( '.siteorigin-widget-field-type-date-range' ).each( function() {
setupDateRangeField.call( this );
} );
};

// Add support for the Site Editor.
window.addEventListener( 'message', function( e ) {
if ( e.data && e.data.action === 'sowbBlockFormInit' ) {
$( '.siteorigin-widget-field-type-date-range' ).each( function() {
setupDateRangeField.call( this );
} );
initializeDateRangeFields();
}
} );
} )( jQuery );

if ( window.frameElement ) {
$( document ).on( 'sowsetupformfield', '.siteorigin-widget-field-type-date-range', setupDateRangeField );
$( initializeDateRangeFields );

if ( window.MutationObserver ) {
$( function() {
if ( ! document.body ) {
return;
}

const observer = new MutationObserver( ( mutations ) => {
mutations.forEach( ( mutation ) => {
$( mutation.addedNodes ).each( function() {
const $node = $( this );

if ( $node.is( '.siteorigin-widget-field-type-date-range' ) ) {
setupDateRangeField.call( this );
}

$node.find( '.siteorigin-widget-field-type-date-range' ).each( function() {
setupDateRangeField.call( this );
} );
} );
} );
} );

observer.observe( document.body, {
childList: true,
subtree: true,
} );
} );
}
}
} );
Loading