diff --git a/src/panelWebView/components/TagPicker.tsx b/src/panelWebView/components/Fields/TagPicker.tsx similarity index 95% rename from src/panelWebView/components/TagPicker.tsx rename to src/panelWebView/components/Fields/TagPicker.tsx index 005f0ea4..119fa3e3 100644 --- a/src/panelWebView/components/TagPicker.tsx +++ b/src/panelWebView/components/Fields/TagPicker.tsx @@ -1,21 +1,21 @@ import * as React from 'react'; -import { Tags } from './Tags'; -import { usePrevious } from '../hooks/usePrevious'; -import { CommandToCode } from '../CommandToCode'; -import { TagType } from '../TagType'; +import { Tags } from '../Tags'; +import { usePrevious } from '../../hooks/usePrevious'; +import { CommandToCode } from '../../CommandToCode'; +import { TagType } from '../../TagType'; import Downshift from 'downshift'; -import { AddIcon } from './Icons/AddIcon'; -import { BlockFieldData, CustomTaxonomyData } from '../../models'; +import { AddIcon } from '../Icons/AddIcon'; +import { BlockFieldData, CustomTaxonomyData } from '../../../models'; import { useCallback, useEffect, useMemo } from 'react'; import { messageHandler, Messenger } from '@estruyf/vscode/dist/client'; -import { FieldMessage } from './Fields/FieldMessage'; -import { FieldTitle } from './Fields/FieldTitle'; +import { FieldMessage } from '../Fields/FieldMessage'; +import { FieldTitle } from '../Fields/FieldTitle'; import { useRecoilValue } from 'recoil'; -import { PanelSettingsAtom } from '../state'; +import { PanelSettingsAtom } from '../../state'; import { SparklesIcon } from '@heroicons/react/24/outline'; import * as l10n from '@vscode/l10n'; -import { LocalizationKey } from '../../localization'; -import useDropdownStyle from '../hooks/useDropdownStyle'; +import { LocalizationKey } from '../../../localization'; +import useDropdownStyle from '../../hooks/useDropdownStyle'; export interface ITagPickerProps { type: TagType; diff --git a/src/panelWebView/components/Fields/WrapperField.tsx b/src/panelWebView/components/Fields/WrapperField.tsx index 00dbbad5..fa068006 100644 --- a/src/panelWebView/components/Fields/WrapperField.tsx +++ b/src/panelWebView/components/Fields/WrapperField.tsx @@ -11,7 +11,6 @@ import { ListUnorderedIcon } from '../Icons/ListUnorderedIcon'; import { TagIcon } from '../Icons/TagIcon'; import { JsonField } from '../JsonField'; import { IMetadata } from '../Metadata'; -import { TagPicker } from '../TagPicker'; import { ChoiceField, DataFileField, @@ -27,7 +26,8 @@ import { PreviewImageValue, NumberField, CustomField, - FieldCollection + FieldCollection, + TagPicker } from '.'; import { fieldWhenClause } from '../../../utils/fieldWhenClause'; import { ContentTypeRelationshipField } from './ContentTypeRelationshipField'; diff --git a/src/panelWebView/components/Fields/index.ts b/src/panelWebView/components/Fields/index.ts index 35a8ebd5..208e8cde 100644 --- a/src/panelWebView/components/Fields/index.ts +++ b/src/panelWebView/components/Fields/index.ts @@ -16,6 +16,7 @@ export * from './PreviewImage'; export * from './PreviewImageField'; export * from './RequiredAsterix'; export * from './SlugField'; +export * from './TagPicker'; export * from './TextField'; export * from './Toggle'; export * from './WrapperField'; diff --git a/src/panelWebView/components/SeoStatus.tsx b/src/panelWebView/components/SeoStatus.tsx index 4da28db3..55b6b38d 100644 --- a/src/panelWebView/components/SeoStatus.tsx +++ b/src/panelWebView/components/SeoStatus.tsx @@ -7,7 +7,7 @@ import FieldBoundary from './ErrorBoundary/FieldBoundary'; import { SymbolKeywordIcon } from './Icons/SymbolKeywordIcon'; import { SeoFieldInfo } from './SeoFieldInfo'; import { SeoKeywords } from './SeoKeywords'; -import { TagPicker } from './TagPicker'; +import { TagPicker } from './Fields/TagPicker'; import * as l10n from '@vscode/l10n'; import { LocalizationKey } from '../../localization'; import { VSCodeTable, VSCodeTableBody, VSCodeTableHead, VSCodeTableHeader, VSCodeTableRow } from './VSCode/VSCodeTable'; diff --git a/src/parsers/ParserEngines.ts b/src/parsers/ParserEngines.ts index 39d226ab..69b6f5b2 100644 --- a/src/parsers/ParserEngines.ts +++ b/src/parsers/ParserEngines.ts @@ -45,7 +45,26 @@ export const Engines = { }, yaml: { parse: (value: string) => { - return yaml.parse(removeCarriageReturn(value)); + const lines = value.split('\n'); + // Check if a line includes a colon and isn't wrapped in quotes, we need to add quotes to the value + for (const line of lines) { + const parts = line.split(':'); + if (parts.length > 2) { + const key = parts[0].trim(); + const value = parts.slice(1).join(':').trim(); + + if ( + !value.startsWith('"') && + !value.endsWith('"') && + !value.includes("'") && + !value.includes('"') + ) { + lines[lines.indexOf(line)] = `${key}: "${value}"`; + } + } + } + + return yaml.parse(removeCarriageReturn(lines.join('\n'))); }, stringify: ( obj: any,