symbiote/silverstripe-prose-editor

A wysiwyg editor based on prose editor

Installs: 74

Dependents: 0

Suggesters: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 5

Language:JavaScript

Type:silverstripe-vendormodule


README

Latest Stable Version Latest Unstable Version Total Downloads License

Provides a wysiwyg editor for HTMLText content fields.

Combined with the frontend authoring module, provides in-place page editing capability

Composer Install

composer require symbiote/silverstripe-prose-editor:~1.0

Requirements

  • SilverStripe 4.1+

Quick Start

Create and use ProseEditorField where you would otherwise use HtmlEditorField

Documentation

  • Markdown-like shortcuts for formatting and creating lists, eg strike, bold, inline code
  • Table editing
  • Image paste and upload,
  • Insert images from the CMS
  • Insert page links from the CMS
  • Creating new pages using square brackets/round brackets, [{page name}]({url-segment}]. You can leave url-segment empty, and one will be automatically created (requires the frontend-authoring module)

Shortcodes

Add the following to your _config.php if you'd like some additional shortcodes made available

ShortcodeParser::get('default')->register('show_field', array(ProseShortcodes::class, 'show_field_shortcode'));
ShortcodeParser::get('default')->register('listing', array(ProseShortcodes::class, 'listing_content'));
ShortcodeParser::get('default')->register('workflow_tasks', array(ProseShortcodes::class, 'workflow_tasks'));
ShortcodeParser::get('default')->register('random_item', array(ProseShortcodes::class, 'random_item'));
ShortcodeParser::get('default')->register('userform', array(ProseShortcodes::class, 'userform'));
  • show_field(field, args) : Displays a field from the 'context' object, typically the currently viewed page.
    • field: The field to display; can be in dotted notation for relationship traversal, ie Team.Title
    • args: Comma separated list of arguments to pass when resolving the value
  • listing(page_id, source_id) : Requires the ListingPage module, lists out content
    • page_id: The listing page to render
    • source_id: The source of the listing. Pass in 'me' to refer to the current page
  • workflow_tasks: Lists out the current user's workflow tasks
  • random_item: Gets a random page from the last 50 edited pages
  • userform(form_id): Display the content of the userform from ID form_id

Quick Start

Where you'd normally use an HTMLEditorField, use ProseEditorField instead.

Usage

To enable or disable menu items, use disableMenuItem($name) and the correlation enableMenuItem. Menu items available are

insertlink
insertimage
bulletlist
orderedlist
quote
paragraph
pre
hr
table
shortcode
viewsource

You can also toggle inserting internal CMS links using disableSetting('linkSelector', 'internal')