aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx2
-rw-r--r--src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 1a5e1febf..729c4d534 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1671,7 +1671,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
this._forceUncollapse = false;
clearStyleSheetRules(FormattedTextBox._bulletStyleSheet);
const clickPos = this._editorView!.posAtCoords({ left: x, top: y });
- const clickPosVal = clickPos?.pos || 1; // - (this._editorView?.state.doc.nodeAt(clickPos?.pos || 1)?.type === this._editorView?.state.schema.nodes.paragraph ? 1 : 0);
+ const clickPosVal = clickPos?.pos || 1;
let olistPos = clickPosVal;
if (clickPos && olistPos && this._props.rootSelected?.()) {
const clickNode = this._editorView?.state.doc.resolve(olistPos).node();
diff --git a/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts b/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts
index 1058c51da..7b4d8aa03 100644
--- a/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts
+++ b/src/client/views/nodes/formattedText/ProsemirrorExampleTransfer.ts
@@ -255,7 +255,7 @@ export function buildKeymap<S extends Schema<any>>(schema: S, props: any, mapKey
});
// backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);
- bind('Backspace', (state: EditorState, dispatch: (tx: Transaction) => void) => {
+ const backspace = (state: EditorState, dispatch: (tx: Transaction) => void, view: EditorView) => {
if (props.onKey?.(event, props)) return true;
if (!canEdit(state)) return true;
@@ -267,6 +267,7 @@ export function buildKeymap<S extends Schema<any>>(schema: S, props: any, mapKey
if (
!joinBackward(state, (tx: Transaction) => {
dispatch(updateBullets(tx, schema));
+ if (!view.state.selection.$from.node().content.size) backspace(view.state, view.dispatch, view);
})
) {
if (
@@ -279,7 +280,8 @@ export function buildKeymap<S extends Schema<any>>(schema: S, props: any, mapKey
}
}
return true;
- });
+ };
+ bind('Backspace', backspace);
//newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock
//command to break line