diff --git a/src/MiniDocs/BrAsyncFileWidget.extension.st b/src/MiniDocs/BrAsyncFileWidget.extension.st new file mode 100644 index 0000000..5d6dd0f --- /dev/null +++ b/src/MiniDocs/BrAsyncFileWidget.extension.st @@ -0,0 +1,23 @@ +Extension { #name : #BrAsyncFileWidget } + +{ #category : #'*MiniDocs' } +BrAsyncFileWidget >> url: aUrl [ + + | realUrl imageUrl | + realUrl := aUrl asZnUrl. + + realUrl scheme = #file ifTrue: [ + ^ self file: realUrl asFileReference ]. + imageUrl := realUrl. + realUrl host = 'www.youtube.com' ifTrue: [ | video | + video := LeRawYoutubeReferenceInfo fromYoutubeStringUrl: realUrl asString. + imageUrl := (video rawData at: 'thumbnail_url') asUrl. + ]. + + self stencil: [ + (SkiaImage fromForm: + (Form fromBase64String: imageUrl retrieveContents base64Encoded)) + asElement constraintsDo: [ :c | + c horizontal matchParent. + c vertical matchParent ] ] +]