Changeset 3450339
- Timestamp:
- 01/30/2026 10:34:44 AM (2 months ago)
- Location:
- trinity-audio/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (1 diff)
-
js/metaboxes.js (modified) (1 diff)
-
trinity.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trinity-audio/trunk/README.txt
r3443319 r3450339 174 174 == Changelog == 175 175 176 = 5.26.0 = 177 *Release Date - Jan 30, 2026* 178 * Improved Post level saving to be more resilient and avoid conflicts 179 176 180 = 5.25.1 = 177 181 *Release Date - Jan 20, 2026* -
trinity-audio/trunk/js/metaboxes.js
r3442287 r3450339 1 1 async function trinityMetaVoiceConfig() { 2 // WP Save button will save our data since we already update the form, so the voice post-lvel new data will just be sent to backend 3 const updateForm = async (formData) => { 4 if (!originalConfig) return; 5 if (JSON.stringify(originalConfig) === JSON.stringify(formData)) return; 6 7 const {voiceId, code} = formData; 8 9 const voiceIdInputEl = document.getElementById('trinity_audio_voice_id'); 10 voiceIdInputEl.value = voiceId; // set public voiceId 11 12 // Good to save locale and not only voiceId, since if voiceId get removed, we have locale which we can rely on 13 const languageInputEl = document.getElementById('trinity_audio_source_language'); 14 languageInputEl.value = code; 15 16 console.debug(`Updating post-level voice config to voiceId: ${voiceId} and locale: ${code}`); 17 }; 18 19 // keep the original config to avoid updating post-level config with the same data which is on unit's one, avoid spamming 2 20 let originalConfig; 3 21 waitForExpression(() => window.TRINITY_UNIT_CONFIGURATION?.getFormData).then(async () => { 4 22 originalConfig = await window.TRINITY_UNIT_CONFIGURATION.getFormData(); 5 }); 6 7 const save = async () => { 8 if (!window.TRINITY_UNIT_CONFIGURATION?.getFormData) return console.error('TRINITY_UNIT_CONFIGURATION.getFormData is not defined. Possible issue with loading Unit Configuration widget. Continue saving...'); 9 const formData = await window.TRINITY_UNIT_CONFIGURATION.getFormData(); 10 11 if (originalConfig && JSON.stringify(originalConfig) !== JSON.stringify(formData)) { 12 const voiceIdInputEl = document.getElementById('trinity_audio_voice_id'); 13 voiceIdInputEl.value = formData.voiceId; // set public voiceId 14 15 // Good to save locale and not only voiceId, since if voiceId get removed, we have locale which we can rely on 16 const languageInputEl = document.getElementById('trinity_audio_source_language'); 17 languageInputEl.value = formData.code; 18 } 19 }; 20 21 // Gutenberg 22 const {dispatch} = wp.data; 23 const editorDispatch = dispatch('core/editor'); 24 if (editorDispatch) { 25 // Save original savePost 26 const originalSavePost = editorDispatch.savePost; 27 28 // Replace savePost with our wrapper 29 editorDispatch.savePost = async (...args) => { 30 await save(); 31 32 // Continue with original save 33 return originalSavePost(...args); 34 }; 35 36 return; 37 } 38 39 console.debug('Gutenberg API is not available, trying to hook into saving button'); 40 41 // Target only the post edit form 42 $('#post').on('submit', async (e) => { 43 try { 44 // Only trigger for post editing, not any other form 45 const postId = $('#post_ID').val(); 46 if (!postId) return; // Not a post edit form 47 48 console.debug('Post form submission intercepted!'); 49 50 // Stop the default submit temporarily 51 e.preventDefault(); 52 53 await save(); 54 } catch (error) { 55 console.error('Could not intercept Update button', error); 56 } finally { 57 e.target.submit(); 58 } 23 window.TRINITY_UNIT_CONFIGURATION.on('change', updateForm); 59 24 }); 60 25 } -
trinity-audio/trunk/trinity.php
r3443319 r3450339 9 9 * Plugin URI: https://www.trinityaudio.ai/the-trinity-audio-wordpress-plugin-implementation-guide 10 10 * Description: This plugin generates an audio version of the post, for absolutely FREE. You can choose the language and the gender of the voice reading your content. You also have the option to add Trinity Audio's player on select posts or have it audiofy all of your content. In both cases, it only takes a few simple clicks to get it done. The plugin is built through collaboration with the Amazon Polly team. 11 * Version: 5.2 5.111 * Version: 5.26.0 12 12 * Author: Trinity Audio 13 13 * Author URI: https://trinityaudio.ai/
Note: See TracChangeset
for help on using the changeset viewer.