Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Components for integrating the Wurd CMS in a React app

License

NotificationsYou must be signed in to change notification settings

wurdcms/wurd-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wurd is a service that lets you integrate a CMS into any website or app in minutes. This module provides components for integrating content and inline editing into your React app as easily as possible.

Example

importwurdfrom'wurd-react';import{marked}from'marked';wurd.connect('my-app',{editMode:true,markdown:marked,// Optional for enabling markdown() mode});wurd.load('shared,homepage').then(content=>{//Access content via gettersdocument.title=content.text('homepage.title');//Use blocks for accessing subsections of contentconstpage=content.block('homepage');ReactDOM.render(<div><h1><content.Textid="shared.company"/></h1><h2><page.Textid="title"/></h2><page.Imageid="hero.image"width="300"/><page.Textid="hero.title"/></div>,document.getElementById('root'));});

See more in theexamples folder or run them withnpm run example.

Installation

Using NPM:

npm install wurd-react

Usage

  1. Create a Wurd account and app
  2. Connect to a Wurd app withwurd.connect('appName', {editMode: true})
  3. Load top level 'sections' of content you'll be using withwurd.load('section')
  4. In your views/templates etc., use the provided components to integrate content and editing functionality:<WurdText/>

Components

Text

Creates an editable text region.

WurdText example

<content.Textid="title",// Required  type="h1",          // Defaults to `span`  vars={{name:'John'}},// Replaces mustache style tokens (e.g. `{{name}}`) with the given data  // Other standard props (className, style etc.) can be passed too/>

Image

Creates an editable image (<img>).

WurdImage example

<content.Imageid="hero.image",//Required  // Other standard props (className, style etc.) can be passed too/>

Markdown

Creates an editable text region that displays formatted Markdown.

NOTE: This uses dangerouslySetInnerHTML,read up on it here.

WurdMarkdown example

<content.Markdownid="home.intro",// Requiredtype="div",// Defaults to `div`  vars={{name:'John'}},// Replaces mustache style tokens (e.g. `{{name}}`) with the given data  // Other standard props (className, style etc.) can be passed too/>

List

Creates an editable list of content. The children passed will represent an item in the list.

<content.Listid="team.members"//Requiredkeys="name"//At least 1 property of the list item>{item=><likey={item.id()}><item.Imageid="pic"width="50"/><item.Textid="name"/></li>}</content.List>

Object

Allows editing a section of content, (like the properties of an object).

This editor is useful for:

  • Off-page content such as metadata
  • The content of complex page elements such as dropdowns, modals and popovers
  • Editing many properties at once
<content.Objectid="meta"keys="title,description"// Required; will define with items can be editedtype="span"// Defaults to `div`  // Other standard props (className, style etc.) can be passed too/>

About

Components for integrating the Wurd CMS in a React app

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp