diff --git a/Resources/Private/Fusion/Helper/Assets.fusion b/Resources/Private/Fusion/Helper/Assets.fusion new file mode 100644 index 0000000..73650fa --- /dev/null +++ b/Resources/Private/Fusion/Helper/Assets.fusion @@ -0,0 +1,29 @@ +prototype(Jonnitto.PrettyEmbed:Assets) < prototype(Neos.Fusion:Component) { + @propTypes { + player = ${PropTypes.oneOf(['YouTube', 'Vimeo', 'Video', 'Audio']).isRequired} + gdprHandling = ${PropTypes.oneOf([true, false, 'popup'])} + includeAlpineJsCheck = ${PropTypes.boolean} + inBackend = ${PropTypes.boolean} + } + + debug = ${Configuration.setting('Jonnitto.PrettyEmbed.debug')} + includeAssets = ${Configuration.setting('Jonnitto.PrettyEmbed.includeAssets')} + includeAlpineJsCheck = ${Configuration.setting('Jonnitto.PrettyEmbed.includeAlpineJsCheck')} + inBackend = ${node.context.inBackend && node.context.currentRenderingMode.edit} + + // This decides which file to load + player = null + + renderer = Carbon.FileLoader:Component { + package = 'Jonnitto.PrettyEmbedHelper' + css = ${props.includeAssets.css ? 'Main.css' : null} + js = ${[props.inBackend ? 'Backend.js' : null, props.debug ? 'Debug.js' : null]} + mjs = Neos.Fusion:DataStructure { + gdprPlugin = ${props.gdprHandling == true ? 'Consent.js' : null} + magicPlugin = ${props.player == 'Video' || props.player == 'Audio' || props.gdprHandling != 'Popup' ? 'Methods.js' : null} + popupPlugin = ${props.gdprHandling ? 'Popup.js' : null} + pluginBasedOnPlayer = ${props.player == 'Video' || props.player == 'Audio' ? 'Media.js' : (props.player + '.js')} + alpineJsCheck= ${props.includeAlpineJsCheck ? 'AlpineCheck.js' : null} + } + } +} diff --git a/Resources/Private/Fusion/Helper/Assets/Assets.fusion b/Resources/Private/Fusion/Helper/Assets/Assets.fusion deleted file mode 100644 index b46482b..0000000 --- a/Resources/Private/Fusion/Helper/Assets/Assets.fusion +++ /dev/null @@ -1,57 +0,0 @@ -prototype(Jonnitto.PrettyEmbed:Assets) < prototype(Neos.Fusion:Component) { - @propTypes { - player = ${PropTypes.oneOf(['YouTube', 'Vimeo', 'Video', 'Audio']).isRequired} - gdprHandling = ${PropTypes.oneOf([true, false, 'popup'])} - includeAlpineJsCheck = ${PropTypes.boolean} - inBackend = ${PropTypes.boolean} - } - - debug = ${Configuration.setting('Jonnitto.PrettyEmbed.debug')} - includeAssets = ${Configuration.setting('Jonnitto.PrettyEmbed.includeAssets')} - includeAlpineJsCheck = ${Configuration.setting('Jonnitto.PrettyEmbed.includeAlpineJsCheck')} - inBackend = ${node.context.inBackend && node.context.currentRenderingMode.edit} - - // This decides which file to load - player = null - - renderer = Neos.Fusion:Join { - generalCSS = Jonnitto.PrettyEmbed:Assets.Fragment.Style { - @if.set = ${props.includeAssets.css} - filename = 'Main.css' - } - backendJS = Jonnitto.PrettyEmbed:Assets.Fragment.Script { - @if.set = ${props.inBackend} - inline = true - filename = 'Backend.js' - } - debugJS = Jonnitto.PrettyEmbed:Assets.Fragment.Script { - @if.set = ${props.debug} - inline = true - filename = 'Debug.js' - } - frontendScripts = Neos.Fusion:Join { - @if.set = ${props.includeAssets.js} - gdprPlugin = Jonnitto.PrettyEmbed:Assets.Fragment.Module { - @if.set = ${props.gdprHandling == true} - filename = 'Consent.js' - } - magicPlugin = Jonnitto.PrettyEmbed:Assets.Fragment.Module { - @if.set = ${props.player == 'Video' || props.player == 'Audio' || props.gdprHandling != 'Popup'} - filename = 'Methods.js' - } - popupPlugin = Jonnitto.PrettyEmbed:Assets.Fragment.Module { - @if.set = ${props.gdprHandling} - filename = 'Popup.js' - } - pluginBasedOnPlayer = Jonnitto.PrettyEmbed:Assets.Fragment.Module { - @if.set = ${props.player} - filename = ${props.player == 'Video' || props.player == 'Audio' ? 'Media.js' : (props.player + '.js')} - } - alpineJs = Jonnitto.PrettyEmbed:Assets.Fragment.Script { - @if.set = ${props.includeAlpineJsCheck} - filename = 'AlpineCheck.js' - slipstream = '//body' - } - } - } -} diff --git a/Resources/Private/Fusion/Helper/Assets/Fragment/Module.fusion b/Resources/Private/Fusion/Helper/Assets/Fragment/Module.fusion deleted file mode 100644 index 14311b2..0000000 --- a/Resources/Private/Fusion/Helper/Assets/Fragment/Module.fusion +++ /dev/null @@ -1,14 +0,0 @@ -prototype(Jonnitto.PrettyEmbed:Assets.Fragment.Module) < prototype(Neos.Fusion:Component) { - filename = null - uri = ${StaticResource.uri('Jonnitto.PrettyEmbedHelper', 'Public/Modules/' + this.filename)} - - renderer = afx` - - ` -} diff --git a/Resources/Private/Fusion/Helper/Assets/Fragment/Script.fusion b/Resources/Private/Fusion/Helper/Assets/Fragment/Script.fusion deleted file mode 100644 index 9f0e72e..0000000 --- a/Resources/Private/Fusion/Helper/Assets/Fragment/Script.fusion +++ /dev/null @@ -1,20 +0,0 @@ -prototype(Jonnitto.PrettyEmbed:Assets.Fragment.Script) < prototype(Neos.Fusion:Component) { - filename = null - slipstream = true - inline = false - - renderer = afx` - - - ` -} diff --git a/Resources/Private/Fusion/Helper/Assets/Fragment/Style.fusion b/Resources/Private/Fusion/Helper/Assets/Fragment/Style.fusion deleted file mode 100644 index 64fbb94..0000000 --- a/Resources/Private/Fusion/Helper/Assets/Fragment/Style.fusion +++ /dev/null @@ -1,12 +0,0 @@ -prototype(Jonnitto.PrettyEmbed:Assets.Fragment.Style) < prototype(Neos.Fusion:Component) { - filename = null - uri = ${StaticResource.uri('Jonnitto.PrettyEmbedHelper', 'Public/Styles/' + this.filename)} - - renderer = afx` - - ` -} diff --git a/Resources/Private/Fusion/Presentation/Audio.fusion b/Resources/Private/Fusion/Presentation/Audio.fusion index f580024..2d020c0 100644 --- a/Resources/Private/Fusion/Presentation/Audio.fusion +++ b/Resources/Private/Fusion/Presentation/Audio.fusion @@ -23,6 +23,14 @@ prototype(Jonnitto.PrettyEmbed:Presentation.Audio) < prototype(Neos.Fusion:Compo @if.checkAudio = ${this.content} + // @internal Move to @private if minimal Neos requirement is 8.3 or higher + _fileLoader = ${{debug: this.debug}} + _fileLoader.@process.convert = Jonnitto.PrettyEmbed:Assets { + player = 'Audio' + debug = ${value.debug} + } + _fileLoaderAsAttributes = ${!Type.isString(this._fileLoader)} + renderer = afx`
- + {props._fileLoaderAsAttributes ? '' : props._fileLoader} {props.customControls}