From b072b920fd2d5d7a3b1f0453ca3397e42554e7f7 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Wed, 15 Sep 2021 18:41:27 +0200 Subject: [PATCH] #102 - Fix on metadata update --- src/webview/ExplorerView.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/webview/ExplorerView.ts b/src/webview/ExplorerView.ts index e9662127..84da9bf2 100644 --- a/src/webview/ExplorerView.ts +++ b/src/webview/ExplorerView.ts @@ -208,14 +208,26 @@ export class ExplorerView implements WebviewViewProvider, Disposable { * @param metadata */ public pushMetadata(metadata: any) { + const config = SettingsHelper.getConfig(); + const commaSeparated = config.get(SETTING_COMMA_SEPARATED_FIELDS); + const articleDetails = this.getArticleDetails(); if (articleDetails) { metadata.articleDetails = articleDetails; } + let updatedMetadata = Object.assign({}, metadata); + if (commaSeparated) { + for (const key of commaSeparated) { + if (updatedMetadata[key] && typeof updatedMetadata[key] === "string") { + updatedMetadata[key] = updatedMetadata[key].split(",").map((s: string) => s.trim()); + } + } + } + this.postWebviewMessage({ command: Command.metadata, data: { - ...metadata + ...updatedMetadata }}); }