Ticket #3588: 3588.patch

File 3588.patch, 21.9 KB (added by Alfonso Martínez de Lizarrondo, 14 years ago)

Proposed patch

  • _samples/assets/fcktemplates.xml

     
     1<?xml version="1.0" encoding="utf-8" ?>
     2<!--
     3 *
     4 * This is the sample templates definitions file from FCKeditor
     5 *
     6 * It's provided as a sample for the backwards compatible plugin xmltemplates
     7-->
     8<Templates imagesBasePath="_samples/assets/" templateName="default">
     9        <Template title="Image and Title" image="template1.gif">
     10                <Description>One main image with a title and text that surround the image.</Description>
     11                <Html>
     12                        <![CDATA[
     13                                <img style="MARGIN-RIGHT: 10px" height="100" alt="" width="100" align="left"/>
     14                                <h3>Type the title here</h3>
     15                                Type the text here
     16                        ]]>
     17                </Html>
     18        </Template>
     19        <Template title="Strange Template" image="template2.gif">
     20                <Description>A template that defines two colums, each one with a title, and some text.</Description>
     21                <Html>
     22                        <![CDATA[
     23                                <table cellspacing="0" cellpadding="0" width="100%" border="0">
     24                                        <tbody>
     25                                                <tr>
     26                                                        <td width="50%">
     27                                                        <h3>Title 1</h3>
     28                                                        </td>
     29                                                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
     30                                                        <td width="50%">
     31                                                        <h3>Title 2</h3>
     32                                                        </td>
     33                                                </tr>
     34                                                <tr>
     35                                                        <td>Text 1</td>
     36                                                        <td>&nbsp;</td>
     37                                                        <td>Text 2</td>
     38                                                </tr>
     39                                        </tbody>
     40                                </table>
     41                                More text goes here.
     42                        ]]>
     43                </Html>
     44        </Template>
     45        <Template title="Text and Table" image="template3.gif">
     46                <Description>A title with some text and a table.</Description>
     47                <Html>
     48                        <![CDATA[
     49                                <table align="left" width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td>
     50                                        <h3>Title goes here</h3>
     51                                        <p>
     52                                        <table style="FLOAT: right" cellspacing="0" cellpadding="0" width="150" border="1">
     53                                                <tbody>
     54                                                        <tr>
     55                                                                <td align="center" colspan="3"><strong>Table title</strong></td>
     56                                                        </tr>
     57                                                        <tr>
     58                                                                <td>&nbsp;</td>
     59                                                                <td>&nbsp;</td>
     60                                                                <td>&nbsp;</td>
     61                                                        </tr>
     62                                                        <tr>
     63                                                                <td>&nbsp;</td>
     64                                                                <td>&nbsp;</td>
     65                                                                <td>&nbsp;</td>
     66                                                        </tr>
     67                                                        <tr>
     68                                                                <td>&nbsp;</td>
     69                                                                <td>&nbsp;</td>
     70                                                                <td>&nbsp;</td>
     71                                                        </tr>
     72                                                        <tr>
     73                                                                <td>&nbsp;</td>
     74                                                                <td>&nbsp;</td>
     75                                                                <td>&nbsp;</td>
     76                                                        </tr>
     77                                                </tbody>
     78                                        </table>
     79                                        Type the text here</p>
     80                                </td></tr></table>
     81                        ]]>
     82                </Html>
     83        </Template>
     84</Templates>
  • _samples/index.html

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _samples\assets\template1.gif
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _samples\assets\template2.gif
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _samples\assets\template3.gif
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
     
    4242                <li><a href="output_xhtml.html">Output XHTML</a></li>
    4343                <li><a href="output_html.html">Output HTML</a></li>
    4444                <li><a href="output_for_flash.html">Output for Flash</a></li>
     45        </ul>
     46        <h2>
     47                Extra plugins
     48        </h2>
     49        <ul>
    4550                <li><a href="autogrow.html">AutoGrow plugin</a></li>
     51                <li><a href="xmltemplates.html">XmlTemplates plugin</a></li>
    4652        </ul>
    4753        <div id="footer">
    4854                <hr />
  • _samples/xmltemplates.html

     
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2<!--
     3Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     4For licensing, see LICENSE.html or http://ckeditor.com/license
     5-->
     6<html xmlns="http://www.w3.org/1999/xhtml">
     7<head>
     8        <title>XmlTemplates Plugin - CKEditor Sample</title>
     9        <meta content="text/html; charset=utf-8" http-equiv="content-type" />
     10        <!-- CKReleaser %REMOVE_LINE%
     11        <script type="text/javascript" src="../ckeditor.js"></script>
     12        CKReleaser %REMOVE_START% -->
     13        <script type="text/javascript" src="../ckeditor_source.js"></script>
     14        <!-- CKReleaser %REMOVE_END% -->
     15        <script src="sample.js" type="text/javascript"></script>
     16        <link href="sample.css" rel="stylesheet" type="text/css" />
     17</head>
     18<body>
     19        <h1>
     20                CKEditor Sample
     21        </h1>
     22        <!-- This <div> holds alert messages to be display in the sample page. -->
     23        <div id="alerts">
     24                <noscript>
     25                        <p>
     26                                <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
     27                                support, like yours, you should still see the contents (HTML data) and you should
     28                                be able to edit it normally, without a rich editor interface.
     29                        </p>
     30                </noscript>
     31        </div>
     32        <form action="sample_posteddata.php" method="post">
     33                <p>
     34                        In this sample the XmlTemplates plugin is available. It allows to load templates defined in a XML file like FCKeditor.</p>
     35                <p>
     36                        The plugin extends the behavior of the templates_files option, so those urls that are prefixed with "xml:" are parsed
     37                        according to the XML Templates rules for FCKEditor, it's possible to specify multiple templates by using the "templateName"
     38                        attribute in the &lt;Templates&gt; node.
     39                <p>
     40                        <label for="editor1">
     41                                Sample editor:</label><br />
     42                        <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
     43                        <script type="text/javascript">
     44                        //<![CDATA[
     45
     46                                CKEDITOR.replace( 'editor1', {
     47                                        extraPlugins : 'xmltemplates',
     48                                        templates_files : ['xml:assets/fcktemplates.xml']
     49                                });
     50
     51                        //]]>
     52                        </script>
     53                </p>
     54                <p>
     55                        <input type="submit" value="Submit" />
     56                </p>
     57        </form>
     58        <div id="footer">
     59                <hr />
     60                <p>
     61                        CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>
     62                </p>
     63                <p id="copy">
     64                        Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico
     65                        Knabben. All rights reserved.
     66                </p>
     67        </div>
     68</body>
     69</html>
  • _source/plugins/ajax/plugin.js

    Property changes on: _source\plugins\ajax
    ___________________________________________________________________
    Added: bugtraq:label
       + Ticket
    Added: bugtraq:url
       + http://dev.ckeditor.com/ticket/%BUGID%
    Added: webviewer:pathrevision
       + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% 
    Added: webviewer:revision
       + http://dev.fckeditor.net/changeset/%REVISION%
    Added: bugtraq:logregex
       + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
    
    
     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @fileOverview Defines the {@link CKEDITOR.ajax} object, which holds ajax methods for
     8 *              data loading.
     9 */
     10
     11(function()
     12{
     13        CKEDITOR.plugins.add( 'ajax',
     14                {
     15                        requires : [ 'xml' ]
     16                });
     17
     18        /**
     19         * Ajax methods for data loading.
     20         * @namespace
     21         * @example
     22         */
     23        CKEDITOR.ajax = (function()
     24        {
     25                var createXMLHttpRequest = function()
     26                {
     27                        // In IE, using the native XMLHttpRequest for local files may throw
     28                        // "Access is Denied" errors.
     29                        if ( !CKEDITOR.env.ie || location.protocol != 'file:' )
     30                                try { return new XMLHttpRequest(); } catch(e) {}
     31
     32                        try { return new ActiveXObject( 'Msxml2.XMLHTTP' ); } catch (e) {}
     33                        try { return new ActiveXObject( 'Microsoft.XMLHTTP' ); } catch (e) {}
     34
     35                        return null;
     36                };
     37
     38                var checkStatus = function( xhr )
     39                {
     40                        // HTTP Status Codes:
     41                        //       2xx : Success
     42                        //       304 : Not Modified
     43                        //         0 : Returned when running locally (file://)
     44                        //      1223 : IE may change 204 to 1223 (see http://dev.jquery.com/ticket/1450)
     45
     46                        return ( xhr.readyState == 4 &&
     47                                        (       ( xhr.status >= 200 && xhr.status < 300 ) ||
     48                                                xhr.status == 304 ||
     49                                                xhr.status === 0 ||
     50                                                xhr.status == 1223 ) );
     51                };
     52
     53                var getResponseText = function( xhr )
     54                {
     55                        if ( checkStatus( xhr ) )
     56                                return xhr.responseText;
     57                        return null;
     58                };
     59
     60                var getResponseXml = function( xhr )
     61                {
     62                        if ( checkStatus( xhr ) )
     63                        {
     64                                var xml = xhr.responseXML;
     65                                return new CKEDITOR.xml( xml && xml.firstChild ? xml : xhr.responseText );
     66                        }
     67                        return null;
     68                };
     69
     70                var load = function( url, callback, getResponseFn )
     71                {
     72                        var async = !!callback;
     73
     74                        var xhr = createXMLHttpRequest();
     75
     76                        if ( !xhr )
     77                                return null;
     78
     79                        xhr.open( 'GET', url, async );
     80
     81                        if ( async )
     82                        {
     83                                // TODO: perform leak checks on this closure.
     84                                /** @ignore */
     85                                xhr.onreadystatechange = function()
     86                                {
     87                                        if ( xhr.readyState == 4 )
     88                                        {
     89                                                callback( getResponseFn( xhr ) );
     90                                                xhr = null;
     91                                        }
     92                                };
     93                        }
     94
     95                        xhr.send(null);
     96
     97                        return async ? '' : getResponseFn( xhr );
     98                };
     99
     100                return  /** @lends CKEDITOR.ajax */ {
     101
     102                        /**
     103                         * Loads data from an URL as plain text.
     104                         * @param {String} url The URL from which load data.
     105                         * @param {Function} [callback] A callback function to be called on
     106                         *              data load. If not provided, the data will be loaded
     107                         *              synchronously.
     108                         * @returns {String} The loaded data. For asynchronous requests, an
     109                         *              empty string. For invalid requests, null.
     110                         * @example
     111                         * // Load data synchronously.
     112                         * var data = CKEDITOR.ajax.load( 'somedata.txt' );
     113                         * alert( data );
     114                         * @example
     115                         * // Load data asynchronously.
     116                         * var data = CKEDITOR.ajax.load( 'somedata.txt', function( data )
     117                         *     {
     118                         *         alert( data );
     119                         *     } );
     120                         */
     121                        load : function( url, callback )
     122                        {
     123                                return load( url, callback, getResponseText );
     124                        },
     125
     126                        /**
     127                         * Loads data from an URL as XML.
     128                         * @param {String} url The URL from which load data.
     129                         * @param {Function} [callback] A callback function to be called on
     130                         *              data load. If not provided, the data will be loaded
     131                         *              synchronously.
     132                         * @returns {CKEDITOR.xml} An XML object holding the loaded data. For asynchronous requests, an
     133                         *              empty string. For invalid requests, null.
     134                         * @example
     135                         * // Load XML synchronously.
     136                         * var xml = CKEDITOR.ajax.loadXml( 'somedata.xml' );
     137                         * alert( xml.getInnerXml( '//' ) );
     138                         * @example
     139                         * // Load XML asynchronously.
     140                         * var data = CKEDITOR.ajax.loadXml( 'somedata.xml', function( xml )
     141                         *     {
     142                         *         alert( xml.getInnerXml( '//' ) );
     143                         *     } );
     144                         */
     145                        loadXml : function( url, callback )
     146                        {
     147                                return load( url, callback, getResponseXml );
     148                        }
     149                };
     150        })();
     151
     152})();
  • _source/plugins/xml/plugin.js

    Property changes on: _source\plugins\xml
    ___________________________________________________________________
    Added: bugtraq:label
       + Ticket
    Added: bugtraq:url
       + http://dev.ckeditor.com/ticket/%BUGID%
    Added: webviewer:pathrevision
       + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% 
    Added: webviewer:revision
       + http://dev.fckeditor.net/changeset/%REVISION%
    Added: bugtraq:logregex
       + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
    
    
     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @fileOverview Defines the {@link CKEDITOR.xml} class, which represents a
     8 *              loaded XML document.
     9 */
     10
     11(function()
     12{
     13        CKEDITOR.plugins.add( 'xml', {});
     14
     15        /**
     16         * Represents a loaded XML document.
     17         * @constructor
     18         * @param {object|string} xmlObjectOrData A native XML (DOM document) object or
     19         *              a string containing the XML definition to be loaded.
     20         * @example
     21         * var xml = <b>new CKEDITOR.xml( '<books><book title="My Book" /></books>' )</b>;
     22         */
     23        CKEDITOR.xml = function( xmlObjectOrData )
     24        {
     25                var baseXml = null;
     26
     27                if ( typeof xmlObjectOrData == 'object' )
     28                        baseXml = xmlObjectOrData;
     29                else
     30                {
     31                        var data = ( xmlObjectOrData || '' ).replace( /&nbsp;/g, '\xA0' );
     32                        if ( window.DOMParser )
     33                                baseXml = (new DOMParser()).parseFromString( data, 'text/xml' );
     34                        else if ( window.ActiveXObject )
     35                        {
     36                                try { baseXml = new ActiveXObject( 'MSXML2.DOMDocument' ); }
     37                                catch(e)
     38                                {
     39                                        try { baseXml = new ActiveXObject( 'Microsoft.XmlDom' ); } catch(e) {}
     40                                }
     41
     42                                if ( baseXml )
     43                                {
     44                                        baseXml.async = false;
     45                                        baseXml.resolveExternals = false;
     46                                        baseXml.validateOnParse = false;
     47                                        baseXml.loadXML( data );
     48                                }
     49                        }
     50                }
     51
     52                /**
     53                 * The native XML (DOM document) used by the class instance.
     54                 * @type object
     55                 * @example
     56                 */
     57                this.baseXml = baseXml;
     58        };
     59
     60        CKEDITOR.xml.prototype =
     61        {
     62                /**
     63                 * Get a single node from the XML document, based on a XPath query.
     64                 * @param {String} xpath The XPath query to execute.
     65                 * @param {Object} [contextNode] The XML DOM node to be used as the context
     66                 *              for the XPath query. The document root is used by default.
     67                 * @returns {Object} A XML node element or null if the query has no results.
     68                 * @example
     69                 * // Create the XML instance.
     70                 * var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' );
     71                 * // Get the first <item> node.
     72                 * var itemNode = <b>xml.selectSingleNode( 'list/item' )</b>;
     73                 * // Alert "item".
     74                 * alert( itemNode.nodeName );
     75                 */
     76                selectSingleNode : function( xpath, contextNode )
     77                {
     78                        var baseXml = this.baseXml;
     79
     80                        if ( contextNode || ( contextNode = baseXml ) )
     81                        {
     82                                if ( CKEDITOR.env.ie || contextNode.selectSingleNode )  // IE
     83                                        return contextNode.selectSingleNode( xpath );
     84                                else if ( baseXml.evaluate )                                                    // Others
     85                                {
     86                                        var result = baseXml.evaluate( xpath, contextNode, null, 9, null);
     87                                        return ( result && result.singleNodeValue ) || null;
     88                                }
     89                        }
     90
     91                        return null;
     92                },
     93
     94                /**
     95                 * Gets a list node from the XML document, based on a XPath query.
     96                 * @param {String} xpath The XPath query to execute.
     97                 * @param {Object} [contextNode] The XML DOM node to be used as the context
     98                 *              for the XPath query. The document root is used by default.
     99                 * @returns {ArrayLike} An array containing all matched nodes. The array will
     100                 *              be empty if the query has no results.
     101                 * @example
     102                 * // Create the XML instance.
     103                 * var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' );
     104                 * // Get the first <item> node.
     105                 * var itemNodes = xml.selectSingleNode( 'list/item' );
     106                 * // Alert "item" twice, one for each <item>.
     107                 * for ( var i = 0 ; i < itemNodes.length ; i++ )
     108                 *     alert( itemNodes[i].nodeName );
     109                 */
     110                selectNodes : function( xpath, contextNode )
     111                {
     112                        var baseXml = this.baseXml,
     113                                nodes = [];
     114
     115                        if ( contextNode || ( contextNode = baseXml ) )
     116                        {
     117                                if ( CKEDITOR.env.ie || contextNode.selectNodes )               // IE
     118                                        return contextNode.selectNodes( xpath );
     119                                else if ( baseXml.evaluate )                                                    // Others
     120                                {
     121                                        var result = baseXml.evaluate( xpath, contextNode, null, 5, null);
     122
     123                                        if ( result )
     124                                        {
     125                                                var node;
     126                                                while ( ( node = result.iterateNext() ) )
     127                                                        nodes.push( node );
     128                                        }
     129                                }
     130                        }
     131
     132                        return nodes;
     133                },
     134
     135                /**
     136                 * Gets the string representation of hte inner contents of a XML node,
     137                 * based on a XPath query.
     138                 * @param {String} xpath The XPath query to execute.
     139                 * @param {Object} [contextNode] The XML DOM node to be used as the context
     140                 *              for the XPath query. The document root is used by default.
     141                 * @returns {String} The textual representation of the inner contents of
     142                 *              the node or null if the query has no results.
     143                 * @example
     144                 * // Create the XML instance.
     145                 * var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' );
     146                 * // Alert "<item id="test1" /><item id="test2" />".
     147                 * alert( xml.getInnerXml( 'list' ) );
     148                 */
     149                getInnerXml : function( xpath, contextNode )
     150                {
     151                        var node = this.selectSingleNode( xpath, contextNode ),
     152                                xml = [];
     153                        if ( node )
     154                        {
     155                                node = node.firstChild;
     156                                while ( node )
     157                                {
     158                                        if ( node.xml )                         // IE
     159                                                xml.push( node.xml );
     160                                        else if ( window.XMLSerializer )        // Others
     161                                                xml.push( ( new XMLSerializer() ).serializeToString( node ) );
     162
     163                                        node = node.nextSibling;
     164                                }
     165                        }
     166
     167                        return xml.length ? xml.join( '' ) : null;
     168                }
     169        };
     170})();
  • _source/plugins/xmltemplates/plugin.js

    Property changes on: _source\plugins\xmltemplates
    ___________________________________________________________________
    Added: bugtraq:label
       + Ticket
    Added: bugtraq:url
       + http://dev.ckeditor.com/ticket/%BUGID%
    Added: webviewer:pathrevision
       + http://dev.fckeditor.net/browser/%PATH%?rev=%REVISION% 
    Added: webviewer:revision
       + http://dev.fckeditor.net/changeset/%REVISION%
    Added: bugtraq:logregex
       + (?:ticket: *|#)(\d+) *(?:, *(\d+))*
    
    
     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6(function()
     7{
     8        CKEDITOR.plugins.add( 'xmltemplates',
     9                {
     10                        requires : [ 'dialog', 'templates', 'ajax', 'xml' ]
     11                });
     12
     13        var templates = {},
     14                loadedTemplatesFiles = {};
     15
     16        CKEDITOR.addTemplates = function( name, definition )
     17        {
     18                templates[ name ] = definition;
     19        };
     20
     21        CKEDITOR.getTemplates = function( name )
     22        {
     23                return templates[ name ];
     24        };
     25
     26        function loadXmlTemplates( urls, callback )
     27        {
     28                function loadedTemplate( xml )
     29                {
     30                        // Parse the template and add it
     31                        if ( !xml )
     32                        {
     33                                alert( 'XML template file not parsed' );
     34                                return;
     35                        }
     36
     37                        var templatesNode = xml.selectSingleNode( '/Templates' );
     38
     39                        if ( !templatesNode )
     40                        {
     41                                alert( 'The <Templates> node was not found' );
     42                                return ;
     43                        }
     44
     45                        // Get the imagesBasePath attribute value.
     46                        var imagesBasePath = templatesNode.getAttribute( 'imagesBasePath' ),
     47                                templateName = templatesNode.getAttribute( 'templateName' ) || 'default',
     48                                newTemplate = {},
     49                                // Retrieve all <Template> nodes.
     50                                templateNodes = xml.selectNodes( 'Template', templatesNode ),
     51                                templates = newTemplate.templates = [];
     52
     53                        if ( imagesBasePath )
     54                                newTemplate.imagesPath = CKEDITOR.getUrl( imagesBasePath );
     55
     56                        for ( var i = 0 ; i < templateNodes.length ; i++ )
     57                        {
     58                                var templateNode = templateNodes[ i ],
     59                                        template = {},
     60                                        title = templateNode.getAttribute( 'title' ) ,
     61                                        image = templateNode.getAttribute( 'image' ) ,
     62                                        description = xml.getInnerXml( 'Description', templateNode ) ,
     63                                        oPart = xml.selectSingleNode( 'Html', templateNode );
     64
     65                                title && ( template.title = title );
     66                                image && ( template.image = image );
     67                                description && ( template.description = description );
     68                                template.html = oPart.text ? oPart.text : oPart.textContent;
     69
     70                                templates.push( template );
     71                        }
     72
     73                        CKEDITOR.addTemplates( templateName, newTemplate );
     74
     75                        // Finish the loading
     76                        if ( ++loadedCount == urls.length)
     77                                setTimeout( callback, 0 );
     78                }
     79
     80                var loadedCount = 0;
     81
     82                for(var i=0; i<urls.length; i++)
     83                        CKEDITOR.ajax.loadXml( urls[i].substring(4), loadedTemplate );
     84        }
     85
     86        CKEDITOR.loadTemplates = function( templateFiles, callback )
     87        {
     88                function jsLoaded()
     89                {
     90                        jsToLoad = [];
     91                        if (xmlToLoad.length==0)
     92                                setTimeout( callback, 0 );
     93                }
     94                function xmlLoaded()
     95                {
     96                        xmlToLoad = [];
     97                        if (jsToLoad.length==0)
     98                                setTimeout( callback, 0 );
     99                }
     100
     101                // Holds the templates files to be loaded.
     102                var jsToLoad = [],
     103                        xmlToLoad = [],
     104                        pending;
     105
     106                if ( typeof templateFiles == 'string')
     107                        templateFiles = [ templateFiles ];
     108
     109                // Look for pending template files to get loaded.
     110                for ( var i = 0, count = templateFiles.length ; i < count ; i++ )
     111                {
     112                        var template = templateFiles[ i ];
     113                        if ( !loadedTemplatesFiles[ template ] )
     114                        {
     115                                ( template.substring(0, 4) == "xml:" ? xmlToLoad : jsToLoad ).push( template );
     116                                loadedTemplatesFiles[ template ] = 1;
     117                        }
     118                }
     119
     120                if ( jsToLoad.length )
     121                {
     122                        pending = true;
     123                        CKEDITOR.scriptLoader.load( jsToLoad, jsLoaded );
     124                }
     125
     126                if ( xmlToLoad.length )
     127                {
     128                        pending = true;
     129                        loadXmlTemplates( xmlToLoad, xmlLoaded );
     130                }
     131
     132                if ( !pending )
     133                        setTimeout( callback, 0 );
     134        };
     135})();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy