Hi there
I'm trying to block/unblock parts of a text inside CK Editor. I'm trying to do this with 2 format tags.
When I press 'Bloquear' the selected part of the text gets blocked (the attribute contenteditable is set)
but when I press 'Desbloquear', with the same text selected, nothing happens.
Can someone guide me here?
First, you need to add custom commands to CKEditor to set and remove the contenteditable attribute. Here's how you can do it:Ensure your CKEditor is properly initialized in your application.You can add custom commands to set and remove the contenteditable attribute.The above code handles the case where the text is selected and applies/removes the contenteditable attribute. Make sure the correct element is being targeted for the attribute change. Update your CKEditor initialization code to include the new plugin: Ensure to handle edge cases, such as when no text is selected or if the selection spans multiple elements. You might need to refine the command execution logic to accommodate these scenarios.Test your implementation thoroughly to ensure that the 'Bloquear' and 'Desbloquear' buttons correctly toggle the contenteditable attribute on the selected text or elements.