Skip to content

Commit

Permalink
fix: Fix problem with adding columns in tables and deactivate fixed-p…
Browse files Browse the repository at this point in the history
…aragraph.

The fixed-paragraph extension was causing a problem when adding columns.
This extension adds an extra paragraph at the end of tables, so that
it's easier to add content below tables. However, we also have the
"dropcursor" extension activated with tables and other block content for
the same reason - this one adding a horizontal cursor when navigating
below tables which helps in adding content there. To allow adding
columns in tables again, the fixed-paragraph extension is deactivated
until explictly needed again.
  • Loading branch information
thet committed Aug 20, 2024
1 parent 62155f8 commit ad5e986
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/extensions/fixed-paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const factory = () => {
];
},

addProseMirrorPlugins() {
// NOTE: Deactivate whole ProseMirror plugin while registering the
// extension as it is used in the trailing-node extension.
// Why is it deactivated? See `TODO` comment below.
DEACTIVATED__addProseMirrorPlugins() {
return [
new Plugin({
filterTransaction(transaction, state) {
Expand All @@ -50,6 +53,8 @@ export const factory = () => {
const map = transaction.mapping.maps[index];
const oldStart = map.ranges[0];
const oldEnd = map.ranges[0] + map.ranges[1];
// TODO: This code breaks for tables when adding
// columns left/right within a table cell.
state.doc.nodesBetween(oldStart, oldEnd, (node) => {
if (node.type.name === "fixed-paragraph") {
result = false;
Expand Down

0 comments on commit ad5e986

Please sign in to comment.