Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 2.72 KB

TinyMCE.md

File metadata and controls

67 lines (50 loc) · 2.72 KB

TinyMCE Visual Editor Integration

Frontend

Please remember that the frontend editor usage is restricted to logged-in users with editing capabilities for post+pages (admin+manager) by default - to change that behaviour you can simply use the filter hook enlighter_frontend_editing

Automatic Integration

The automatic integration requires the following conditions:

  1. Enabled frontend integration flag (Settings -> Editing -> TinyMCE -> Frontend Integration)
  2. The editor has to be added via the standard wp_editor function
  3. The first toolbar is not overridden with custom settings
  4. Frontend editing is limited to users with the standard WordPress permissions edit_post or edit_pages. You can change this security condition by invoking the filter enlighter_frontend_editing

bbPress Integration

see bbPress

Manual Integration

In case your plugins doesn't fulfill all previous mentioned requirements it is also possible to add the EnlighterJS editor plugin manually - this required advanced knowledge in php and javascript!

The editor plugin has its own repository on GitHub

Javascript initialization Examples

Dependencies

The plugin dependencies have to be available on your website. In case you're already using the Enlighter plugin they are located in wp-content/plugins/enlighter/resources/tinymce

Direct initialization via tinymce

 // initialize TinyMCE
tinymce.init({
    // paste plugin is required to strip pasted wysiwyg content (drop formats!)
    plugins: 'paste',
    external_plugins: {
        'enlighterjs': '/wp-content/plugins/enlighter/resources/tinymce/enlighterjs.tinymce.min.js'
    },
    content_css: "/wp-content/plugins/enlighter/resources/tinymce/enlighterjs.tinymce.min.css",
    selector: '#editor1',
    menubar: false,
    height: 1200,
    toolbar: 'styleselect | bold italic | link image | pastetext | EnlighterInsert EnlighterEdit'
});

Indirect initialization via wp.editor

 // initialize TinyMCE
wp.editor.initialize('editor1', {
    'tinymce': {
        // paste plugin is required to strip pasted wysiwyg content (drop formats!)
        plugins: 'paste',
        external_plugins: {
            'enlighterjs': '/wp-content/plugins/enlighter/resources/tinymce/enlighterjs.tinymce.min.js'
        },
        content_css: "/wp-content/plugins/enlighter/resources/tinymce/enlighterjs.tinymce.min.css",
        toolbar: 'styleselect | bold italic | link image | pastetext | EnlighterInsert EnlighterEdit'
    }
});