mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-08 01:42:58 +02:00
Merge branch 'dev' of github.com:estruyf/vscode-front-matter into dev
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
- Fix field error message color
|
||||
- [#433](https://github.com/estruyf/vscode-front-matter/issues/433): Fix issue with rendering an incorrect title value on the content dashboard
|
||||
- [#462](https://github.com/estruyf/vscode-front-matter/issues/462): Fix issue in script error notification
|
||||
|
||||
## [8.1.2] - 2022-10-06
|
||||
|
||||
|
||||
@@ -338,13 +338,21 @@ export class ArticleHelper {
|
||||
if (typeof filePrefixOnFolder !== "undefined") {
|
||||
prefix = filePrefixOnFolder;
|
||||
}
|
||||
|
||||
if (prefix && typeof prefix === "string") {
|
||||
prefix = `${format(new Date(), DateHelper.formatUpdate(prefix) as string)}`;
|
||||
}
|
||||
|
||||
// Name of the file or folder to create
|
||||
const sanitizedName = ArticleHelper.sanitize(titleValue);
|
||||
let sanitizedName = ArticleHelper.sanitize(titleValue);
|
||||
let newFilePath: string | undefined;
|
||||
|
||||
// Create a folder with the `index.md` file
|
||||
if (contentType?.pageBundle) {
|
||||
if (prefix && typeof prefix === "string") {
|
||||
sanitizedName = `${prefix}-${sanitizedName}`;
|
||||
}
|
||||
|
||||
const newFolder = join(folderPath, sanitizedName);
|
||||
if (await existsAsync(newFolder)) {
|
||||
Notifications.error(`A page bundle with the name ${sanitizedName} already exists in ${folderPath}`);
|
||||
@@ -357,7 +365,7 @@ export class ArticleHelper {
|
||||
let newFileName = `${sanitizedName}.${fileExtension || contentType?.fileType || fileType}`;
|
||||
|
||||
if (prefix && typeof prefix === "string") {
|
||||
newFileName = `${format(new Date(), DateHelper.formatUpdate(prefix) as string)}-${newFileName}`;
|
||||
newFileName = `${prefix}-${newFileName}`;
|
||||
}
|
||||
|
||||
newFilePath = join(folderPath, newFileName);
|
||||
|
||||
@@ -195,7 +195,11 @@ export class CustomScript {
|
||||
const output = await CustomScript.executeScript(script, wsPath, `"${wsPath}" "${contentPath}" ${articleData}`);
|
||||
return output;
|
||||
} catch (e) {
|
||||
Notifications.error(`${script.title}: ${(e as Error).message}`);
|
||||
if (typeof e === "string") {
|
||||
Notifications.error(`${script.title}: ${e}`);
|
||||
} else {
|
||||
Notifications.error(`${script.title}: ${(e as Error).message}`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -285,6 +289,7 @@ export class CustomScript {
|
||||
exec(fullScript, (error, stdout) => {
|
||||
if (error) {
|
||||
reject(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stdout && stdout.endsWith(`\n`)) {
|
||||
|
||||
@@ -484,14 +484,8 @@ export class Settings {
|
||||
|
||||
// Array settings
|
||||
if (Settings.isEqualOrStartsWith(relSettingName, SETTING_CUSTOM_SCRIPTS)) {
|
||||
// Get the correct setting name
|
||||
let settingNameValue = ""
|
||||
if (relSettingName === SETTING_CUSTOM_SCRIPTS.toLowerCase()) {
|
||||
settingNameValue = SETTING_CUSTOM_SCRIPTS;
|
||||
}
|
||||
|
||||
const crntValue = Settings.globalConfig[`${CONFIG_KEY}.${settingNameValue}`] || [];
|
||||
Settings.globalConfig[`${CONFIG_KEY}.${settingNameValue}`] = [...crntValue, configJson];
|
||||
const crntValue = Settings.globalConfig[`${CONFIG_KEY}.${SETTING_CUSTOM_SCRIPTS}`] || [];
|
||||
Settings.globalConfig[`${CONFIG_KEY}.${SETTING_CUSTOM_SCRIPTS}`] = [...crntValue, configJson];
|
||||
}
|
||||
// Content types
|
||||
else if (Settings.isEqualOrStartsWith(relSettingName, SETTING_TAXONOMY_CONTENT_TYPES)) {
|
||||
|
||||
Reference in New Issue
Block a user