cotestatnt / esp-fs-webserver

ESP32/ESP8266 webserver, WiFi manager and web editor Arduino library
MIT License
105 stars 27 forks source link

Add more supported editor files (for example like .yaml) #32

Closed erazor83 closed 5 months ago

erazor83 commented 10 months ago

Hi there.

For a project of mine it'd be great to also allow .yaml files in the editor.

I found the corresponding part in setup-ui/extras/edit.htm . Can you supply an unminified version too?

Thanks and have a great day!

cotestatnt commented 10 months ago

Hi @erazor83 You should edit this file and then "repack" as byte array using the script reduce_index.sh (despite the wrong name, it works on edit.htm file)

It's not so immedetiate because the edit.htm file is minified, so the content it's not so clear at a first glance.

Anyway if you try with one of the many beatifiers that are online, in the Javascript section of the page, at one point there is a switch/case:

 switch (e.toLowerCase()) {
            case "txt":
            case "htm":
            case "html":

and you need to add the extension you are interested in.

erazor83 commented 10 months ago

Can you supply an unminified version too?

cotestatnt commented 10 months ago

The file edit.htm is not mine. It comes from one of the ESP8266 webserver library example.

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/FSBrowser/data/edit/index.htm

You could also serve directly this file from filesystem. In this way you can edit it directly online.