File tree Expand file tree Collapse file tree 6 files changed +1446
-12
lines changed
content/tutorials/zh-Hans Expand file tree Collapse file tree 6 files changed +1446
-12
lines changed Original file line number Diff line number Diff line change @@ -44,14 +44,23 @@ export const CodeEmbed = (props) => {
4444 previewHeight = previewHeight || parseFloat ( canvasMatch [ 2 ] ) ;
4545 }
4646
47- const largeSketch = previewWidth && previewWidth > 770 - 60 ;
48-
4947 // Quick hack to make room for DOM that gets added below the canvas by default
5048 const domMatch = / c r e a t e ( B u t t o n | S e l e c t | P | D i v | I n p u t | C o l o r P i c k e r ) / . exec ( initialCode ) ;
5149 if ( domMatch && previewHeight ) {
5250 previewHeight += 100 ;
5351 }
5452
53+ // Fallback preview size when no usable canvas dimensions are detected.
54+ // Ensures DOM-based examples (e.g., createCapture with noCanvas) are visible.
55+ const DEFAULT_PREVIEW_WIDTH = 400 ;
56+ const DEFAULT_PREVIEW_HEIGHT = 300 ;
57+ if ( previewWidth === undefined || previewHeight === undefined ) {
58+ previewWidth = previewWidth ?? DEFAULT_PREVIEW_WIDTH ;
59+ previewHeight = previewHeight ?? DEFAULT_PREVIEW_HEIGHT ;
60+ }
61+
62+ const largeSketch = previewWidth && previewWidth > 770 - 60 ;
63+
5564 const codeFrameRef = useRef ( null ) ;
5665
5766 const updateOrReRun = ( ) => {
Original file line number Diff line number Diff line change @@ -152,8 +152,8 @@ export const Dropdown = ({
152152 </ div >
153153 < button
154154 onClick = { ( ) => handleOptionClick ( option ) }
155- ref = { el => {
156- optionRefs . current [ index ] = el as HTMLButtonElement
155+ ref = { ( el ) => {
156+ optionRefs . current [ index ] = el as HTMLButtonElement ;
157157 } }
158158 onBlur = { handleBlur }
159159 >
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const { config } = Astro.props;
1010
1111---
1212
13- <div class =" px-lg pt-[11.25rem] lg:pt-3xl pb-0 h-full" >
13+ <div class =" max-lg:flex max-lg:flex-col px-lg pt-[11.25rem] lg:pt-3xl pb-0 h-full" >
1414 <div class =" homepage-header-top" >
1515 <div class =" grid grid-cols-3 lg:grid-cols-4 gap-md overflow-visible h-min" >
1616 <p class =" col-span-2 lg:col-span-3 mt-0 text-md md:text-xl lg:text-3xl" >
@@ -39,7 +39,7 @@ const { config } = Astro.props;
3939 {
4040 config .data .heroImages .map ((im , i ) => (
4141 im .linkTarget ?
42- <a href = { im .linkTarget } class = { ` hero-image-container ${i > 0 ? " hidden" : " " } ` } >
42+ <a href = { im .linkTarget } class = { ` max-lg:flex-1 max-lg:min-h-0 hero-image-container ${i > 0 ? " hidden" : " " }` } >
4343 <Image
4444 containerClass = { " relative" }
4545 class = { " hero-image" }
@@ -51,7 +51,7 @@ const { config } = Astro.props;
5151 </a >
5252 :
5353 <Image
54- containerClass = { ` relative hero-image-container ${i > 0 ? " hidden" : " " } ` }
54+ containerClass = { ` max-lg:flex-1 max-lg:min-h-0 relative hero-image-container ${i > 0 ? " hidden" : " " }` }
5555 class = { " hero-image" }
5656 aspectRatio = " none"
5757 src = { im .image }
You can’t perform that action at this time.
0 commit comments