D
D
Dmitry Kim2016-06-22 09:38:06
Yii
Dmitry Kim, 2016-06-22 09:38:06

How to save styles in windowManager dialog in TinyMCE?

I want to upload images directly to TinyMCE. Those. pressed a button in the editor, a dialog box appears, you press another button in it, select an image from your computer, press upload, the image is sent to the server, it is compressed as it should be, stored in storage and its local (relative to the site) address is returned, which can be safely inserted to the editor.
I use YII2, for loading we take BootstrapFileInput from Krajee.
Here is an example: plugins.krajee.com/file-basic-usage-demo#basic-exa... .
I create a button in TinyMCE:

setup: function (editor) {
  editor.addButton('mybutton', {
    text:     'My button',
    icon:     false,
    onclick:  function () {
      editor.windowManager.open({
        title:  'Loading image',
        html:   '<input id="file-loader" type="file" class="file" name="UploadForm[image][]">',
      });
      $('#file-loader').fileinput();
    }
  });
}

Everything works, but styles fly off.
It is expected that the loading window will look like this:
1f9f5ab4e6bb4348a3e676a639f6c83d.png
In fact, it looks like this:
9ac659c3894f4842921ea13efa942824.png
Everything happens due to the fact that for mce-container * {}TinyMCE it applies the following styles:
f28fd67454e14158943afbf68b4348c4.png
And if you change the window class from mce-containerto mce-container2, for example, in the browser, then we get this picture:
05180d8dee034d09b5a8649e6f77098c.png
Also a wadded version . Are there any solutions to paste the normal code into the dialog box while keeping the styles?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-06-23
@webinar

It is necessary that krajee is connected after the editor. Write the css loader dependency on the css editor in assets

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question