Skip to content

Instantly share code, notes, and snippets.

@Petah
Last active December 14, 2015 06:28
Show Gist options
  • Save Petah/5042409 to your computer and use it in GitHub Desktop.
Save Petah/5042409 to your computer and use it in GitHub Desktop.
<div class="raptor-editable" data-id="main-content">
<p>
Raptor may be integrated into a site many ways.
This article aims to cover the simplest integration possible.
</p>
</div>
<script>
$(function() {
$('.raptor-editable').raptor({
plugins: {
// Define which save plugin to use. May be saveJson or saveRest
save: {
plugin: 'saveJson'
},
// Provide options for the saveJson plugin
saveJson: {
// The URL to which Raptor data will be POSTed
url: '/save.php',
// The parameter name for the posted data
postName: 'raptor-content',
// A string or function that returns the identifier for the Raptor instance being saved
id: function() {
return this.raptor.getElement().data('id');
}
}
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment