Hi David,
I would like to offer a small simple html editor attached to an html area in the app to allow the user to do some very basic html formatting. I have been looking at a product called CLEditor and it looks like a pretty basic implementation. If you look at the example at https://premiumsoftware.net/cleditor/simpledemo you can view the html involved. I have downloaded the referenced assets and have the page working locally in an html file.
I decided to see if I could get it working in the Agenda sample so I added a reference to jquery.cleditor.css and jquery.cleditor.min.js and the toolbar images but am assuming that jquery.min.js is already referenced by AB so doesn't need to be added? Then I added the following code to the show view event:
When I view the app, it does show the wysiwyg editor in the Edit view but there seems to be an issue with the index layer and I am not sure if the wysiwyg editor is cleanly attached to the html area. Would you have a few minutes to take a look at what I have done and let me know if what I am trying to do is possible and if so, where I am going wrong?
Thanks,
Pete
p.s. You can download my sample file at https://mymarina.online/iPort/decsoft/AgendaCLEditor.zip
Hello Peter,
Unfortunately, it's not as easy as can appear. The point is that this kind of editor made various changes and add certain style in the HTML that break the app's layout. But it's a question of a bit of CSS? Well... not really... for example, if you replace the editor inicialization code by this other:
... we (apparently) avoid the "wrong position" of the editor, which, probably we wanted in the place of the original textarea. But, if you try the above code, even when apparently works... certainly don't work completely as expected, or, some other issues appear.
And this require more time in order to check what can happen... or maybe look for another possible editor, maybe more friendly for us. Or maybe we must try to avoid the usage of a textarea... and try to use an HTML control, since this editors works also in this way.
Let me to try to take a look, Peter... if I have some time tomorrow I will try to test more editors (since I already try some of them...) and how can be the best way to achieve it, probably by using an HTML control... but this is mental note to me too... because probably this can be a better approach (for us, at least) than use an existing Textarea.
Hi David,
I really appreciate you looking into it. Another one that I was looking at was Summernote which might be a good candidate since they specifically mention Bootstrap 4 and Angular: https://summernote.org
Cheers,
Pete
Hello Peter,
Please, take a look at the below app sample, who use the Summernote editor. Copy the below XML, save it as "MyApp.ab", open that file with App Builder and run the app:
]]>
https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.11/summernote-lite.css
https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.11/summernote-lite.js
App Builder
2019.36 (4/27/2019)
mailto:info@decsoftutils.com
https://www.decsoftutils.com/
©2019 App Builder by DecSoft
As you can see, using an HTML control to place the editor, it's quite better than try to use the Textarea replacement approach. This is because, also with Summernote, when use a textarea in order to be replaced with the editor, the editor become wrong positioning, and, even when maybe we can try to fix this using CSS, probably it's not as easy as appear (see my previous post in this thread), and, on the other hand, apparently the HTML control can give us a more or less good usage of the editor.
Look at the above app sample. Probably we must calculate a "height" for the editor, or probably apply some possible CSS... and, of course, since we don't use a Textarea, we can't use any existing variable, but, in order to set and get the content of the editor, we must use the editor's API. But honestly I think this is the way, Peter, since the Textarea replacement appear to not work as expected in our case.
Supose that we find difficulties to integrate the editor along other controls in the view, since we use an HTML control, that may finally don't fit exactly the place that we wanted. Here may we can take at least two approaches: the first one, include other possible required input text controls also inside the HTML control. Or, maybe include a button and not the editor, and, when the user press that button, shown the editor in a new view (maybe modal), since maybe the editor can be more easily fit an entire view. Both of these approaches are correct, in my opinion. *
* If we can't fit the editor along other controls... but this don't mean that maybe that is possible: depend on the controls that we want to use, their positions, etc. Remember that an HTML control (our editor container) can be have their "overflow-y" CSS rule in "auto", and, doing this, we can control the position of the HTML control in a more accurate way, since everything that go "beyond" that position, is "hidden" but available in the HTML control by using their scrollbar.