@eeacms/volto-citation 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,10 +4,46 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- ### [0.1.1](https://github.com/eea/volto-citation/compare/0.1.0...0.1.1) - 24 July 2023
7
+ ### [0.1.3](https://github.com/eea/volto-citation/compare/0.1.2...0.1.3) - 3 August 2023
8
+
9
+ #### :house: Documentation changes
10
+
11
+ - docs: Cleanup Makefile, update DEVELOP documentation, i18n - refs #254894 [valentinab25 - [`987cef0`](https://github.com/eea/volto-citation/commit/987cef0334372e3f119a6d35bd2a2fdb0c403b79)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - citation [Dobricean Ioan Dorian - [`a9d15f9`](https://github.com/eea/volto-citation/commit/a9d15f9cc44c4857d42c3ad1c246e48d25113d79)]
16
+ - tab test [Dobricean Ioan Dorian - [`85ebc22`](https://github.com/eea/volto-citation/commit/85ebc22c31481f2cc80ef9248f3880c58d8c5796)]
17
+ - increase covreage [Dobricean Ioan Dorian - [`c6b2d7b`](https://github.com/eea/volto-citation/commit/c6b2d7b512cbc047e6fa5c5bb5045dcce56672c6)]
18
+ - increase [Dobricean Ioan Dorian - [`978a6ea`](https://github.com/eea/volto-citation/commit/978a6ea3ef35a19fd891167a23c6ff7d575c4ead)]
19
+ - increase code covreage [Dobricean Ioan Dorian - [`9644480`](https://github.com/eea/volto-citation/commit/964448028b2e32b82a8313a003567365ac9455cf)]
20
+ - increase code covreage [Dobricean Ioan Dorian - [`0123f35`](https://github.com/eea/volto-citation/commit/0123f35ce0fd39422e0bbdc38c36ee8e38486908)]
21
+ - accesibility [Dobricean Ioan Dorian - [`104b624`](https://github.com/eea/volto-citation/commit/104b624c77682f4599b48cc93aefc29d56adef92)]
22
+ - refecator [Dobricean Ioan Dorian - [`c7f8eeb`](https://github.com/eea/volto-citation/commit/c7f8eeb574ec9230e4a1bf2736b6a27375b186c1)]
23
+ - remove console [Dobricean Ioan Dorian - [`a50f9cc`](https://github.com/eea/volto-citation/commit/a50f9cca891fa11417936bd0ea615ca1ad557a32)]
24
+ - merge [Dobricean Ioan Dorian - [`a8bf3aa`](https://github.com/eea/volto-citation/commit/a8bf3aa3f8765669db598ca62fe76bd35efeea43)]
25
+ - remove empty line [Dobricean Ioan Dorian - [`066914e`](https://github.com/eea/volto-citation/commit/066914ef76010cce4f5a1f2cb97ada7afd7d9353)]
26
+ - use static [Dobricean Ioan Dorian - [`a3065e3`](https://github.com/eea/volto-citation/commit/a3065e38bd528bfd0f008a6aa76101597d7376e3)]
27
+ - new styles [Dobricean Ioan Dorian - [`465933f`](https://github.com/eea/volto-citation/commit/465933fe4b7f89b2054373572b521799f213371a)]
28
+ - Don't crash [Tiberiu Ichim - [`c607fd1`](https://github.com/eea/volto-citation/commit/c607fd1708f1abc20500d7985a5a44272cecd226)]
29
+ - Code cleanup [Tiberiu Ichim - [`394bc85`](https://github.com/eea/volto-citation/commit/394bc853429626fe863c069500bf22e7e60b86c4)]
30
+ - test [Dobricean Ioan Dorian - [`6f9ab9a`](https://github.com/eea/volto-citation/commit/6f9ab9abf379cd91a613f93cf9a7797cb0afbe10)]
31
+ - fix font [Dobricean Ioan Dorian - [`57a5182`](https://github.com/eea/volto-citation/commit/57a51828a38bd3f628f201f0db855280a6a08794)]
32
+ - change style [Dobricean Ioan Dorian - [`839187e`](https://github.com/eea/volto-citation/commit/839187e9beaf0e5fcaa7ae79f8d67cea240436ff)]
33
+ - fix cypress [Dobricean Ioan Dorian - [`b4ad8e2`](https://github.com/eea/volto-citation/commit/b4ad8e25e048426155fac5007d05df11dc23a601)]
34
+ - icon [Dobricean Ioan Dorian - [`191585f`](https://github.com/eea/volto-citation/commit/191585f49cb007537e288b0280aff143949da767)]
35
+ - use icons [Dobricean Ioan Dorian - [`4d1aadc`](https://github.com/eea/volto-citation/commit/4d1aadc660c7ef4434793d532ff1cb7be4e9e3f9)]
36
+ - use tabs [Dobricean Ioan Dorian - [`9ac7028`](https://github.com/eea/volto-citation/commit/9ac7028f892c2fec82b3ef63dbabca5798fb518c)]
37
+ ### [0.1.2](https://github.com/eea/volto-citation/compare/0.1.1...0.1.2) - 25 July 2023
38
+
39
+ #### :hammer_and_wrench: Others
40
+
41
+ - Update package.json [dobri1408 - [`7a01616`](https://github.com/eea/volto-citation/commit/7a01616b4470bd90ffc2f79ee2fd853d7fc513ed)]
42
+ ### [0.1.1](https://github.com/eea/volto-citation/compare/0.1.0...0.1.1) - 25 July 2023
8
43
 
9
44
  #### :hammer_and_wrench: Others
10
45
 
46
+ - small fixes [Dobricean Ioan Dorian - [`b4afc0e`](https://github.com/eea/volto-citation/commit/b4afc0e3d561a2e92da136ec835140847d313c02)]
11
47
  - tests and lint [Dobricean Ioan Dorian - [`eb90d2a`](https://github.com/eea/volto-citation/commit/eb90d2afd8fc210e62faab2dbcc063564a205dcf)]
12
48
  - Update README.md [dobri1408 - [`94bb499`](https://github.com/eea/volto-citation/commit/94bb49936791f41860ef2829e0223e125d04469b)]
13
49
  - update [Dobricean Ioan Dorian - [`b95f01f`](https://github.com/eea/volto-citation/commit/b95f01fb06513859c2960dc67f7fb8135d10eaf8)]
package/DEVELOP.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## Develop
4
4
 
5
+ 1. Make sure you have `docker` and `docker compose` installed and running on your machine:
6
+
7
+ ```Bash
8
+ git clone https://github.com/eea/volto-citation.git
9
+ cd volto-citation
10
+ git checkout -b bugfix-123456 develop
11
+ make
12
+ make start
13
+ ```
14
+
15
+ 1. Wait for `Volto started at 0.0.0.0:3000` meesage
16
+
17
+ 1. Go to http://localhost:3000
18
+
19
+ 1. Happy hacking!
20
+
21
+ ```Bash
22
+ cd src/addons/volto-citation/
23
+ ```
24
+
25
+ ### Or add @eeacms/volto-citation to your Volto project
26
+
5
27
  Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
6
28
 
7
29
  1. Make sure you have installed `yo`, `@plone/generator-volto` and `mrs-developer`
@@ -49,3 +71,37 @@ Before starting make sure your development environment is properly set. See [Vol
49
71
  1. Happy hacking!
50
72
 
51
73
  cd src/addons/volto-citation/
74
+
75
+ ## Cypress
76
+
77
+ To run cypress locally, first make sure you don't have any Volto/Plone running on ports `8080` and `3000`.
78
+
79
+ You don't have to be in a `clean-volto-project`, you can be in any Volto Frontend
80
+ project where you added `volto-citation` to `mrs.developer.json`
81
+
82
+ Go to:
83
+
84
+ ```BASH
85
+ cd src/addons/volto-citation/
86
+ ```
87
+
88
+ Start:
89
+
90
+ ```Bash
91
+ make
92
+ make start
93
+ ```
94
+
95
+ This will build and start with Docker a clean `Plone backend` and `Volto Frontend` with `volto-citation` block installed.
96
+
97
+ Open Cypress Interface:
98
+
99
+ ```Bash
100
+ make cypress-open
101
+ ```
102
+
103
+ Or run it:
104
+
105
+ ```Bash
106
+ make cypress-run
107
+ ```
package/README.md CHANGED
@@ -25,10 +25,23 @@ Volto Citation shows users how to cite an article. It supports four types of cit
25
25
 
26
26
  ## Getting started
27
27
 
28
+ ### Try volto-citation with Docker
29
+
30
+ git clone https://github.com/eea/volto-citation.git
31
+ cd volto-citation
32
+ make
33
+ make start
34
+
35
+ Go to http://localhost:3000
36
+
28
37
  ### Add volto-citation to your Volto project
29
38
 
30
39
  1. Make sure you have a [Plone backend](https://plone.org/download) up-and-running at http://localhost:8080/Plone
31
40
 
41
+ ```Bash
42
+ docker compose up backend
43
+ ```
44
+
32
45
  1. Start Volto frontend
33
46
 
34
47
  * If you already have a volto project, just update `package.json`:
@@ -0,0 +1,28 @@
1
+ version: "3"
2
+ services:
3
+ backend:
4
+ image: plone/plone-backend:${PLONE_VERSION:-6}
5
+ ports:
6
+ - "8080:8080"
7
+ environment:
8
+ SITE: "Plone"
9
+
10
+ frontend:
11
+ build:
12
+ context: ./
13
+ dockerfile: ./Dockerfile
14
+ args:
15
+ ADDON_NAME: "${ADDON_NAME}"
16
+ ADDON_PATH: "${ADDON_PATH}"
17
+ VOLTO_VERSION: ${VOLTO_VERSION:-16}
18
+ ports:
19
+ - "3000:3000"
20
+ - "3001:3001"
21
+ depends_on:
22
+ - backend
23
+ volumes:
24
+ - ./:/app/src/addons/${ADDON_PATH}
25
+ environment:
26
+ RAZZLE_INTERNAL_API_PATH: "http://backend:8080/Plone"
27
+ RAZZLE_DEV_PROXY_API_PATH: "http://backend:8080/Plone"
28
+ HOST: "0.0.0.0"
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
@@ -0,0 +1,14 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: \n"
8
+ "Language: \n"
9
+ "Language-Team: \n"
10
+ "Content-Type: \n"
11
+ "Content-Transfer-Encoding: \n"
12
+ "Plural-Forms: \n"
13
+
14
+
package/locales/volto.pot CHANGED
@@ -0,0 +1,16 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Plone\n"
4
+ "POT-Creation-Date: 2023-06-28T10:48:22.678Z\n"
5
+ "Last-Translator: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
6
+ "Language-Team: Plone i18n <plone-i18n@lists.sourceforge.net>\n"
7
+ "MIME-Version: 1.0\n"
8
+ "Content-Type: text/plain; charset=utf-8\n"
9
+ "Content-Transfer-Encoding: 8bit\n"
10
+ "Plural-Forms: nplurals=1; plural=0;\n"
11
+ "Language-Code: en\n"
12
+ "Language-Name: English\n"
13
+ "Preferred-Encodings: utf-8\n"
14
+ "Domain: volto\n"
15
+
16
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-citation",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "@eeacms/volto-citation: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -18,7 +18,6 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@citation-js/plugin-ris": "^0.6.8",
21
- "@citation-js/plugin-wikipedia-templates": "0.1.0",
22
21
  "citation-js": "^0.6.8"
23
22
  },
24
23
  "devDependencies": {
@@ -1,16 +1,19 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import './styles.less';
3
- import { Menu } from 'semantic-ui-react';
2
+ import { Tab, Label, Menu } from 'semantic-ui-react';
4
3
  import { useCopyToClipboard } from '@eeacms/volto-citation/helpers';
5
- import copySVG from '@plone/volto/icons/copy.svg';
6
- import checkSVG from '@plone/volto/icons/check.svg';
7
4
  import { Icon } from '@plone/volto/components';
8
5
 
9
6
  import Cite from 'citation-js';
10
7
 
11
- const CopyUrlButton = ({ citation }) => {
8
+ import copySVG from '@plone/volto/icons/copy.svg';
9
+ import checkSVG from '@plone/volto/icons/check.svg';
10
+
11
+ import './styles.less';
12
+
13
+ const CopyUrlButton = ({ citation, className }) => {
12
14
  const [copyUrlStatus, copyUrl] = useCopyToClipboard(citation);
13
15
  const [icon, setIcon] = useState(copySVG);
16
+
14
17
  useEffect(() => {
15
18
  if (copyUrlStatus === 'copied') {
16
19
  setIcon(checkSVG);
@@ -20,115 +23,162 @@ const CopyUrlButton = ({ citation }) => {
20
23
  }
21
24
  }, [copyUrlStatus]);
22
25
 
23
- return <Icon className="citation-copy" name={icon} onClick={copyUrl} />;
26
+ return (
27
+ <Label
28
+ floating
29
+ basic
30
+ tabIndex={0}
31
+ onKeyDown={(e) => {
32
+ if (e.key === 'Enter') copyUrl();
33
+ }}
34
+ >
35
+ <Icon
36
+ name={icon}
37
+ onClick={copyUrl}
38
+ className="citation-copy"
39
+ tabIndex={0}
40
+ />
41
+ </Label>
42
+ );
24
43
  };
25
44
 
26
45
  function Citation({ title, authors, link, type = 'article', year, mode }) {
27
- const [format, setFormat] = useState('bibliography');
28
- const [subFormat, setSubFormat] = useState('html');
29
- const [citation, setCitation] = useState();
30
-
31
- React.useEffect(() => {
32
- let citation = new Cite({
46
+ const cite = (format, subFormat) => {
47
+ const citationObject = new Cite({
33
48
  title: title,
34
49
  type: type,
35
- author: authors,
50
+ author: authors.map((author) => {
51
+ return {
52
+ literal: author,
53
+ };
54
+ }),
55
+
36
56
  issued: { 'date-parts': [[year]] },
37
57
  URL: link,
38
58
  });
39
- let output = citation.format(format, {
40
- format: subFormat,
41
- template: 'apa',
42
- });
43
- setCitation(output);
44
- if (subFormat === 'html')
45
- setCitation(
46
- `<blockquote> <p>(${year}).</p> <p>${title}</p> <p>
47
- ${authors.map((author, index) => {
48
- let separator = '';
49
- if (index < authors.length - 1) separator = ' , ';
50
- return (
51
- author?.family + ' ' + author.given?.charAt(0) + '.' + separator
52
- );
53
- })}
54
- </p> <a href=${link}>${link}</a> </blockquote>`,
55
- );
56
- }, [authors, format, year, link, subFormat, title, type]);
57
-
58
- const handleChangeFormat = (format, subformat) => {
59
- setFormat(format);
60
- setSubFormat(subformat);
59
+
60
+ if (format === 'html')
61
+ return `<blockquote>
62
+ <p>(${year}).</p>
63
+ <p>${title}</p>
64
+ <p>${authors.map((author, index) => {
65
+ const separator = index < authors.length - 1 ? ', ' : '';
66
+ return (author || '') + separator;
67
+ })}
68
+ </p>
69
+ <a href=${link}>${link}</a>
70
+ </blockquote>`;
71
+ else
72
+ return citationObject
73
+ .format(format, {
74
+ format: subFormat,
75
+ template: 'apa',
76
+ })
77
+ .replace(/(^[ \t]*\n)/gm, '');
61
78
  };
62
- return (
63
- <div className="citation-block">
64
- <Menu pointing>
79
+
80
+ const modes = [
81
+ {
82
+ menuItem: (
65
83
  <Menu.Item
66
- name="html"
67
- as="a"
68
- active={subFormat === 'html'}
69
- onClick={() => {
70
- handleChangeFormat('bibliography', 'html');
84
+ tabIndex={0}
85
+ onKeyDown={(e) => {
86
+ if (e.key === 'Enter') e.target.click();
71
87
  }}
72
88
  >
73
- HTML
89
+ Html
74
90
  </Menu.Item>
91
+ ),
92
+ render: () => (
93
+ <Tab.Pane attached={false}>
94
+ <blockquote className="text">
95
+ <p>({year}).</p>
96
+ <p>{title}</p>
97
+ <p>
98
+ {authors.map((author, index) => {
99
+ let separator = '';
100
+ if (index < authors.length - 1) separator = ', ';
101
+ return (author || '') + separator;
102
+ })}
103
+ </p>
104
+ {mode === 'edit' ? <p>{link}</p> : <a href={link}>{link}</a>}
75
105
 
106
+ <CopyUrlButton citation={cite('html')} />
107
+ </blockquote>
108
+ </Tab.Pane>
109
+ ),
110
+ },
111
+ {
112
+ menuItem: (
76
113
  <Menu.Item
77
- name="text"
78
- active={subFormat === 'text'}
79
- onClick={() => {
80
- handleChangeFormat('bibliography', 'text');
114
+ tabIndex={0}
115
+ onKeyDown={(e) => {
116
+ if (e.key === 'Enter') e.target.click();
81
117
  }}
82
118
  >
83
119
  Text
84
120
  </Menu.Item>
121
+ ),
122
+ render: () => (
123
+ <Tab.Pane attached={false}>
124
+ <div className="text">
125
+ <pre>{cite('bibliography', 'text')}</pre>
85
126
 
127
+ <CopyUrlButton citation={cite('bibliography', 'text')} />
128
+ </div>
129
+ </Tab.Pane>
130
+ ),
131
+ },
132
+ {
133
+ menuItem: (
86
134
  <Menu.Item
87
- name="ris"
88
- active={format === 'ris'}
89
- onClick={() => {
90
- handleChangeFormat('ris', '');
135
+ tabIndex={0}
136
+ onKeyDown={(e) => {
137
+ if (e.key === 'Enter') e.target.click();
91
138
  }}
92
139
  >
93
- RIS
140
+ Ris
94
141
  </Menu.Item>
142
+ ),
143
+ render: () => (
144
+ <Tab.Pane attached={false}>
145
+ <div className="text">
146
+ <pre>{cite('ris')}</pre>
147
+
148
+ <CopyUrlButton citation={cite('ris')} />
149
+ </div>
150
+ </Tab.Pane>
151
+ ),
152
+ },
153
+ {
154
+ menuItem: (
95
155
  <Menu.Item
96
- name="BibTex"
97
- active={format === 'bibtex'}
98
- onClick={() => {
99
- handleChangeFormat('bibtex');
156
+ tabIndex={0}
157
+ onKeyDown={(e) => {
158
+ if (e.key === 'Enter') e.target.click();
100
159
  }}
101
160
  >
102
161
  BibTex
103
162
  </Menu.Item>
104
- <Menu.Menu position="right">
105
- <Menu.Item>
106
- <CopyUrlButton citation={citation} />
107
- </Menu.Item>
108
- </Menu.Menu>
109
- </Menu>
110
- {subFormat === 'text' || format === 'bibtex' || format === 'ris' ? (
111
- <pre>{citation}</pre>
112
- ) : (
113
- <blockquote>
114
- <p>({year}).</p>
115
- <p>{title}</p>
116
- <p>
117
- {authors.map((author, index) => {
118
- let separator = '';
119
- if (index < authors.length - 1) separator = ' , ';
120
- return (
121
- (author?.family || '') +
122
- ' ' +
123
- (author.given?.charAt(0) || '') +
124
- '.' +
125
- separator
126
- );
127
- })}
128
- </p>
129
- {mode === 'edit' ? <p>{link}</p> : <a href={link}>{link}</a>}
130
- </blockquote>
131
- )}
163
+ ),
164
+ render: () => (
165
+ <Tab.Pane attached={false}>
166
+ <div className="text">
167
+ <pre>{cite('bibtex')}</pre>
168
+
169
+ <CopyUrlButton citation={cite('bibtex')} />
170
+ </div>
171
+ </Tab.Pane>
172
+ ),
173
+ },
174
+ ];
175
+
176
+ return (
177
+ <div className="citation-block tabs-block">
178
+ <Tab
179
+ panes={modes}
180
+ menu={{ className: 'ui green fluid pointing secondary menu' }}
181
+ />
132
182
  </div>
133
183
  );
134
184
  }
@@ -9,7 +9,7 @@ function CitationBlockEdit(props) {
9
9
  <div>
10
10
  <Citation
11
11
  title={data?.title || ''}
12
- authors={data.author || []}
12
+ authors={(data.authors || []).map((field) => field.author)}
13
13
  link={data.url || ''}
14
14
  year={data.year ?? 'n.d.'}
15
15
  mode={'edit'}
@@ -6,7 +6,7 @@ function CitationBlockView({ data }) {
6
6
  <div>
7
7
  <Citation
8
8
  title={data?.title || ''}
9
- authors={data.author || []}
9
+ authors={(data?.authors || []).map((field) => field.author)}
10
10
  link={data.url || ''}
11
11
  year={data.year ?? 'n.d.'}
12
12
  />
@@ -5,16 +5,43 @@
5
5
  cursor: pointer;
6
6
  }
7
7
 
8
+ .active.tab {
9
+ border: 0;
10
+ }
11
+
12
+ .ui.segment {
13
+ background: transparent !important;
14
+ }
15
+
16
+ .text {
17
+ position: relative;
18
+
19
+ .basic.floating {
20
+ border: none !important;
21
+ margin: -0.5em 0em 0em -3em !important;
22
+ background-color: transparent !important;
23
+ }
24
+ }
25
+
26
+ .citation-copy {
27
+ height: 1.5rem !important;
28
+ padding: 0.1em 1.3em !important;
29
+ }
30
+
31
+ .text {
32
+ .floating.label {
33
+ top: -1rem;
34
+ }
35
+ }
36
+
8
37
  pre {
9
38
  display: block;
10
- overflow: scroll;
39
+ overflow: auto;
11
40
  padding: 9.5px;
12
41
  border: 1px solid #ccc;
13
42
  margin: 0 0 10px;
14
43
  background-color: #f5f5f5;
15
44
  border-radius: 4px;
16
- color: #333333;
17
- font-size: 13px;
18
45
  line-height: 1.428571429;
19
46
  word-break: break-all;
20
47
  word-wrap: break-word;
@@ -22,15 +49,11 @@
22
49
 
23
50
  blockquote {
24
51
  position: relative;
25
- width: 60%;
52
+ width: 80%;
26
53
  padding: 1.2em 30px 1.2em 75px;
27
54
  border-left: 8px solid @secondaryColor;
28
55
  margin: 50px auto;
29
56
  background: #ededed;
30
- color: #555555;
31
- font-family: Open Sans;
32
- font-size: 1.4em;
33
- font-style: italic;
34
57
  line-height: 1.6;
35
58
  word-break: break-all;
36
59
  }
@@ -41,7 +64,6 @@
41
64
  left: 10px;
42
65
  color: @secondaryColor;
43
66
  content: '\201C';
44
- font-family: Arial;
45
67
  font-size: 4em;
46
68
  }
47
69
 
@@ -52,7 +74,6 @@
52
74
  blockquote span {
53
75
  display: block;
54
76
  margin-top: 1em;
55
- color: #333333;
56
77
  font-style: normal;
57
78
  font-weight: bold;
58
79
  }
@@ -72,5 +93,9 @@
72
93
  width: 0 !important;
73
94
  }
74
95
  }
96
+
97
+ .ui.tabular.menu .item {
98
+ padding: 0.875em 1.2em;
99
+ }
75
100
  }
76
101
  }
@@ -2,11 +2,13 @@ import React from 'react';
2
2
 
3
3
  const useCopyToClipboard = (text) => {
4
4
  const [copyStatus, setCopyStatus] = React.useState('inactive');
5
+
5
6
  const copy = React.useCallback(() => {
6
- navigator.clipboard.writeText(text).then(
7
- () => setCopyStatus('copied'),
8
- () => setCopyStatus('failed'),
9
- );
7
+ if (navigator?.clipboard)
8
+ navigator.clipboard.writeText(text).then(
9
+ () => setCopyStatus('copied'),
10
+ () => setCopyStatus('failed'),
11
+ );
10
12
  }, [text]);
11
13
 
12
14
  React.useEffect(() => {
package/src/schema.js CHANGED
@@ -9,6 +9,26 @@ const messages = defineMessages({
9
9
  id: 'URL',
10
10
  defaultMessage: 'URL',
11
11
  },
12
+ CitationUrlDescription: {
13
+ id: 'URLDescription',
14
+ defaultMessage: 'The url where the article can be found',
15
+ },
16
+ YearDescription: {
17
+ id: 'YearDescription',
18
+ defaultMessage: 'The year when the article was published',
19
+ },
20
+ TitleDescription: {
21
+ id: 'TitleDescription',
22
+ defaultMessage: 'The title of the article',
23
+ },
24
+ AuthorsDescription: {
25
+ id: 'AauthorsDescription',
26
+ defaultMessage: 'The authors that have contributed to the article',
27
+ },
28
+ AuthorDescription: {
29
+ id: 'AuthorDescription',
30
+ defaultMessage: 'One of the authors',
31
+ },
12
32
  Year: {
13
33
  id: 'year',
14
34
  defaultMessage: 'Year',
@@ -17,38 +37,32 @@ const messages = defineMessages({
17
37
  id: 'title',
18
38
  defaultMessage: 'Title',
19
39
  },
40
+ Authors: {
41
+ id: 'authors',
42
+ defaultMessage: 'Authors',
43
+ },
20
44
  Author: {
21
45
  id: 'author',
22
46
  defaultMessage: 'Author',
23
47
  },
24
- Given: {
25
- id: 'given',
26
- defaultMessage: 'Given',
27
- },
28
- Family: {
29
- id: 'family',
30
- defaultMessage: 'Family',
31
- },
32
48
  });
33
49
 
34
50
  export const CitationBlockSchema = (props) => {
35
51
  const authorSchema = {
36
52
  title: props.intl.formatMessage(messages.Author),
53
+
37
54
  fieldsets: [
38
55
  {
39
56
  id: 'default',
40
57
  title: 'Default',
41
- fields: ['given', 'family'],
58
+ fields: ['author'],
42
59
  },
43
60
  ],
44
61
  properties: {
45
- given: {
46
- title: props.intl.formatMessage(messages.Given),
47
- widget: 'default',
48
- },
49
- family: {
50
- title: props.intl.formatMessage(messages.Family),
51
- widget: 'default',
62
+ author: {
63
+ title: props.intl.formatMessage(messages.Author),
64
+ a: 'default',
65
+ description: props.intl.formatMessage(messages.AuthorDescription),
52
66
  },
53
67
  },
54
68
  required: [],
@@ -60,7 +74,7 @@ export const CitationBlockSchema = (props) => {
60
74
  {
61
75
  id: 'default',
62
76
  title: 'Default',
63
- fields: ['url', 'year', 'title', 'author'],
77
+ fields: ['title', 'year', 'authors', 'url'],
64
78
  },
65
79
  ],
66
80
 
@@ -68,19 +82,23 @@ export const CitationBlockSchema = (props) => {
68
82
  url: {
69
83
  title: props.intl.formatMessage(messages.CitationUrl),
70
84
  widget: 'url',
85
+ description: props.intl.formatMessage(messages.CitationUrlDescription),
71
86
  },
72
87
  year: {
73
88
  title: props.intl.formatMessage(messages.Year),
74
89
  widget: 'default',
90
+ description: props.intl.formatMessage(messages.YearDescription),
75
91
  },
76
92
  title: {
77
93
  title: props.intl.formatMessage(messages.Title),
78
94
  widget: 'default',
95
+ description: props.intl.formatMessage(messages.TitleDescription),
79
96
  },
80
- author: {
81
- title: props.intl.formatMessage(messages.Author),
97
+ authors: {
98
+ title: props.intl.formatMessage(messages.Authors),
82
99
  widget: 'object_list',
83
100
  schema: authorSchema,
101
+ description: props.intl.formatMessage(messages.AuthorsDescription),
84
102
  },
85
103
  },
86
104
  required: [],
@@ -1 +0,0 @@
1
- module.exports = require('@plone/volto/babel');