EpicEditor icon indicating copy to clipboard operation
EpicEditor copied to clipboard

Adding placeholder text to the editor?

Open lfzawacki opened this issue 7 years ago • 4 comments

Going by the documentation and a quick search through the code it doesn't seem to be possible to add a placeholder text to the editor. Is the the feature really not present? How hard would it be to add it?

By the way, the official http://epiceditor.com seems to be down.

Thanks

lfzawacki avatar Oct 24 '16 05:10 lfzawacki

If by 'placeholder' you mean a 'default text', the trick I use is to have:

<textarea id="epiceditor">
# Placeholder

A placeholder
</textarea>

Then when your javascript loads, you find the 'epiceditor' node in the DOM and replace it with the EpicEditor, using the content of the textarea as the starting point ('textarea' argument in the options)

That way you get a nice fallback to HTML for those who properly disable Javascript till they see why they should enable it and that it is for a real reason not just to load ads and other malware.

Of course, you could also use your epiceditor loader script to async load some content and set that as the body.

By the way, the official http://epiceditor.com seems to be down.

Apparently the A address of epiceditor.com points to a old cluster of Fastly; hence, @OscarGodson will have to update DNS for that to be resolved. (bad thing about CDNs and not using their DNS: can't "CNAME" the root to their cluster).

massar avatar Oct 24 '16 07:10 massar

Ok, thanks. I was actually thinking of something more like the placeholder attribute in the textarea tag which displays text with different styling and is not 'actually' there (it will disappear when the user focuses and/or starts typing text).

Anyway, I might make it work loading the text there, but the issue is about the input tag placeholder behavior.

lfzawacki avatar Oct 25 '16 03:10 lfzawacki

Placeholders do not make total sense for an editor like EpicEditor IMHO.

But If you want the behaviour of a placeholder: when the editor is activated, remove the initial text and let people type.

massar avatar Oct 25 '16 07:10 massar

Yeah, I'll get it to work this way. You can probably close this issue now. Thanks again.

lfzawacki avatar Oct 26 '16 04:10 lfzawacki