Clean up after image widget experiments
This commit is contained in:
parent
e299613d6a
commit
97787741d7
31
packages/netlify-cms-core/index.d.ts
vendored
31
packages/netlify-cms-core/index.d.ts
vendored
@ -528,36 +528,6 @@ declare module 'netlify-cms-core' {
|
||||
fileObj: File;
|
||||
};
|
||||
|
||||
type DisplayURL = { id: string; path: string } | string;
|
||||
|
||||
type EntryField = StaticallyTypedRecord<{
|
||||
field?: EntryField;
|
||||
fields?: List<EntryField>;
|
||||
types?: List<EntryField>;
|
||||
widget: string;
|
||||
name: string;
|
||||
default: string | null | boolean | List<unknown>;
|
||||
media_folder?: string;
|
||||
public_folder?: string;
|
||||
comment?: string;
|
||||
meta?: boolean;
|
||||
i18n: 'translate' | 'duplicate' | 'none';
|
||||
}>;
|
||||
|
||||
interface BackendMediaFile {
|
||||
name: string;
|
||||
id: string;
|
||||
size?: number;
|
||||
displayURL?: DisplayURL;
|
||||
path: string;
|
||||
draft?: boolean;
|
||||
url?: string;
|
||||
file?: File;
|
||||
field?: EntryField;
|
||||
}
|
||||
|
||||
type MediaFile = BackendMediaFile & { key?: string };
|
||||
|
||||
export type PreviewTemplateComponentProps = {
|
||||
entry: Map<string, any>;
|
||||
collection: Map<string, any>;
|
||||
@ -579,7 +549,6 @@ declare module 'netlify-cms-core' {
|
||||
getRemarkPlugins: () => Array<Pluggable>;
|
||||
getLocale: (locale: string) => CmsLocalePhrases | undefined;
|
||||
getMediaLibrary: (name: string) => CmsMediaLibrary | undefined;
|
||||
selectMediaFiles: (field?: EntryField | undefined) => MediaFile[];
|
||||
resolveWidget: (name: string) => CmsWidget | undefined;
|
||||
getPreviewStyles: () => PreviewStyle[];
|
||||
getPreviewTemplate: (name: string) => ComponentType<PreviewTemplateComponentProps> | undefined;
|
||||
|
@ -222,8 +222,6 @@ class EditorControl extends React.Component {
|
||||
const childErrors = this.isAncestorOfFieldError();
|
||||
const hasErrors = !!errors || childErrors;
|
||||
|
||||
console.log('[EditorControl] widgetName', widgetName, 'mediaPaths', mediaPaths);
|
||||
|
||||
return (
|
||||
<ClassNames>
|
||||
{({ css, cx }) => (
|
||||
|
@ -3,8 +3,6 @@ import produce from 'immer';
|
||||
import { oneLine } from 'common-tags';
|
||||
|
||||
import EditorComponent from '../valueObjects/EditorComponent';
|
||||
import { selectMediaFiles as selectMediaFilesSelector } from '../reducers/mediaLibrary';
|
||||
import { store } from '../redux';
|
||||
|
||||
const allowedEvents = [
|
||||
'prePublish',
|
||||
@ -54,7 +52,6 @@ export default {
|
||||
getBackend,
|
||||
registerMediaLibrary,
|
||||
getMediaLibrary,
|
||||
selectMediaFiles,
|
||||
registerLocale,
|
||||
getLocale,
|
||||
registerEventListener,
|
||||
@ -227,15 +224,6 @@ export function getMediaLibrary(name) {
|
||||
return registry.mediaLibraries.find(ml => ml.name === name);
|
||||
}
|
||||
|
||||
export function selectMediaFiles(field) {
|
||||
const state = store.getState();
|
||||
if (state) {
|
||||
return selectMediaFilesSelector(state, field);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
export function getFiles(name) {
|
||||
return registry.mediaLibraries.find(ml => ml.name === name);
|
||||
}
|
||||
|
@ -195,8 +195,6 @@ export default function withFileControl({ forImage } = {}) {
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
console.log('[withFileControl][shouldComponentUpdate] nextProps', nextProps);
|
||||
|
||||
/**
|
||||
* Always update if the value or getAsset changes.
|
||||
*/
|
||||
@ -219,8 +217,6 @@ export default function withFileControl({ forImage } = {}) {
|
||||
componentDidUpdate() {
|
||||
const { mediaPaths, value, onRemoveInsertedMedia, onChange } = this.props;
|
||||
const mediaPath = mediaPaths.get(this.controlID);
|
||||
console.log('[withFileControl][shouldComponentUpdate] mediaPath', mediaPath);
|
||||
console.log('[withFileControl][shouldComponentUpdate] value', value);
|
||||
if (mediaPath && mediaPath !== value) {
|
||||
onChange(mediaPath);
|
||||
} else if (mediaPath && mediaPath === value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user