50
Views
5
Comments
Solved
[CKEditor.Reactive] Component only works second time page is loaded
Question
Forge component by Fábio Fantato
2
Published on 07 May 2020

Using this component under an if (Main page view is a display, user clicks 'edit' which displays a block with the reactive CKeditor, and inputs within) seems to result in a situation where on the first load of the edit view, the editor area is blank.


Only on the second load of the page does the CKeditor view load the actual content of the database field with the HTML. (Not even hitting cancel, and then redisplaying the block works to load the data into ckeditor.)


It feels like the scripts or something for the ckeditor has to be cached or something in the browser before the page loads in order for it to display the html to be edited.


Has anyone encountered similar behavior? Is there a workaround other than probably hiding a editor block on the top level of the page so that it's pre-loaded when the user hits the edit view?

Rank: #834
Solution

Braxton wrote:

Vera Mendonça wrote:

Hello, 

Maybe when you click edit the first time, the data hasn't been fetched from the database yet.
What you if you add a condition to only show the edit button or the ckeditor area when the data is fetched? 

Vera,

I've manipulated the page to get it to work about 50% of the time by forcing the database to refresh the aggregate in the OnInitialize action, and then forcing the data into the editor using SetEditorData at the CKEditor's event CkeditorReady...


It still only loads the data about 50-75% of the time... And this even loading directly to the edit view of the page with no click in between...


It seems like the editor isn't done loading until after the rest of the page loads, and only then once the data is completely loaded on the page, will the refresh permit the data to actually load into the editor...


Yes, that's what I said. The screen is rendering faster than the data arrives from the database. So in your if statement you have to add a condition to only allow to show or edit the ckeditor only when you have all the data, the aggregates have a property "IsDataFetched" that you can use. 

Rank: #834

Hello, 

Maybe when you click edit the first time, the data hasn't been fetched from the database yet.
What you if you add a condition to only show the edit button or the ckeditor area when the data is fetched? 

Rank: #241

Braxton,

Have you tried to use the SetEditorData on the afterfetch action of your query?