aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/ProsemirrorExampleTransfer.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-09-06 10:11:23 -0400
committerbob <bcz@cs.brown.edu>2019-09-06 10:11:23 -0400
commiteb05b987d7a1b2ca2e50268a0c15f2de7d44c5bd (patch)
tree50c4963cbd0c2433b4b76d73744b23af7749c532 /src/client/util/ProsemirrorExampleTransfer.ts
parent95f773b56b8ed4fa95b1fd308c19baee1744275a (diff)
cleanup of prosemirror stuff.
Diffstat (limited to 'src/client/util/ProsemirrorExampleTransfer.ts')
-rw-r--r--src/client/util/ProsemirrorExampleTransfer.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/client/util/ProsemirrorExampleTransfer.ts b/src/client/util/ProsemirrorExampleTransfer.ts
index 55e07cfb9..e7566e3a4 100644
--- a/src/client/util/ProsemirrorExampleTransfer.ts
+++ b/src/client/util/ProsemirrorExampleTransfer.ts
@@ -116,8 +116,7 @@ export default function buildKeymap<S extends Schema<any>>(schema: S, mapKeys?:
marks && tx2.setStoredMarks([...marks]);
dispatch(tx2);
})) { // couldn't sink into an existing list, so wrap in a new one
- let sxf = state.tr.setSelection(TextSelection.create(state.doc, range!.start, range!.end));
- let newstate = state.applyTransaction(sxf);
+ let newstate = state.applyTransaction(state.tr.setSelection(TextSelection.create(state.doc, range!.start, range!.end)));
if (!wrapInList(schema.nodes.ordered_list)(newstate.state, (tx2: Transaction) => {
updateBullets(tx2);
// when promoting to a list, assume list will format things so don't copy the stored marks.
@@ -144,16 +143,12 @@ export default function buildKeymap<S extends Schema<any>>(schema: S, mapKeys?:
});
bind("Enter", (state: EditorState<S>, dispatch: (tx: Transaction<S>) => void) => {
- if (!keys["ACTIVE"]) {
+ if (!keys["ACTIVE"]) {// hack to ignore an initial carriage return when creating a textbox from the action menu
dispatch(state.tr.setSelection(TextSelection.create(state.doc, state.selection.from - 1, state.selection.from)).deleteSelection());
return true;
}
var marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());
- if (!splitListItem(schema.nodes.list_item)(state, (tx3: Transaction) => {
- // marks && tx3.ensureMarks(marks);
- // marks && tx3.setStoredMarks(marks);
- dispatch(tx3);
- })) {
+ if (!splitListItem(schema.nodes.list_item)(state, (tx3: Transaction) => dispatch(tx3))) {
if (!splitBlockKeepMarks(state, (tx3: Transaction) => {
marks && tx3.ensureMarks(marks);
marks && tx3.setStoredMarks(marks);