Tinymce Windowmanager.open() Parameters

Tags: tinymce

I use wordpress and currently writing a plugin for the tinymce-editor. I use the windowmanager.open() function to show a modal, but I dont know how to hide the ok button in this modal. The official documentation is very slim: https://www.tinymce.com/docs/api/tinymce/tinymce.windowmanager/#open


I assume you are creating the modal as per the documentation link you provide, if so, then the buttons parameter let you specify the buttons to add to the modal and the actions of said buttons, like this:

  url: 'file.htm',
  buttons: [{ 
      text: 'Accept',
      subtype: 'primary',
      onclick: 'submit'
      text: 'Custom',
      onclick: function(){
        //Add custom action here
      text: 'Close',
      onclick: 'close'
  width: 320,
  height: 240
}, {
  custom_param: 1

passing an empty buttons parameter gives no buttons in the modal, the 'submit' and 'close' strings in onclick button's parameter make the buttons perform those actions, you can add custom logic by defining an anonymous function instead, you can also add custom logic to the 'submit' action by adding the onsubmit parameter, like this:

onsubmit: function() {
  //custom logic

Tinymce documentation is not much help, I've been researching something similar this past days, these links might be useful for you: https://www.tinymce.com/docs/api/tinymce/tinymce.plugin/ https://docs.contenido.org/display/CONDEVE/TinyMCE+4#TinyMCE4-Writingownplugins

You can debug your mongo queries in multiple ways.

Start with your index usage using below command :
db.images.aggregate( [ { $indexStats: { } } ] )

If this don't give you any useful information, then check the execution plan of the slow queries using : db.setProfilingLevel(2)

db.system.profile will give you complete profile of your queries.

C++11 solution:

#include <type_traits>

template<typename From, typename To>
To map(From e) {
    return static_cast<To>(
        static_cast<typename std::underlying_type<To>::type>(
        static_cast<typename std::underlying_type<From>::type>(e)));

This casting cascade is very explicit and supports enum classes.

For older C++ versions and for enums without class, static_cast<Enum2>(e) would suffice.


With template specialization, you can use map without specifying any types explicitly:

enum class Enum1: int {A, B, C, D};
enum class Enum2: char {A1, B1, C1, D1};

template<typename T>
struct target_enum {

struct target_enum<Enum1> {
    typedef Enum2 type;

template<typename From>
typename target_enum<From>::type map(From e) {
    typedef typename target_enum<From>::type To;
    return static_cast<To>(
        static_cast<typename std::underlying_type<To>::type>(
        static_cast<typename std::underlying_type<From>::type>(e)));

You can then call map(Enum1::A). Also works with simple, non-class enums.

By : flyx

This video can help you solving your question :)
By: admin