[Bug]: Text component content not retrieved properly when using custom RTE
Version: 0.16.12
Are you able to reproduce the bug from the demo ?
[ ] Yes [x] No (it does not include a custom RTE)
What is the expected behavior ?
When using a custom RTE, the generated / exported code should correspond to the RTE's generated code
What is the current behavior ?
The generated code corresponds to the text component canvas element's innerHTML.
If we take CKEditor as an example: creating an empty anchor (as shown in screenshot 1) results in GJS' generated code containing the anchor flag's <img> element (cf screenshot 2), whereas CKEditor generates it properly (cf screenshot 3).
Proposed solution:
-
The ComponentTextView.getContent method should look for
this.activeRteinstead ofthis.rte.activeRte, which I don't think ever exists given the actual affectation -
This would also imply exposing the appropriate
rte.getContentmethod from the CKEditor plugin (which I think should reference CKE'sgetDatamethod)
Does this look good to you ? As always, I'd be happy to open both PRs to fix this :) !
Are you able to attach screenshots, screencasts or a live demo ?
[x] Yes (attach)
Screenshot 1 (example canvas):
Screenshot 2 (GJS' generated code):
Screenshot 3 (CKEditor's generated code):
[ ] No
Your solution seems to be correct 👍 a PR would be really helpful
Awesome ! artf/grapesjs-plugin-ckeditor#39 & #2977 opened.