Editor Field Type 2.2

Ryan Thompson Releases


We've drastically improved the Editor field type! Let's take a look at what's different:

TLDR

  • Swapped out the Ace in favor of CodeMirror.
  • Fixed support for repeater/grid field types.
  • Added a nice set of developer tools like Emmet.

Editor Field Type 2 2 Multi Cursor

Updating

Simply bump your composer.json to require "anomaly/editor-field_type": "~2.2.0". You will want to run php artisan asset:clear and php artisan twig:clean as well after updating.

This is a backwards compatible update all config options are the same.

CodeMirror

The Ace editor plugin used in v2.1 was starting to show some signs of age and fatness. It required pulling teeth to support repeater and grid field types and any other ajax loaded content containing ajax. It's developed strange behavior with the cursor jumping around.. Just losing it's luster.

So we swapped out Ace in favor of the latest CodeMirror and it's back to business.

Grid and Repeater Support

Ace was really having issues when loaded in by an Ajax script. Ace required that the receiving page have knowledge that Ace was going to be used because the way it loaded required it to ONLY be loaded / attempted once. So the Grid / Repeater field types required a hack to detect ace and protect subsequent loads of Ace: https://github.com/anomalylabs/repeater-field_type/blob/1.2/resources/js/input.js#L244-L261

Pyro's abstracted API and addon-based design meant this was a big red flag due to coupling.

Developer Tools

We've got a lot stronger set of tools like key mapping (Sublime/Vim keymap included), code automation (Emmet), and multi-cursor support. This will make working within the editor less awful as we're all used to our respective IDEs with their fancy features.

Check it out and if you have any experience with CodeMirror help us improve the field type even more! 2.2 will be included by default in the upcoming Pyro 3.4.

- Ryan


No Comments


Leave a Comment