Skip to content

Commit 587b55e

Browse files
author
Sean King
committed
Add API references doc
1 parent 9a18cca commit 587b55e

3 files changed

Lines changed: 49 additions & 24 deletions

File tree

API.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# API Reference
2+
3+
Simpla-admin attaches itself to `window` as a global singleton, you can access it from `window.SimplaAdmin`.
4+
5+
## Properties
6+
7+
Custom properties of `<simpla-admin>`, available on the `window.SimplaAdmin` singleton
8+
9+
Property | Type | Default | Description
10+
---------------- | --------- | ------- | -----------
11+
`hashTracking` | `Boolean` | `true` | Whether to bind edit mode to `#edit` in the URL
12+
`loginPrompt` | `Boolean` | `true` | Whether to visually prompt for login if the user is not authenticated
13+
`hotkeys` | `Boolean` | `true` | Whether to enable keyboard shortcuts for common actions
14+
`protectEditing` | `Boolean` | `true` | Whether to enable accidental click protection while editing
15+
16+
```js
17+
window.SimplaAdmin = window.SimplaAdmin || {};
18+
SimplaAdmin.hashTracking = false;
19+
```

README.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
# Simpla Admin
22
[![Build status][travis-badge]][travis-url] ![Size][size-badge] ![Version][bower-badge] [![Published][webcomponents-badge]][webcomponents-url] [![Simpla slack group][slack-badge]][slack-url]
33

4-
Simpla-admin is a lightweight, beautiful admin component for the [Simpla](https://www.simpla.io) content system. It provides everything you need to manage a Simpla app (login prompts, edit mode management, save controls, notifications, keyboard shortcuts) while remaining unobtrusive and minimal.
4+
Simpla-admin is a lightweight, beautiful admin component for the [Simpla][simpla] content system. It provides everything you need to manage a Simpla app (login prompts, edit mode management, save controls, notifications, keyboard shortcuts) while remaining unobtrusive and minimal.
5+
6+
### Contents
7+
8+
- [Installation and setup](#installation-and-setup)
9+
- [Hashtracking](#hashtracking)
10+
- [Login prompts](#login-prompts)
11+
- [Hotkeys](#hotkeys)
12+
- [Accidental click protection](#accidental-click-protection)
13+
- [Notifications](#notifications)
14+
- [Contributing](#contributing)
15+
16+
### Resources
17+
18+
- [API reference][api]
19+
- [Demo][demo]
20+
- [License][license]
521

622
## Installation and setup
723

@@ -11,7 +27,7 @@ Install simpla-admin with Bower (Yarn support coming soon)
1127
$ bower i simpla-admin --save
1228
```
1329

14-
[Setup Simpla](https://www.simpla.io/docs/guides/get-started) on your page, then import simpla-admin into your `<head>`. It will automatically attach and load itself as a singleton when Simpla enters edit mode.
30+
[Setup Simpla][simpla-setup] on your page, then import simpla-admin into your `<head>`. It will automatically attach and load itself as a singleton when Simpla enters edit mode.
1531

1632
```html
1733
<link rel="import" href="/bower_components/simpla-admin/simpla-admin.html" async>
@@ -82,34 +98,21 @@ var notification = new CustomEvent('simpla-notification', {
8298

8399
window.dispatchEvent(notification);
84100
```
85-
86-
## API reference
87-
88-
Simpla-admin attaches itself to `window` as a global singleton, you can access it from `window.SimplaAdmin`.
89-
90-
### Properties
91-
92-
Property | Type | Default | Description
93-
---------------- | ------- | ------- | -----------
94-
`hashTracking` | Boolean | `true` | Whether to bind edit mode to `#edit` in the URL
95-
`loginPrompt` | Boolean | `true` | Whether to visually prompt for login if the user is not authenticated
96-
`hotkeys` | Boolean | `true` | Whether to enable keyboard shortcuts for common actions
97-
`protectEditing` | Boolean | `true` | Whether to enable accidental click protection while editing
98-
99-
Set properties on `window.SimplaAdmin` directly
100-
101-
```js
102-
window.SimplaAdmin = window.SimplaAdmin || {};
103-
SimplaAdmin.hashTracking = false;
104-
```
105101

106102
## Contributing
107103

108-
If you find any issues with simpla-admin please report them! If you'd like to see a new feature in supported file an issue or let us know in Simpla's public [Slack group](https://slack.simpla.io). We also happily accept PRs.
104+
If you find any issues with simpla-admin please report them! If you'd like to see a new feature supported file an issue or let us know in Simpla's public [Slack group][slack-url]. We also happily accept PRs.
109105

110106
***
111107

112-
MIT © [Simpla](https://www.simpla.io)
108+
MIT © [Simpla][simpla]
109+
110+
[api]: https://www.webcomponents.org/element/SimplaElements/simpla-admin/page/API.md
111+
[demo]: https://www.webcomponents.org/element/SimplaElements/simpla-admin/demo/demo/index.html
112+
[license]: https://github.com/SimplaElements/simpla-admin/blob/master/LICENSE
113+
114+
[simpla]: https://www.simpla.io
115+
[simpla-setup]: https://www.simpla.io/docs/guides/get-started
113116

114117
[bower-badge]: https://img.shields.io/bower/v/simpla-admin.svg
115118
[travis-badge]: https://img.shields.io/travis/SimplaElements/simpla-admin.svg

bower.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"demos": {
2020
"Demo": "demo/index.html"
2121
},
22+
"pages": {
23+
"API Reference": "API.md"
24+
},
2225
"ignore": [
2326
"*",
2427
"!*.html",

0 commit comments

Comments
 (0)