chore: fix miscellaneous errors from linters (#1555)
This commit is contained in:
parent
d5f59de2d2
commit
5a27fb8b9d
@ -29,7 +29,7 @@ export default class Bitbucket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.options.proxied && !config.getIn(["backend", "repo"], false)) {
|
if (!this.options.proxied && !config.getIn(["backend", "repo"], false)) {
|
||||||
throw new Error("The BitBucket backend needs a \"repo\ in the backend configuration.");
|
throw new Error("The BitBucket backend needs a \"repo\" in the backend configuration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api = this.options.API || null;
|
this.api = this.options.API || null;
|
||||||
|
@ -143,14 +143,14 @@ export default class API {
|
|||||||
const cache = localForage.getItem(`gh.meta.${ key }`);
|
const cache = localForage.getItem(`gh.meta.${ key }`);
|
||||||
return cache.then((cached) => {
|
return cache.then((cached) => {
|
||||||
if (cached && cached.expires > Date.now()) { return cached.data; }
|
if (cached && cached.expires > Date.now()) { return cached.data; }
|
||||||
console.log("%c Checking for MetaData files", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
console.log("%c Checking for MetaData files", "line-height: 30px;text-align: center;font-weight: bold");
|
||||||
return this.request(`${ this.repoURL }/contents/${ key }.json`, {
|
return this.request(`${ this.repoURL }/contents/${ key }.json`, {
|
||||||
params: { ref: "refs/meta/_netlify_cms" },
|
params: { ref: "refs/meta/_netlify_cms" },
|
||||||
headers: { Accept: "application/vnd.github.VERSION.raw" },
|
headers: { Accept: "application/vnd.github.VERSION.raw" },
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
})
|
})
|
||||||
.then(response => JSON.parse(response))
|
.then(response => JSON.parse(response))
|
||||||
.catch(error => console.log("%c %s does not have metadata", "line-height: 30px;text-align: center;font-weight: bold", key)); // eslint-disable-line
|
.catch(error => console.log("%c %s does not have metadata", "line-height: 30px;text-align: center;font-weight: bold", key));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ export default class API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
listUnpublishedBranches() {
|
listUnpublishedBranches() {
|
||||||
console.log("%c Checking for Unpublished entries", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
console.log("%c Checking for Unpublished entries", "line-height: 30px;text-align: center;font-weight: bold");
|
||||||
return this.request(`${ this.repoURL }/git/refs/heads/cms`)
|
return this.request(`${ this.repoURL }/git/refs/heads/cms`)
|
||||||
.then(branches => filterPromises(branches, (branch) => {
|
.then(branches => filterPromises(branches, (branch) => {
|
||||||
const branchName = branch.ref.substring("/refs/heads/".length - 1);
|
const branchName = branch.ref.substring("/refs/heads/".length - 1);
|
||||||
@ -245,7 +245,7 @@ export default class API {
|
|||||||
.then(prs => prs.some(pr => pr.head.ref === branchName));
|
.then(prs => prs.some(pr => pr.head.ref === branchName));
|
||||||
}))
|
}))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("%c No Unpublished entries", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
console.log("%c No Unpublished entries", "line-height: 30px;text-align: center;font-weight: bold");
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ export default class API {
|
|||||||
parts = file.path.split("/").filter(part => part);
|
parts = file.path.split("/").filter(part => part);
|
||||||
filename = parts.pop();
|
filename = parts.pop();
|
||||||
subtree = fileTree;
|
subtree = fileTree;
|
||||||
while (part = parts.shift()) {
|
while (part = parts.shift()) { // eslint-disable-line no-cond-assign
|
||||||
subtree[part] = subtree[part] || {};
|
subtree[part] = subtree[part] || {};
|
||||||
subtree = subtree[part];
|
subtree = subtree[part];
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ export default class API {
|
|||||||
closePR(pullrequest, objects) {
|
closePR(pullrequest, objects) {
|
||||||
const headSha = pullrequest.head;
|
const headSha = pullrequest.head;
|
||||||
const prNumber = pullrequest.number;
|
const prNumber = pullrequest.number;
|
||||||
console.log("%c Deleting PR", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
console.log("%c Deleting PR", "line-height: 30px;text-align: center;font-weight: bold");
|
||||||
return this.request(`${ this.repoURL }/pulls/${ prNumber }`, {
|
return this.request(`${ this.repoURL }/pulls/${ prNumber }`, {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@ -648,7 +648,7 @@ export default class API {
|
|||||||
mergePR(pullrequest, objects) {
|
mergePR(pullrequest, objects) {
|
||||||
const headSha = pullrequest.head;
|
const headSha = pullrequest.head;
|
||||||
const prNumber = pullrequest.number;
|
const prNumber = pullrequest.number;
|
||||||
console.log("%c Merging PR", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
console.log("%c Merging PR", "line-height: 30px;text-align: center;font-weight: bold");
|
||||||
return this.request(`${ this.repoURL }/pulls/${ prNumber }/merge`, {
|
return this.request(`${ this.repoURL }/pulls/${ prNumber }/merge`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
@ -673,7 +673,7 @@ export default class API {
|
|||||||
files.forEach((file) => {
|
files.forEach((file) => {
|
||||||
commitMessage += `\n* "${ file.path }"`;
|
commitMessage += `\n* "${ file.path }"`;
|
||||||
});
|
});
|
||||||
console.log("%c Automatic merge not possible - Forcing merge.", "line-height: 30px;text-align: center;font-weight: bold"); // eslint-disable-line
|
console.log("%c Automatic merge not possible - Forcing merge.", "line-height: 30px;text-align: center;font-weight: bold");
|
||||||
return this.getBranch()
|
return this.getBranch()
|
||||||
.then(branchData => this.updateTree(branchData.commit.sha, "/", fileTree))
|
.then(branchData => this.updateTree(branchData.commit.sha, "/", fileTree))
|
||||||
.then(changeTree => this.commit(commitMessage, changeTree))
|
.then(changeTree => this.commit(commitMessage, changeTree))
|
||||||
@ -738,7 +738,7 @@ export default class API {
|
|||||||
|
|
||||||
for (let i = 0, len = tree.tree.length; i < len; i++) {
|
for (let i = 0, len = tree.tree.length; i < len; i++) {
|
||||||
obj = tree.tree[i];
|
obj = tree.tree[i];
|
||||||
if (fileOrDir = fileTree[obj.path]) {
|
if (fileOrDir = fileTree[obj.path]) { // eslint-disable-line no-cond-assign
|
||||||
added[obj.path] = true;
|
added[obj.path] = true;
|
||||||
if (fileOrDir.file) {
|
if (fileOrDir.file) {
|
||||||
updates.push({ path: obj.path, mode: obj.mode, type: obj.type, sha: fileOrDir.sha });
|
updates.push({ path: obj.path, mode: obj.mode, type: obj.type, sha: fileOrDir.sha });
|
||||||
|
@ -86,7 +86,7 @@ export function validateConfig(config) {
|
|||||||
throw new Error("Error in configuration file: Your `backend.name` must be a string. Check your config.yml file.");
|
throw new Error("Error in configuration file: Your `backend.name` must be a string. Check your config.yml file.");
|
||||||
}
|
}
|
||||||
if (!config.get('media_folder')) {
|
if (!config.get('media_folder')) {
|
||||||
throw new Error("Error in configuration file: A `media_folder` wasn\'t found. Check your config.yml file.");
|
throw new Error("Error in configuration file: A `media_folder` wasn't found. Check your config.yml file.");
|
||||||
}
|
}
|
||||||
if (typeof config.get('media_folder') !== 'string') {
|
if (typeof config.get('media_folder') !== 'string') {
|
||||||
throw new Error("Error in configuration file: Your `media_folder` must be a string. Check your config.yml file.");
|
throw new Error("Error in configuration file: Your `media_folder` must be a string. Check your config.yml file.");
|
||||||
@ -99,7 +99,7 @@ export function validateConfig(config) {
|
|||||||
throw new Error("Error in configuration file: Your `slug.clean_accents` must be a boolean. Check your config.yml file.");
|
throw new Error("Error in configuration file: Your `slug.clean_accents` must be a boolean. Check your config.yml file.");
|
||||||
}
|
}
|
||||||
if (!config.get('collections')) {
|
if (!config.get('collections')) {
|
||||||
throw new Error("Error in configuration file: A `collections` wasn\'t found. Check your config.yml file.");
|
throw new Error("Error in configuration file: A `collections` wasn't found. Check your config.yml file.");
|
||||||
}
|
}
|
||||||
const collections = config.get('collections');
|
const collections = config.get('collections');
|
||||||
if (!List.isList(collections) || collections.isEmpty() || !collections.first()) {
|
if (!List.isList(collections) || collections.isEmpty() || !collections.first()) {
|
||||||
|
@ -45,7 +45,7 @@ const slugFormatter = (collection, entryData, slugConfig) => {
|
|||||||
throw new Error("Collection must have a field name that is a valid entry identifier");
|
throw new Error("Collection must have a field name that is a valid entry identifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
const slug = template.replace(/\{\{([^\}]+)\}\}/g, (_, field) => {
|
const slug = template.replace(/\{\{([^}]+)\}\}/g, (_, field) => {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case "year":
|
case "year":
|
||||||
return date.getFullYear();
|
return date.getFullYear();
|
||||||
@ -85,7 +85,7 @@ const commitMessageTemplates = Map({
|
|||||||
const commitMessageFormatter = (type, config, { slug, path, collection }) => {
|
const commitMessageFormatter = (type, config, { slug, path, collection }) => {
|
||||||
const templates = commitMessageTemplates.merge(config.getIn(['backend', 'commit_messages'], Map()));
|
const templates = commitMessageTemplates.merge(config.getIn(['backend', 'commit_messages'], Map()));
|
||||||
const messageTemplate = templates.get(type);
|
const messageTemplate = templates.get(type);
|
||||||
return messageTemplate.replace(/\{\{([^\}]+)\}\}/g, (_, variable) => {
|
return messageTemplate.replace(/\{\{([^}]+)\}\}/g, (_, variable) => {
|
||||||
switch (variable) {
|
switch (variable) {
|
||||||
case 'slug':
|
case 'slug':
|
||||||
return slug;
|
return slug;
|
||||||
|
@ -7,8 +7,10 @@ const NotFoundContainer = styled.div`
|
|||||||
margin: ${lengths.pageMargin};
|
margin: ${lengths.pageMargin};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default () => (
|
const NotFoundPage = () => (
|
||||||
<NotFoundContainer>
|
<NotFoundContainer>
|
||||||
<h2>Not Found</h2>
|
<h2>Not Found</h2>
|
||||||
</NotFoundContainer>
|
</NotFoundContainer>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export default NotFoundPage;
|
||||||
|
@ -186,7 +186,7 @@ class EditorInterface extends Component {
|
|||||||
fieldsErrors={fieldsErrors}
|
fieldsErrors={fieldsErrors}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onValidate={onValidate}
|
onValidate={onValidate}
|
||||||
ref={c => this.controlPaneRef = c} // eslint-disable-line
|
ref={c => this.controlPaneRef = c}
|
||||||
/>
|
/>
|
||||||
</ControlPaneContainer>
|
</ControlPaneContainer>
|
||||||
);
|
);
|
||||||
|
@ -120,7 +120,7 @@ export default class PreviewPane extends React.Component {
|
|||||||
const widgets = nestedFields && Map(nestedFields.map((f, i) => [f.get('name'), <div key={i}>{this.getWidget(f, val, this.props)}</div>]));
|
const widgets = nestedFields && Map(nestedFields.map((f, i) => [f.get('name'), <div key={i}>{this.getWidget(f, val, this.props)}</div>]));
|
||||||
return Map({ data: val, widgets });
|
return Map({ data: val, widgets });
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return Map({
|
return Map({
|
||||||
data: value,
|
data: value,
|
||||||
|
@ -57,12 +57,12 @@ export default class ScrollSync extends Component {
|
|||||||
|
|
||||||
addEvents = (node, group) => {
|
addEvents = (node, group) => {
|
||||||
/* For some reason element.addEventListener doesnt work with document.body */
|
/* For some reason element.addEventListener doesnt work with document.body */
|
||||||
node.onscroll = this.handlePaneScroll.bind(this, node, group) // eslint-disable-line
|
node.onscroll = this.handlePaneScroll.bind(this, node, group)
|
||||||
}
|
}
|
||||||
|
|
||||||
removeEvents = (node) => {
|
removeEvents = (node) => {
|
||||||
/* For some reason element.removeEventListener doesnt work with document.body */
|
/* For some reason element.removeEventListener doesnt work with document.body */
|
||||||
node.onscroll = null // eslint-disable-line
|
node.onscroll = null
|
||||||
}
|
}
|
||||||
|
|
||||||
findPane = (node, group) => {
|
findPane = (node, group) => {
|
||||||
@ -108,10 +108,10 @@ export default class ScrollSync extends Component {
|
|||||||
const paneWidth = pane.scrollWidth - clientWidth
|
const paneWidth = pane.scrollWidth - clientWidth
|
||||||
/* Adjust the scrollTop position of it accordingly */
|
/* Adjust the scrollTop position of it accordingly */
|
||||||
if (vertical && scrollTopOffset > 0) {
|
if (vertical && scrollTopOffset > 0) {
|
||||||
pane.scrollTop = proportional ? (paneHeight * scrollTop) / scrollTopOffset : scrollTop // eslint-disable-line
|
pane.scrollTop = proportional ? (paneHeight * scrollTop) / scrollTopOffset : scrollTop
|
||||||
}
|
}
|
||||||
if (horizontal && scrollLeftOffset > 0) {
|
if (horizontal && scrollLeftOffset > 0) {
|
||||||
pane.scrollLeft = proportional ? (paneWidth * scrollLeft) / scrollLeftOffset : scrollLeft // eslint-disable-line
|
pane.scrollLeft = proportional ? (paneWidth * scrollLeft) / scrollLeftOffset : scrollLeft
|
||||||
}
|
}
|
||||||
/* Re-attach event listeners after we're done scrolling */
|
/* Re-attach event listeners after we're done scrolling */
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
|
@ -373,4 +373,4 @@ export default class EditorToolbar extends React.Component {
|
|||||||
</ToolbarContainer>
|
</ToolbarContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -48,11 +48,11 @@ function mergeProps(stateProps, dispatchProps, ownProps) {
|
|||||||
|
|
||||||
export default function withWorkflow(Editor) {
|
export default function withWorkflow(Editor) {
|
||||||
return connect(mapStateToProps, null, mergeProps)(
|
return connect(mapStateToProps, null, mergeProps)(
|
||||||
class extends React.Component {
|
class WorkflowEditor extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return <Editor {...this.props} />;
|
return <Editor {...this.props} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
@ -209,4 +209,4 @@ Please drag the card to the "Ready" column to enable publishing.`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default HTML5DragDrop(WorkflowList); // eslint-disable-line
|
export default HTML5DragDrop(WorkflowList);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
export const IDENTIFIER_FIELDS = ['title', 'path'];
|
export const IDENTIFIER_FIELDS = ['title', 'path'];
|
||||||
|
|
||||||
export const INFERABLE_FIELDS = {
|
export const INFERABLE_FIELDS = {
|
||||||
@ -8,7 +7,7 @@ export const INFERABLE_FIELDS = {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
secondaryTypes: [],
|
secondaryTypes: [],
|
||||||
synonyms: ['title', 'name', 'label', 'headline', 'header'],
|
synonyms: ['title', 'name', 'label', 'headline', 'header'],
|
||||||
defaultPreview: value => <h1>{ value }</h1>,
|
defaultPreview: value => <h1>{ value }</h1>, // eslint-disable-line react/display-name
|
||||||
fallbackToFirstField: true,
|
fallbackToFirstField: true,
|
||||||
showError: true,
|
showError: true,
|
||||||
},
|
},
|
||||||
@ -16,7 +15,7 @@ export const INFERABLE_FIELDS = {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
secondaryTypes: [],
|
secondaryTypes: [],
|
||||||
synonyms: ['short_title', 'shortTitle', 'short'],
|
synonyms: ['short_title', 'shortTitle', 'short'],
|
||||||
defaultPreview: value => <h2>{ value }</h2>,
|
defaultPreview: value => <h2>{ value }</h2>, // eslint-disable-line react/display-name
|
||||||
fallbackToFirstField: false,
|
fallbackToFirstField: false,
|
||||||
showError: false,
|
showError: false,
|
||||||
},
|
},
|
||||||
@ -24,7 +23,7 @@ export const INFERABLE_FIELDS = {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
secondaryTypes: [],
|
secondaryTypes: [],
|
||||||
synonyms: ['author', 'name', 'by', 'byline', 'owner'],
|
synonyms: ['author', 'name', 'by', 'byline', 'owner'],
|
||||||
defaultPreview: value => <strong>{ value }</strong>,
|
defaultPreview: value => <strong>{ value }</strong>, // eslint-disable-line react/display-name
|
||||||
fallbackToFirstField: false,
|
fallbackToFirstField: false,
|
||||||
showError: false,
|
showError: false,
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@ import { createEntry } from 'ValueObjects/Entry';
|
|||||||
import { selectEntrySlug } from 'Reducers/collections';
|
import { selectEntrySlug } from 'Reducers/collections';
|
||||||
|
|
||||||
function getSlug(path) {
|
function getSlug(path) {
|
||||||
return path.split('/').pop().replace(/\.[^\.]+$/, '');
|
return path.split('/').pop().replace(/\.[^.]+$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Algolia {
|
export default class Algolia {
|
||||||
|
@ -38,10 +38,10 @@ export default {
|
|||||||
*/
|
*/
|
||||||
export function registerPreviewStyle(style, opts) {
|
export function registerPreviewStyle(style, opts) {
|
||||||
registry.previewStyles.push({ ...opts, value: style });
|
registry.previewStyles.push({ ...opts, value: style });
|
||||||
};
|
}
|
||||||
export function getPreviewStyles() {
|
export function getPreviewStyles() {
|
||||||
return registry.previewStyles;
|
return registry.previewStyles;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,10 +49,10 @@ export function getPreviewStyles() {
|
|||||||
*/
|
*/
|
||||||
export function registerPreviewTemplate(name, component) {
|
export function registerPreviewTemplate(name, component) {
|
||||||
registry.templates[name] = component;
|
registry.templates[name] = component;
|
||||||
};
|
}
|
||||||
export function getPreviewTemplate(name) {
|
export function getPreviewTemplate(name) {
|
||||||
return registry.templates[name];
|
return registry.templates[name];
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,13 +63,13 @@ export function registerWidget(name, control, preview) {
|
|||||||
// multiple copies with different previews.
|
// multiple copies with different previews.
|
||||||
const newControl = typeof control === 'string' ? registry.widgets[control].control : control;
|
const newControl = typeof control === 'string' ? registry.widgets[control].control : control;
|
||||||
registry.widgets[name] = { control: newControl, preview };
|
registry.widgets[name] = { control: newControl, preview };
|
||||||
};
|
}
|
||||||
export function getWidget(name) {
|
export function getWidget(name) {
|
||||||
return registry.widgets[name];
|
return registry.widgets[name];
|
||||||
};
|
}
|
||||||
export function resolveWidget(name) {
|
export function resolveWidget(name) {
|
||||||
return getWidget(name || 'string') || getWidget('unknown');
|
return getWidget(name || 'string') || getWidget('unknown');
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,10 +78,10 @@ export function resolveWidget(name) {
|
|||||||
export function registerEditorComponent(component) {
|
export function registerEditorComponent(component) {
|
||||||
const plugin = EditorComponent(component);
|
const plugin = EditorComponent(component);
|
||||||
registry.editorComponents = registry.editorComponents.set(plugin.get('id'), plugin);
|
registry.editorComponents = registry.editorComponents.set(plugin.get('id'), plugin);
|
||||||
};
|
}
|
||||||
export function getEditorComponents() {
|
export function getEditorComponents() {
|
||||||
return registry.editorComponents;
|
return registry.editorComponents;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,10 +89,10 @@ export function getEditorComponents() {
|
|||||||
*/
|
*/
|
||||||
export function registerWidgetValueSerializer(widgetName, serializer) {
|
export function registerWidgetValueSerializer(widgetName, serializer) {
|
||||||
registry.widgetValueSerializers[widgetName] = serializer;
|
registry.widgetValueSerializers[widgetName] = serializer;
|
||||||
};
|
}
|
||||||
export function getWidgetValueSerializer(widgetName) {
|
export function getWidgetValueSerializer(widgetName) {
|
||||||
return registry.widgetValueSerializers[widgetName];
|
return registry.widgetValueSerializers[widgetName];
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend API
|
* Backend API
|
||||||
|
@ -122,7 +122,7 @@ export const selectInferedField = (collection, fieldName) => {
|
|||||||
if (inferableField.showError) {
|
if (inferableField.showError) {
|
||||||
consoleError(
|
consoleError(
|
||||||
`The Field ${ fieldName } is missing for the collection “${ collection.get('name') }”`,
|
`The Field ${ fieldName } is missing for the collection “${ collection.get('name') }”`,
|
||||||
`Netlify CMS tries to infer the entry ${ fieldName } automatically, but one couldn\'t be found for entries of the collection “${ collection.get('name') }”. Please check your site configuration.`
|
`Netlify CMS tries to infer the entry ${ fieldName } automatically, but one couldn't be found for entries of the collection “${ collection.get('name') }”. Please check your site configuration.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ const EditorComponent = Record({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
class Plugin extends Component { // eslint-disable-line
|
class Plugin extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
children: PropTypes.element.isRequired,
|
children: PropTypes.element.isRequired,
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ const image = {
|
|||||||
alt: match[1],
|
alt: match[1],
|
||||||
},
|
},
|
||||||
toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`,
|
toBlock: data => `![${ data.alt || '' }](${ data.image || '' })`,
|
||||||
toPreview: (data, getAsset) => <img src={getAsset(data.image) || ''} alt={data.alt || ''} />,
|
toPreview: (data, getAsset) => <img src={getAsset(data.image) || ''} alt={data.alt || ''} />, // eslint-disable-line react/display-name
|
||||||
pattern: /^!\[(.*)\]\((.*)\)$/,
|
pattern: /^!\[(.*)\]\((.*)\)$/,
|
||||||
fields: [{
|
fields: [{
|
||||||
label: 'Image',
|
label: 'Image',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const absolutePath = new RegExp('^(?:[a-z]+:)?//', 'i');
|
const absolutePath = new RegExp('^(?:[a-z]+:)?//', 'i');
|
||||||
const normalizePath = path => path.replace(/[\\\/]+/g, '/');
|
const normalizePath = path => path.replace(/[\\/]+/g, '/');
|
||||||
|
|
||||||
export function resolvePath(path, basePath) { // eslint-disable-line
|
export function resolvePath(path, basePath) {
|
||||||
// No path provided, skip
|
// No path provided, skip
|
||||||
if (!path) return null;
|
if (!path) return null;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ const FileWidgetButtonRemove = styled.button`
|
|||||||
`
|
`
|
||||||
|
|
||||||
export default function withFileControl({ forImage } = {}) {
|
export default function withFileControl({ forImage } = {}) {
|
||||||
return class extends React.Component {
|
return class FileControl extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
field: PropTypes.object.isRequired,
|
field: PropTypes.object.isRequired,
|
||||||
getAsset: PropTypes.func.isRequired,
|
getAsset: PropTypes.func.isRequired,
|
||||||
@ -164,4 +164,4 @@ export default function withFileControl({ forImage } = {}) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -307,4 +307,4 @@ export default class ListControl extends React.Component {
|
|||||||
className={classNameWrapper}
|
className={classNameWrapper}
|
||||||
/>);
|
/>);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -112,4 +112,4 @@ export default class Shortcode extends React.Component {
|
|||||||
</ShortcodeContainer>
|
</ShortcodeContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -14,7 +14,7 @@ const testPlugins = fromJS([
|
|||||||
alt: match[1],
|
alt: match[1],
|
||||||
},
|
},
|
||||||
toBlock: data => `![${ data.alt }](${ data.image })`,
|
toBlock: data => `![${ data.alt }](${ data.image })`,
|
||||||
toPreview: data => <img src={data.image} alt={data.alt} />,
|
toPreview: data => <img src={data.image} alt={data.alt} />, // eslint-disable-line react/display-name
|
||||||
pattern: /^!\[([^\]]+)]\(([^)]+)\)$/,
|
pattern: /^!\[([^\]]+)]\(([^)]+)\)$/,
|
||||||
fields: [{
|
fields: [{
|
||||||
label: 'Image',
|
label: 'Image',
|
||||||
|
@ -51,4 +51,4 @@ function onKeyDown(event, change) {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return change.toggleMark(markName);
|
return change.toggleMark(markName);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -86,4 +86,4 @@ export function validateNode(node) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -70,6 +70,13 @@ export default css`
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background-color: ${colors.background};
|
||||||
|
border-radius: ${lengths.borderRadius};
|
||||||
|
padding: 0 2px;
|
||||||
|
font-size: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
pre > code {
|
pre > code {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -80,13 +87,6 @@ export default css`
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
|
||||||
background-color: ${colors.background};
|
|
||||||
border-radius: ${lengths.borderRadius};
|
|
||||||
padding: 0 2px;
|
|
||||||
font-size: 85%;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
border-left: 3px solid ${colors.background};
|
border-left: 3px solid ${colors.background};
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
/* eslint max-len:0 */
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
import { padStart } from 'lodash';
|
import { padStart } from 'lodash';
|
||||||
|
@ -106,7 +106,7 @@ export const remarkToMarkdown = obj => {
|
|||||||
const Compiler = this.Compiler;
|
const Compiler = this.Compiler;
|
||||||
const visitors = Compiler.prototype.visitors;
|
const visitors = Compiler.prototype.visitors;
|
||||||
visitors.text = node => node.value;
|
visitors.text = node => node.value;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide an empty MDAST if no value is provided.
|
* Provide an empty MDAST if no value is provided.
|
||||||
|
@ -56,4 +56,4 @@ export default function remarkAllowHtmlEntities() {
|
|||||||
value: subvalue,
|
value: subvalue,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -93,7 +93,7 @@ const escapePatterns = [
|
|||||||
*
|
*
|
||||||
* Match strings surrounded by one or more asterisks on both sides.
|
* Match strings surrounded by one or more asterisks on both sides.
|
||||||
*/
|
*/
|
||||||
/(\*+)[^\*]*(\1)/g,
|
/(\*+)[^*]*(\1)/g,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emphasis - Underscore
|
* Emphasis - Underscore
|
||||||
|
@ -48,7 +48,7 @@ export default function remarkPaddedLinks() {
|
|||||||
const children = processedChildren.map(transform);
|
const children = processedChildren.map(transform);
|
||||||
|
|
||||||
return { ...node, children };
|
return { ...node, children };
|
||||||
};
|
}
|
||||||
|
|
||||||
function transformChildren(node) {
|
function transformChildren(node) {
|
||||||
if (node.type !== 'link') return node;
|
if (node.type !== 'link') return node;
|
||||||
@ -102,7 +102,7 @@ export default function remarkPaddedLinks() {
|
|||||||
*/
|
*/
|
||||||
let findFn;
|
let findFn;
|
||||||
if (end) { findFn = findLast }
|
if (end) { findFn = findLast }
|
||||||
else { findFn = find };
|
else { findFn = find }
|
||||||
|
|
||||||
let edgeChildWithValue;
|
let edgeChildWithValue;
|
||||||
setEdgeChildWithValue(node);
|
setEdgeChildWithValue(node);
|
||||||
|
@ -53,4 +53,4 @@ export default function remarkStripTrailingBreaks() {
|
|||||||
return node;
|
return node;
|
||||||
};
|
};
|
||||||
return transform;
|
return transform;
|
||||||
};
|
}
|
||||||
|
@ -176,4 +176,4 @@ export default class RelationControl extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -52,9 +52,6 @@ h3 {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 > p {
|
|
||||||
}
|
|
||||||
|
|
||||||
p, ul {
|
p, ul {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
|
@ -1,15 +1,3 @@
|
|||||||
.docs-content,
|
|
||||||
.blog-content {
|
|
||||||
pre {
|
|
||||||
margin: 30px -16px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: $xlarge) {
|
|
||||||
pre {
|
|
||||||
margin-right: -120px !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.docs.page,
|
.docs.page,
|
||||||
.blog.page {
|
.blog.page {
|
||||||
padding: 69px $tiny $xl;
|
padding: 69px $tiny $xl;
|
||||||
@ -225,6 +213,13 @@
|
|||||||
border-radius: $borderRadius;
|
border-radius: $borderRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
margin: 30px -16px !important;
|
||||||
|
@media (min-width: $xlarge) {
|
||||||
|
margin-right: -120px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
:not(pre) > code {
|
:not(pre) > code {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
background: $lightestGrey;
|
background: $lightestGrey;
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: 0;
|
|
||||||
color: $darkGrey;
|
color: $darkGrey;
|
||||||
border: 2px solid $darkGreen;
|
border: 2px solid $darkGreen;
|
||||||
border-radius: $borderRadius;
|
border-radius: $borderRadius;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user