2014-05-07 13:06:24 +08:00
( function ( exports , undefined ) { "use strict" ; var modules = { } ; function require ( ids , callback ) { var module , defs = [ ] ; for ( var i = 0 ; i < ids . length ; ++ i ) { module = modules [ ids [ i ] ] || resolve ( ids [ i ] ) ; if ( ! module ) { throw "module definition dependecy not found: " + ids [ i ] } defs . push ( module ) } callback . apply ( null , defs ) } function define ( id , dependencies , definition ) { if ( typeof id !== "string" ) { throw "invalid module definition, module id must be defined and be a string" } if ( dependencies === undefined ) { throw "invalid module definition, dependencies must be specified" } if ( definition === undefined ) { throw "invalid module definition, definition function must be specified" } require ( dependencies , function ( ) { modules [ id ] = definition . apply ( null , arguments ) } ) } function defined ( id ) { return ! ! modules [ id ] } function resolve ( id ) { var target = exports ; var fragments = id . split ( /[.\/]/ ) ; for ( var fi = 0 ; fi < fragments . length ; ++ fi ) { if ( ! target [ fragments [ fi ] ] ) { return } target = target [ fragments [ fi ] ] } return target } function expose ( ids ) { for ( var i = 0 ; i < ids . length ; i ++ ) { var target = exports ; var id = ids [ i ] ; var fragments = id . split ( /[.\/]/ ) ; for ( var fi = 0 ; fi < fragments . length - 1 ; ++ fi ) { if ( target [ fragments [ fi ] ] === undefined ) { target [ fragments [ fi ] ] = { } } target = target [ fragments [ fi ] ] } target [ fragments [ fragments . length - 1 ] ] = modules [ id ] } } define ( "tinymce/dom/EventUtils" , [ ] , function ( ) { "use strict" ; var eventExpandoPrefix = "mce-data-" ; var mouseEventRe = /^(?:mouse|contextmenu)|click/ ; var deprecated = { keyLocation : 1 , layerX : 1 , layerY : 1 , returnValue : 1 } ; function addEvent ( target , name , callback , capture ) { if ( target . addEventListener ) { target . addEventListener ( name , callback , capture || false ) } else if ( target . attachEvent ) { target . attachEvent ( "on" + name , callback ) } } function removeEvent ( target , name , callback , capture ) { if ( target . removeEventListener ) { target . removeEventListener ( name , callback , capture || false ) } else if ( target . detachEvent ) { target . detachEvent ( "on" + name , callback ) } } function fix ( originalEvent , data ) { var name , event = data || { } , undef ; function returnFalse ( ) { return false } function returnTrue ( ) { return true } for ( name in originalEvent ) { if ( ! deprecated [ name ] ) { event [ name ] = originalEvent [ name ] } } if ( ! event . target ) { event . target = event . srcElement || document } if ( originalEvent && mouseEventRe . test ( originalEvent . type ) && originalEvent . pageX === undef && originalEvent . clientX !== undef ) { var eventDoc = event . target . ownerDocument || document ; var doc = eventDoc . documentElement ; var body = eventDoc . body ; event . pageX = originalEvent . clientX + ( doc && doc . scrollLeft || body && body . scrollLeft || 0 ) - ( doc && doc . clientLeft || body && body . clientLeft || 0 ) ; event . pageY = originalEvent . clientY + ( doc && doc . scrollTop || body && body . scrollTop || 0 ) - ( doc && doc . clientTop || body && body . clientTop || 0 ) } event . preventDefault = function ( ) { event . isDefaultPrevented = returnTrue ; if ( originalEvent ) { if ( originalEvent . preventDefault ) { originalEvent . preventDefault ( ) } else { originalEvent . returnValue = false } } } ; event . stopPropagation = function ( ) { event . isPropagationStopped = returnTrue ; if ( originalEvent ) { if ( originalEvent . stopPropagation ) { originalEvent . stopPropagation ( ) } else { originalEvent . cancelBubble = true } } } ; event . stopImmediatePropagation = function ( ) { event . isImmediatePropagationStopped = returnTrue ; event . stopPropagation ( ) } ; if ( ! event . isDefaultPrevented ) { event . isDefaultPrevented = returnFalse ; event . isPropagationStopped = returnFalse ; event . isImmediatePropagationStopped = returnFalse } return event } function bindOnReady ( win , callback , eventUtils ) { var doc = win . document , event = { type : "ready" } ; if ( eventUtils . domLoaded ) { callback ( event ) ; return } function readyHandler ( ) { if ( ! eventUtils . domLoaded ) { eventUtils . domLoaded = true ; callback ( event ) } } function waitForDomLoaded ( ) { if ( doc . readyState === "complete" ) { removeEvent ( doc , "readystatechange" , waitForDomLoaded ) ; readyHandler ( ) } } function tryScroll ( ) { try { doc . documentElement . doScroll ( "left" ) } catch ( ex ) { setTimeout ( tryScroll , 0 ) ; return } readyHandler ( ) } if ( doc . addEventListener ) { if ( doc . readyState === "complete" ) { readyHandler ( ) } else { addEvent ( win , "DOMContentLoaded" , readyHandler ) } } else { addEvent ( doc , "readystatechange" , waitForDomLoaded ) ; if ( doc . documentElement . doScroll && win === win . top ) { tryScroll ( ) } } addEvent ( win , "load" , readyHandler ) } function EventUtils ( ) { var self = this , events = { } , count , expando , hasFocusIn , hasMouseEnter
if ( matcher ) { matcher ( matcherIn , matcherOut , context , xml ) } if ( postFilter ) { temp = condense ( matcherOut , postMap ) ; postFilter ( temp , [ ] , context , xml ) ; i = temp . length ; while ( i -- ) { if ( elem = temp [ i ] ) { matcherOut [ postMap [ i ] ] = ! ( matcherIn [ postMap [ i ] ] = elem ) } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { temp = [ ] ; i = matcherOut . length ; while ( i -- ) { if ( elem = matcherOut [ i ] ) { temp . push ( matcherIn [ i ] = elem ) } } postFinder ( null , matcherOut = [ ] , temp , xml ) } i = matcherOut . length ; while ( i -- ) { if ( ( elem = matcherOut [ i ] ) && ( temp = postFinder ? indexOf . call ( seed , elem ) : preMap [ i ] ) > - 1 ) { seed [ temp ] = ! ( results [ temp ] = elem ) } } } } else { matcherOut = condense ( matcherOut === results ? matcherOut . splice ( preexisting , matcherOut . length ) : matcherOut ) ; if ( postFinder ) { postFinder ( null , results , matcherOut , xml ) } else { push . apply ( results , matcherOut ) } } } ) } function matcherFromTokens ( tokens ) { var checkContext , matcher , j , len = tokens . length , leadingRelative = Expr . relative [ tokens [ 0 ] . type ] , implicitRelative = leadingRelative || Expr . relative [ " " ] , i = leadingRelative ? 1 : 0 , matchContext = addCombinator ( function ( elem ) { return elem === checkContext } , implicitRelative , true ) , matchAnyContext = addCombinator ( function ( elem ) { return indexOf . call ( checkContext , elem ) > - 1 } , implicitRelative , true ) , matchers = [ function ( elem , context , xml ) { return ! leadingRelative && ( xml || context !== outermostContext ) || ( ( checkContext = context ) . nodeType ? matchContext ( elem , context , xml ) : matchAnyContext ( elem , context , xml ) ) } ] ; for ( ; i < len ; i ++ ) { if ( matcher = Expr . relative [ tokens [ i ] . type ] ) { matchers = [ addCombinator ( elementMatcher ( matchers ) , matcher ) ] } else { matcher = Expr . filter [ tokens [ i ] . type ] . apply ( null , tokens [ i ] . matches ) ; if ( matcher [ expando ] ) { j = ++ i ; for ( ; j < len ; j ++ ) { if ( Expr . relative [ tokens [ j ] . type ] ) { break } } return setMatcher ( i > 1 && elementMatcher ( matchers ) , i > 1 && toSelector ( tokens . slice ( 0 , i - 1 ) ) . replace ( rtrim , "$1" ) , matcher , i < j && matcherFromTokens ( tokens . slice ( i , j ) ) , j < len && matcherFromTokens ( tokens = tokens . slice ( j ) ) , j < len && toSelector ( tokens ) ) } matchers . push ( matcher ) } } return elementMatcher ( matchers ) } function matcherFromGroupMatchers ( elementMatchers , setMatchers ) { var matcherCachedRuns = 0 , bySet = setMatchers . length > 0 , byElement = elementMatchers . length > 0 , superMatcher = function ( seed , context , xml , results , expandContext ) { var elem , j , matcher , setMatched = [ ] , matchedCount = 0 , i = "0" , unmatched = seed && [ ] , outermost = expandContext != null , contextBackup = outermostContext , elems = seed || byElement && Expr . find [ "TAG" ] ( "*" , expandContext && context . parentNode || context ) , dirrunsUnique = dirruns += contextBackup == null ? 1 : Math . random ( ) || . 1 ; if ( outermost ) { outermostContext = context !== document && context ; cachedruns = matcherCachedRuns } for ( ; ( elem = elems [ i ] ) != null ; i ++ ) { if ( byElement && elem ) { j = 0 ; while ( matcher = elementMatchers [ j ++ ] ) { if ( matcher ( elem , context , xml ) ) { results . push ( elem ) ; break } } if ( outermost ) { dirruns = dirrunsUnique ; cachedruns = ++ matcherCachedRuns } } if ( bySet ) { if ( elem = ! matcher && elem ) { matchedCount -- } if ( seed ) { unmatched . push ( elem ) } } } matchedCount += i ; if ( bySet && i !== matchedCount ) { j = 0 ; while ( matcher = setMatchers [ j ++ ] ) { matcher ( unmatched , setMatched , context , xml ) } if ( seed ) { if ( matchedCount > 0 ) { while ( i -- ) { if ( ! ( unmatched [ i ] || setMatched [ i ] ) ) { setMatched [ i ] = pop . call ( results ) } } } setMatched = condense ( setMatched ) } push . apply ( results , setMatched ) ; if ( outermost && ! seed && setMatched . length > 0 && matchedCount + setMatchers . length > 1 ) { Sizzle . uniqueSort ( results ) } } if ( outermost ) { dirruns = dirrunsUnique ; outermostContext = contextBackup } return unmatched } ; return bySet ? markFunction ( superMatcher ) : superMatcher } compile = Sizzle . compile = function ( selector , group ) { var i , setMatchers = [ ] , elementMatchers = [ ] , cached = compilerCache [ selector + " " ] ; if ( ! cached ) { if ( ! group ) { group = tokenize ( selector ) } i = group . length ; while ( i -- ) { cached = matcherFromTokens ( group [ i ] ) ; if ( cached [ expando ] ) { setMatchers . push ( cached ) } else { elementMatchers . push ( cached ) } } cached = compilerCache ( selector , matcherFromGroupMatchers ( elementMatchers , setMatchers ) ) } return cached } ; function multipleContexts ( selector , contexts , results ) { var i = 0 , len = contexts . length ; for ( ; i < len ; i ++ ) { Sizzle ( selector , contexts [ i ] , results ) } return results } function select ( selector , context , results , seed ) { var i , tokens , token , type , find , match = tokenize ( selector ) ; if ( ! seed ) { if ( match . length === 1 ) { tokens = match [ 0 ] = match [ 0 ] . slice ( 0 ) ; if ( tokens . length > 2 && ( token
clonedGrandParent = _traverseNode ( parent , FALSE , TRUE , how ) ; if ( how != DELETE ) { clonedGrandParent . appendChild ( clonedParent ) } clonedParent = clonedGrandParent } } function _traverseNode ( n , isFullySelected , isLeft , how ) { var txtValue , newNodeValue , oldNodeValue , offset , newNode ; if ( isFullySelected ) { return _traverseFullySelected ( n , how ) } if ( n . nodeType == 3 ) { txtValue = n . nodeValue ; if ( isLeft ) { offset = t [ START _OFFSET ] ; newNodeValue = txtValue . substring ( offset ) ; oldNodeValue = txtValue . substring ( 0 , offset ) } else { offset = t [ END _OFFSET ] ; newNodeValue = txtValue . substring ( 0 , offset ) ; oldNodeValue = txtValue . substring ( offset ) } if ( how != CLONE ) { n . nodeValue = oldNodeValue } if ( how == DELETE ) { return } newNode = dom . clone ( n , FALSE ) ; newNode . nodeValue = newNodeValue ; return newNode } if ( how == DELETE ) { return } return dom . clone ( n , FALSE ) } function _traverseFullySelected ( n , how ) { if ( how != DELETE ) { return how == CLONE ? dom . clone ( n , TRUE ) : n } n . parentNode . removeChild ( n ) } function toStringIE ( ) { return dom . create ( "body" , null , cloneContents ( ) ) . outerText } extend ( t , { startContainer : doc , startOffset : 0 , endContainer : doc , endOffset : 0 , collapsed : TRUE , commonAncestorContainer : doc , START _TO _START : 0 , START _TO _END : 1 , END _TO _END : 2 , END _TO _START : 3 , setStart : setStart , setEnd : setEnd , setStartBefore : setStartBefore , setStartAfter : setStartAfter , setEndBefore : setEndBefore , setEndAfter : setEndAfter , collapse : collapse , selectNode : selectNode , selectNodeContents : selectNodeContents , compareBoundaryPoints : compareBoundaryPoints , deleteContents : deleteContents , extractContents : extractContents , cloneContents : cloneContents , insertNode : insertNode , surroundContents : surroundContents , cloneRange : cloneRange , toStringIE : toStringIE } ) ; return t } Range . prototype . toString = function ( ) { return this . toStringIE ( ) } ; return Range } ) ; define ( "tinymce/html/Entities" , [ "tinymce/util/Tools" ] , function ( Tools ) { var makeMap = Tools . makeMap ; var namedEntities , baseEntities , reverseEntities , attrsCharsRegExp = /[&<>\"\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g , textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g , rawCharsRegExp = /[<>&\"\']/g , entityRegExp = /&(#x|#)?([\w]+);/g , asciiMap = { 128 : "€" , 130 : "‚ " , 131 : "ƒ" , 132 : "„" , 133 : "…" , 134 : "†" , 135 : "‡" , 136 : "ˆ " , 137 : "‰" , 138 : "Š" , 139 : "‹ " , 140 : "Œ" , 142 : "Ž" , 145 : "‘ " , 146 : "’ " , 147 : "“" , 148 : "”" , 149 : "•" , 150 : "– " , 151 : "—" , 152 : "˜ " , 153 : "™" , 154 : "š" , 155 : "› " , 156 : "œ" , 158 : "ž" , 159 : "Ÿ" } ; baseEntities = { '"' : """ , "'" : "'" , "<" : "<" , ">" : ">" , "&" : "&" } ; reverseEntities = { "<" : "<" , ">" : ">" , "&" : "&" , """ : '"' , "'" : "'" } ; function nativeDecode ( text ) { var elm ; elm = document . createElement ( "div" ) ; elm . innerHTML = text ; return elm . textContent || elm . innerText || text } function buildEntitiesLookup ( items , radix ) { var i , chr , entity , lookup = { } ; if ( items ) { items = items . split ( "," ) ; radix = radix || 10 ; for ( i = 0 ; i < items . length ; i += 2 ) { chr = String . fromCharCode ( parseInt ( items [ i ] , radix ) ) ; if ( ! baseEntities [ chr ] ) { entity = "&" + items [ i + 1 ] + ";" ; lookup [ chr ] = entity ; lookup [ entity ] = chr } } return lookup } } namedEntities = buildEntitiesLookup ( "50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy," + "5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute," + "5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34," + "5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil," + "68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde," + "6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute," + "6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml," + "75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc," + "7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash," + "7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta," + "sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu," + "st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi," + " t9 , Omega , th , alpha , ti , beta , tj , gamma , tk , delta , tl , epsilon , tm , zet
this . lookup [ id ] = { instance : addOn , dependencies : dependencies } ; return addOn } , createUrl : function ( baseUrl , dep ) { if ( typeof dep === "object" ) { return dep } else { return { prefix : baseUrl . prefix , resource : dep , suffix : baseUrl . suffix } } } , addComponents : function ( pluginName , scripts ) { var pluginUrl = this . urls [ pluginName ] ; each ( scripts , function ( script ) { ScriptLoader . ScriptLoader . add ( pluginUrl + "/" + script ) } ) } , load : function ( n , u , cb , s ) { var t = this , url = u ; function loadDependencies ( ) { var dependencies = t . dependencies ( n ) ; each ( dependencies , function ( dep ) { var newUrl = t . createUrl ( u , dep ) ; t . load ( newUrl . resource , newUrl , undefined , undefined ) } ) ; if ( cb ) { if ( s ) { cb . call ( s ) } else { cb . call ( ScriptLoader ) } } } if ( t . urls [ n ] ) { return } if ( typeof u === "object" ) { url = u . prefix + u . resource + u . suffix } if ( url . indexOf ( "/" ) !== 0 && url . indexOf ( "://" ) == - 1 ) { url = AddOnManager . baseURL + "/" + url } t . urls [ n ] = url . substring ( 0 , url . lastIndexOf ( "/" ) ) ; if ( t . lookup [ n ] ) { loadDependencies ( ) } else { ScriptLoader . ScriptLoader . add ( url , loadDependencies , s ) } } } ; AddOnManager . PluginManager = new AddOnManager ; AddOnManager . ThemeManager = new AddOnManager ; return AddOnManager } ) ; define ( "tinymce/html/Node" , [ ] , function ( ) { var whiteSpaceRegExp = /^[ \t\r\n]*$/ , typeLookup = { "#text" : 3 , "#comment" : 8 , "#cdata" : 4 , "#pi" : 7 , "#doctype" : 10 , "#document-fragment" : 11 } ; function walk ( node , root _node , prev ) { var sibling , parent , startName = prev ? "lastChild" : "firstChild" , siblingName = prev ? "prev" : "next" ; if ( node [ startName ] ) { return node [ startName ] } if ( node !== root _node ) { sibling = node [ siblingName ] ; if ( sibling ) { return sibling } for ( parent = node . parent ; parent && parent !== root _node ; parent = parent . parent ) { sibling = parent [ siblingName ] ; if ( sibling ) { return sibling } } } } function Node ( name , type ) { this . name = name ; this . type = type ; if ( type === 1 ) { this . attributes = [ ] ; this . attributes . map = { } } } Node . prototype = { replace : function ( node ) { var self = this ; if ( node . parent ) { node . remove ( ) } self . insert ( node , self ) ; self . remove ( ) ; return self } , attr : function ( name , value ) { var self = this , attrs , i , undef ; if ( typeof name !== "string" ) { for ( i in name ) { self . attr ( i , name [ i ] ) } return self } if ( attrs = self . attributes ) { if ( value !== undef ) { if ( value === null ) { if ( name in attrs . map ) { delete attrs . map [ name ] ; i = attrs . length ; while ( i -- ) { if ( attrs [ i ] . name === name ) { attrs = attrs . splice ( i , 1 ) ; return self } } } return self } if ( name in attrs . map ) { i = attrs . length ; while ( i -- ) { if ( attrs [ i ] . name === name ) { attrs [ i ] . value = value ; break } } } else { attrs . push ( { name : name , value : value } ) } attrs . map [ name ] = value ; return self } else { return attrs . map [ name ] } } } , clone : function ( ) { var self = this , clone = new Node ( self . name , self . type ) , i , l , selfAttrs , selfAttr , cloneAttrs ; if ( selfAttrs = self . attributes ) { cloneAttrs = [ ] ; cloneAttrs . map = { } ; for ( i = 0 , l = selfAttrs . length ; i < l ; i ++ ) { selfAttr = selfAttrs [ i ] ; if ( selfAttr . name !== "id" ) { cloneAttrs [ cloneAttrs . length ] = { name : selfAttr . name , value : selfAttr . value } ; cloneAttrs . map [ selfAttr . name ] = selfAttr . value } } clone . attributes = cloneAttrs } clone . value = self . value ; clone . shortEnded = self . shortEnded ; return clone } , wrap : function ( wrapper ) { var self = this ; self . parent . insert ( wrapper , self ) ; wrapper . append ( self ) ; return self } , unwrap : function ( ) { var self = this , node , next ; for ( node = self . firstChild ; node ; ) { next = node . next ; self . insert ( node , self , true ) ; node = next } self . remove ( ) } , remove : function ( ) { var self = this , parent = self . parent , next = self . next , prev = self . prev ; if ( parent ) { if ( parent . firstChild === self ) { parent . firstChild = next ; if ( next ) { next . prev = null } } else { prev . next = next } if ( parent . lastChild === self ) { parent . lastChild = prev ; if ( prev ) { prev . next = null } } else { next . prev = prev } self . parent = self . next = self . prev = null } return self } , append : function ( node ) { var self = this , last ; if ( node . parent ) { node . remove ( ) } last = self . lastChild ; if ( last ) { last . next = node ; node . prev = last ; self . lastChild = node } else { self . lastChild = self . firstChild = node } node . parent = self ; return node } , insert : function ( node , ref _node , before ) { var parent ; if ( node . parent ) { node . remove ( ) } parent = ref _node . parent || this ; if ( before ) { if ( ref _node === parent . firstChild ) { parent . firstChild = node } else { ref _node . prev . next = node } node . prev = ref _node . prev ; node . next = ref _node ; ref _node . prev = node } else { if ( ref _node === parent . lastChild ) { parent . lastChild = node } else { ref _node . next . prev = node } node . next = ref _node . next ; node . prev = ref _node ; ref _node . next = node } node . parent = parent ; ret
for ( i = 0 ; i < attributeFilters . length ; i ++ ) { if ( attributeFilters [ i ] . name === name ) { attributeFilters [ i ] . callbacks . push ( callback ) ; return } } attributeFilters . push ( { name : name , callbacks : [ callback ] } ) } ) } ; self . parse = function ( html , args ) { var parser , rootNode , node , nodes , i , l , fi , fl , list , name , validate ; var blockElements , startWhiteSpaceRegExp , invalidChildren = [ ] , isInWhiteSpacePreservedElement ; var endWhiteSpaceRegExp , allWhiteSpaceRegExp , isAllWhiteSpaceRegExp , whiteSpaceElements ; var children , nonEmptyElements , rootBlockName ; args = args || { } ; matchedNodes = { } ; matchedAttributes = { } ; blockElements = extend ( makeMap ( "script,style,head,html,body,title,meta,param" ) , schema . getBlockElements ( ) ) ; nonEmptyElements = schema . getNonEmptyElements ( ) ; children = schema . children ; validate = settings . validate ; rootBlockName = "forced_root_block" in args ? args . forced _root _block : settings . forced _root _block ; whiteSpaceElements = schema . getWhiteSpaceElements ( ) ; startWhiteSpaceRegExp = /^[ \t\r\n]+/ ; endWhiteSpaceRegExp = /[ \t\r\n]+$/ ; allWhiteSpaceRegExp = /[ \t\r\n]+/g ; isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/ ; function addRootBlocks ( ) { var node = rootNode . firstChild , next , rootBlockNode ; function trim ( rootBlockNode ) { if ( rootBlockNode ) { node = rootBlockNode . firstChild ; if ( node && node . type == 3 ) { node . value = node . value . replace ( startWhiteSpaceRegExp , "" ) } node = rootBlockNode . lastChild ; if ( node && node . type == 3 ) { node . value = node . value . replace ( endWhiteSpaceRegExp , "" ) } } } if ( ! schema . isValidChild ( rootNode . name , rootBlockName . toLowerCase ( ) ) ) { return } while ( node ) { next = node . next ; if ( node . type == 3 || node . type == 1 && node . name !== "p" && ! blockElements [ node . name ] && ! node . attr ( "data-mce-type" ) ) { if ( ! rootBlockNode ) { rootBlockNode = createNode ( rootBlockName , 1 ) ; rootBlockNode . attr ( settings . forced _root _block _attrs ) ; rootNode . insert ( rootBlockNode , node ) ; rootBlockNode . append ( node ) } else { rootBlockNode . append ( node ) } } else { trim ( rootBlockNode ) ; rootBlockNode = null } node = next } trim ( rootBlockNode ) } function createNode ( name , type ) { var node = new Node ( name , type ) , list ; if ( name in nodeFilters ) { list = matchedNodes [ name ] ; if ( list ) { list . push ( node ) } else { matchedNodes [ name ] = [ node ] } } return node } function removeWhitespaceBefore ( node ) { var textNode , textVal , sibling ; for ( textNode = node . prev ; textNode && textNode . type === 3 ; ) { textVal = textNode . value . replace ( endWhiteSpaceRegExp , "" ) ; if ( textVal . length > 0 ) { textNode . value = textVal ; textNode = textNode . prev } else { sibling = textNode . prev ; textNode . remove ( ) ; textNode = sibling } } } function cloneAndExcludeBlocks ( input ) { var name , output = { } ; for ( name in input ) { if ( name !== "li" && name != "p" ) { output [ name ] = input [ name ] } } return output } parser = new SaxParser ( { validate : validate , allow _script _urls : settings . allow _script _urls , allow _conditional _comments : settings . allow _conditional _comments , self _closing _elements : cloneAndExcludeBlocks ( schema . getSelfClosingElements ( ) ) , cdata : function ( text ) { node . append ( createNode ( "#cdata" , 4 ) ) . value = text } , text : function ( text , raw ) { var textNode ; if ( ! isInWhiteSpacePreservedElement ) { text = text . replace ( allWhiteSpaceRegExp , " " ) ; if ( node . lastChild && blockElements [ node . lastChild . name ] ) { text = text . replace ( startWhiteSpaceRegExp , "" ) } } if ( text . length !== 0 ) { textNode = createNode ( "#text" , 3 ) ; textNode . raw = ! ! raw ; node . append ( textNode ) . value = text } } , comment : function ( text ) { node . append ( createNode ( "#comment" , 8 ) ) . value = text } , pi : function ( name , text ) { node . append ( createNode ( name , 7 ) ) . value = text ; removeWhitespaceBefore ( node ) } , doctype : function ( text ) { var newNode ; newNode = node . append ( createNode ( "#doctype" , 10 ) ) ; newNode . value = text ; removeWhitespaceBefore ( node ) } , start : function ( name , attrs , empty ) { var newNode , attrFiltersLen , elementRule , attrName , parent ; elementRule = validate ? schema . getElementRule ( name ) : { } ; if ( elementRule ) { newNode = createNode ( elementRule . outputName || name , 1 ) ; newNode . attributes = attrs ; newNode . shortEnded = empty ; node . append ( newNode ) ; parent = children [ node . name ] ; if ( parent && children [ newNode . name ] && ! parent [ newNode . name ] ) { invalidChildren . push ( newNode ) } attrFiltersLen = attributeFilters . length ; while ( attrFiltersLen -- ) { attrName = attributeFilters [ attrFiltersLen ] . name ; if ( attrName in attrs . map ) { list = matchedAttributes [ attrName ] ; if ( list ) { list . push ( newNode ) } else { matchedAttributes [ attrName ] = [ newNode ] } } } if ( blockElements [ name ] ) { removeWhitespaceBefore ( newNode )
} catch ( ex ) { } } function controlSelect ( elm ) { var ctrlRng ; if ( ! isIE ) { return } ctrlRng = editableDoc . body . createControlRange ( ) ; try { ctrlRng . addElement ( elm ) ; ctrlRng . select ( ) ; return true } catch ( ex ) { } } editor . on ( "init" , function ( ) { if ( isIE ) { editor . on ( "ObjectResized" , function ( e ) { if ( e . target . nodeName != "TABLE" ) { hideResizeRect ( ) ; controlSelect ( e . target ) } } ) ; attachEvent ( editor . getBody ( ) , "controlselect" , nativeControlSelect ) ; editor . on ( "mousedown" , function ( e ) { lastMouseDownEvent = e } ) } else { disableGeckoResize ( ) ; if ( Env . ie >= 11 ) { editor . on ( "mouseup" , function ( e ) { var nodeName = e . target . nodeName ; if ( /^(TABLE|IMG|HR)$/ . test ( nodeName ) ) { editor . selection . select ( e . target , nodeName == "TABLE" ) ; editor . nodeChanged ( ) } } ) ; editor . dom . bind ( editor . getBody ( ) , "mscontrolselect" , function ( e ) { if ( /^(TABLE|IMG|HR)$/ . test ( e . target . nodeName ) ) { e . preventDefault ( ) } } ) } } editor . on ( "nodechange mousedown mouseup ResizeEditor" , updateResizeRect ) ; editor . on ( "keydown keyup" , function ( e ) { if ( selectedElm && selectedElm . nodeName == "TABLE" ) { updateResizeRect ( e ) } } ) } ) ; function destroy ( ) { selectedElm = selectedElmGhost = null ; if ( isIE ) { detachResizeStartListener ( ) ; detachEvent ( editor . getBody ( ) , "controlselect" , nativeControlSelect ) } } return { controlSelect : controlSelect , destroy : destroy } } } ) ; define ( "tinymce/dom/Selection" , [ "tinymce/dom/TreeWalker" , "tinymce/dom/TridentSelection" , "tinymce/dom/ControlSelection" , "tinymce/Env" , "tinymce/util/Tools" ] , function ( TreeWalker , TridentSelection , ControlSelection , Env , Tools ) { var each = Tools . each , grep = Tools . grep , trim = Tools . trim ; var isIE = Env . ie , isOpera = Env . opera ; function Selection ( dom , win , serializer , editor ) { var self = this ; self . dom = dom ; self . win = win ; self . serializer = serializer ; self . editor = editor ; self . controlSelection = new ControlSelection ( self , editor ) ; if ( ! self . win . getSelection ) { self . tridentSel = new TridentSelection ( self ) } } Selection . prototype = { setCursorLocation : function ( node , offset ) { var self = this , rng = self . dom . createRng ( ) ; rng . setStart ( node , offset ) ; rng . setEnd ( node , offset ) ; self . setRng ( rng ) ; self . collapse ( false ) } , getContent : function ( args ) { var self = this , rng = self . getRng ( ) , tmpElm = self . dom . create ( "body" ) ; var se = self . getSel ( ) , whiteSpaceBefore , whiteSpaceAfter , fragment ; args = args || { } ; whiteSpaceBefore = whiteSpaceAfter = "" ; args . get = true ; args . format = args . format || "html" ; args . selection = true ; self . editor . fire ( "BeforeGetContent" , args ) ; if ( args . format == "text" ) { return self . isCollapsed ( ) ? "" : rng . text || ( se . toString ? se . toString ( ) : "" ) } if ( rng . cloneContents ) { fragment = rng . cloneContents ( ) ; if ( fragment ) { tmpElm . appendChild ( fragment ) } } else if ( rng . item !== undefined || rng . htmlText !== undefined ) { tmpElm . innerHTML = "<br>" + ( rng . item ? rng . item ( 0 ) . outerHTML : rng . htmlText ) ; tmpElm . removeChild ( tmpElm . firstChild ) } else { tmpElm . innerHTML = rng . toString ( ) } if ( /^\s/ . test ( tmpElm . innerHTML ) ) { whiteSpaceBefore = " " } if ( /\s+$/ . test ( tmpElm . innerHTML ) ) { whiteSpaceAfter = " " } args . getInner = true ; args . content = self . isCollapsed ( ) ? "" : whiteSpaceBefore + self . serializer . serialize ( tmpElm , args ) + whiteSpaceAfter ; self . editor . fire ( "GetContent" , args ) ; return args . content } , setContent : function ( content , args ) { var self = this , rng = self . getRng ( ) , caretNode , doc = self . win . document , frag , temp ; args = args || { format : "html" } ; args . set = true ; args . selection = true ; content = args . content = content ; if ( ! args . no _events ) { self . editor . fire ( "BeforeSetContent" , args ) } content = args . content ; if ( rng . insertNode ) { content += '<span id="__caret">_</span>' ; if ( rng . startContainer == doc && rng . endContainer == doc ) { doc . body . innerHTML = content } else { rng . deleteContents ( ) ; if ( doc . body . childNodes . length === 0 ) { doc . body . innerHTML = content } else { if ( rng . createContextualFragment ) { rng . insertNode ( rng . createContextualFragment ( content ) ) } else { frag = doc . createDocumentFragment ( ) ; temp = doc . createElement ( "div" ) ; frag . appendChild ( temp ) ; temp . outerHTML = content ; rng . insertNode ( frag ) } } } caretNode = self . dom . get ( "__caret" ) ; rng = doc . createRange ( ) ; rng . setStartBefore ( caretNode ) ; rng . setEndBefore ( caretNode ) ; self . setRng ( rng ) ; self . dom . remove ( "__caret" ) ; try { self . setRng ( rng ) } catch ( ex ) { } } else { if ( rng . item ) { doc . execCommand ( "Delete" , false , null ) ; rng = self . getRng ( ) } if ( /^\s+/ . test ( content ) ) { rng . pasteHTML ( '<span id="__mce_tmp">_</span>' + content ) ; self . dom . remove ( "__mce_tmp" ) } else { rng . pasteHTML ( content ) } } if ( ! args . no
2015-01-08 00:36:28 +08:00
wrapElm = dom . create ( wrapName ) ; setElementFormat ( wrapElm ) ; rangeUtils . walk ( rng , function ( nodes ) { var currentWrapElm ; function process ( node ) { var nodeName , parentName , found , hasContentEditableState , lastContentEditable ; lastContentEditable = contentEditable ; nodeName = node . nodeName . toLowerCase ( ) ; parentName = node . parentNode . nodeName . toLowerCase ( ) ; if ( node . nodeType === 1 && getContentEditable ( node ) ) { lastContentEditable = contentEditable ; contentEditable = getContentEditable ( node ) === "true" ; hasContentEditableState = true } if ( isEq ( nodeName , "br" ) ) { currentWrapElm = 0 ; if ( format . block ) { dom . remove ( node ) } return } if ( format . wrapper && matchNode ( node , name , vars ) ) { currentWrapElm = 0 ; return } if ( contentEditable && ! hasContentEditableState && format . block && ! format . wrapper && isTextBlock ( nodeName ) && isValid ( parentName , wrapName ) ) { node = dom . rename ( node , wrapName ) ; setElementFormat ( node ) ; newWrappers . push ( node ) ; currentWrapElm = 0 ; return } if ( format . selector ) { each ( formatList , function ( format ) { if ( "collapsed" in format && format . collapsed !== isCollapsed ) { return } if ( dom . is ( node , format . selector ) && ! isCaretNode ( node ) ) { setElementFormat ( node , format ) ; found = true } } ) ; if ( ! format . inline || found ) { currentWrapElm = 0 ; return } } if ( contentEditable && ! hasContentEditableState && isValid ( wrapName , nodeName ) && isValid ( parentName , wrapName ) && ! ( ! node _specific && node . nodeType === 3 && node . nodeValue . length === 1 && node . nodeValue . charCodeAt ( 0 ) === 65279 ) && ! isCaretNode ( node ) && ( ! format . inline || ! isBlock ( node ) ) ) { if ( ! currentWrapElm ) { currentWrapElm = dom . clone ( wrapElm , FALSE ) ; node . parentNode . insertBefore ( currentWrapElm , node ) ; newWrappers . push ( currentWrapElm ) } currentWrapElm . appendChild ( node ) } else if ( nodeName == "li" && bookmark ) { currentWrapElm = applyStyleToList ( node , bookmark , wrapElm , newWrappers , process ) } else { currentWrapElm = 0 ; each ( grep ( node . childNodes ) , process ) ; if ( hasContentEditableState ) { contentEditable = lastContentEditable } currentWrapElm = 0 } } each ( nodes , process ) } ) ; if ( format . wrap _links === false ) { each ( newWrappers , function ( node ) { function process ( node ) { var i , currentWrapElm , children ; if ( node . nodeName === "A" ) { currentWrapElm = dom . clone ( wrapElm , FALSE ) ; newWrappers . push ( currentWrapElm ) ; children = grep ( node . childNodes ) ; for ( i = 0 ; i < children . length ; i ++ ) { currentWrapElm . appendChild ( children [ i ] ) } node . appendChild ( currentWrapElm ) } each ( grep ( node . childNodes ) , process ) } process ( node ) } ) } each ( newWrappers , function ( node ) { var childCount ; function getChildCount ( node ) { var count = 0 ; each ( node . childNodes , function ( node ) { if ( ! isWhiteSpaceNode ( node ) && ! isBookmarkNode ( node ) ) { count ++ } } ) ; return count } function mergeStyles ( node ) { var child , clone ; each ( node . childNodes , function ( node ) { if ( node . nodeType == 1 && ! isBookmarkNode ( node ) && ! isCaretNode ( node ) ) { child = node ; return FALSE } } ) ; if ( child && matchName ( child , format ) ) { clone = dom . clone ( child , FALSE ) ; setElementFormat ( clone ) ; dom . replace ( clone , node , TRUE ) ; dom . remove ( child , 1 ) } return clone || node } childCount = getChildCount ( node ) ; if ( ( newWrappers . length > 1 || ! isBlock ( node ) ) && childCount === 0 ) { dom . remove ( node , 1 ) ; return } if ( format . inline || format . wrapper ) { if ( ! format . exact && childCount === 1 ) { node = mergeStyles ( node ) } each ( formatList , function ( format ) { each ( dom . select ( format . inline , node ) , function ( child ) { var parent ; if ( format . wrap _links === false ) { parent = child . parentNode ; do { if ( parent . nodeName === "A" ) { return } } while ( parent = parent . parentNode ) } removeFormat ( format , vars , child , format . exact ? child : null ) } ) } ) ; if ( matchNode ( node . parentNode , name , vars ) ) { dom . remove ( node , 1 ) ; node = 0 ; return TRUE } if ( format . merge _with _parents ) { dom . getParent ( node . parentNode , function ( parent ) { if ( matchNode ( parent , name , vars ) ) { dom . remove ( node , 1 ) ; node = 0 ; return TRUE } } ) } if ( node && format . merge _siblings !== false ) { node = mergeSiblings ( getNonWhiteSpaceSibling ( node ) , node ) ; node = mergeSiblings ( node , getNonWhiteSpaceSibling ( node , TRUE ) ) } } } ) } if ( format ) { if ( node ) { if ( node . nodeType ) { rng = dom . createRng ( ) ; rng . setStartBefore ( node ) ; rng . setEndAfter ( node ) ; applyRngStyle ( expandRng ( rng , formatList ) , null , true ) } else { applyRngStyle ( node , null , true ) } } else { if ( ! isCollapsed || ! format . inline || dom . select ( "td.mce-item-selected,th.mce-item-selected" ) . length ) { var curSelNode = ed . selection . getNode ( ) ; if ( ! forcedRootBlock && formatList [ 0 ] . defaultBlock && ! dom . getParent ( curSelNode , dom . isBlock ) ) { apply ( formatList [ 0 ] . default
} } ) ; self = { data : data , typing : false , beforeChange : function ( ) { if ( ! lock ) { beforeBookmark = editor . selection . getBookmark ( 2 , true ) } } , setCanAdd : function ( status ) { canAdd = status } , add : function ( level ) { if ( ! canAdd ) { log ( "cant add history" ) ; return } log ( "add history" ) ; var i , settings = editor . settings , lastLevel ; level = level || { } ; level . content = getContent ( ) ; if ( lock || editor . fire ( "BeforeAddUndo" , { level : level } ) . isDefaultPrevented ( ) ) { return null } lastLevel = data [ index ] ; if ( lastLevel && lastLevel . content == level . content ) { return null } if ( data [ index ] ) { data [ index ] . beforeBookmark = beforeBookmark } if ( settings . custom _undo _redo _levels ) { if ( data . length > settings . custom _undo _redo _levels ) { for ( i = 0 ; i < data . length - 1 ; i ++ ) { data [ i ] = data [ i + 1 ] } data . length -- ; index = data . length } } level . bookmark = editor . selection . getBookmark ( 2 , true ) ; if ( index < data . length - 1 ) { data . length = index + 1 } data . push ( level ) ; index = data . length - 1 ; var args = { level : level , lastLevel : lastLevel } ; editor . fire ( "AddUndo" , args ) ; if ( index > 0 ) { editor . fire ( "change" , args ) ; editor . isNotDirty = false } return level } , undo : function ( ) { var level ; if ( self . typing ) { self . add ( ) ; self . typing = false } if ( index > 0 ) { level = data [ -- index ] ; if ( index === 0 ) { editor . isNotDirty = true } editor . setContent ( level . content , { format : "raw" } ) ; editor . selection . moveToBookmark ( level . beforeBookmark ) ; editor . fire ( "undo" , { level : level } ) } return level } , redo : function ( ) { var level ; if ( index < data . length - 1 ) { level = data [ ++ index ] ; editor . setContent ( level . content , { format : "raw" } ) ; editor . selection . moveToBookmark ( level . bookmark ) ; editor . fire ( "redo" , { level : level } ) } return level } , clear : function ( ) { data = [ ] ; index = 0 ; self . typing = false ; editor . fire ( "ClearUndos" ) } , hasUndo : function ( ) { return index > 0 || self . typing && data [ 0 ] && getContent ( ) != data [ 0 ] . content } , hasRedo : function ( ) { return index < data . length - 1 && ! this . typing } , transact : function ( callback ) { self . beforeChange ( ) ; lock = true ; callback ( ) ; lock = false ; self . add ( ) } } ; return self } } ) ; define ( "tinymce/EnterKey" , [ "tinymce/dom/TreeWalker" , "tinymce/Env" ] , function ( TreeWalker , Env ) { var isIE = Env . ie && Env . ie < 11 ; return function ( editor ) { var dom = editor . dom , selection = editor . selection , settings = editor . settings ; var undoManager = editor . undoManager , schema = editor . schema , nonEmptyElementsMap = schema . getNonEmptyElements ( ) ; function handleEnterKey ( evt ) { var rng = selection . getRng ( true ) , tmpRng , editableRoot , container , offset , parentBlock , documentMode , shiftKey , newBlock , fragment , containerBlock , parentBlockName , containerBlockName , newBlockName , isAfterLastNodeInContainer ; function canSplitBlock ( node ) { return node && dom . isBlock ( node ) && ! /^(TD|TH|CAPTION|FORM)$/ . test ( node . nodeName ) && ! /^(fixed|absolute)/i . test ( node . style . position ) && dom . getContentEditable ( node ) !== "true" } function renderBlockOnIE ( block ) { var oldRng ; if ( dom . isBlock ( block ) ) { oldRng = selection . getRng ( ) ; block . appendChild ( dom . create ( "span" , null , " " ) ) ; selection . select ( block ) ; block . lastChild . outerHTML = "" ; selection . setRng ( oldRng ) } } function trimInlineElementsOnLeftSideOfBlock ( block ) { var node = block , firstChilds = [ ] , i ; while ( node = node . firstChild ) { if ( dom . isBlock ( node ) ) { return } if ( node . nodeType == 1 && ! nonEmptyElementsMap [ node . nodeName . toLowerCase ( ) ] ) { firstChilds . push ( node ) } } i = firstChilds . length ; while ( i -- ) { node = firstChilds [ i ] ; if ( ! node . hasChildNodes ( ) || node . firstChild == node . lastChild && node . firstChild . nodeValue === "" ) { dom . remove ( node ) } else { if ( node . nodeName == "A" && ( node . innerText || node . textContent ) === " " ) { dom . remove ( node ) } } } } function moveToCaretPosition ( root ) { var walker , node , rng , lastNode = root , tempElm ; function firstNonWhiteSpaceNodeSibling ( node ) { while ( node ) { if ( node . nodeType == 1 || node . nodeType == 3 && node . data && /[\r\n\s]/ . test ( node . data ) ) { return node } node = node . nextSibling } } if ( root . nodeName == "LI" ) { var firstChild = firstNonWhiteSpaceNodeSibling ( root . firstChild ) ; if ( firstChild && /^(UL|OL)$/ . test ( firstChild . nodeName ) ) { root . insertBefore ( dom . doc . createTextNode ( " " ) , root . firstChild ) } } rng = dom . createRng ( ) ; if ( root . hasChildNodes ( ) ) { walker = new TreeWalker ( root , root ) ; while ( node = walker . current ( ) ) { if ( node . nodeType == 3 ) { rng . setStart ( node , 0 ) ; rng . setEnd ( node , 0 ) ; break } if ( nonEmptyElementsMap [ node . nodeName . toLowerCase ( ) ] ) { rng . setStartBefore ( node ) ; rng . setEndBefore ( node ) ; break } lastNode = node ; node = walker . next ( ) } if ( ! node ) { rng . setStart ( lastNo
break } } } if ( breakPoint === 1 ) { return path } for ( i = 0 , l = base . length - ( breakPoint - 1 ) ; i < l ; i ++ ) { out += "../" } for ( i = breakPoint - 1 , l = items . length ; i < l ; i ++ ) { if ( i != breakPoint - 1 ) { out += "/" + items [ i ] } else { out += items [ i ] } } return out } , toAbsPath : function ( base , path ) { var i , nb = 0 , o = [ ] , tr , outPath ; tr = /\/$/ . test ( path ) ? "/" : "" ; base = base . split ( "/" ) ; path = path . split ( "/" ) ; each ( base , function ( k ) { if ( k ) { o . push ( k ) } } ) ; base = o ; for ( i = path . length - 1 , o = [ ] ; i >= 0 ; i -- ) { if ( path [ i ] . length === 0 || path [ i ] === "." ) { continue } if ( path [ i ] === ".." ) { nb ++ ; continue } if ( nb > 0 ) { nb -- ; continue } o . push ( path [ i ] ) } i = base . length - nb ; if ( i <= 0 ) { outPath = o . reverse ( ) . join ( "/" ) } else { outPath = base . slice ( 0 , i ) . join ( "/" ) + "/" + o . reverse ( ) . join ( "/" ) } if ( outPath . indexOf ( "/" ) !== 0 ) { outPath = "/" + outPath } if ( tr && outPath . lastIndexOf ( "/" ) !== outPath . length - 1 ) { outPath += tr } return outPath } , getURI : function ( noProtoHost ) { var s , self = this ; if ( ! self . source || noProtoHost ) { s = "" ; if ( ! noProtoHost ) { if ( self . protocol ) { s += self . protocol + "://" } if ( self . userInfo ) { s += self . userInfo + "@" } if ( self . host ) { s += self . host } if ( self . port ) { s += ":" + self . port } } if ( self . path ) { s += self . path } if ( self . query ) { s += "?" + self . query } if ( self . anchor ) { s += "#" + self . anchor } self . source = s } return self . source } } ; return URI } ) ; define ( "tinymce/util/Class" , [ "tinymce/util/Tools" ] , function ( Tools ) { var each = Tools . each , extend = Tools . extend ; var extendClass , initializing ; function Class ( ) { } Class . extend = extendClass = function ( prop ) { var Self = this , _super = Self . prototype , prototype , name , member ; function Class ( ) { var i , mixins , mixin , self ; if ( ! initializing ) { self = this ; if ( self . init ) { self . init . apply ( self , arguments ) } mixins = self . Mixins ; if ( mixins ) { i = mixins . length ; while ( i -- ) { mixin = mixins [ i ] ; if ( mixin . init ) { mixin . init . apply ( self , arguments ) } } } } } function dummy ( ) { return this } function createMethod ( name , fn ) { return function ( ) { var self = this , tmp = self . _super , ret ; self . _super = _super [ name ] ; ret = fn . apply ( self , arguments ) ; self . _super = tmp ; return ret } } initializing = true ; prototype = new Self ; initializing = false ; if ( prop . Mixins ) { each ( prop . Mixins , function ( mixin ) { mixin = mixin ; for ( var name in mixin ) { if ( name !== "init" ) { prop [ name ] = mixin [ name ] } } } ) ; if ( _super . Mixins ) { prop . Mixins = _super . Mixins . concat ( prop . Mixins ) } } if ( prop . Methods ) { each ( prop . Methods . split ( "," ) , function ( name ) { prop [ name ] = dummy } ) } if ( prop . Properties ) { each ( prop . Properties . split ( "," ) , function ( name ) { var fieldName = "_" + name ; prop [ name ] = function ( value ) { var self = this , undef ; if ( value !== undef ) { self [ fieldName ] = value ; return self } return self [ fieldName ] } } ) } if ( prop . Statics ) { each ( prop . Statics , function ( func , name ) { Class [ name ] = func } ) } if ( prop . Defaults && _super . Defaults ) { prop . Defaults = extend ( { } , _super . Defaults , prop . Defaults ) } for ( name in prop ) { member = prop [ name ] ; if ( typeof member == "function" && _super [ name ] ) { prototype [ name ] = createMethod ( name , member ) } else { prototype [ name ] = member } } Class . prototype = prototype ; Class . constructor = Class ; Class . extend = extendClass ; return Class } ; return Class } ) ; define ( "tinymce/ui/Selector" , [ "tinymce/util/Class" ] , function ( Class ) { "use strict" ; function unique ( array ) { var uniqueItems = [ ] , i = array . length , item ; while ( i -- ) { item = array [ i ] ; if ( ! item . _ _checked ) { uniqueItems . push ( item ) ; item . _ _checked = 1 } } i = uniqueItems . length ; while ( i -- ) { delete uniqueItems [ i ] . _ _checked } return uniqueItems } var expression = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i ; var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g , whiteSpace = /^\s*|\s*$/g , Collection ; var Selector = Class . extend ( { init : function ( selector ) { var match = this . match ; function compileNameFilter ( name ) { if ( name ) { name = name . toLowerCase ( ) ; return function ( item ) { return name === "*" || item . type === name } } } function compileIdFilter ( id ) { if ( id ) { return function ( item ) { return item . _name === id } } } function compileClassesFilter ( classes ) { if ( classes ) { classes = classes . split ( "." ) ; return function ( item ) { var i = classes . length ; while ( i -- ) { if ( ! item . hasClass ( classes [ i ] ) ) { return false } } return true } } } function compileAttrFilter ( name , cmp , check ) { if ( name ) { return function ( item ) { var value = item [ name ] ? item [ name ] ( ) : "" ; return ! cmp ? ! ! check : cmp === "=" ? value === check : cmp === "*=" ? value . indexOf ( check ) >= 0 : cmp ===
for ( var name in data ) { self . find ( "#" + name ) . value ( data [ name ] ) } return self } , toJSON : function ( ) { var self = this , data = { } ; self . find ( "*" ) . each ( function ( ctrl ) { var name = ctrl . name ( ) , value = ctrl . value ( ) ; if ( name && typeof value != "undefined" ) { data [ name ] = value } } ) ; return data } , preRender : function ( ) { } , renderHtml : function ( ) { var self = this , layout = self . _layout ; self . preRender ( ) ; layout . preRender ( self ) ; return '<div id="' + self . _id + '" class="' + self . classes ( ) + '" role="' + this . settings . role + '">' + '<div id="' + self . _id + '-body" class="' + self . classes ( "body" ) + '">' + ( self . settings . html || "" ) + layout . renderHtml ( self ) + "</div>" + "</div>" } , postRender : function ( ) { var self = this , box ; self . items ( ) . exec ( "postRender" ) ; self . _super ( ) ; self . _layout . postRender ( self ) ; self . _rendered = true ; if ( self . settings . style ) { DomUtils . css ( self . getEl ( ) , self . settings . style ) } if ( self . settings . border ) { box = self . borderBox ( ) ; DomUtils . css ( self . getEl ( ) , { "border-top-width" : box . top , "border-right-width" : box . right , "border-bottom-width" : box . bottom , "border-left-width" : box . left } ) } return self } , initLayoutRect : function ( ) { var self = this , layoutRect = self . _super ( ) ; self . _layout . recalc ( self ) ; return layoutRect } , recalc : function ( ) { var self = this , rect = self . _layoutRect , lastRect = self . _lastRect ; if ( ! lastRect || lastRect . w != rect . w || lastRect . h != rect . h ) { self . _layout . recalc ( self ) ; rect = self . layoutRect ( ) ; self . _lastRect = { x : rect . x , y : rect . y , w : rect . w , h : rect . h } ; return true } } , reflow : function ( ) { var i , items ; if ( this . visible ( ) ) { Control . repaintControls = [ ] ; Control . repaintControls . map = { } ; items = this . recalc ( ) ; i = Control . repaintControls . length ; while ( i -- ) { Control . repaintControls [ i ] . repaint ( ) } if ( this . settings . layout !== "flow" && this . settings . layout !== "stack" ) { this . repaint ( ) } Control . repaintControls = [ ] } return this } } ) } ) ; define ( "tinymce/ui/DragHelper" , [ "tinymce/ui/DomUtils" ] , function ( DomUtils ) { "use strict" ; function getDocumentSize ( ) { var doc = document , documentElement , body , scrollWidth , clientWidth ; var offsetWidth , scrollHeight , clientHeight , offsetHeight , max = Math . max ; documentElement = doc . documentElement ; body = doc . body ; scrollWidth = max ( documentElement . scrollWidth , body . scrollWidth ) ; clientWidth = max ( documentElement . clientWidth , body . clientWidth ) ; offsetWidth = max ( documentElement . offsetWidth , body . offsetWidth ) ; scrollHeight = max ( documentElement . scrollHeight , body . scrollHeight ) ; clientHeight = max ( documentElement . clientHeight , body . clientHeight ) ; offsetHeight = max ( documentElement . offsetHeight , body . offsetHeight ) ; return { width : scrollWidth < offsetWidth ? clientWidth : scrollWidth , height : scrollHeight < offsetHeight ? clientHeight : scrollHeight } } return function ( id , settings ) { var eventOverlayElm , doc = document , downButton , start , stop , drag , startX , startY ; settings = settings || { } ; function getHandleElm ( ) { return doc . getElementById ( settings . handle || id ) } start = function ( e ) { var docSize = getDocumentSize ( ) , handleElm , cursor ; e . preventDefault ( ) ; downButton = e . button ; handleElm = getHandleElm ( ) ; startX = e . screenX ; startY = e . screenY ; if ( window . getComputedStyle ) { cursor = window . getComputedStyle ( handleElm , null ) . getPropertyValue ( "cursor" ) } else { cursor = handleElm . runtimeStyle . cursor } eventOverlayElm = doc . createElement ( "div" ) ; DomUtils . css ( eventOverlayElm , { position : "absolute" , top : 0 , left : 0 , width : docSize . width , height : docSize . height , zIndex : 2147483647 , opacity : 1e-4 , background : "red" , cursor : cursor } ) ; doc . body . appendChild ( eventOverlayElm ) ; DomUtils . on ( doc , "mousemove" , drag ) ; DomUtils . on ( doc , "mouseup" , stop ) ; settings . start ( e ) } ; drag = function ( e ) { if ( e . button !== downButton ) { return stop ( e ) } e . deltaX = e . screenX - startX ; e . deltaY = e . screenY - startY ; e . preventDefault ( ) ; settings . drag ( e ) } ; stop = function ( e ) { DomUtils . off ( doc , "mousemove" , drag ) ; DomUtils . off ( doc , "mouseup" , stop ) ; eventOverlayElm . parentNode . removeChild ( eventOverlayElm ) ; if ( settings . stop ) { settings . stop ( e ) } } ; this . destroy = function ( ) { DomUtils . off ( getHandleElm ( ) ) } ; DomUtils . on ( getHandleElm ( ) , "mousedown" , start ) } } ) ; define ( "tinymce/ui/Scrollable" , [ "tinymce/ui/DomUtils" , "tinymce/ui/DragHelper" ] , function ( DomUtils , DragHelper ) { "use strict" ; return { init : function ( ) { var self = this ; self . on ( "repaint" , self . renderScroll ) } , renderScroll : function ( ) { var self = this , margin = 2 ; function repaintScroll ( ) { var hasScrollH , hasScrollV , bodyElm ; function repaintAxis ( axisName
return function ( ) { var target = selection . getStart ( ) ; if ( target !== editor . getBody ( ) ) { dom . setAttrib ( target , "style" , null ) ; each ( template , function ( attr ) { target . setAttributeNode ( attr . cloneNode ( true ) ) } ) } } } function isSelectionAcrossElements ( ) { return ! selection . isCollapsed ( ) && dom . getParent ( selection . getStart ( ) , dom . isBlock ) != dom . getParent ( selection . getEnd ( ) , dom . isBlock ) } editor . on ( "keypress" , function ( e ) { var applyAttributes ; if ( ! isDefaultPrevented ( e ) && ( e . keyCode == 8 || e . keyCode == 46 ) && isSelectionAcrossElements ( ) ) { applyAttributes = getAttributeApplyFunction ( ) ; editor . getDoc ( ) . execCommand ( "delete" , false , null ) ; applyAttributes ( ) ; e . preventDefault ( ) ; return false } } ) ; dom . bind ( editor . getDoc ( ) , "cut" , function ( e ) { var applyAttributes ; if ( ! isDefaultPrevented ( e ) && isSelectionAcrossElements ( ) ) { applyAttributes = getAttributeApplyFunction ( ) ; setTimeout ( function ( ) { applyAttributes ( ) } , 0 ) } } ) } function selectionChangeNodeChanged ( ) { var lastRng , selectionTimer ; editor . on ( "selectionchange" , function ( ) { if ( selectionTimer ) { clearTimeout ( selectionTimer ) ; selectionTimer = 0 } selectionTimer = window . setTimeout ( function ( ) { var rng = selection . getRng ( ) ; if ( ! lastRng || ! RangeUtils . compareRanges ( rng , lastRng ) ) { editor . nodeChanged ( ) ; lastRng = rng } } , 50 ) } ) } function ensureBodyHasRoleApplication ( ) { document . body . setAttribute ( "role" , "application" ) } function disableBackspaceIntoATable ( ) { editor . on ( "keydown" , function ( e ) { if ( ! isDefaultPrevented ( e ) && e . keyCode === BACKSPACE ) { if ( selection . isCollapsed ( ) && selection . getRng ( true ) . startOffset === 0 ) { var previousSibling = selection . getNode ( ) . previousSibling ; if ( previousSibling && previousSibling . nodeName && previousSibling . nodeName . toLowerCase ( ) === "table" ) { e . preventDefault ( ) ; return false } } } } ) } function addNewLinesBeforeBrInPre ( ) { if ( getDocumentMode ( ) > 7 ) { return } setEditorCommandState ( "RespectVisibilityInDesign" , true ) ; editor . contentStyles . push ( ".mceHideBrInPre pre br {display: none}" ) ; dom . addClass ( editor . getBody ( ) , "mceHideBrInPre" ) ; parser . addNodeFilter ( "pre" , function ( nodes ) { var i = nodes . length , brNodes , j , brElm , sibling ; while ( i -- ) { brNodes = nodes [ i ] . getAll ( "br" ) ; j = brNodes . length ; while ( j -- ) { brElm = brNodes [ j ] ; sibling = brElm . prev ; if ( sibling && sibling . type === 3 && sibling . value . charAt ( sibling . value - 1 ) != "\n" ) { sibling . value += "\n" } else { brElm . parent . insert ( new Node ( "#text" , 3 ) , brElm , true ) . value = "\n" } } } } ) ; serializer . addNodeFilter ( "pre" , function ( nodes ) { var i = nodes . length , brNodes , j , brElm , sibling ; while ( i -- ) { brNodes = nodes [ i ] . getAll ( "br" ) ; j = brNodes . length ; while ( j -- ) { brElm = brNodes [ j ] ; sibling = brElm . prev ; if ( sibling && sibling . type == 3 ) { sibling . value = sibling . value . replace ( /\r?\n$/ , "" ) } } } } ) } function removePreSerializedStylesWhenSelectingControls ( ) { dom . bind ( editor . getBody ( ) , "mouseup" , function ( ) { var value , node = selection . getNode ( ) ; if ( node . nodeName == "IMG" ) { if ( value = dom . getStyle ( node , "width" ) ) { dom . setAttrib ( node , "width" , value . replace ( /[^0-9%]+/g , "" ) ) ; dom . setStyle ( node , "width" , "" ) } if ( value = dom . getStyle ( node , "height" ) ) { dom . setAttrib ( node , "height" , value . replace ( /[^0-9%]+/g , "" ) ) ; dom . setStyle ( node , "height" , "" ) } } } ) } function keepInlineElementOnDeleteBackspace ( ) { editor . on ( "keydown" , function ( e ) { var isDelete , rng , container , offset , brElm , sibling , collapsed , nonEmptyElements ; isDelete = e . keyCode == DELETE ; if ( ! isDefaultPrevented ( e ) && ( isDelete || e . keyCode == BACKSPACE ) && ! VK . modifierPressed ( e ) ) { rng = selection . getRng ( ) ; container = rng . startContainer ; offset = rng . startOffset ; collapsed = rng . collapsed ; if ( container . nodeType == 3 && container . nodeValue . length > 0 && ( offset === 0 && ! collapsed || collapsed && offset === ( isDelete ? 0 : 1 ) ) ) { sibling = container . previousSibling ; if ( sibling && sibling . nodeName == "IMG" ) { return } nonEmptyElements = editor . schema . getNonEmptyElements ( ) ; e . preventDefault ( ) ; brElm = dom . create ( "br" , { id : "__tmp" } ) ; container . parentNode . insertBefore ( brElm , container ) ; editor . getDoc ( ) . execCommand ( isDelete ? "ForwardDelete" : "Delete" , false , null ) ; container = selection . getRng ( ) . startContainer ; sibling = container . previousSibling ; if ( sibling && sibling . nodeType == 1 && ! dom . isBlock ( sibling ) && dom . isEmpty ( sibling ) && ! nonEmptyElements [ sibling . nodeName . toLowerCase ( ) ] ) { dom . remove ( sibling ) } dom . remove ( "__tmp" ) } } } ) } function removeBlockQuoteOnBackSpace ( ) { editor . on ( "keydown" , function ( e ) { var rng , container , offset , roo
} , addQueryValueHandler : function ( name , callback , scope ) { this . queryValueCommands [ name ] = { func : callback , scope : scope || this } } , addShortcut : function ( pattern , desc , cmdFunc , scope ) { this . shortcuts . add ( pattern , desc , cmdFunc , scope ) } , execCommand : function ( cmd , ui , value , args ) { var self = this , state = 0 , cmdItem ; if ( ! /^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/ . test ( cmd ) && ( ! args || ! args . skip _focus ) ) { if ( cmd != "toggleCode" ) self . focus ( ) } args = extend ( { } , args ) ; args = self . fire ( "BeforeExecCommand" , { command : cmd , ui : ui , value : value } ) ; if ( args . isDefaultPrevented ( ) ) { return false } if ( cmdItem = self . execCommands [ cmd ] ) { if ( cmdItem . func . call ( cmdItem . scope , ui , value ) !== true ) { self . fire ( "ExecCommand" , { command : cmd , ui : ui , value : value } ) ; return true } } each ( self . plugins , function ( p ) { if ( p . execCommand && p . execCommand ( cmd , ui , value ) ) { self . fire ( "ExecCommand" , { command : cmd , ui : ui , value : value } ) ; state = true ; return false } } ) ; if ( state ) { return state } if ( self . theme && self . theme . execCommand && self . theme . execCommand ( cmd , ui , value ) ) { self . fire ( "ExecCommand" , { command : cmd , ui : ui , value : value } ) ; return true } if ( self . editorCommands . execCommand ( cmd , ui , value ) ) { self . fire ( "ExecCommand" , { command : cmd , ui : ui , value : value } ) ; return true } self . getDoc ( ) . execCommand ( cmd , ui , value ) ; self . fire ( "ExecCommand" , { command : cmd , ui : ui , value : value } ) } , queryCommandState : function ( cmd ) { var self = this , queryItem , returnVal ; if ( self . _isHidden ( ) ) { return } if ( queryItem = self . queryStateCommands [ cmd ] ) { returnVal = queryItem . func . call ( queryItem . scope ) ; if ( returnVal !== true ) { return returnVal } } returnVal = self . editorCommands . queryCommandState ( cmd ) ; if ( returnVal !== - 1 ) { return returnVal } try { return self . getDoc ( ) . queryCommandState ( cmd ) } catch ( ex ) { } } , queryCommandValue : function ( cmd ) { var self = this , queryItem , returnVal ; if ( self . _isHidden ( ) ) { return } if ( queryItem = self . queryValueCommands [ cmd ] ) { returnVal = queryItem . func . call ( queryItem . scope ) ; if ( returnVal !== true ) { return returnVal } } returnVal = self . editorCommands . queryCommandValue ( cmd ) ; if ( returnVal !== undefined ) { return returnVal } try { return self . getDoc ( ) . queryCommandValue ( cmd ) } catch ( ex ) { } } , show : function ( ) { var self = this ; DOM . show ( self . getContainer ( ) ) ; DOM . hide ( self . id ) ; self . load ( ) ; self . fire ( "show" ) } , hide : function ( ) { var self = this , doc = self . getDoc ( ) ; if ( ie && doc ) { doc . execCommand ( "SelectAll" ) } self . save ( ) ; DOM . hide ( self . getContainer ( ) ) ; DOM . setStyle ( self . id , "display" , self . orgDisplay ) ; self . fire ( "hide" ) } , isHidden : function ( ) { return ! DOM . isHidden ( this . id ) } , setProgressState : function ( state , time ) { this . fire ( "ProgressState" , { state : state , time : time } ) } , load : function ( args ) { var self = this , elm = self . getElement ( ) , html ; if ( elm ) { args = args || { } ; args . load = true ; html = self . setContent ( elm . value !== undefined ? elm . value : elm . innerHTML , args ) ; args . element = elm ; if ( ! args . no _events ) { self . fire ( "LoadContent" , args ) } args . element = elm = null ; return html } } , save : function ( args ) { var self = this , elm = self . getElement ( ) , html , form ; if ( ! elm || ! self . initialized ) { return } args = args || { } ; args . save = true ; args . element = elm ; html = args . content = self . getContent ( args ) ; if ( ! args . no _events ) { self . fire ( "SaveContent" , args ) } html = args . content ; if ( ! /TEXTAREA|INPUT/i . test ( elm . nodeName ) ) { elm . innerHTML = html ; if ( form = DOM . getParent ( self . id , "form" ) ) { each ( form . elements , function ( elm ) { if ( elm . name == self . id ) { elm . value = html ; return false } } ) } } else { elm . value = html } args . element = elm = null ; if ( args . set _dirty !== false ) { self . isNotDirty = true } return html } , setContent : function ( content , args ) { var self = this , body = self . getBody ( ) , forcedRootBlockName ; if ( LeaAce && LeaAce . canAce ) { var everContent = $ ( self . getBody ( ) ) ; if ( everContent ) { LeaAce . destroyAceFromContent ( everContent ) } } args = args || { } ; args . format = args . format || "html" ; args . set = true ; args . content = content ; if ( ! args . no _events ) { self . fire ( "BeforeSetContent" , args ) } content = args . content ; resizeEditor ( ) ; if ( content . length === 0 || /^\s+$/ . test ( content ) ) { forcedRootBlockName = self . settings . forced _root _block ; if ( forcedRootBlockName && self . schema . isValidChild ( body . nodeName . toLowerCase ( ) , forcedRootBlockName . toLowerCase ( ) ) ) { content = ie && ie < 11 ? "" : '<br data-mce-bogus="1">' ; content = self . dom . createHTML ( forcedRootBlockName , self . settings . forced _root _block _attrs , content ) } else if ( ! ie || ie < 11 ) { content = '<br data-mce-bogus="1">' } body . innerHTML = content ; se
var DOM = DomUtils . DOM ; return PanelButton . extend ( { init : function ( settings ) { this . _super ( settings ) ; this . addClass ( "colorbutton" ) } , color : function ( color ) { if ( color ) { this . _color = color ; this . getEl ( "preview" ) . style . backgroundColor = color ; return this } return this . _color } , renderHtml : function ( ) { var self = this , id = self . _id , prefix = self . classPrefix ; var icon = self . settings . icon ? prefix + "ico " + prefix + "i-" + self . settings . icon : "" ; var image = self . settings . image ? " style=\"background-image: url('" + self . settings . image + "')\"" : "" ; return '<div id="' + id + '" class="' + self . classes ( ) + '">' + '<button role="presentation" hidefocus type="button" tabindex="-1">' + ( icon ? '<i class="' + icon + '"' + image + "></i>" : "" ) + '<span id="' + id + '-preview" class="' + prefix + 'preview"></span>' + ( self . _text ? ( icon ? " " : "" ) + self . _text : "" ) + "</button>" + '<button type="button" class="' + prefix + 'open" hidefocus tabindex="-1">' + ' <i class="' + prefix + 'caret"></i>' + "</button>" + "</div>" } , postRender : function ( ) { var self = this , onClickHandler = self . settings . onclick ; self . on ( "click" , function ( e ) { if ( e . control == self && ! DOM . getParent ( e . target , "." + self . classPrefix + "open" ) ) { e . stopImmediatePropagation ( ) ; onClickHandler . call ( self , e ) } } ) ; delete self . settings . onclick ; return self . _super ( ) } } ) } ) ; define ( "tinymce/ui/ComboBox" , [ "tinymce/ui/Widget" , "tinymce/ui/DomUtils" ] , function ( Widget , DomUtils ) { "use strict" ; return Widget . extend ( { init : function ( settings ) { var self = this ; self . _super ( settings ) ; self . addClass ( "combobox" ) ; self . on ( "click" , function ( e ) { var elm = e . target ; while ( elm ) { if ( elm . id && elm . id . indexOf ( "-open" ) != - 1 ) { self . fire ( "action" ) } elm = elm . parentNode } } ) ; self . on ( "keydown" , function ( e ) { if ( e . target . nodeName == "INPUT" && e . keyCode == 13 ) { self . parents ( ) . reverse ( ) . each ( function ( ctrl ) { e . preventDefault ( ) ; self . fire ( "change" ) ; if ( ctrl . hasEventListeners ( "submit" ) && ctrl . toJSON ) { ctrl . fire ( "submit" , { data : ctrl . toJSON ( ) } ) ; return false } } ) } } ) ; if ( settings . placeholder ) { self . addClass ( "placeholder" ) ; self . on ( "focusin" , function ( ) { if ( ! self . _hasOnChange ) { DomUtils . on ( self . getEl ( "inp" ) , "change" , function ( ) { self . fire ( "change" ) } ) ; self . _hasOnChange = true } if ( self . hasClass ( "placeholder" ) ) { self . getEl ( "inp" ) . value = "" ; self . removeClass ( "placeholder" ) } } ) ; self . on ( "focusout" , function ( ) { if ( self . value ( ) . length === 0 ) { self . getEl ( "inp" ) . value = settings . placeholder ; self . addClass ( "placeholder" ) } } ) } } , value : function ( value ) { var self = this ; if ( typeof value != "undefined" ) { self . _value = value ; self . removeClass ( "placeholder" ) ; if ( self . _rendered ) { self . getEl ( "inp" ) . value = value } return self } if ( self . _rendered ) { value = self . getEl ( "inp" ) . value ; if ( value != self . settings . placeholder ) { return value } return "" } return self . _value } , disabled : function ( state ) { var self = this ; if ( self . _rendered && typeof state != "undefined" ) { self . getEl ( "inp" ) . disabled = state } return self . _super ( state ) } , focus : function ( ) { this . getEl ( "inp" ) . focus ( ) } , repaint : function ( ) { var self = this , elm = self . getEl ( ) , openElm = self . getEl ( "open" ) , rect = self . layoutRect ( ) ; var width , lineHeight ; if ( openElm ) { width = rect . w - DomUtils . getSize ( openElm ) . width - 10 } else { width = rect . w - 10 } var doc = document ; if ( doc . all && ( ! doc . documentMode || doc . documentMode <= 8 ) ) { lineHeight = self . layoutRect ( ) . h - 2 + "px" } DomUtils . css ( elm . firstChild , { width : width , lineHeight : lineHeight } ) ; self . _super ( ) ; return self } , postRender : function ( ) { var self = this ; DomUtils . on ( this . getEl ( "inp" ) , "change" , function ( ) { self . fire ( "change" ) } ) ; return self . _super ( ) } , remove : function ( ) { DomUtils . off ( this . getEl ( "inp" ) ) ; this . _super ( ) } , renderHtml : function ( ) { var self = this , id = self . _id , settings = self . settings , prefix = self . classPrefix ; var value = settings . value || settings . placeholder || "" ; var icon , text , openBtnHtml = "" ; icon = settings . icon ? prefix + "ico " + prefix + "i-" + settings . icon : "" ; text = self . _text ; if ( icon || text ) { openBtnHtml = '<div id="' + id + '-open" class="' + prefix + "btn " + prefix + 'open" tabIndex="-1">' + '<button id="' + id + '-action" type="button" hidefocus tabindex="-1">' + ( icon ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>' ) + ( text ? ( icon ? " " : "" ) + text : "" ) + "</button>" + "</div>" ; self . addClass ( "has-open" ) } return '<div id="' + id + '" class="' + self . classes ( ) + '">' + '<input id="' + id + '-inp" class="' + prefix + "textbox " + prefix + 'placeholder" value="' + value + '" hidefocus="true"' + ( self . disabl
if ( self . settings . multiline ) { var size = DomUtils . getSize ( self . getEl ( ) ) ; if ( size . width > layoutRect . maxW ) { layoutRect . minW = layoutRect . maxW ; self . addClass ( "multiline" ) } self . getEl ( ) . style . width = layoutRect . minW + "px" ; layoutRect . startMinH = layoutRect . h = layoutRect . minH = Math . min ( layoutRect . maxH , DomUtils . getSize ( self . getEl ( ) ) . height ) } return layoutRect } , repaint : function ( ) { var self = this ; if ( ! self . settings . multiline ) { self . getEl ( ) . style . lineHeight = self . layoutRect ( ) . h + "px" } return self . _super ( ) } , text : function ( text ) { var self = this ; if ( self . _rendered && text ) { this . innerHtml ( self . encode ( text ) ) } return self . _super ( text ) } , renderHtml : function ( ) { var self = this , forId = self . settings . forId ; return '<label id="' + self . _id + '" class="' + self . classes ( ) + '"' + ( forId ? ' for="' + forId : "" ) + '">' + self . encode ( self . _text ) + "</label>" } } ) } ) ; define ( "tinymce/ui/Toolbar" , [ "tinymce/ui/Container" , "tinymce/ui/KeyboardNavigation" ] , function ( Container , KeyboardNavigation ) { "use strict" ; return Container . extend ( { Defaults : { role : "toolbar" , layout : "flow" } , init : function ( settings ) { var self = this ; self . _super ( settings ) ; self . addClass ( "toolbar" ) } , postRender : function ( ) { var self = this ; self . items ( ) . addClass ( "toolbar-item" ) ; self . keyNav = new KeyboardNavigation ( { root : self , enableLeftRight : true } ) ; return self . _super ( ) } } ) } ) ; define ( "tinymce/ui/MenuBar" , [ "tinymce/ui/Toolbar" ] , function ( Toolbar ) { "use strict" ; return Toolbar . extend ( { Defaults : { role : "menubar" , containerCls : "menubar" , defaults : { type : "menubutton" } } } ) } ) ; define ( "tinymce/ui/MenuButton" , [ "tinymce/ui/Button" , "tinymce/ui/Factory" , "tinymce/ui/MenuBar" ] , function ( Button , Factory , MenuBar ) { "use strict" ; function isChildOf ( node , parent ) { while ( node ) { if ( parent === node ) { return true } node = node . parentNode } return false } var MenuButton = Button . extend ( { init : function ( settings ) { var self = this ; self . _renderOpen = true ; self . _super ( settings ) ; self . addClass ( "menubtn" ) ; if ( settings . fixedWidth ) { self . addClass ( "fixed-width" ) } self . aria ( "haspopup" , true ) ; self . hasPopup = true } , showMenu : function ( ) { var self = this , settings = self . settings , menu ; if ( self . menu && self . menu . visible ( ) ) { return self . hideMenu ( ) } if ( ! self . menu ) { menu = settings . menu || [ ] ; if ( menu . length ) { menu = { type : "menu" , items : menu } } else { menu . type = menu . type || "menu" } self . menu = Factory . create ( menu ) . parent ( self ) . renderTo ( self . getContainerElm ( ) ) ; self . fire ( "createmenu" ) ; self . menu . reflow ( ) ; self . menu . on ( "cancel" , function ( e ) { if ( e . control === self . menu ) { self . focus ( ) } } ) ; self . menu . on ( "show hide" , function ( e ) { if ( e . control == self . menu ) { self . activeMenu ( e . type == "show" ) } } ) . fire ( "show" ) ; self . aria ( "expanded" , true ) } self . menu . show ( ) ; self . menu . layoutRect ( { w : self . layoutRect ( ) . w } ) ; self . menu . moveRel ( self . getEl ( ) , self . isRtl ( ) ? [ "br-tr" , "tr-br" ] : [ "bl-tl" , "tl-bl" ] ) } , hideMenu : function ( ) { var self = this ; if ( self . menu ) { self . menu . items ( ) . each ( function ( item ) { if ( item . hideMenu ) { item . hideMenu ( ) } } ) ; self . menu . hide ( ) ; self . aria ( "expanded" , false ) } } , activeMenu : function ( state ) { this . toggleClass ( "active" , state ) } , renderHtml : function ( ) { var self = this , id = self . _id , prefix = self . classPrefix ; var icon = self . settings . icon ? prefix + "ico " + prefix + "i-" + self . settings . icon : "" ; self . aria ( "role" , self . parent ( ) instanceof MenuBar ? "menuitem" : "button" ) ; return '<div id="' + id + '" class="' + self . classes ( ) + '" tabindex="-1">' + '<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' + ( icon ? '<i class="' + icon + '"></i>' : "" ) + "<span>" + ( self . _text ? ( icon ? " " : "" ) + self . encode ( self . _text ) : "" ) + "</span>" + ' <i class="' + prefix + 'caret"></i>' + "</button>" + "</div>" } , postRender : function ( ) { var self = this ; self . on ( "click" , function ( e ) { if ( e . control === self && isChildOf ( e . target , self . getEl ( ) ) ) { self . showMenu ( ) ; if ( e . keyboard ) { self . menu . items ( ) [ 0 ] . focus ( ) } } } ) ; self . on ( "mouseenter" , function ( e ) { var overCtrl = e . control , parent = self . parent ( ) , hasVisibleSiblingMenu ; if ( overCtrl && parent && overCtrl instanceof MenuButton && overCtrl . parent ( ) == parent ) { parent . items ( ) . filter ( "MenuButton" ) . each ( function ( ctrl ) { if ( ctrl . hideMenu && ctrl != overCtrl ) { if ( ctrl . menu && ctrl . menu . visible ( ) ) { hasVisibleSiblingMenu = true } ctrl . hideMenu ( ) } } ) ; if ( hasVisibleSiblingMenu ) { overCtrl . focus ( ) ; overCtrl . showMenu ( ) } } } ) ; return self . _super ( ) } , text : function ( text ) { var self = this , i , children ; if ( self . _rendered ) { children = self . ge