Send editor content RESTfully; then render response?
30 views
Skip to first unread message
Alec Taylor
unread,
Nov 18, 2012, 2:10:20 AM11/18/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to etherpad...@googlegroups.com
I have many novel ideas on how to increase the number of use-cases Etherpad caters for.
In order to explore these ideas though, I need to know how to:
Create a button which on-click will send the editor's content as JSON—{'id': 'untitled', 'body':'hello world', 'revision': 3432}—in POST to a server
Display the output from the server where the POST message was sent in a "wide" status-bar at the bottom of the screen
Thanks for all suggestions,
Alec Taylor
BTW: I will open-source this project when it's Beta ready
Marcel Klehr
unread,
Nov 18, 2012, 5:52:57 AM11/18/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to etherpad...@googlegroups.com
Hey Alec,
afaik it's rather difficult to get the pad contents directly out of the client-side editor. It is possible to retrieve the current pad contents through our (not yet RESTful...) HTTP API, though. Have a look at http://etherpad.org/doc/v1.2.0/#index_http_api for a list of all supported endpoints and a quick introduction on how to use the API. In order to display something om the screen you can just use some jquery and css. You'd want to write all this as a plugin, of course. Insert css <link>s and a toolbar button using an eejs Block hook for the 'styles' block and the 'editbarMenuLeft' / 'editbarMenuRight' blocks respectively. The documentReady hook will call you once the document is ready... ;)
good luck! marcel
John McLear
unread,
Nov 18, 2012, 1:15:11 PM11/18/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to etherpad...@googlegroups.com
var url = document.href + "/export/txt";
$.get(url, function(data) {
alert(data);
});
Marcel is right, make sure you right it as a plugin and try to use git
so we can review the code and suggest improvements.