diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx
index 37d846e..a6b4725 100644
--- a/src/editor/Editor.jsx
+++ b/src/editor/Editor.jsx
@@ -1,6 +1,5 @@
import React from 'preact/compat';
import { useState, useRef, useEffect } from 'preact/hooks';
-import Environment from '../Environment';
import { getWidget, DEFAULT_WIDGETS } from './widgets';
import setPosition from './setPosition';
import i18n from '../i18n';
@@ -19,7 +18,7 @@ const bounds = elem => {
* with CTRL+Z.
*/
const Editor = props => {
-
+
// The current state of the edited annotation vs. original
const [ currentAnnotation, setCurrentAnnotation ] = useState();
@@ -75,7 +74,7 @@ const Editor = props => {
const creationMeta = body => {
const meta = {};
- const { user } = Environment;
+ const { user } = props.env;
// Metadata is only added when a user is set, otherwise
// the Editor operates in 'anonymous mode'. Also,
@@ -86,9 +85,9 @@ const Editor = props => {
if (user.displayName) meta.creator.name = user.displayName;
if (body.created)
- body.modified = Environment.getCurrentTimeAdjusted();
+ body.modified = props.env.getCurrentTimeAdjusted();
else
- body.created = Environment.getCurrentTimeAdjusted();
+ body.created = props.env.getCurrentTimeAdjusted();
}
return meta;
@@ -152,6 +151,7 @@ const Editor = props => {
annotation : currentAnnotation,
readOnly : props.readOnly,
config: props.config,
+ env: props.env,
onAppendBody,
onUpdateBody,
onRemoveBody,
diff --git a/src/editor/widgets/comment/Comment.jsx b/src/editor/widgets/comment/Comment.jsx
index 2e63b25..7de63ce 100644
--- a/src/editor/widgets/comment/Comment.jsx
+++ b/src/editor/widgets/comment/Comment.jsx
@@ -4,7 +4,6 @@ import TimeAgo from 'timeago-react';
import DropdownMenu from './DropdownMenu';
import TextEntryField from './TextEntryField';
import { ChevronDownIcon } from '../../../Icons';
-import Environment from '../../../Environment';
/** A single comment inside the CommentWidget **/
const Comment = props => {
@@ -32,7 +31,7 @@ const Comment = props => {
{props.body.creator.name || props.body.creator.id}
{ props.body.created &&
-
+
}
diff --git a/src/editor/widgets/comment/CommentWidget.jsx b/src/editor/widgets/comment/CommentWidget.jsx
index 0324b04..9d42f8d 100644
--- a/src/editor/widgets/comment/CommentWidget.jsx
+++ b/src/editor/widgets/comment/CommentWidget.jsx
@@ -2,7 +2,6 @@ import React from 'preact/compat';
import Comment from './Comment';
import TextEntryField from './TextEntryField';
import i18n from '../../../i18n';
-import Environment from '../../../Environment';
/**
* Comments are TextualBodies where the purpose field is either
@@ -66,7 +65,7 @@ const CommentWidget = props => {
const creator = body.creator?.id;
// The current user
- const me = Environment.user?.id;
+ const me = props.env.user?.id;
return me !== creator;
}
@@ -80,6 +79,7 @@ const CommentWidget = props => {
{ comments.map((body, idx) =>