Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Blueprint type:editor not displaying code/preview buttons

Started by Muut Archive 9 years ago · 2 replies · 478 views
9 years ago

I'm working on a simple custom form and using a field of type:editor to provide rich content to the page.

Unfortunately the editor that is generated doesn't show the code/preview buttons we can see in the default blueprint (top right corner).

Is there a way to have them show up?

Sample of my blueprint file:

YAML

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab
          title: Content

          fields:
            content:
              type: editor 
---
9 years ago

Try

YAML
form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab
          title: Content

          fields:
            content:
              type: editor
              codemirror:
                'ignore': ['code']

Explanation: by default the editor ignores the ['code', 'preview'], which removes the code and the preview functionality. You re-set that property to just include ['code'], which will just remove the code button.

9 years ago

Awesome, it works!
This would be a nice addition to the docs!

It's worth noting since the preview button is a toggle for the code button, you should either keep none or both, other wise the functionality is broken (no way to go back to code):

YAML
codemirror:
  ignore: []

Thank you!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1329 9 years ago
Archive · by Muut Archive, 9 years ago
2 922 9 years ago
Archive · by Muut Archive, 9 years ago
2 4051 9 years ago
Archive · by Muut Archive, 9 years ago
1 2930 9 years ago
Archive · by Muut Archive, 9 years ago
3 1108 9 years ago