WebArea as a TextEditor

Summary

[Updated]

While waiting for 4D Write to earn it’s Pro-badge I evaluate options to use the WebArea as a writing field. These days I stumbled across bold.io. Simple, clear looking and gave it a try. You should too, I suppose.

Ich warte darauf, daß sich 4D Write das Pro-Label verdient. Währenddessen schaue ich mich um, ob ich nicht was finde, das in der WebArea schreiben erlaubt. Dieser Tage stolperte ich über bold.io. Sieht super aus und versuchte es. Ich denke, Sie sollten das auch tun.


Ich habe ein WebArea-Formuler, mit der ich alles mögliche teste. Bold.io sieht auch hier gut aus und funktioniert.

bold.io in meiner Test-WebArea
bold.io in meiner Test-WebArea

Habe ich einen Text-Editor in der WebArea, muß ich dafür sorgen, den eingegebenen Text auch wieder zu bekommen. Dafür habe ich den Content-Button angelegt. Das ist der auszuführende Code.
$contentText:=WA Evaluate JavaScript(*;$wa_AreaObj;“document.body.innerText“;Is text)

Die Funktion liefert den Text als reinen Text. Das ist ein Ansatz. In der Richtung will ich weitersuchen.

Es kommt Leben rein

Andreas Overmeyer wies mich darauf hin: sobald gepublished bekommst Du eine URL. Hänge an diese .json an und Du kannst den Inhalt als JSON abfragen.
Das funktioniert. Super!
$url:=WA Get current URL(*;$wa_AreaObj)
$url:=strBefore ($url;“#“)
$result_L:=HTTP Get($url+“.json“;$received_T)



For testing-purposes I use a 4D-form containing a web-area. Bold.io looks good here too and works.

bold.io in meiner Test-WebArea
bold.io in meiner Test-WebArea

When using a text-editor inside the web-area I need to get the text entered back to 4D. The button Content achieves that. This is the code attached:
$contentText:=WA Evaluate JavaScript(*;$wa_AreaObj;“document.body.innerText“;Is text)

This function delivers the content as pure text. This is a first step. Searching on in that direction.

Getting traction!

As Andreas Overmeyer pointed out: add .json to the url received when published, you’ll get the content as json. Which is nice!
Indeed, that works
$url:=WA Get current URL(*;$wa_AreaObj)
$url:=strBefore ($url;“#“)
$result_L:=HTTP Get($url+“.json“;$received_T)