1

I'm working on a desktop app and I'd like to show only the editor and it's toolbar.

I'm able to load and save the past content easily enough through the app but I'd like to be able to reuse the editor. When I say editor I mean when you edit a post and you can use the visual or text editor, set bold or normal font weight, add and remove images, etc but nothing else. No other buttons like update or save, just only the editor.

Is there an existing page I can go to show just the editor or code I can write to create just the editor? I hope so, then I can just JavaScript to get and set the raw HTML.

  • 2
    There's wp_editor() you can use and search for its settings to disable visual (TINYMCE).. As for updating you might need to look at wp_update_post() – Samuel Elh Jun 23 '16 at 6:54
1

You say, that you will not see Update, save areas.

Meta Boxes

This is the functionalities inside a additional meta box. Each meta box can you remove, so that you only see the area with the editor, there have the possibility visual or text. Read about the function remove_meta_box( $id, $page, $context ) for remove the not required meta boxes.

Default mode

You can also set this to a default value, like the follow example to set the visual mode.

add_filter( 'wp_default_editor', create_function( '', 'return "tinymce";' ) );

That works also for the value html to see only the text mode. The codex has more content about this. I use this in a plugin to remove unnecessary areas, items from the admin area, see the source, if it helps.

User settings

You should also check this question, see the hint for user settings, that the right mode is sure active. The help of a small JavaScript is helpful.

<script>
if (getUserSetting('editor') != "tinymce") {
    setUserSetting('editor', 'tinymce');
    location.reload();
}
</script>

Buttons

Visual Mode

If you will remove buttons inside the visual editor, use the core function wp_editor() like:

wp_editor( '', 'some-id', array( 'quicktags' => FALSE ) );

Text mode

To remove quicktags is not hook inside the core, not so easy. But you can see this solution in a plugin, thats have a UI and function to remove core quicktags. In short, you must fire on the hook quicktags_settings and unset the not necessary buttons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.