Skip to content

Commit

Permalink
fix multiple split
Browse files Browse the repository at this point in the history
  • Loading branch information
ol0lll committed Apr 19, 2024
1 parent 4ba63a1 commit 23896b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/build/split_paragraph.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/ckeditor5_plugins/split_paragraph/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SplitParagraph extends Plugin {
}

if (
previousParagraph &&
[...paragraph.parentElement.children].indexOf(previousParagraph) === window._splitParagraph.originalRowIndex &&
this.editor.sourceElement.dataset.drupalSelector.match(window._splitParagraph.selector.replace(/-[0-9]+-?/, '-[0-9]+-'))) {
// Defer to wait until init is complete.
setTimeout(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default class SplitParagraphCommand extends Command {
const paragraph = sourceElement.closest('.paragraphs-subform').closest('tr.draggable');
const paragraphType = paragraph.querySelector('[data-paragraphs-split-text-type]').dataset.paragraphsSplitTextType;
const paragraphDelta = [...paragraph.parentNode.children].filter(el => el.querySelector('.paragraphs-actions')).indexOf(paragraph) + 1;
const originalRowIndex = [...paragraph.parentNode.children].indexOf(paragraph);

// Store the value of the paragraphs.
window._splitParagraph = {
Expand All @@ -36,6 +37,7 @@ export default class SplitParagraphCommand extends Command {
second: elementAfter.outerHTML,
},
selector: sourceElement.dataset.drupalSelector,
originalRowIndex: originalRowIndex,
};

// Add new paragraph after current.
Expand Down

0 comments on commit 23896b4

Please sign in to comment.