aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2023-06-28 13:00:15 -0400
committersrichman333 <sarah_n_richman@brown.edu>2023-06-28 13:00:15 -0400
commitdfa5bcd6377f57c99a37513c2295a17a4c4bc243 (patch)
tree850406a8d1ea0547e5caabb178a73fb347c2b949
parent7567210b6e0dce1e5bc79255dc2dd4debe55ed82 (diff)
Augment is actually a working version of SelfEdit now
-rw-r--r--src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts b/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts
index ec56c043b..d2273c91c 100644
--- a/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts
+++ b/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts
@@ -49,14 +49,9 @@ export function buildKeymap<S extends Schema<any>>(schema: S, props: any, mapKey
const canEdit = (state: any) => {
switch (GetEffectiveAcl(props.DataDoc)) {
case AclAugment:
- const content = state.selection.$anchor.path[0].content.content;
- var line = content[content.length-1].content.content;
- var lastEdit = line[line.length-1];
- if (line == undefined || line.length == 0){
- lastEdit = content[content.length-1];
- }
- const lastEditor = lastEdit.marks[lastEdit.marks.length-1].attrs.userid
- if (lastEditor != Doc.CurrentUserEmail){
+ const prevNode = state.selection.$cursor.nodeBefore;
+ const prevUser = prevNode.marks[prevNode.marks.length-1].attrs.userid
+ if (prevUser != Doc.CurrentUserEmail){
return false;
}
}
@@ -268,7 +263,7 @@ export function buildKeymap<S extends Schema<any>>(schema: S, props: any, mapKey
bind('Backspace', (state: EditorState, dispatch: (tx: Transaction) => void) => {
if (props.onKey?.(event, props)) return true;
if (!canEdit(state)) return true;
-
+
if (
!deleteSelection(state, (tx: Transaction) => {
dispatch(updateBullets(tx, schema));