chore: fix typos across the codebase (#402)
This commit is contained in:
parent
14db8da270
commit
6d9478f8f7
@ -27,7 +27,7 @@
|
|||||||
_faqs: {
|
_faqs: {
|
||||||
'what-is-static-cms.md': {
|
'what-is-static-cms.md': {
|
||||||
content:
|
content:
|
||||||
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git comitters.\n\n',
|
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git committers.\n\n',
|
||||||
},
|
},
|
||||||
'what-is-jam-stack.md': {
|
'what-is-jam-stack.md': {
|
||||||
content:
|
content:
|
||||||
|
@ -35,7 +35,7 @@ import {
|
|||||||
selectFieldsComments,
|
selectFieldsComments,
|
||||||
selectFileEntryLabel,
|
selectFileEntryLabel,
|
||||||
selectFolderEntryExtension,
|
selectFolderEntryExtension,
|
||||||
selectInferedField,
|
selectInferredField,
|
||||||
selectMediaFolders,
|
selectMediaFolders,
|
||||||
} from './lib/util/collection.util';
|
} from './lib/util/collection.util';
|
||||||
import { selectMediaFilePath, selectMediaFilePublicPath } from './lib/util/media.util';
|
import { selectMediaFilePath, selectMediaFilePublicPath } from './lib/util/media.util';
|
||||||
@ -526,12 +526,12 @@ export class Backend<BC extends BackendClass = BackendClass> {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
searchFields = [
|
searchFields = [
|
||||||
selectInferedField(collection, 'title'),
|
selectInferredField(collection, 'title'),
|
||||||
selectInferedField(collection, 'shortTitle'),
|
selectInferredField(collection, 'shortTitle'),
|
||||||
selectInferedField(collection, 'author'),
|
selectInferredField(collection, 'author'),
|
||||||
...summaryFields.map(elem => {
|
...summaryFields.map(elem => {
|
||||||
if (dateParsers[elem]) {
|
if (dateParsers[elem]) {
|
||||||
return selectInferedField(collection, 'date');
|
return selectInferredField(collection, 'date');
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
}),
|
}),
|
||||||
@ -555,7 +555,7 @@ export class Backend<BC extends BackendClass = BackendClass> {
|
|||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
throw new Error({ message: 'Errors ocurred while searching entries locally!', errors });
|
throw new Error({ message: 'Errors occurred while searching entries locally!', errors });
|
||||||
}
|
}
|
||||||
|
|
||||||
const hits = entries
|
const hits = entries
|
||||||
|
@ -86,7 +86,7 @@ const Header = ({
|
|||||||
createNewEntry(collectionName);
|
createNewEntry(collectionName);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const createableCollections = useMemo(
|
const creatableCollections = useMemo(
|
||||||
() =>
|
() =>
|
||||||
Object.values(collections).filter(collection =>
|
Object.values(collections).filter(collection =>
|
||||||
'folder' in collection ? collection.create ?? false : false,
|
'folder' in collection ? collection.create ?? false : false,
|
||||||
@ -123,7 +123,7 @@ const Header = ({
|
|||||||
) : null}
|
) : null}
|
||||||
<StyledSpacer />
|
<StyledSpacer />
|
||||||
<StyledAppHeaderActions>
|
<StyledAppHeaderActions>
|
||||||
{createableCollections.length > 0 && (
|
{creatableCollections.length > 0 && (
|
||||||
<div key="quick-create">
|
<div key="quick-create">
|
||||||
<Button
|
<Button
|
||||||
id="quick-create-button"
|
id="quick-create-button"
|
||||||
@ -145,7 +145,7 @@ const Header = ({
|
|||||||
'aria-labelledby': 'quick-create-button',
|
'aria-labelledby': 'quick-create-button',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{createableCollections.map(collection => (
|
{creatableCollections.map(collection => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={collection.name}
|
key={collection.name}
|
||||||
onClick={() => handleCreatePostClick(collection.name)}
|
onClick={() => handleCreatePostClick(collection.name)}
|
||||||
|
@ -54,7 +54,7 @@ const EntryCard = ({
|
|||||||
|
|
||||||
interface EntryCardOwnProps {
|
interface EntryCardOwnProps {
|
||||||
entry: Entry;
|
entry: Entry;
|
||||||
inferedFields: {
|
inferredFields: {
|
||||||
titleField?: string | null | undefined;
|
titleField?: string | null | undefined;
|
||||||
descriptionField?: string | null | undefined;
|
descriptionField?: string | null | undefined;
|
||||||
imageField?: string | null | undefined;
|
imageField?: string | null | undefined;
|
||||||
@ -67,11 +67,11 @@ interface EntryCardOwnProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
|
function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
|
||||||
const { entry, inferedFields, collection } = ownProps;
|
const { entry, inferredFields, collection } = ownProps;
|
||||||
const entryData = entry.data;
|
const entryData = entry.data;
|
||||||
|
|
||||||
let image = inferedFields.imageField
|
let image = inferredFields.imageField
|
||||||
? (entryData?.[inferedFields.imageField] as string | undefined)
|
? (entryData?.[inferredFields.imageField] as string | undefined)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
if (image) {
|
if (image) {
|
||||||
@ -86,7 +86,7 @@ function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
|
|||||||
image,
|
image,
|
||||||
imageField:
|
imageField:
|
||||||
'fields' in collection
|
'fields' in collection
|
||||||
? collection.fields?.find(f => f.name === inferedFields.imageField && f.widget === 'image')
|
? collection.fields?.find(f => f.name === inferredFields.imageField && f.widget === 'image')
|
||||||
: undefined,
|
: undefined,
|
||||||
isLoadingAsset,
|
isLoadingAsset,
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@ import { Waypoint } from 'react-waypoint';
|
|||||||
|
|
||||||
import { VIEW_STYLE_LIST } from '@staticcms/core/constants/collectionViews';
|
import { VIEW_STYLE_LIST } from '@staticcms/core/constants/collectionViews';
|
||||||
import { transientOptions } from '@staticcms/core/lib';
|
import { transientOptions } from '@staticcms/core/lib';
|
||||||
import { selectFields, selectInferedField } from '@staticcms/core/lib/util/collection.util';
|
import { selectFields, selectInferredField } from '@staticcms/core/lib/util/collection.util';
|
||||||
import EntryCard from './EntryCard';
|
import EntryCard from './EntryCard';
|
||||||
|
|
||||||
import type { CollectionViewStyle } from '@staticcms/core/constants/collectionViews';
|
import type { CollectionViewStyle } from '@staticcms/core/constants/collectionViews';
|
||||||
@ -86,12 +86,12 @@ const EntryListing = ({
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const titleField = selectInferedField(collection, 'title');
|
const titleField = selectInferredField(collection, 'title');
|
||||||
const descriptionField = selectInferedField(collection, 'description');
|
const descriptionField = selectInferredField(collection, 'description');
|
||||||
const imageField = selectInferedField(collection, 'image');
|
const imageField = selectInferredField(collection, 'image');
|
||||||
const fields = selectFields(collection);
|
const fields = selectFields(collection);
|
||||||
const inferedFields = [titleField, descriptionField, imageField];
|
const inferredFields = [titleField, descriptionField, imageField];
|
||||||
const remainingFields = fields && fields.filter(f => inferedFields.indexOf(f.name) === -1);
|
const remainingFields = fields && fields.filter(f => inferredFields.indexOf(f.name) === -1);
|
||||||
return { titleField, descriptionField, imageField, remainingFields };
|
return { titleField, descriptionField, imageField, remainingFields };
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
@ -99,11 +99,11 @@ const EntryListing = ({
|
|||||||
|
|
||||||
const renderedCards = useMemo(() => {
|
const renderedCards = useMemo(() => {
|
||||||
if ('collection' in otherProps) {
|
if ('collection' in otherProps) {
|
||||||
const inferedFields = inferFields(otherProps.collection);
|
const inferredFields = inferFields(otherProps.collection);
|
||||||
return entries.map((entry, idx) => (
|
return entries.map((entry, idx) => (
|
||||||
<EntryCard
|
<EntryCard
|
||||||
collection={otherProps.collection}
|
collection={otherProps.collection}
|
||||||
inferedFields={inferedFields}
|
inferredFields={inferredFields}
|
||||||
viewStyle={viewStyle}
|
viewStyle={viewStyle}
|
||||||
entry={entry}
|
entry={entry}
|
||||||
key={idx}
|
key={idx}
|
||||||
@ -118,12 +118,12 @@ const EntryListing = ({
|
|||||||
coll => coll.name === collectionName,
|
coll => coll.name === collectionName,
|
||||||
);
|
);
|
||||||
const collectionLabel = !isSingleCollectionInList ? collection?.label : undefined;
|
const collectionLabel = !isSingleCollectionInList ? collection?.label : undefined;
|
||||||
const inferedFields = inferFields(collection);
|
const inferredFields = inferFields(collection);
|
||||||
return collection ? (
|
return collection ? (
|
||||||
<EntryCard
|
<EntryCard
|
||||||
collection={collection}
|
collection={collection}
|
||||||
entry={entry}
|
entry={entry}
|
||||||
inferedFields={inferedFields}
|
inferredFields={inferredFields}
|
||||||
collectionLabel={collectionLabel}
|
collectionLabel={collectionLabel}
|
||||||
key={idx}
|
key={idx}
|
||||||
/>
|
/>
|
||||||
|
@ -46,7 +46,7 @@ const LocaleRowWrapper = styled('div')`
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const DefaultLocaleWrittingIn = styled('div')`
|
const DefaultLocaleWritingIn = styled('div')`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 36.5px;
|
height: 36.5px;
|
||||||
@ -89,7 +89,7 @@ const LocaleDropdown = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!canChangeLocale) {
|
if (!canChangeLocale) {
|
||||||
return <DefaultLocaleWrittingIn>{dropdownText}</DefaultLocaleWrittingIn>;
|
return <DefaultLocaleWritingIn>{dropdownText}</DefaultLocaleWritingIn>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -10,7 +10,7 @@ import { getAsset as getAssetAction } from '@staticcms/core/actions/media';
|
|||||||
import { ErrorBoundary } from '@staticcms/core/components/UI';
|
import { ErrorBoundary } from '@staticcms/core/components/UI';
|
||||||
import { lengths } from '@staticcms/core/components/UI/styles';
|
import { lengths } from '@staticcms/core/components/UI/styles';
|
||||||
import { getPreviewStyles, getPreviewTemplate, resolveWidget } from '@staticcms/core/lib/registry';
|
import { getPreviewStyles, getPreviewTemplate, resolveWidget } from '@staticcms/core/lib/registry';
|
||||||
import { selectTemplateName, useInferedFields } from '@staticcms/core/lib/util/collection.util';
|
import { selectTemplateName, useInferredFields } from '@staticcms/core/lib/util/collection.util';
|
||||||
import { selectField } from '@staticcms/core/lib/util/field.util';
|
import { selectField } from '@staticcms/core/lib/util/field.util';
|
||||||
import { selectIsLoadingAsset } from '@staticcms/core/reducers/selectors/medias';
|
import { selectIsLoadingAsset } from '@staticcms/core/reducers/selectors/medias';
|
||||||
import { getTypedFieldForValue } from '@staticcms/list/typedListHelpers';
|
import { getTypedFieldForValue } from '@staticcms/list/typedListHelpers';
|
||||||
@ -92,7 +92,7 @@ function getWidgetFor(
|
|||||||
name: string,
|
name: string,
|
||||||
fields: Field[],
|
fields: Field[],
|
||||||
entry: Entry,
|
entry: Entry,
|
||||||
inferedFields: Record<string, InferredField>,
|
inferredFields: Record<string, InferredField>,
|
||||||
getAsset: GetAssetFunction,
|
getAsset: GetAssetFunction,
|
||||||
widgetFields: Field[] = fields,
|
widgetFields: Field[] = fields,
|
||||||
values: EntryData = entry.data,
|
values: EntryData = entry.data,
|
||||||
@ -116,7 +116,7 @@ function getWidgetFor(
|
|||||||
collection,
|
collection,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
getAsset,
|
getAsset,
|
||||||
field.fields,
|
field.fields,
|
||||||
value as EntryData | EntryData[],
|
value as EntryData | EntryData[],
|
||||||
@ -130,7 +130,7 @@ function getWidgetFor(
|
|||||||
collection,
|
collection,
|
||||||
field,
|
field,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
getAsset,
|
getAsset,
|
||||||
value as EntryData[],
|
value as EntryData[],
|
||||||
),
|
),
|
||||||
@ -138,7 +138,7 @@ function getWidgetFor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const labelledWidgets = ['string', 'text', 'number'];
|
const labelledWidgets = ['string', 'text', 'number'];
|
||||||
const inferedField = Object.entries(inferedFields)
|
const inferredField = Object.entries(inferredFields)
|
||||||
.filter(([key]) => {
|
.filter(([key]) => {
|
||||||
const fieldToMatch = selectField(collection, key);
|
const fieldToMatch = selectField(collection, key);
|
||||||
return fieldToMatch === fieldWithWidgets;
|
return fieldToMatch === fieldWithWidgets;
|
||||||
@ -146,8 +146,8 @@ function getWidgetFor(
|
|||||||
.map(([, value]) => value)[0];
|
.map(([, value]) => value)[0];
|
||||||
|
|
||||||
let renderedValue: ValueOrNestedValue | ReactNode = value;
|
let renderedValue: ValueOrNestedValue | ReactNode = value;
|
||||||
if (inferedField) {
|
if (inferredField) {
|
||||||
renderedValue = inferedField.defaultPreview(String(value));
|
renderedValue = inferredField.defaultPreview(String(value));
|
||||||
} else if (
|
} else if (
|
||||||
value &&
|
value &&
|
||||||
fieldWithWidgets.widget &&
|
fieldWithWidgets.widget &&
|
||||||
@ -235,7 +235,7 @@ function widgetsForNestedFields(
|
|||||||
collection: Collection,
|
collection: Collection,
|
||||||
fields: Field[],
|
fields: Field[],
|
||||||
entry: Entry,
|
entry: Entry,
|
||||||
inferedFields: Record<string, InferredField>,
|
inferredFields: Record<string, InferredField>,
|
||||||
getAsset: GetAssetFunction,
|
getAsset: GetAssetFunction,
|
||||||
widgetFields: Field[],
|
widgetFields: Field[],
|
||||||
values: EntryData,
|
values: EntryData,
|
||||||
@ -249,7 +249,7 @@ function widgetsForNestedFields(
|
|||||||
field.name,
|
field.name,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
getAsset,
|
getAsset,
|
||||||
widgetFields,
|
widgetFields,
|
||||||
values,
|
values,
|
||||||
@ -267,7 +267,7 @@ function getTypedNestedWidgets(
|
|||||||
collection: Collection,
|
collection: Collection,
|
||||||
field: ListField,
|
field: ListField,
|
||||||
entry: Entry,
|
entry: Entry,
|
||||||
inferedFields: Record<string, InferredField>,
|
inferredFields: Record<string, InferredField>,
|
||||||
getAsset: GetAssetFunction,
|
getAsset: GetAssetFunction,
|
||||||
values: EntryData[],
|
values: EntryData[],
|
||||||
) {
|
) {
|
||||||
@ -283,7 +283,7 @@ function getTypedNestedWidgets(
|
|||||||
collection,
|
collection,
|
||||||
itemType.fields,
|
itemType.fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
getAsset,
|
getAsset,
|
||||||
itemType.fields,
|
itemType.fields,
|
||||||
value,
|
value,
|
||||||
@ -301,7 +301,7 @@ function getNestedWidgets(
|
|||||||
collection: Collection,
|
collection: Collection,
|
||||||
fields: Field[],
|
fields: Field[],
|
||||||
entry: Entry,
|
entry: Entry,
|
||||||
inferedFields: Record<string, InferredField>,
|
inferredFields: Record<string, InferredField>,
|
||||||
getAsset: GetAssetFunction,
|
getAsset: GetAssetFunction,
|
||||||
widgetFields: Field[],
|
widgetFields: Field[],
|
||||||
values: EntryData | EntryData[],
|
values: EntryData | EntryData[],
|
||||||
@ -314,7 +314,7 @@ function getNestedWidgets(
|
|||||||
collection,
|
collection,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
getAsset,
|
getAsset,
|
||||||
widgetFields,
|
widgetFields,
|
||||||
value,
|
value,
|
||||||
@ -328,7 +328,7 @@ function getNestedWidgets(
|
|||||||
collection,
|
collection,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
getAsset,
|
getAsset,
|
||||||
widgetFields,
|
widgetFields,
|
||||||
values,
|
values,
|
||||||
@ -338,7 +338,7 @@ function getNestedWidgets(
|
|||||||
const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
||||||
const { entry, collection, config, fields, previewInFrame, getAsset, t } = props;
|
const { entry, collection, config, fields, previewInFrame, getAsset, t } = props;
|
||||||
|
|
||||||
const inferedFields = useInferedFields(collection);
|
const inferredFields = useInferredFields(collection);
|
||||||
|
|
||||||
const handleGetAsset = useCallback(
|
const handleGetAsset = useCallback(
|
||||||
(path: string, field?: Field) => {
|
(path: string, field?: Field) => {
|
||||||
@ -359,11 +359,11 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
|||||||
name,
|
name,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
handleGetAsset,
|
handleGetAsset,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[collection, config, entry, fields, handleGetAsset, inferedFields],
|
[collection, config, entry, fields, handleGetAsset, inferredFields],
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -413,7 +413,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
|||||||
field.name,
|
field.name,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
handleGetAsset,
|
handleGetAsset,
|
||||||
nestedFields,
|
nestedFields,
|
||||||
val,
|
val,
|
||||||
@ -445,7 +445,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
|||||||
field.name,
|
field.name,
|
||||||
fields,
|
fields,
|
||||||
entry,
|
entry,
|
||||||
inferedFields,
|
inferredFields,
|
||||||
handleGetAsset,
|
handleGetAsset,
|
||||||
nestedFields,
|
nestedFields,
|
||||||
value,
|
value,
|
||||||
@ -457,7 +457,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
|||||||
}, {} as Record<string, ReactNode>),
|
}, {} as Record<string, ReactNode>),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
[collection, config.config, entry, fields, handleGetAsset, inferedFields],
|
[collection, config.config, entry, fields, handleGetAsset, inferredFields],
|
||||||
);
|
);
|
||||||
|
|
||||||
const previewStyles = useMemo(
|
const previewStyles = useMemo(
|
||||||
|
@ -2097,7 +2097,7 @@ const equalStaticArray = function * ( table , finalKey ,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( lineRest[0]===']' ) { break; }
|
if ( lineRest[0]===']' ) { break; }
|
||||||
throw throws(SyntaxError$1(`Unexpect character in static array item value` + where(', which is found at ')));
|
throw throws(SyntaxError$1(`Unexpected character in static array item value` + where(', which is found at ')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline===null || beInline(staticArray, inline);
|
inline===null || beInline(staticArray, inline);
|
||||||
@ -2231,7 +2231,7 @@ const Root = () => {
|
|||||||
const { leadingKeys, finalKey, asArrayItem, tag, lineRest } = TABLE_DEFINITION_exec_groups(line, parseKeys);
|
const { leadingKeys, finalKey, asArrayItem, tag, lineRest } = TABLE_DEFINITION_exec_groups(line, parseKeys);
|
||||||
const table = prepareTable(rootTable, leadingKeys);
|
const table = prepareTable(rootTable, leadingKeys);
|
||||||
if ( lineRest ) {
|
if ( lineRest ) {
|
||||||
lineRest[0]==='#' || throws(SyntaxError$1(`Unexpect charachtor after table header` + where(' at ')));
|
lineRest[0]==='#' || throws(SyntaxError$1(`Unexpected charachtor after table header` + where(' at ')));
|
||||||
}
|
}
|
||||||
lastSectionTable = appendTable(table, finalKey, asArrayItem, tag);
|
lastSectionTable = appendTable(table, finalKey, asArrayItem, tag);
|
||||||
preserveComment && lineRest && ( lastSectionTable[commentForThis] = asArrayItem ? lineRest.slice(1) : table[commentFor(finalKey)] = lineRest.slice(1) );
|
preserveComment && lineRest && ( lastSectionTable[commentForThis] = asArrayItem ? lineRest.slice(1) : table[commentFor(finalKey)] = lineRest.slice(1) );
|
||||||
@ -2244,7 +2244,7 @@ const Root = () => {
|
|||||||
let rest = assign(forComment);
|
let rest = assign(forComment);
|
||||||
typeof rest==='string' || ( rest = x (rest) );
|
typeof rest==='string' || ( rest = x (rest) );
|
||||||
if ( rest ) {
|
if ( rest ) {
|
||||||
rest[0]==='#' || throws(SyntaxError$1(`Unexpect charachtor after key/value pair` + where(' at ')));
|
rest[0]==='#' || throws(SyntaxError$1(`Unexpected charachtor after key/value pair` + where(' at ')));
|
||||||
if ( preserveComment ) { forComment.table[commentFor(forComment.finalKey)] = rest.slice(1); }
|
if ( preserveComment ) { forComment.table[commentFor(forComment.finalKey)] = rest.slice(1); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ async function sha256(text: string) {
|
|||||||
|
|
||||||
// based on https://github.com/auth0/auth0-spa-js/blob/9a83f698127eae7da72691b0d4b1b847567687e3/src/utils.ts#L147
|
// based on https://github.com/auth0/auth0-spa-js/blob/9a83f698127eae7da72691b0d4b1b847567687e3/src/utils.ts#L147
|
||||||
function generateVerifierCode() {
|
function generateVerifierCode() {
|
||||||
// characters that can be used for codeVerifer
|
// characters that can be used for codeVerifier
|
||||||
// excludes _~ as if included would cause an uneven distribution as char.length would no longer be a factor of 256
|
// excludes _~ as if included would cause an uneven distribution as char.length would no longer be a factor of 256
|
||||||
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.';
|
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.';
|
||||||
const randomValues = Array.from(window.crypto.getRandomValues(new Uint8Array(128)));
|
const randomValues = Array.from(window.crypto.getRandomValues(new Uint8Array(128)));
|
||||||
|
@ -4,7 +4,7 @@ import partialRight from 'lodash/partialRight';
|
|||||||
|
|
||||||
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
|
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
|
||||||
import { sanitizeSlug } from './urlHelper';
|
import { sanitizeSlug } from './urlHelper';
|
||||||
import { selectIdentifier, selectInferedField } from './util/collection.util';
|
import { selectIdentifier, selectInferredField } from './util/collection.util';
|
||||||
import { selectField } from './util/field.util';
|
import { selectField } from './util/field.util';
|
||||||
import { set } from './util/object.util';
|
import { set } from './util/object.util';
|
||||||
import {
|
import {
|
||||||
@ -108,7 +108,7 @@ export function slugFormatter(collection: Collection, entryData: EntryData, slug
|
|||||||
|
|
||||||
export function summaryFormatter(summaryTemplate: string, entry: Entry, collection: Collection) {
|
export function summaryFormatter(summaryTemplate: string, entry: Entry, collection: Collection) {
|
||||||
let entryData = entry.data;
|
let entryData = entry.data;
|
||||||
const date = parseDateFromEntry(entry, selectInferedField(collection, 'date')) || null;
|
const date = parseDateFromEntry(entry, selectInferredField(collection, 'date')) || null;
|
||||||
const identifier = get(entryData, keyToPathArray(selectIdentifier(collection)));
|
const identifier = get(entryData, keyToPathArray(selectIdentifier(collection)));
|
||||||
|
|
||||||
entryData =
|
entryData =
|
||||||
@ -144,7 +144,7 @@ export function folderFormatter(
|
|||||||
'folder' in collection ? collection.folder : '',
|
'folder' in collection ? collection.folder : '',
|
||||||
);
|
);
|
||||||
|
|
||||||
const date = parseDateFromEntry(entry, selectInferedField(collection, 'date')) || null;
|
const date = parseDateFromEntry(entry, selectInferredField(collection, 'date')) || null;
|
||||||
const identifier = get(fields, keyToPathArray(selectIdentifier(collection)));
|
const identifier = get(fields, keyToPathArray(selectIdentifier(collection)));
|
||||||
const processSegment = getProcessSegment(slugConfig, [defaultFolder, fields?.dirname as string]);
|
const processSegment = getProcessSegment(slugConfig, [defaultFolder, fields?.dirname as string]);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ export function selectEntryCollectionTitle(collection: Collection, entry: Entry)
|
|||||||
|
|
||||||
// try to infer a title field from the entry data
|
// try to infer a title field from the entry data
|
||||||
const entryData = entry.data;
|
const entryData = entry.data;
|
||||||
const titleField = selectInferedField(collection, 'title');
|
const titleField = selectInferredField(collection, 'title');
|
||||||
const result = titleField && get(entryData, keyToPathArray(titleField));
|
const result = titleField && get(entryData, keyToPathArray(titleField));
|
||||||
|
|
||||||
// if the custom field does not yield a result, fallback to 'title'
|
// if the custom field does not yield a result, fallback to 'title'
|
||||||
@ -138,7 +138,7 @@ export function selectEntryCollectionTitle(collection: Collection, entry: Entry)
|
|||||||
|
|
||||||
export function selectDefaultSortableFields(collection: Collection, backend: Backend) {
|
export function selectDefaultSortableFields(collection: Collection, backend: Backend) {
|
||||||
let defaultSortable = SORTABLE_FIELDS.map((type: string) => {
|
let defaultSortable = SORTABLE_FIELDS.map((type: string) => {
|
||||||
const field = selectInferedField(collection, type);
|
const field = selectInferredField(collection, type);
|
||||||
if (backend.isGitBackend() && type === 'author' && !field) {
|
if (backend.isGitBackend() && type === 'author' && !field) {
|
||||||
// default to commit author if not author field is found
|
// default to commit author if not author field is found
|
||||||
return COMMIT_AUTHOR;
|
return COMMIT_AUTHOR;
|
||||||
@ -336,7 +336,7 @@ export function selectIdentifier(collection: Collection) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectInferedField(collection: Collection, fieldName: string) {
|
export function selectInferredField(collection: Collection, fieldName: string) {
|
||||||
if (fieldName === 'title' && collection.identifier_field) {
|
if (fieldName === 'title' && collection.identifier_field) {
|
||||||
return selectIdentifier(collection);
|
return selectIdentifier(collection);
|
||||||
}
|
}
|
||||||
@ -393,11 +393,11 @@ export function selectInferedField(collection: Collection, fieldName: string) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useInferedFields(collection: Collection) {
|
export function useInferredFields(collection: Collection) {
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
const titleField = selectInferedField(collection, 'title');
|
const titleField = selectInferredField(collection, 'title');
|
||||||
const shortTitleField = selectInferedField(collection, 'shortTitle');
|
const shortTitleField = selectInferredField(collection, 'shortTitle');
|
||||||
const authorField = selectInferedField(collection, 'author');
|
const authorField = selectInferredField(collection, 'author');
|
||||||
|
|
||||||
const iFields: Record<string, InferredField> = {};
|
const iFields: Record<string, InferredField> = {};
|
||||||
if (titleField) {
|
if (titleField) {
|
||||||
|
@ -48,7 +48,7 @@ declare global {
|
|||||||
cloudinary: {
|
cloudinary: {
|
||||||
createMediaLibrary: (
|
createMediaLibrary: (
|
||||||
config: Record<string, unknown>,
|
config: Record<string, unknown>,
|
||||||
hadlers: { insertHandler: (data: { assets: CloudinaryAsset[] }) => void },
|
handlers: { insertHandler: (data: { assets: CloudinaryAsset[] }) => void },
|
||||||
) => {
|
) => {
|
||||||
show: (config: Record<string, unknown>) => void;
|
show: (config: Record<string, unknown>) => void;
|
||||||
hide: () => void;
|
hide: () => void;
|
||||||
|
@ -381,7 +381,7 @@ const withFileControl = ({ forImage = false }: WithFileControlProps = {}) => {
|
|||||||
|
|
||||||
if (isMultiple(internalValue)) {
|
if (isMultiple(internalValue)) {
|
||||||
return (
|
return (
|
||||||
<FileLinks key="mulitple-file-links">
|
<FileLinks key="multiple-file-links">
|
||||||
<FileLinkList key="file-links-list">
|
<FileLinkList key="file-links-list">
|
||||||
{internalValue.map(val => (
|
{internalValue.map(val => (
|
||||||
<li key={val}>{renderFileLink(val)}</li>
|
<li key={val}>{renderFileLink(val)}</li>
|
||||||
|
@ -36,7 +36,7 @@ const StyledMapControlContent = styled(
|
|||||||
)<StyledMapControlContentProps>(
|
)<StyledMapControlContentProps>(
|
||||||
({ $collapsed, $height }) => `
|
({ $collapsed, $height }) => `
|
||||||
display: flex;
|
display: flex;
|
||||||
postion: relative;
|
position: relative;
|
||||||
height: ${$height}
|
height: ${$height}
|
||||||
${
|
${
|
||||||
$collapsed
|
$collapsed
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
_faqs: {
|
_faqs: {
|
||||||
'what-is-static-cms.md': {
|
'what-is-static-cms.md': {
|
||||||
content:
|
content:
|
||||||
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git comitters.\n\n',
|
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git committers.\n\n',
|
||||||
},
|
},
|
||||||
'what-is-jam-stack.md': {
|
'what-is-jam-stack.md': {
|
||||||
content:
|
content:
|
||||||
|
@ -24,7 +24,7 @@ Then create a new route for your project (for instance at `/admin`), and import
|
|||||||
import CMS from '@staticcms/core';
|
import CMS from '@staticcms/core';
|
||||||
```
|
```
|
||||||
|
|
||||||
The default export is a _CMS_ object, which has an `init` method that takes an object with a `config` attribute. The `config` attribute is an object representing the [configuration options](docs/configuration-options). You can use destructuring assigment syntax as shorthand:
|
The default export is a _CMS_ object, which has an `init` method that takes an object with a `config` attribute. The `config` attribute is an object representing the [configuration options](docs/configuration-options). You can use destructuring assignment syntax as shorthand:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import CMS from '@staticcms/core';
|
import CMS from '@staticcms/core';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user