Skip to content

Commit

Permalink
do not use linkHref attribute of insertion context when dropping cont…
Browse files Browse the repository at this point in the history
…ent + do not use attributes of insertion context when dropping on new row
  • Loading branch information
jens-meisner committed Jan 22, 2025
1 parent fb7b1f2 commit 738bb16
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@ export default class DataToModelMechanism {
insertPosition = writer.split(markerPosition).range.end;
}
const range = writer.model.insertContent(item, insertPosition);
DataToModelMechanism.#applyAttributes(writer, [range], contentInputData.insertionContext.selectedAttributes);
if (range.start.path.length === 2 && range.end.path.length === 2) {
// applying attributes for empty rows leads to a bad element structure (e.g. strong tag surrounding a paragraph)
// avoid applying the linkHref attribute of the link which ended right before this one
const filteredAttributes = contentInputData.insertionContext.selectedAttributes.filter(
(arr) => arr[0] !== "linkHref",
);
DataToModelMechanism.#applyAttributes(writer, [range], filteredAttributes);
}

// Evaluate if the container element has to be split after the element has
// been inserted.
Expand Down

0 comments on commit 738bb16

Please sign in to comment.