You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-23Lines changed: 33 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,9 @@
3
3
Editmode allows you to turn plain text in your React app into easily inline-editable bits of content that can be managed by anyone with no technical knowledge.
4
4
5
5
## Installation
6
+
6
7
Use npm to install Editmode:
8
+
7
9
```
8
10
npm install editmode-react
9
11
```
@@ -12,40 +14,46 @@ npm install editmode-react
12
14
13
15
### Step 1:
14
16
15
-
Within your React app, navigate to the index file within your src directory.
16
-
Import the Editmode wrapper and wrap your App within.
17
+
Within your React app, navigate to the index file within your src directory.
18
+
Import the Editmode wrapper and wrap your App within.
If you have already created the chunk you would like to render on the Editmode CMS, you can simply pass the identifier as a prop and begin editing.
40
+
If you have already created the chunk you would like to render on the Editmode CMS, you can simply pass the identifier as a prop and begin editing.
37
41
You can provide default content as a fallback should anything go wrong trying to retrieve the data from the API:
38
42
39
-
```
43
+
```js
40
44
import { Chunk } from"editmode-react";
41
45
42
46
functionExample() {
43
-
return (
44
-
<div>
45
-
<p> <Chunk identifier="cnk_123"/> </p>
46
-
<p> <Chunk identifier="cnk_321"> I have default content </Chunk> </p>
47
-
</div>
48
-
);
47
+
return (
48
+
<div>
49
+
<p>
50
+
<Chunk identifier="cnk_123"/>
51
+
</p>
52
+
<p>
53
+
<Chunk identifier="cnk_321">I have default content </Chunk>
54
+
</p>
55
+
</div>
56
+
);
49
57
}
50
58
```
51
59
@@ -56,23 +64,24 @@ Alternatively, if you are using one of our **text editor plugins** and would lik
56
64
Chunk collections are simply a way to categorise chunks and can be used to render repeatable content.
57
65
Each collection can contain many properties and each property can hold different types of information.
58
66
59
-
A good use case example would be creating a "Team Member" collection. It may have `Full Name`, `Title` and `Headshot` properties. Within your React app, you may want to display the name, title and headshot of all your team members (ie all chunks within the Team Member collection). You can do this by passing the chunk collection identifier as a prop to the ChunkCollection component. To render the name, title and headshot for each team member, pass the identifiers for each property as a prop to the ChunkProperty component:
67
+
A good use case example would be creating a "Team Member" collection. It may have `Full Name`, `Title` and `Headshot` properties. Within your React app, you may want to display the name, title and headshot of all your team members (ie all chunks within the Team Member collection). You can do this by passing the chunk collection identifier as a prop to the ChunkCollection component. To render the name, title and headshot for each team member, pass the identifiers for each property as a prop to the ChunkFieldValue component:
60
68
61
-
```
62
-
import { ChunkCollection, ChunkProperty } from "editmode-react";
This will render editable headings containing the name and title and an image containing the headshot for every person in the "Team Member" collection.
77
86
78
87
### Step 3:
@@ -94,6 +103,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
94
103
95
104
<!-- markdownlint-enable -->
96
105
<!-- prettier-ignore-end -->
106
+
97
107
<!-- ALL-CONTRIBUTORS-LIST:END -->
98
108
99
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
109
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
0 commit comments