| @@ -16,13 +16,16 @@ | ||
| 16 | 16 | var require_editor_background_video_state = /* @__PURE__ */ __commonJSMin(((exports) => { |
| 17 | 17 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 18 | 18 | exports.getEditorState = getEditorState; |
| 19 | 19 | exports.isEditorPreview = isEditorPreview; |
| 20 | + exports.resolveDesignTimeState = resolveDesignTimeState; | |
| 20 | 21 | exports.setEditorState = setEditorState; |
| 21 | 22 | var _alpinejs$1 = (globalThis.elementorV2.alpinejs); |
| 22 | 23 | var STORE_NAME = "editor-background-video-state"; |
| 24 | + var PLAYING_STATE = "playing"; | |
| 25 | + var PAUSED_STATE = "paused"; | |
| 23 | 26 | /** |
| 24 | - * @typedef {Record<string, 'playing' | 'paused'>} BackgroundVideoState | |
| 27 | + * @typedef {Record<string, 'playing' | 'paused' | ''>} BackgroundVideoState | |
| 25 | 28 | */ |
| 26 | 29 | function ensureStore() { |
| 27 | 30 | if (!_alpinejs$1.Alpine.store(STORE_NAME)) _alpinejs$1.Alpine.store( |
| 28 | 31 | STORE_NAME, |
| @@ -30,9 +33,13 @@ | ||
| 30 | 33 | {} |
| 31 | 34 | ); |
| 32 | 35 | return _alpinejs$1.Alpine.store(STORE_NAME); |
| 33 | 36 | } |
| 34 | - function getEditorState(elementId, fallback = "playing") { | |
| 37 | + function resolveDesignTimeState(state) { | |
| 38 | + if (PAUSED_STATE === state || "" === state) return state; | |
| 39 | + return PLAYING_STATE; | |
| 40 | + } | |
| 41 | + function getEditorState(elementId, fallback = PLAYING_STATE) { | |
| 35 | 42 | var _store$elementId; |
| 36 | 43 | return (_store$elementId = ensureStore()[elementId]) !== null && _store$elementId !== void 0 ? _store$elementId : fallback; |
| 37 | 44 | } |
| 38 | 45 | function setEditorState(elementId, state) { |
| @@ -95,9 +102,9 @@ | ||
| 95 | 102 | _alpinejs.Alpine.data(`eBackgroundVideo${elementId}`, () => ({ |
| 96 | 103 | isPlaying: video ? !video.paused : false, |
| 97 | 104 | isEditor: (0, _editorBackgroundVideoState.isEditorPreview)(), |
| 98 | 105 | get editorState() { |
| 99 | - return (0, _editorBackgroundVideoState.getEditorState)(elementId, settings.state || "playing"); | |
| 106 | + return (0, _editorBackgroundVideoState.getEditorState)(elementId, (0, _editorBackgroundVideoState.resolveDesignTimeState)(settings.state)); | |
| 100 | 107 | }, |
| 101 | 108 | get previewState() { |
| 102 | 109 | if (this.isEditor) return this.editorState; |
| 103 | 110 | return this.isPlaying ? "playing" : "paused"; |