mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	chore(deps): update to excalidraw 0.18.0
This commit is contained in:
		
							parent
							
								
									39f3cb47fa
								
							
						
					
					
						commit
						c2cb48a25c
					
				
							
								
								
									
										2111
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2111
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -70,7 +70,7 @@
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@braintree/sanitize-url": "7.1.1",
 | 
			
		||||
    "@electron/remote": "2.1.2",
 | 
			
		||||
    "@excalidraw/excalidraw": "0.17.6",
 | 
			
		||||
    "@excalidraw/excalidraw": "0.18.0",
 | 
			
		||||
    "@fullcalendar/core": "6.1.15",
 | 
			
		||||
    "@fullcalendar/daygrid": "6.1.15",
 | 
			
		||||
    "@fullcalendar/interaction": "6.1.15",
 | 
			
		||||
 | 
			
		||||
@ -3,12 +3,12 @@ import utils from "../../services/utils.js";
 | 
			
		||||
import linkService from "../../services/link.js";
 | 
			
		||||
import server from "../../services/server.js";
 | 
			
		||||
import type FNote from "../../entities/fnote.js";
 | 
			
		||||
import type { default as ExcalidrawLib } from "@excalidraw/excalidraw";
 | 
			
		||||
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/types/element/types.js";
 | 
			
		||||
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types/types.js";
 | 
			
		||||
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
 | 
			
		||||
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types";
 | 
			
		||||
import type { JSX } from "react";
 | 
			
		||||
import type React from "react";
 | 
			
		||||
import type { Root } from "react-dom/client";
 | 
			
		||||
import "@excalidraw/excalidraw/index.css";
 | 
			
		||||
 | 
			
		||||
const TPL = `
 | 
			
		||||
    <div class="canvas-widget note-detail-canvas note-detail-printable note-detail">
 | 
			
		||||
@ -123,7 +123,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
 | 
			
		||||
    private librarycache: LibraryItem[];
 | 
			
		||||
    private attachmentMetadata: AttachmentMetadata[];
 | 
			
		||||
    private themeStyle!: Theme;
 | 
			
		||||
    private excalidrawLib!: typeof ExcalidrawLib;
 | 
			
		||||
    private excalidrawLib!: typeof import("@excalidraw/excalidraw");
 | 
			
		||||
    private excalidrawApi!: ExcalidrawImperativeAPI;
 | 
			
		||||
    private excalidrawWrapperRef!: React.RefObject<HTMLElement | null>;
 | 
			
		||||
 | 
			
		||||
@ -361,7 +361,8 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
 | 
			
		||||
        const svgString = svg.outerHTML;
 | 
			
		||||
 | 
			
		||||
        const activeFiles: Record<string, BinaryFileData> = {};
 | 
			
		||||
        elements.forEach((element) => {
 | 
			
		||||
        // TODO: Used any where upstream typings appear to be broken.
 | 
			
		||||
        elements.forEach((element: any) => {
 | 
			
		||||
            if ("fileId" in element && element.fileId) {
 | 
			
		||||
                activeFiles[element.fileId] = files[element.fileId];
 | 
			
		||||
            }
 | 
			
		||||
@ -386,7 +387,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
 | 
			
		||||
 | 
			
		||||
            // there's no separate method to get library items, so have to abuse this one
 | 
			
		||||
            const libraryItems = await this.excalidrawApi.updateLibrary({
 | 
			
		||||
                libraryItems(currentLibraryItems) {
 | 
			
		||||
                libraryItems() {
 | 
			
		||||
                    return [];
 | 
			
		||||
                },
 | 
			
		||||
                merge: true
 | 
			
		||||
@ -395,7 +396,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
 | 
			
		||||
            // excalidraw saves the library as a own state. the items are saved to libraryItems. then we compare the library right now with a libraryitemcache. The cache is filled when we first load the Library into the note.
 | 
			
		||||
            //We need the cache to delete old attachments later in the server.
 | 
			
		||||
 | 
			
		||||
            const libraryItemsMissmatch = this.librarycache.filter((obj1) => !libraryItems.some((obj2) => obj1.id === obj2.id));
 | 
			
		||||
            const libraryItemsMissmatch = this.librarycache.filter((obj1) => !libraryItems.some((obj2: LibraryItem) => obj1.id === obj2.id));
 | 
			
		||||
 | 
			
		||||
            // before we saved the metadata of the attachments in a cache. the title of the attachment is a combination of libraryitem  ´s ID und it´s name.
 | 
			
		||||
            // we compare the library items in the libraryitemmissmatch variable (this one saves all libraryitems that are different to the state right now. E.g. you delete 1 item, this item is saved as mismatch)
 | 
			
		||||
 | 
			
		||||
@ -42,6 +42,32 @@ const config: Configuration = {
 | 
			
		||||
                ],
 | 
			
		||||
                exclude: /node_modules/
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.m?js$/,
 | 
			
		||||
                resolve: {
 | 
			
		||||
                    fullySpecified: false
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                // bootstrap CSS related configuration
 | 
			
		||||
                test: /\.(css)$/,
 | 
			
		||||
                use: [
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: miniCssExtractPlugin.loader
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: "css-loader"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: "postcss-loader",
 | 
			
		||||
                        options: {
 | 
			
		||||
                            postcssOptions: {
 | 
			
		||||
                                plugins: [autoprefixer]
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                // bootstrap CSS related configuration
 | 
			
		||||
                test: /\.(scss)$/,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user