shortlist-digital/acf-strict-wysiwyg

A stricter wysiwyg field for Advanced Custom Fields. In line with modern content strategy. Only semantic intent should be saved in a CMS. This only allows an editor to input HTML that can be converted to Markdown

This package's canonical repository appears to be gone and the package has been frozen as a result.

Installs: 5 775

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 0

Language:JavaScript

Type:wordpress-plugin

2.1.0 2018-02-08 17:05 UTC

README

An ACF Field type plugin for a stricter wysiwyg field.

TinyMCE allows for too much freedom in a paragraph tag. For the sake of futureproofing content and data safety, we only want to allow a small subset of formatting options. Specifically, all of those formatting options should be convertable to Markdown.

Local development

npm run watch-js to build the javascript from the ./src folder

Example ACF config

  array (
      'key' => 'widget_heading_text',
      'label' => 'Text',
      'name' => 'text',
      'type' => 'strict_wysiwyg',
      'simplify' => true,
      'no_return' => true,
      'required' => 1,
      'conditional_logic' => 0,
  ),

Simplify

Adding 'simplify' => true will reduce the toolbar to bold, italic and Hyperlink

No Return

Adding 'no_return' -> true will prevent the user from hitting the enter/return key to create a new paragraph. It will also stop the value returned from being wrapped in <p> tags.