From 387437882495126d4d831683cc3e0da1c0fe133b Mon Sep 17 00:00:00 2001 From: MassiveBox Date: Thu, 17 Jul 2025 16:24:38 +0200 Subject: [PATCH] Dropped migration legacy code --- src/index.ts | 2 -- src/migration.ts | 65 ------------------------------------------------ 2 files changed, 67 deletions(-) delete mode 100644 src/migration.ts diff --git a/src/index.ts b/src/index.ts index 6dbee74..1e0d691 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,6 @@ import { findImgSrc, imgSrcToIDs, generateTimeString, generateRandomString } from "@/helper"; -import {migrate} from "@/migration"; import {EditorManager} from "@/editor"; import {PluginConfig, PluginConfigViewer} from "@/config"; import {Analytics} from "@/analytics"; @@ -22,7 +21,6 @@ export default class DrawJSPlugin extends Plugin { new ErrorReporter(this.i18n); loadIcons(this); EditorManager.registerTab(this); - migrate() await this.startConfig(); await this.startAnalytics(); diff --git a/src/migration.ts b/src/migration.ts deleted file mode 100644 index 2829aad..0000000 --- a/src/migration.ts +++ /dev/null @@ -1,65 +0,0 @@ -import {sql} from "@/api"; -import {PluginAsset, PluginFile} from "@/file"; -import {ASSETS_PATH, DATA_PATH, SVG_MIME} from "@/const"; -import {replaceBlockContent} from "@/protyle"; -import {generateRandomString, getMarkdownBlock} from "@/helper"; -import {Dialog} from "siyuan"; - -export async function migrate() { - - let blocks = await findEmbedBlocks(); - const found = blocks.length > 0; - - for(const block of blocks) { - const oldFileID = extractID(block.markdown); - if(oldFileID) { - const oldFile = new PluginFile(DATA_PATH + ASSETS_PATH, oldFileID + '.svg', SVG_MIME); - await oldFile.loadFromSiYuanFS(); - const newFile = new PluginAsset(generateRandomString(), oldFileID, SVG_MIME); - newFile.setContent(oldFile.getContent()); - await newFile.save(); - const newMarkdown = getMarkdownBlock(newFile.getFileID(), newFile.getSyncID()); - if(await replaceBlockContent(block.id, block.markdown, newMarkdown)) { - await oldFile.remove(); - } - } - } - - if(found) { - new Dialog({ - width: "90vw", - height: "90vh", - content: ` -