mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-07 09:23:00 +02:00
Move taxonomy picker
This commit is contained in:
+11
-11
@@ -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;
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user