Skip to content

Commit 8b43422

Browse files
committed
Update README for V2.0 features
1 parent c21db8e commit 8b43422

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,29 @@ window.addEventListener(
205205

206206
Another part of the above-mentioned communication protocol enables the editors to click properties within the preview to edit them.
207207

208-
To implement this, first add `umb-preview-edit='[property alias]'` attributes to the preview rendering for the relevant document properties - for example:
208+
To implement this, first add `umb-preview-edit='[options]'` attributes to the preview rendering for the relevant document properties. The attribute value is expected to follow the pattern `PropertyAlias[:EditMode[:ModalSize]]`, where:
209+
210+
- `PropertyAlias` (required): The Umbraco alias of the property to edit.
211+
- `EditMode` (optional): How the property should be edited:
212+
- `default` brings the editors back to the Umbraco "Content" view.
213+
- `modal` opens the property for editing in a modal overlay.
214+
- `ModalSize` (optional): If `EditMode` is `modal`, this controls the size of the modal.
215+
- Applicable modal sizes are `small`, `medium`, `large` and `full`. Default is `large`.
216+
217+
218+
For example:
209219

210220
```tsx
211221
export default function PostHeader({ title, coverImage, date, author }: Props) {
212222
return (
213223
<>
214224
<PostTitle>{title}</PostTitle>
225+
{/* edit the 'author' property in the Umbraco "Content" view */}
215226
<div className="hidden md:block md:mb-12" umb-preview-edit="author">
216227
<Avatar author={author}/>
217228
</div>
218-
<div className="mb-8 md:mb-16 sm:mx-0" umb-preview-edit="coverImage">
229+
{/* edit the 'coverImage' property in a medium sized modal overlay */}
230+
<div className="mb-8 md:mb-16 sm:mx-0" umb-preview-edit="coverImage:modal:medium">
219231
<CoverImage title={title} coverImage={coverImage}/>
220232
</div>
221233
<div className="max-w-2xl mx-auto">
@@ -283,7 +295,7 @@ window.onload = () => {
283295
> [!IMPORTANT]
284296
> Notice the overlap with the previous example script. A combined script can be found [right here](https://github.com/kjac/Kjac.HeadlessPreview/blob/main/src/Kjac.HeadlessPreview.Site/wwwroot/scripts/umb.preview.js).
285297
286-
The result is a hover effect around the editable properties. When they're clicked, the editor is sent to the "Content" view:
298+
The result is a hover effect around the editable properties. When they're clicked, the editor is either sent to the Umbraco "Content" view, or a modal overlay opens up for editing the property:
287299

288300
!["Click to edit" example](docs/click-to-edit.png)
289301

@@ -296,11 +308,17 @@ For your viewing pleasure, here's a screencast that shows it all in action 😉
296308

297309
## Known limitations
298310

299-
### Segment support is missing
311+
### Certain property editors vs. modal editing
312+
313+
For some property editors, the modal overlay editing just does not work. The Tags property editor is one, there might be others.
314+
315+
If all things fail, revert to using the `default` editing mode.
316+
317+
### Segment support is untested
300318

301-
At this point, the Umbraco UI does not support segments, which means this package can't support them either.
319+
The V16 UI brought back segment support. At this point, segments are still largely untested with this package.
302320

303-
The package is prepared for segments, so theoretically, segmented preview should start working when segments become part of the UI - time will tell 🤞
321+
It should work, though - let me know if you run into problems with segments.
304322

305323
### Collections
306324

0 commit comments

Comments
 (0)