mirror of
https://github.com/outline/outline.git
synced 2026-08-03 13:27:25 +03:00
fix: CMD-Enter in table within toggle block does not add row (#13226)
* fix: CMD-Enter in table within toggle block does not add newline * simplify
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
splitBlock,
|
||||
} from "prosemirror-commands";
|
||||
import { Slice, Fragment } from "prosemirror-model";
|
||||
import { isInTable } from "prosemirror-tables";
|
||||
import type { Command } from "prosemirror-state";
|
||||
import { NodeSelection, TextSelection } from "prosemirror-state";
|
||||
import { liftTarget, ReplaceAroundStep } from "prosemirror-transform";
|
||||
@@ -202,6 +203,11 @@ export const indentBlock: Command = (state, dispatch) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If inside a table, allow the table's Tab handler to move cells instead.
|
||||
if (isInTable(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { $from } = state.selection;
|
||||
|
||||
let before = -1;
|
||||
@@ -242,6 +248,11 @@ export const toggleBlock: Command = (state, dispatch) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If inside a table, allow the table's handler to add a row instead.
|
||||
if (isInTable(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isToggle = isToggleBlock(state);
|
||||
const toggle = nearest(ancestors($cursor!).filter(isToggle));
|
||||
if (!toggle) {
|
||||
@@ -353,6 +364,11 @@ export const dedentBlocks: Command = (state, dispatch) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If inside a table, allow the table's Shift-Tab handler to move cells instead.
|
||||
if (isInTable(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { $from } = state.selection;
|
||||
|
||||
const isToggle = isToggleBlock(state);
|
||||
|
||||
Reference in New Issue
Block a user