Editable with SimpleMDE Plugin
Important: The plugin requires Markdown page content that is transfered by Grav straight from a normal Grav page and presents it in a Markdown editor to be saved back to the page when editing is finished.
Typically the plugin should be installed via GPM (Grav Package Manager):
$ bin/gpm install editable-simplemde
Or, when using the Admin plugin the plugin can be added from the Plugins section. Look for "Editable With SimpleMDE".
Another option is to manualy install the plugin by downloading the plugin as a zip file. Copy the zip file to your /user/plugins directory, unzip it there and rename the folder to editable-simplemde.
Before configuring this plugin, you should copy the
Make configuration changes to that copy so your changes will remain when installing a new version of the plugin.
Here is the default configuration and an explanation of available options:
true enables or activates the plugin.
To enable users to edit content in the frontend they must be able to login.
To edit a page a frontend user must have the permission
site.editable. Add the required authorization to each user in the user's account file:
access: site: login: 'true' editable: 'true'
By default Grav separates backend (Admin) and frontend users into separate sessions.
Allowing backend users to edit pages in the frontend requires the Grav option
session.split to be set to
system.yaml or in the Admin panel).
A backend or Admin user must have the permission
admin.pages to be allowed to edit a page.
Enabling page editing
To make a single page editable add these lines to the page header or frontmatter:
editable-simplemde: self: true
In case all pages need to be made editable make the setting site wide by adding
self: true to the plugin configuration file
enabled: true self: true
When using the site wide option then to exclude a page from being editable set
false in that page's frontmatter:
editable-simplemde: self: false
A page can be made editable by one or more users or groups. To learn about users, groups and permissions see the documentation on Groups and Permissions, the Login Plugin and Standard Administration Panel Plugin.
Given this page's frontmatter:
editable-simplemde: self: true editable_by: - brigitte - tom - users: - frank - jane - groups: - editors - trinity
and assuming user permissions are set right, only the named users plus the users belonging to the group "editors" are allowed to edit that page.
Images and files that are uploaded are saved in the same folder as the corresponding page.
Note: Uploaded images and files that are no longer referenced in the page markdown content are automatically deleted when the page is saved.
Thanks go to Team Grav and everyone on the Grav Forum for creating and supporting Grav.
Notes, Issues and To Do's
- Make the editor toolbar sticky so it stays in view when editing longer texts. See this Proof of Concept but help is required to make it work with Grav!
- Navigating away from a page with yet unsaved changes is not handled properly for all browsers.