Skip to content

Commit

Permalink
$: make format
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaspiterek committed Feb 2, 2024
1 parent 0cb59e9 commit beca673
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
20 changes: 10 additions & 10 deletions src/components/View.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import config from "@plone/volto/registry";
import { flattenToAppURL } from "@plone/volto/helpers";
import cx from "classnames";
import { DetachedTextBlockEditor } from "@plone/volto-slate/blocks/Text/DetachedTextBlockEditor";
import { TextBlockView } from "@plone/volto-slate/blocks/Text";
import React from 'react';
import config from '@plone/volto/registry';
import { flattenToAppURL } from '@plone/volto/helpers';
import cx from 'classnames';
import { DetachedTextBlockEditor } from '@plone/volto-slate/blocks/Text/DetachedTextBlockEditor';
import { TextBlockView } from '@plone/volto-slate/blocks/Text';

const View = (props) => {
const { data, isEditMode } = props;
Expand All @@ -13,7 +13,7 @@ const View = (props) => {
slateSettings: {
...config.settings.slate,
toolbarButtons: config.settings.slate.toolbarButtons.filter(
(index) => index - config.settings.slate.toolbarButtons
(index) => index - config.settings.slate.toolbarButtons,
),
},
};
Expand All @@ -25,7 +25,7 @@ const View = (props) => {
data.image?.[0] && (
<div className="image-wrapper">
<img
src={`${flattenToAppURL(data.image?.[0]?.["@id"])}/${
src={`${flattenToAppURL(data.image?.[0]?.['@id'])}/${
data.image?.[0]?.image_scales?.image[0]?.scales?.preview
?.download
}}`}
Expand All @@ -37,7 +37,7 @@ const View = (props) => {
)}
<blockquote
cite={data.cite}
className={cx(data.language, isEditMode && "edit")}
className={cx(data.language, isEditMode && 'edit')}
>
{!isEditMode ? (
<TextBlockView {...props} />
Expand All @@ -46,7 +46,7 @@ const View = (props) => {
)}
<footer>
{data.author && data.additional_information
? data.author + ", "
? data.author + ', '
: data.author}
{data.additional_information && data.cite ? (
<cite>{data.additional_information}</cite>
Expand Down
62 changes: 31 additions & 31 deletions src/components/schema.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import config from "@plone/volto/registry";
import { defineMessages } from "react-intl";
import config from '@plone/volto/registry';
import { defineMessages } from 'react-intl';

const messages = defineMessages({
quote: {
id: "Quote",
defaultMessage: "Quote",
id: 'Quote',
defaultMessage: 'Quote',
},
language: {
id: "Language",
defaultMessage: "Language",
id: 'Language',
defaultMessage: 'Language',
},
image: {
id: "Image",
defaultMessage: "Image",
id: 'Image',
defaultMessage: 'Image',
},
author: {
id: "Author",
defaultMessage: "Author",
id: 'Author',
defaultMessage: 'Author',
},
additional_information: {
id: "Additional information",
defaultMessage: "Additional information",
id: 'Additional information',
defaultMessage: 'Additional information',
},
cite: {
id: "Cite",
defaultMessage: "Cite",
id: 'Cite',
defaultMessage: 'Cite',
},
description: {
id: "This field expects an URL as input (optional). If an URL is provided the additional information will have a relation to this URL, this is due to accessibility norms.",
id: 'This field expects an URL as input (optional). If an URL is provided the additional information will have a relation to this URL, this is due to accessibility norms.',
defaultMessage:
"This field expects an URL as input (optional). If an URL is provided the additional information will have a relation to this URL, this is due to accessibility norms.",
'This field expects an URL as input (optional). If an URL is provided the additional information will have a relation to this URL, this is due to accessibility norms.',
},
});

Expand All @@ -38,14 +38,14 @@ export const QuoteBlockSchema = ({ intl }) => {
const allowed_languages =
config.blocks?.blocksConfig?.quote?.allowed_languages;
const DEFAULT_LANGUAGES = [
["EN", "EN"],
["DE", "DE"],
['EN', 'EN'],
['DE', 'DE'],
];

const filterDefaultLanguages = () => {
if (allowed_languages) {
return DEFAULT_LANGUAGES.filter((item) =>
allowed_languages.includes(item[0])
allowed_languages.includes(item[0]),
);
} else {
return DEFAULT_LANGUAGES;
Expand All @@ -54,19 +54,19 @@ export const QuoteBlockSchema = ({ intl }) => {

return {
title: intl.formatMessage(messages.quote),
block: "quote",
block: 'quote',
fieldsets: [
{
id: "default",
title: "Default",
id: 'default',
title: 'Default',
fields: config?.blocks?.blocksConfig?.quote?.showImageField
? ["language", "image"]
: ["language"],
? ['language', 'image']
: ['language'],
},
{
id: "person",
title: "Person",
fields: ["author", "additional_information", "cite"],
id: 'person',
title: 'Person',
fields: ['author', 'additional_information', 'cite'],
},
],
properties: {
Expand All @@ -78,10 +78,10 @@ export const QuoteBlockSchema = ({ intl }) => {
},
image: {
title: intl.formatMessage(messages.image),
widget: "object_browser",
mode: "image",
widget: 'object_browser',
mode: 'image',
allowExternals: true,
selectedItemAttrs: ["image_field", "image_scales"],
selectedItemAttrs: ['image_field', 'image_scales'],
},
author: {
title: intl.formatMessage(messages.author),
Expand All @@ -91,7 +91,7 @@ export const QuoteBlockSchema = ({ intl }) => {
},
cite: {
title: intl.formatMessage(messages.cite),
widget: "url",
widget: 'url',
description: intl.formatMessage(messages.description),
},
},
Expand Down

0 comments on commit beca673

Please sign in to comment.