This commit is contained in:
Tom Moor committed 2020-10-15 22:10:30 -07:00
1 parent ae1761e517
commit 7dcbaa9c5c
3 files changed
+54 -14

No files matched your search

+31 -11
View File
@@ -99,27 +99,47 @@ const StyledEditor = styled(RichMarkdownEditor)`
.ProseMirror {
.ProseMirror-yjs-cursor {
position: absolute;
border-left: black;
border-left-style: solid;
border-left-width: 2px;
border-color: orange;
position: relative;
margin-left: -1px;
margin-right: -1px;
border-left: 1px solid black;
border-right: 1px solid black;
height: 1em;
word-break: normal;
pointer-events: none;
&:after {
content: "";
display: block;
position: absolute;
left: -8px;
right: -8px;
top: 0;
bottom: 0;
}
> div {
position: relative;
top: -1.05em;
opacity: 0;
position: absolute;
top: -1.8em;
font-size: 13px;
background-color: rgb(250, 129, 0);
font-style: normal;
font-weight: normal;
line-height: normal;
user-select: none;
white-space: nowrap;
color: white;
padding-left: 2px;
padding-right: 2px;
padding: 2px 6px;
font-weight: 500;
border-radius: 4px;
pointer-events: none;
left: -1px;
}
&:hover {
> div {
opacity: 1;
transition: opacity 100ms ease-in-out;
}
}
}
}
+18 -3
View File
@@ -82,11 +82,20 @@ class Multiplayer extends Extension {
}
get plugins() {
const type = this.options.doc.get("prosemirror", Y.XmlFragment);
const { user, provider, doc } = this.options;
const type = doc.get("prosemirror", Y.XmlFragment);
provider.awareness.setLocalStateField("user", {
color: "#008833",
name: user.name,
});
const permanentUserData = new Y.PermanentUserData(doc);
permanentUserData.setUserMapping(doc, doc.clientID, user.id);
return [
ySyncPlugin(type),
yCursorPlugin(this.options.provider.awareness),
yCursorPlugin(provider.awareness),
yUndoPlugin(),
keymap({
"Mod-z": undo,
@@ -352,6 +361,7 @@ class DocumentScene extends React.Component<Props> {
match,
} = this.props;
const team = auth.team;
const user = auth.user;
const isShare = !!match.params.shareId;
const value = revision ? revision.text : document.text;
@@ -477,7 +487,12 @@ class DocumentScene extends React.Component<Props> {
readOnly={readOnly}
readOnlyWriteCheckboxes={readOnly && abilities.update}
ui={this.props.ui}
extensions={[new Multiplayer(this.props.multiplayer)]}
extensions={[
new Multiplayer({
user,
...this.props.multiplayer,
}),
]}
/>
</Flex>
{readOnly && !isShare && !revision && (
+5
View File
@@ -6,6 +6,11 @@ export const fadeIn = keyframes`
to { opacity: 1; }
`;
export const fadeOut = keyframes`
from { opacity: 0; }
to { opacity: 1; }
`;
export const fadeAndScaleIn = keyframes`
from {
opacity: 0;