Fix Media Manager critical syntax errors and enforce ES5 architecture
- Resolved persistent 'SyntaxError: Unexpected token class' by refactoring 'MediaState' and 'UI' classes in MediaManager.html to standard ES5 function constructors. - Resolved 'SyntaxError: Unexpected identifier src' by rewriting 'createCard' to use 'document.createElement' instead of template strings for dynamic media elements. - Consolidated script tags in MediaManager.html to prevent Apps Script parser merge issues. - Updated docs/ARCHITECTURE.md and MEMORY.md to formally document client-side constraints (No ES6 classes, strict DOM manipulation for media). - Note: Google Drive video animate-on-hover functionality is implemented but currently pending verification/fix.
This commit is contained in:
@ -139,6 +139,20 @@ export class MediaService {
|
||||
// Find Shopify Orphans
|
||||
shopifyMedia.forEach(m => {
|
||||
if (!matchedShopifyIds.has(m.id)) {
|
||||
let mimeType = 'image/jpeg'; // Default
|
||||
let contentUrl = "";
|
||||
|
||||
if (m.mediaContentType === 'VIDEO' && m.sources) {
|
||||
// Find MP4
|
||||
const mp4 = m.sources.find((s: any) => s.mimeType === 'video/mp4')
|
||||
if (mp4) {
|
||||
mimeType = mp4.mimeType
|
||||
contentUrl = mp4.url
|
||||
}
|
||||
} else if (m.mediaContentType === 'IMAGE' && m.image) {
|
||||
contentUrl = m.image.url
|
||||
}
|
||||
|
||||
unifiedState.push({
|
||||
id: m.id, // Use Shopify ID keys for orphans
|
||||
driveId: null,
|
||||
@ -148,7 +162,9 @@ export class MediaService {
|
||||
source: 'shopify_only',
|
||||
thumbnail: m.preview?.image?.originalSrc || "",
|
||||
status: 'active',
|
||||
galleryOrder: 10000 // End of list
|
||||
galleryOrder: 10000, // End of list
|
||||
mimeType: mimeType,
|
||||
contentUrl: contentUrl
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@ -78,6 +78,17 @@ export class ShopifyMediaService implements IShopifyMediaService {
|
||||
originalSrc
|
||||
}
|
||||
}
|
||||
... on Video {
|
||||
sources {
|
||||
url
|
||||
mimeType
|
||||
}
|
||||
}
|
||||
... on MediaImage {
|
||||
image {
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user