diff --git a/manifest.json b/manifest.json index 83bcec2..64cc4d5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "merge-notes", "name": "Merge Notes", - "version": "0.0.10", + "version": "0.0.11", "minAppVersion": "0.0.0", "description": "Merge the selected notes.", "author": "fnya", diff --git a/package.json b/package.json index a3466f3..d98fee5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "merge-notes", - "version": "0.0.10", + "version": "0.0.11", "description": "Merge the selected notes.", "main": "main.js", "scripts": { diff --git a/src/components/Files.tsx b/src/components/Files.tsx index 31f8bed..bdb0fb3 100644 --- a/src/components/Files.tsx +++ b/src/components/Files.tsx @@ -1,10 +1,6 @@ -import { File } from "./File"; -import { TFile, Notice, parseYaml } from "obsidian"; -import { Title } from "./Title"; -import React, { useState } from "react"; import { - DndContext, closestCenter, + DndContext, KeyboardSensor, PointerSensor, useSensor, @@ -16,6 +12,10 @@ import { sortableKeyboardCoordinates, verticalListSortingStrategy, } from "@dnd-kit/sortable"; +import { Notice, parseYaml, TFile } from "obsidian"; +import React, { useState } from "react"; +import { File } from "./File"; +import { Title } from "./Title"; const PROPERTIES_REGEX = /---\n([\s\S]*?)\n---/; const MERGED_NOTED_DIRECTORY = "_merged_notes"; @@ -99,24 +99,25 @@ export const Files = (props: any) => { lines.forEach((line) => { if (line.trim() !== "") { - const [key, value] = line.split(":"); + if (line.includes(",")) { + const index = line.indexOf(":"); + const key = line.substring(0, index).trim(); + const value = line.substring(index + 1).trim(); - if (value || value !== "") { - if (value.includes(",")) { - const values = value - .split(",") - .map((v) => - v.trim().replace("[", "").replace("]", "").replace(/"/g, "") - ); + const values = value + .split(",") + .map((v) => + v.trim().replace("[", "").replace("]", "").replace(/"/g, "") + ); - tempProperties += `${key}:`; - values.forEach((v) => { - tempProperties += `\n - "${v}"`; - }); - tempProperties += "\n"; - } + tempProperties += `${key}:`; + + values.forEach((v) => { + tempProperties += `\n - "${v}"`; + }); + tempProperties += "\n"; } else { - tempProperties += `${key}: \n`; + tempProperties += line + "\n"; } } }); diff --git a/versions.json b/versions.json index 1f6b7db..df0bc33 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "0.0.10": "0.0.0" + "0.0.11": "0.0.0" }