Hello to all! Has anyone worked with TinyMCE, but with JWPlayer? Since this topic is just for those who dealt with these two javascript tools! So let's start, there is a JWPlayer video player and to put a video on the page, you need to paste this code here:

<div id="mediaplayer">Видео будет здесь</div> <script type="text/javascript" src="jwplayer.js"></script> <script type="text/javascript"> jwplayer("mediaplayer").setup({ flashplayer: "player.swf", file: "video.mp4", image: "preview.jpg" }); </script> 

And here I thought, I will not speak to the client, in order to put the video, you need to insert such code on the page)) that is, in TinyMCE [HTML]. You need to do this in TinyMCE, so that there is a button to add a video and when you click on it, the modal window of the TinyMCE editor itself appears and there will be a URL field to the video in it. And when adding a video, TinyMCE (editor) will create such a script and paste it into HTML (into the editor). If anyone knows the implementation, tell me how to do this?

    2 answers 2

    Write a simple plugin:

     (function (tiny) { tiny.PluginManager.add("jwplayer", function (editor, url) { function showDialog() { editor.windowManager.open({ title: 'jwplayer video', file: url + "/jwplayer.html", width: 800, height: 530, inline: 1, resizable: true, maximizable: true }); } editor.addButton("jwplayer", { icon: true, image: url + "/img/jwplayer.gif", tooltip: 'тултип кнопки', onclick: showDialog, onPostRender: function () { var self = this; editor.on("NodeChange", function (e) { self.active(e.element.nodeName === "IMG"); }); } }); }); }(tinymce)); 

    Full example: https://github.com/gtraxx/tinymce-plugin-youtube

      You need to see examples of creating plugins on the TinyMCE website.