src/pyams_skin/resources/js/ext/tinymce/dev/classes/ui/Iframe.js
changeset 557 bca7a7e058a3
equal deleted inserted replaced
-1:000000000000 557:bca7a7e058a3
       
     1 /**
       
     2  * Iframe.js
       
     3  *
       
     4  * Copyright, Moxiecode Systems AB
       
     5  * Released under LGPL License.
       
     6  *
       
     7  * License: http://www.tinymce.com/license
       
     8  * Contributing: http://www.tinymce.com/contributing
       
     9  */
       
    10 
       
    11 /*jshint scripturl:true */
       
    12 
       
    13 /**
       
    14  * This class creates an iframe.
       
    15  *
       
    16  * @setting {String} url Url to open in the iframe.
       
    17  *
       
    18  * @-x-less Iframe.less
       
    19  * @class tinymce.ui.Iframe
       
    20  * @extends tinymce.ui.Widget
       
    21  */
       
    22 define("tinymce/ui/Iframe", [
       
    23 	"tinymce/ui/Widget"
       
    24 ], function(Widget) {
       
    25 	"use strict";
       
    26 
       
    27 	return Widget.extend({
       
    28 		/**
       
    29 		 * Renders the control as a HTML string.
       
    30 		 *
       
    31 		 * @method renderHtml
       
    32 		 * @return {String} HTML representing the control.
       
    33 		 */
       
    34 		renderHtml: function() {
       
    35 			var self = this;
       
    36 
       
    37 			self.addClass('iframe');
       
    38 			self.canFocus = false;
       
    39 
       
    40 			/*eslint no-script-url:0 */
       
    41 			return (
       
    42 				'<iframe id="' + self._id + '" class="' + self.classes() + '" tabindex="-1" src="' +
       
    43 				(self.settings.url || "javascript:\'\'") + '" frameborder="0"></iframe>'
       
    44 			);
       
    45 		},
       
    46 
       
    47 		/**
       
    48 		 * Setter for the iframe source.
       
    49 		 *
       
    50 		 * @method src
       
    51 		 * @param {String} src Source URL for iframe.
       
    52 		 */
       
    53 		src: function(src) {
       
    54 			this.getEl().src = src;
       
    55 		},
       
    56 
       
    57 		/**
       
    58 		 * Inner HTML for the iframe.
       
    59 		 *
       
    60 		 * @method html
       
    61 		 * @param {String} html HTML string to set as HTML inside the iframe.
       
    62 		 * @param {function} callback Optional callback to execute when the iframe body is filled with contents.
       
    63 		 * @return {tinymce.ui.Iframe} Current iframe control.
       
    64 		 */
       
    65 		html: function(html, callback) {
       
    66 			var self = this, body = this.getEl().contentWindow.document.body;
       
    67 
       
    68 			// Wait for iframe to initialize IE 10 takes time
       
    69 			if (!body) {
       
    70 				setTimeout(function() {
       
    71 					self.html(html);
       
    72 				}, 0);
       
    73 			} else {
       
    74 				body.innerHTML = html;
       
    75 
       
    76 				if (callback) {
       
    77 					callback();
       
    78 				}
       
    79 			}
       
    80 
       
    81 			return this;
       
    82 		}
       
    83 	});
       
    84 });