BUG: Text element not able to be selected twice after extended with events
Question
Version: 0.17.25
Are you able to reproduce the bug from the demo?
- Yes
- No
What is the expected behavior? Update a existing component of type text by adding an event to his view.
Describe the bug detailed The event is being added, but once I select another component I cannot go back to the first one. It can only be entered one time for edition.
Are you able to attach screenshots, screencasts or a live demo?
- Yes (attach)
- No
first, i'm trying to extend the text type component to add an event to listen when something is typed.
export default (editor, opts = {}) => {
const domc = editor.DomComponents;
domc.addType('text', {
view: {
events: {
keypress: (e) => {
console.log("Some code")
}
}
},
});
};
Even if I leave only a empty events property like events:{} the bug remains.
When I first add the component, the event works:

And then, once I deselect the component and try do select him again:

The purpose of this is to generate a roll event everytime someone hits return to break a line. This is a workaround for a bug in CKEditor plugin where the editor toolbar does not roll as the text component gets bigger. I will also open an issue in the CK Editor plugin repository and relate to this one.
Answers (3)
That actually was the problem. Thanks for replying. I'll be closing the issue.
+1 :D We are trying to solve this issue https://github.com/artf/grapesjs/issues/1136
Because it still happening when use a ckeditor.

The events are not automatically merged with the extended component so, you have to do it manually.
events: {
...domc.getType('text').view.prototype.events,
keypress: (e) => {...}
}
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3291
BUG (v0.16.41): the duplicate icon from the icon toolbar is modifying the original element too
Version: v0.16.41 Are you able to reproduce the bug from the demo? [ ] Yes What is the expected behavior? The elements duplicated not shoul...
Issue #3018
Page refresh preventing after click on import
Version: 0.15.9 Are you able to reproduce the bug from the demo? Yes What is the expected behavior? Don't refresh the page after clicking o...
Issue #3681
BUG: Textable not working with extended text component
Version: 0.17.22 Are you able to reproduce the bug from the demo?[X] Yes[ ] No What is the expected behavior? Should be able to drop a text...
Issue #3134
BUG: Canvas scroll to top of the page when I try to drag an element from the last sections
Version: 0.16.27 Are you able to reproduce the bug from the demo? [ X] Yes [ ] No What is the expected behavior? When a try to drag a compo...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.