All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.assets.ueditor.dialogs.template.template.js Maven / Gradle / Ivy

The newest version!
/**
 * Created with JetBrains PhpStorm.
 * User: xuheng
 * Date: 12-8-8
 * Time: 下午2:09
 * To change this template use File | Settings | File Templates.
 */
(function () {
    var me = editor,
            preview = $G( "preview" ),
            preitem = $G( "preitem" ),
            tmps = templates,
            currentTmp;
    var initPre = function () {
        var str = "";
        for ( var i = 0, tmp; tmp = tmps[i++]; ) {
            str += '
'; } preitem.innerHTML = str; }; var pre = function ( n ) { var tmp = tmps[n - 1]; currentTmp = tmp; clearItem(); domUtils.setStyles( preitem.childNodes[n - 1], { "background-color":"lemonChiffon", "border":"#ccc 1px solid" } ); preview.innerHTML = tmp.preHtml ? tmp.preHtml : ""; }; var clearItem = function () { var items = preitem.children; for ( var i = 0, item; item = items[i++]; ) { domUtils.setStyles( item, { "background-color":"", "border":"white 1px solid" } ); } }; dialog.onok = function () { if ( !$G( "issave" ).checked ){ me.execCommand( "cleardoc" ); } var obj = { html:currentTmp && currentTmp.html }; me.execCommand( "template", obj ); }; initPre(); window.pre = pre; pre(2) })();




© 2015 - 2024 Weber Informatics LLC | Privacy Policy