Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog #

## v2.2.2 (September 14, 2026) ##
## v2.2.2 (September 15, 2026) ##

- Feat: Organize media into folders in bulk — the media library list view now has a "Move to folder…" bulk action, and each user's folder sidebar remembers its own open/closed state.
- Tweak: The Video Editor's player preview now mirrors the real front-end control bar — skip buttons, volume panel, branding, and appearance settings — and restores skip buttons that were missing on older videos.
Expand Down
67 changes: 55 additions & 12 deletions assets/src/js/godam-player/utils/layer-registry.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,55 @@
/**
* Layer Registry
* Manages dynamic layer type registration for add-ons
*
* The registry store lives on `window` so every webpack bundle that imports
* this module shares ONE store. The main player build and the separate
* image-layers build each carry their own module-scoped copy of this file; a
* module-local store would give each build a private registry. Add-ons (e.g.
* the Woo layer) register once — into whichever build initialized
* `window.godamLayerRegistry` first (it drains the queue) — so with private
* stores the other build never sees that registration. The player reads its
* own copy via getLayerManager(), so on a page that had both a godam/video and
* a godam/image block, if the image build won the init race the player's store
* stayed empty and the video's Woo hotspots never rendered. A shared,
* window-backed store makes every copy of these functions read/write the same
* data, independent of bundle load order.
*/

// Internal registry for layer types, validators, and managers
const layerRegistry = {
types: {},
validators: {},
managers: {},
hooks: [],
};
const STORE_KEY = '__godamLayerRegistryStore';

/**
* Create an empty registry store.
*
* @return {Object} A fresh store for layer types, validators, managers and hooks.
*/
function createStore() {
return {
types: {},
validators: {},
managers: {},
hooks: [],
};
}

// Module-local fallback for non-browser contexts (SSR / unit tests with no
// window). In the browser the store is a singleton hung off `window`.
const fallbackStore = createStore();

/**
* Get the shared registry store.
*
* @return {Object} The window-backed store, or the module-local fallback when there is no `window`.
*/
function getStore() {
if ( typeof window === 'undefined' ) {
return fallbackStore;
}
if ( ! window[ STORE_KEY ] ) {
window[ STORE_KEY ] = createStore();
}
return window[ STORE_KEY ];
}

/**
* Register a new layer type
Expand All @@ -22,6 +62,8 @@ const layerRegistry = {
* @return {boolean} True if registration successful, false if already registered
*/
export function registerLayerType( id, config ) {
const layerRegistry = getStore();

if ( layerRegistry.types[ id ] ) {
// eslint-disable-next-line no-console
console.warn( `Layer type "${ id }" is already registered. Skipping duplicate registration.` );
Expand Down Expand Up @@ -59,6 +101,7 @@ export function registerLayerType( id, config ) {
* @return {Object} Object with all registered layer type IDs as keys
*/
export function getLayerTypes() {
const layerRegistry = getStore();
const defaultTypes = {
FORM: 'form',
CTA: 'cta',
Expand All @@ -79,7 +122,7 @@ export function getLayerTypes() {
* @return {Function|null} Validator function if found, null otherwise
*/
export function getLayerValidator( layerType ) {
return layerRegistry.validators[ layerType ] || null;
return getStore().validators[ layerType ] || null;
}

/**
Expand All @@ -89,7 +132,7 @@ export function getLayerValidator( layerType ) {
* @return {Function|null} Manager class if found, null otherwise
*/
export function getLayerManager( layerType ) {
return layerRegistry.managers[ layerType ] || null;
return getStore().managers[ layerType ] || null;
}

/**
Expand All @@ -99,7 +142,7 @@ export function getLayerManager( layerType ) {
* @return {boolean} True if layer type is registered
*/
export function isLayerTypeRegistered( layerType ) {
return !! layerRegistry.types[ layerType ] || [ 'form', 'cta', 'poll', 'hotspot' ].includes( layerType );
return !! getStore().types[ layerType ] || [ 'form', 'cta', 'poll', 'hotspot' ].includes( layerType );
}

/**
Expand All @@ -109,7 +152,7 @@ export function isLayerTypeRegistered( layerType ) {
* @param {Function} callback - Callback function to execute
*/
export function addLayerRegistryHook( callback ) {
layerRegistry.hooks.push( callback );
getStore().hooks.push( callback );
}

/**
Expand All @@ -119,6 +162,6 @@ export function addLayerRegistryHook( callback ) {
*/
export function getAllRegisteredLayerTypes() {
return {
...layerRegistry.types,
...getStore().types,
};
}
15 changes: 15 additions & 0 deletions inc/classes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,28 @@ public function register_blocks() {
// unscoped). Tie it to the block via wp_enqueue_block_style so WordPress
// prints it reliably whenever the block renders — including block themes /
// FSE, where a late wp_enqueue_style() from render.php is not printed.
//
// `godam-player-style` depends on `godam-player-wrapper-style` (the player
// placeholder / poster / aspect-ratio rules), a dependency declared where
// the player registers its scripts (class-godam-player.php), on
// `wp_enqueue_scripts`. On classic themes, `enqueue_block_assets` fires at
// the very start of `wp_enqueue_scripts`, so this block-style callback
// registers `godam-player-style` FIRST — and a later wp_register_style()
// for an already-registered handle is a silent no-op, which would drop the
// wrapper dependency. That left a page carrying both a godam/video and a
// godam/image block with the player's aspect-ratio CSS missing, so the
// video poster rendered at its natural (oversized) height. Declaring the
// same dependency here keeps it regardless of which registration wins the
// race; the wrapper handle itself is registered by the always-booted
// player shortcode class, so it resolves at print time.
if ( function_exists( 'wp_enqueue_block_style' ) ) {
$godam_player_css = RTGODAM_PATH . 'assets/build/css/godam-player.css';
wp_enqueue_block_style(
'godam/image',
array(
'handle' => 'godam-player-style',
'src' => RTGODAM_URL . 'assets/build/css/godam-player.css',
'deps' => array( 'godam-player-wrapper-style' ),
'path' => $godam_player_css,
'ver' => file_exists( $godam_player_css ) ? filemtime( $godam_player_css ) : RTGODAM_VERSION,
)
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
=== GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more ===
Contributors: rtcamp, elifvish, subodhrajpopat, kuldipchaudhary, prachigarg19, juzar, geekofshire, nazmulhassann20, joelabreo, mi5t4n, abhinavbelhekar03, gautam23, mukulsingh27, hbhalodia, kishu7270, opurockey, utsavladani, whiteshadow01, ahmarzaidi, im3dabasia1, rudrakshigupta, sabbir1991, shreyasikhar26, akrocks
Tags: transcoder, video, media library, folders, file manager
Expand Down Expand Up @@ -224,7 +224,7 @@

== Changelog ==

= v2.2.2 (September 14, 2026) =
= v2.2.2 (September 15, 2026) =

- Feat: Organize media into folders in bulk — the media library list view now has a "Move to folder…" bulk action, and each user's folder sidebar remembers its own open/closed state.
- Tweak: The Video Editor's player preview now mirrors the real front-end control bar — skip buttons, volume panel, branding, and appearance settings — and restores skip buttons that were missing on older videos.
Expand Down
Loading