If you wish to provide your own custom templates you can use the templateServiceUrl
startup parameter. This parameter defines a base url for a
REST based service that
conforms to the specifications described in this document. You will have to create this REST service using
the server side technology of your choice. Please refer to the documentation provided by your server
side technology on how to accomplish this.
Keep in mind that if you do not wish to provide custom templates simply omit the
templateServiceUrl
parameter from the startup method
and the default set of template groups will be provided by the server.
There are four REST end points you are required to implement.
editor = new ESDWeb(null, 'editorNode'); /* set other properties here */ editor.startup({ /* other parameters */, templateServiceUrl: "http://www.example.com/REST" });
You are required to implement the following REST end points. Each will return a JSON string in the specified format.
Returns a list of all template groups.
<template service URL>/groups
The result will be a JSON string in the following format:
[ "group name one", "group name two, ... ]
Returns info on all the templates in the group with name <group name>
<group name>
is a parameter that will be one of the strings returned by the call to
"Get Groups".
<template service URL>/group/<group name>
The result will be a JSON string in the following format:
[ { "id": <template ID>, "name": "<template name>", "description": "<template description>" }, ... ]
Returns info on templates in the group with name <group name>
that match the
query <query>
.
<template service URL>/group/<group name>?s=<query>
The result will be a JSON string in the following format:
[ { "id": <template ID>, "name": "<template name>", "description": "<template description>" }, ... ]
Returns the SVG of the template with <template id> as a string.
<template service URL>/template/<template id>
You may need to configure a MIME type to deliver the template library JSON:
For information on MIME type configuration please refer to the documentation for your web server.