Skip to content

Instantly share code, notes, and snippets.

@jules0x
Last active March 1, 2020 22:58
Show Gist options
  • Save jules0x/f3fd70c8811a47452430 to your computer and use it in GitHub Desktop.
Save jules0x/f3fd70c8811a47452430 to your computer and use it in GitHub Desktop.
# TinyMCE custom classes ### Apply custom classes to html elements via a dropdown
<?
$htmlEditorConfig = HtmlEditorConfig::get('cms');
// Add half' and 'third' wrappers to tinyMCE (will appear in styles drop-down).
$htmlEditorConfig->setOption('style_formats', [
[
'title' => 'Half (md)',
'block' => 'div',
'wrapper' => true,
'classes' => 'pure-u-md-6',
'merge_siblings' => false
],
[
'title' => 'Third (md)',
'block' => 'div',
'wrapper' => true,
'classes' => 'pure-u-md-4',
'merge_siblings' => false
]
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment