diff --git a/package-lock.json b/package-lock.json
index 15cdac1..31ee6c5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@recogito/recogito-client-core",
- "version": "1.3.5",
+ "version": "1.4.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@recogito/recogito-client-core",
- "version": "1.3.5",
+ "version": "1.4.4",
"license": "BSD-3-Clause",
"dependencies": {
"@babel/polyfill": "^7.10.4",
diff --git a/package.json b/package.json
index ed86513..36f97c7 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,9 @@
{
"name": "@recogito/recogito-client-core",
- "version": "1.3.5",
+ "version": "1.4.4",
"description": "Core functions, classes and components for RecogitoJS",
"main": "src/index.js",
+ "sideEffects": ["themes/default/*"],
"scripts": {
"test": "NODE_ENV=test ./node_modules/.bin/mocha --require @babel/register"
},
diff --git a/src/editor/widgets/comment/PurposeSelect.jsx b/src/editor/widgets/comment/PurposeSelect.jsx
index ab13a19..754ca02 100644
--- a/src/editor/widgets/comment/PurposeSelect.jsx
+++ b/src/editor/widgets/comment/PurposeSelect.jsx
@@ -13,7 +13,8 @@ export const PURPOSES = [
{'value': 'linking', 'label': 'Linking'},
{'value': 'moderating', 'label': 'Moderating'},
{'value': 'questioning', 'label': 'Questioning'},
- {'value': 'replying', 'label': 'Replying'}
+ {'value': 'replying', 'label': 'Replying'},
+ {'value': 'supplementing', 'label': 'Transcription'}
]
const PurposeSelect = props => {
@@ -34,4 +35,4 @@ const PurposeSelect = props => {
}
-export default PurposeSelect;
\ No newline at end of file
+export default PurposeSelect;
diff --git a/src/editor/widgets/index.jsx b/src/editor/widgets/index.jsx
index d528f1b..12bd001 100644
--- a/src/editor/widgets/index.jsx
+++ b/src/editor/widgets/index.jsx
@@ -59,22 +59,34 @@ const isReactComponent = component => {
*/
export const getWidget = arg => {
- const instantiate = (widget, config) => {
+ const instantiate = (widget, config, force) => {
+ // Check if user forced explicit type
if (typeof widget === 'string' || widget instanceof String) {
+ // Built-in
return React.createElement(BUILTIN_WIDGETS[widget], config);
- } else if (isReactComponent(widget)) {
- return React.createElement(widget, config);
- } else if (typeof widget === 'function' || widget instanceof Function) {
- return
- } else {
- throw `${widget} is not a valid plugin`
+ } else {
+ // Plugin
+ if (force?.toLowerCase() === 'react') {
+ return React.createElement(widget, config);
+ } else if (force?.toLowerCase() === 'plainjs') {
+ return
+ } else {
+ // Auto-detect
+ if (isReactComponent(widget)) {
+ return React.createElement(widget, config);
+ } else if (typeof widget === 'function' || widget instanceof Function) {
+ return
+ } else {
+ throw `${widget} is not a valid plugin`
+ }
+ }
}
}
// First, check 'top-level' vs. 'nested object' case
if (arg.widget) {
- const { widget, ...config } = arg;
- return instantiate(widget, config);
+ const { widget, force, ...config } = arg;
+ return instantiate(widget, config, force);
} else {
// No object with args -> instantiate arg directly
return instantiate(arg);
diff --git a/src/i18n/index.js b/src/i18n/index.js
index 14b4bfb..a50a60d 100644
--- a/src/i18n/index.js
+++ b/src/i18n/index.js
@@ -1,12 +1,42 @@
import Polyglot from 'node-polyglot';
import * as timeago from 'timeago.js';
+import messages_ar from './messages_ar.json';
+import messages_cs from './messages_cs.json';
+import messages_de from './messages_de.json';
+import messages_el from './messages_el.json';
+import messages_es from './messages_es.json';
+import messages_gl from './messages_gl.json';
+import messages_hi from './messages_hi.json';
+import messages_it from './messages_it.json';
+import messages_nl from './messages_nl.json';
+import messages_pt from './messages_pt.json';
+import messages_sv from './messages_sv.json';
+import messages_tr from './messages_tr.json';
+import messages_ur from './messages_ur.json';
+
+const MESSAGES = {
+ ar: messages_ar,
+ cs: messages_cs,
+ de: messages_de,
+ el: messages_el,
+ es: messages_es,
+ gl: messages_gl,
+ hi: messages_hi,
+ it: messages_it,
+ nl: messages_nl,
+ pt: messages_pt,
+ sv: messages_sv,
+ tr: messages_tr,
+ ur: messages_ur
+}
+
const i18n = new Polyglot({ allowMissing: true });
i18n.init = (lang, opt_messages) => {
if (lang) {
i18n.locale(lang);
- i18n.extend(require(`./messages_${lang}.json`));
+ i18n.extend(MESSAGES[lang]);
}
if (opt_messages)