This is a migrated thread and some comments may be shown as answers.

Embedding video in html editor from image browser

4 Answers 191 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Enrico
Top achievements
Rank 1
Enrico asked on 15 Aug 2018, 03:42 AM

Hi, I was able to embed video using my own template and on change event under image browser.

                            change: function () {
                                var editor = $('#editor').data("kendoEditor");
                                var template = kendo.template($("#video-template").html());
                                var filename = $(".k-imagebrowser").find(".k-state-selected").children("strong").text();
                                var range = editor.getRange();
                                editor.selectRange(range);
                                editor.exec("insertHtml", { value: template({ source: $(".k-imagebrowser").data("kendoImageBrowser").dataSource.data()[0].blob + '/' + filename })});

                            }

 

but after the insert button click, it clears any content inside the editor.

 

4 Answers, 1 is accepted

Sort by
0
Enrico
Top achievements
Rank 1
answered on 15 Aug 2018, 04:17 AM

got a solution to my problem.

 

            $(document).on("click",".k-dialog-insert", function (e) {
                var editor = $('#editor').data("kendoEditor");
                var template = kendo.template($("#video-template").html());
                var range = editor.getRange();
                editor.selectRange(range);
                editor.exec("insertHtml", { value: template({ source: $("#urlHolder").val() }) });
            });

 

thanks!

0
Rumen
Telerik team
answered on 17 Aug 2018, 08:29 AM
Hi Enrico,

Thank you for sharing your solution with the community. It may be helpful for your fellow developers, if you share your kendo.template($("#video-template") too.

Best regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Enrico
Top achievements
Rank 1
answered on 17 Aug 2018, 01:30 PM

Hi Rumen,

Sure!

<script type="text/x-kendo-template" id="video-template" style="width: 500px; height: 500px">
    <video id="video-file" class="video-js vjs-default-skin" controls controlsList="nodownload" style="min-height: 500px; min-width:500px" preload="auto"  data - setup="{}">
        <source src='#=source #' type="video/mp4">
    </video>
</script>
0
Rumen
Telerik team
answered on 17 Aug 2018, 01:36 PM
Thank you very much for your contribution! I've updated your Telerik points for it.

Best regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Editor
Asked by
Enrico
Top achievements
Rank 1
Answers by
Enrico
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or