aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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));