mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 07:01:31 +08:00 
			
		
		
		
	refactor(canvas): remove unnecessary fragment
This commit is contained in:
		
							parent
							
								
									5b4ceb27c5
								
							
						
					
					
						commit
						dab9b02990
					
				@ -2,6 +2,7 @@ import "@excalidraw/excalidraw/index.css";
 | 
				
			|||||||
import { Excalidraw, getSceneVersion, exportToSvg } from "@excalidraw/excalidraw";
 | 
					import { Excalidraw, getSceneVersion, exportToSvg } from "@excalidraw/excalidraw";
 | 
				
			||||||
import { createElement, createRef, Fragment, RefObject, render, useEffect, useState } from "preact/compat";
 | 
					import { createElement, createRef, Fragment, RefObject, render, useEffect, useState } from "preact/compat";
 | 
				
			||||||
import { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, SceneData } from "@excalidraw/excalidraw/types";
 | 
					import { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, SceneData } from "@excalidraw/excalidraw/types";
 | 
				
			||||||
 | 
					import type { ComponentType, VNode } from "preact";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** -1 indicates that it is fresh. excalidraw scene version is always >0 */
 | 
					/** -1 indicates that it is fresh. excalidraw scene version is always >0 */
 | 
				
			||||||
const SCENE_VERSION_INITIAL = -1;
 | 
					const SCENE_VERSION_INITIAL = -1;
 | 
				
			||||||
@ -29,14 +30,9 @@ export default class Canvas {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private createCanvasElement(opts: ExcalidrawProps) {
 | 
					    private createCanvasElement(opts: ExcalidrawProps) {
 | 
				
			||||||
        return createElement(Fragment, null,
 | 
					        return createElement("div", { className: "excalidraw-wrapper", },
 | 
				
			||||||
            createElement(
 | 
					            createElement(Excalidraw as ComponentType<ExcalidrawProps>, opts)
 | 
				
			||||||
                "div",
 | 
					        );
 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    className: "excalidraw-wrapper",
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                createElement(Excalidraw, opts)
 | 
					 | 
				
			||||||
            ));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user