Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into quote-edit
Browse files Browse the repository at this point in the history
  • Loading branch information
jnptk committed Feb 20, 2024
2 parents 4da7df7 + 5248b26 commit 0752457
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 25 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@

<!-- towncrier release notes start -->

## 1.0.0-alpha.7 (2024-02-20)

### Feature

- - set quotation marks by site language [@jonaspiterek]
- combine "language" and "cite" fields in new accessibility fieldset [@jonaspiterek] [#14](https://github.com/kitconcept/volto-quote-block/pull/14)

## 1.0.0-alpha.6 (2024-02-05)

### Bugfix
Expand Down
11 changes: 8 additions & 3 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ msgid "Quote"
msgstr "Zitat"

#: components/schema
# 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.
msgid "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."
msgstr "Dieses Feld erwartet eine URL als Eingabe (optional). Wenn eine URL angegeben wird, beziehen sich die Zusatzinformationen auf diese URL, um Barrierefreiheit zu gewährleisten."
# defaultMessage: This field is not exposed, it is only used by accessibility tools to provide a better experience.
msgid "This field is not exposed, it is only used by accessibility tools to provide a better experience."
msgstr "Dieses Fled wird nicht angezeigt, es wird nur von Barrierefreiheittools verwendet, um eine bessere Nutzererfahrung zu gewährleisten."

#: components/schema
# defaultMessage: Accessibility
msgid "accessibility"
msgstr "Barrierefreiheit"
9 changes: 7 additions & 2 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ msgid "Quote"
msgstr ""

#: components/schema
# 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.
msgid "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 is not exposed, it is only used by accessibility tools to provide a better experience.
msgid "This field is not exposed, it is only used by accessibility tools to provide a better experience."
msgstr ""

#: components/schema
# defaultMessage: Accessibility
msgid "accessibility"
msgstr ""
11 changes: 8 additions & 3 deletions locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-02-02T08:52:19.982Z\n"
"POT-Creation-Date: 2024-02-19T15:23:26.397Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -44,6 +44,11 @@ msgid "Quote"
msgstr ""

#: components/schema
# 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.
msgid "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 is not exposed, it is only used by accessibility tools to provide a better experience.
msgid "This field is not exposed, it is only used by accessibility tools to provide a better experience."
msgstr ""

#: components/schema
# defaultMessage: Accessibility
msgid "accessibility"
msgstr ""
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kitconcept/volto-quote-block",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"description": "volto-quote-block: Volto add-on",
"main": "src/index.js",
"license": "MIT",
Expand Down
6 changes: 4 additions & 2 deletions src/components/View.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
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 { useSelector } from 'react-redux';

const View = (props) => {
const { data, isEditMode } = props;
const language = useSelector((state) => state.intl.locale);

const customSlateSettings = {
...props,
Expand Down Expand Up @@ -37,7 +38,8 @@ const View = (props) => {
)}
<blockquote
cite={data.cite}
className={cx(!isEditMode && data.quotationLanguage)}
lang={data.quotationLanguage}
siteLang={language}
>
{!isEditMode ? (
<TextBlockView {...props} />
Expand Down
28 changes: 19 additions & 9 deletions src/components/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ const messages = defineMessages({
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 is not exposed, it is only used by accessibility tools to provide a better experience.',
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 is not exposed, it is only used by accessibility tools to provide a better experience.',
},
accessibility: {
id: 'accessibility',
defaultMessage: 'Accessibility',
},
});

export const QuoteBlockSchema = ({ intl }) => {
const defaultLang = config.blocks?.blocksConfig?.quote?.defaultLang;
const allowedLanguages = config.blocks?.blocksConfig?.quote?.allowedLanguages;
const DEFAULT_LANGUAGES = [
['EN', 'EN'],
['DE', 'DE'],
['en', 'en'],
['de', 'de'],
];

const filterDefaultLanguages = () => {
Expand All @@ -59,13 +63,18 @@ export const QuoteBlockSchema = ({ intl }) => {
id: 'default',
title: 'Default',
fields: config?.blocks?.blocksConfig?.quote?.showImageField
? ['quotationLanguage', 'image']
: ['quotationLanguage'],
? ['image']
: [],
},
{
id: 'person',
title: 'Person',
fields: ['author', 'additional_information', 'cite'],
id: 'author',
title: intl.formatMessage(messages.author),
fields: ['author', 'additional_information'],
},
{
id: 'accessibility',
title: intl.formatMessage(messages.accessibility),
fields: ['quotationLanguage', 'cite'],
},
],
properties: {
Expand All @@ -74,6 +83,7 @@ export const QuoteBlockSchema = ({ intl }) => {
choices: filterDefaultLanguages(),
default: defaultLang,
noValueOption: false,
description: intl.formatMessage(messages.description),
},
image: {
title: intl.formatMessage(messages.image),
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const applyConfig = (config) => {
// If an image is added and later on the image field get's disabled by setting 'showImageField' to 'false',
// the image and alignment fields aswell as the image won't show any longer.
showImageField: true,
defaultLang: 'EN',
allowedLanguages: ['EN', 'DE'],
defaultLang: 'en',
allowedLanguages: ['en', 'de'],
};

return config;
Expand Down
6 changes: 3 additions & 3 deletions src/theme/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
margin: 0em 0em 1em;
}

.block.quote blockquote:not(.edit) {
&.EN p {
.block.quote blockquote:not(.block-editor-quote blockquote) {
&[siteLang='en'] p {
&::before {
content: '"';
}
Expand All @@ -17,7 +17,7 @@
}
}

&.DE p {
&[siteLang='de'] p {
&::before {
content: '';
}
Expand Down

0 comments on commit 0752457

Please sign in to comment.