Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set summernote text programatically
#1
When setting the textarea of TIWSummernote (e.g. IWSummernote1.Lines.Add('...'); ) programmatically, the control acts as expected, nicely rendering formatted HTML text.

However, if the control is rendered in a project using bootstrap template, the text area appears to be rendered in a separate frame which does not occupy the full width, and the html is shown as a literal sting.

   

The code I am using in both scenarios is the same:
IWSummernote1.Lines.Add('<p>Hello<br><b>World</b></p>');

Using Intraweb 15.6.9 ultimate.
Reply
#2
(02-04-2023, 12:15 AM)john.burgess Wrote: When setting the textarea of TIWSummernote (e.g. IWSummernote1.Lines.Add('...'); ) programmatically, the control acts as expected, nicely rendering formatted HTML text.

However, if the control is rendered in a project using bootstrap template, the text area appears to be rendered in a separate frame which does not occupy the full width, and the html is shown as a literal sting.



The code I am using in both scenarios is the same:
IWSummernote1.Lines.Add('<p>Hello<br><b>World</b></p>');

Using Intraweb 15.6.9 ultimate.

Just to provide more clarity to this problem I have discovered that IWSummernote renders OK if the text is set programmatically during form onShow but not if I attempt to (re)set the text programatically within an async method on the form - e.g. selecting an item from a IWBSSelect. So it seems this is not related to the use of templates but the ajax refresh of the control after the form has already been shown. I will continue testing this and add any further findings to this thread - but would appreciate any suggestions as to how it can be addressed.
Reply
#3
Can you please provide a minimal test case showing your issue?
Reply
#4
Thanks for looking at this Alexandre.

Attaching test project.

Text sets ok during form show event but not on button's OnAsyncClick

I have attempted without success various techniques such as asyncrefresh, invalidate etc. to get this to work during the async method.


Attached Files
.zip   SummernoteTest.zip (Size: 89.92 KB / Downloads: 3)
Reply
#5
OK. I'll have a look and get back to you ASAP

Cheers
Reply
#6
(02-12-2023, 10:36 PM)Alexandre Machado Wrote: OK. I'll have a look and get back to you ASAP

Cheers

Hi Alexandre,

This is quite an old thread, so maybe it is solved and I missed it. I encounter the same problems as John. When I use an Async buttonclick to fill the content of the IWSummernote, nothing is shown. Just like him, I tried several refresh, repaint, asyncrender lines, but nothing changed. When I use a Sync buttonclick, the content is shown (but my full page is then rendered, so scroll positions and thelike are lost...

Using Intraweb 16.08

Cheers
Reply
#7
It sounds like the Bootstrap template is affecting how TIWSummernote’s iframe/content area is initialized. I’d check the generated HTML and Bootstrap CSS first, especially the iframe width and Summernote initialization, since the literal HTML suggests the content isn’t being interpreted in the expected editor context.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)