Skip to content

Commit

Permalink
Revert "Support dynamic default value for KeyValue widget"
Browse files Browse the repository at this point in the history
This reverts commit f483e81.
  • Loading branch information
kyoshino committed Dec 30, 2024
1 parent b055b77 commit 8a02c08
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/lib/services/contents/draft/create.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isObject } from '@sveltia/utils/object';
import { stripTags } from '@sveltia/utils/string';
import { get } from 'svelte/store';
import { getCollection } from '$lib/services/contents/collection';
Expand Down Expand Up @@ -86,22 +85,6 @@ const parseDynamicDefaultValue = ({ fieldConfig, keyPath, newContent, value }) =
}
}

if (widgetName === 'keyvalue') {
try {
const parsed = JSON.parse(value);

if (isObject(parsed)) {
Object.entries(/** @type {Record<string, string>} */ (parsed)).forEach(([key, val]) => {
newContent[`${keyPath}.${key}`] = val;
});
}
} catch {
//
}

return;
}

// Just use the string as is
newContent[keyPath] = value;
};
Expand Down

0 comments on commit 8a02c08

Please sign in to comment.