- Issue created by @bbrala
- 🇳🇱Netherlands bbrala Netherlands
The problem is as follows:
When an element has data-entity-type and/or data-entity-uuid, this module load that data into the ckeditor model. This means if another module adds those properties it will think its a file upload. This is wrong. The fix here is to check if the type is a file. Then load the model. There might be a world where it is better to add a new property like data-managed-by=editor_file, but im not sure of the side effects of this, and this might conflict on other levels.
- Merge request !5Make sure we do not conflict with other modules like LinkIt, if the type is no... → (Open) created by bbrala
- Status changed to Needs review
11 months ago 8:19am 19 January 2024 - 🇺🇸United States mkindred
Although I've never used editor_file previously, I was able to confirm the bug in a fresh install of D10.2.2, editor_file 2.0.0-rc1, and linkit 6.1.2.
Patch #6 fixed the issue for me.
- 🇳🇱Netherlands bbrala Netherlands
@mkindred if you tested, cant you RTBC then?
- Status changed to RTBC
10 months ago 2:40pm 15 February 2024 - 🇺🇸United States matthew.page
I'm facing a similar problem with ckeditor5. I've created a function intended to eliminate the data-entity-type and data-entity-uuid upon clicking. However, it currently only detaches the text, leaving the data attributes unchanged. I'm in the process of developing a converter to address this issue by removing the attributes while preserving the text, if that clarifies my approach.
// Method to handle unlinking a file unlinkFileCommand() { const { editor } = this; const { model } = this.editor; const { selection } = model.document; let isUnlinkingInProgress = false; // Execute the 'unlink' command to remove the link from the selected text. editor.execute('unlink'); // This single block wraps all changes that should be in a single undo step. model.change(() => { // Now, in this single "undo block" let the unlink command flow naturally. isUnlinkingInProgress = true; // Do the unlinking within a single undo step. editor.execute('unlink'); // Let's make sure the next unlinking will also be handled. isUnlinkingInProgress = false; // The actual integration that removes the extra attribute. model.change((writer) => { // Get ranges to unlink. let ranges; const attributeNames = ['data-entity-type', 'data-entity-uuid']; if (selection.isCollapsed) { ranges = [ findAttributeRange( selection.getFirstPosition(), attributeNames, selection.getAttribute(attributeNames[0]), // Assuming both attributes have the same value. model, ), ]; } else { ranges = model.schema.getValidRanges( selection.getRanges(), attributeNames, ); } // Remove the extra attribute from specified ranges. for (const range of ranges) { attributeNames.forEach((attr) => { writer.removeAttribute(attr, range); }); } }); }); }
- 🇮🇹Italy kopeboy Milan
I confirm that after applying patch #6 removing links from CKEditor is not broken.
- e6347210 committed on 2.x
Issue #3415505: fix removing links broken when linkit is enabled
- e6347210 committed on 2.x
Automatically closed - issue fixed for 2 weeks with no activity.