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 }}); }