Text component content not retrieved properly when using custom RTE
Your solution seems to be correct 👍 a PR would be really helpful
Read full answer below ↓Question
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):
<img width="200" alt="Screenshot 2020-07-24 at 4 05 06 PM" src="https://user-images.githubusercontent.com/9916749/88408361-bf547c00-cdd3-11ea-9bfa-df6dcb3b3fbb.png">Screenshot 2 (GJS' generated code):
<img width="408" alt="Screenshot 2020-07-24 at 4 05 17 PM" src="https://user-images.githubusercontent.com/9916749/88408374-c24f6c80-cdd3-11ea-9682-fa80454fabf9.png">Screenshot 3 (CKEditor's generated code):
<img width="818" alt="Screenshot 2020-07-24 at 5 22 57 PM" src="https://user-images.githubusercontent.com/9916749/88408382-c4b1c680-cdd3-11ea-8605-33e0ed9e6a26.png">[ ] No
Answers (2)
Your solution seems to be correct 👍 a PR would be really helpful
Awesome ! artf/grapesjs-plugin-ckeditor#39 & #2977 opened.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3681
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 #3352
Default Content is getting Inserted while using setComponents if Tag Body is empty
Version: Latest You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo?[X] Yes...
Issue #5037
How to drag external text into particular index inside the textable component?
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link NA Describe...
Issue #3655
The form button name changes are not getting captured in generated html code
Version: Version 0.17.19(grapesjs) Version 0.1.11(grapesjs-preset-webpage) Are you able to reproduce the bug from the demo?[ ] No What is t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.