| 64 | | var oSelection = dialog.Selection.GetSelection() ; |
| 65 | | ActiveEl = ( new FCKElementPath( oSelection.GetSelectedElement() || oSelection.GetParentElement() ) ).BlockLimit ; |
| 66 | | if ( ActiveEl && ActiveEl.nodeName.toLowerCase() != 'div' ) |
| 67 | | ActiveEl = null ; |
| | 64 | dialog.Selection.EnsureSelection() ; |
| | 65 | var range = new FCKDomRange( FCK.EditorWindow ) ; |
| | 66 | range.MoveToSelection() ; |
| | 67 | |
| | 68 | var startNode = range.StartNode ; |
| | 69 | var endNode = range.EndNode ; |
| | 70 | var currentNode = startNode ; |
| | 71 | var elementMarkers = {} ; |
| | 72 | |
| | 73 | do |
| | 74 | { |
| | 75 | if ( currentNode.nodeName.IEquals( 'div' ) && currentNode.firstChild && |
| | 76 | oEditor.FCKListsLib.BlockElements[ currentNode.firstChild.nodeName.toLowerCase() ] ) |
| | 77 | { |
| | 78 | CurrentContainers.push( currentNode ) ; |
| | 79 | if ( currentNode.parentNode.nodeName.IEquals( 'div' ) ) |
| | 80 | FCKDomTools.SetElementMarker( elementMarkers, currentNode, '_fckignorethisnode', true ) ; |
| | 81 | } |
| | 82 | } |
| | 83 | while ( ( currentNode = FCKDomTools.GetNextSourceElement( currentNode ) ) && currentNode != endNode |
| | 84 | && currentNode != endNode.parentNode ) ; |
| | 85 | |
| | 86 | for ( var i = CurrentContainers.length - 1 ; i >= 0 ; i-- ) |
| | 87 | { |
| | 88 | if ( CurrentContainers[i]['_fckignorethisnode'] ) |
| | 89 | CurrentContainers.splice( i, 1 ) ; |
| | 90 | } |
| 116 | | for ( var i in styles ) |
| 117 | | { |
| 118 | | if ( ! /^_FCK_/.test( i ) && styles[i].Element == 'div' ) |
| 119 | | { |
| 120 | | if ( ActiveEl && styles[i].CheckElementRemovable( ActiveEl, true ) ) |
| 121 | | match = i ; |
| 122 | | selectableStyles[i] = styles[i] ; |
| 123 | | } |
| 124 | | } |
| 125 | | if ( !match ) |
| 126 | | AddStyleOption( "" ) ; |
| 127 | | for ( var i in selectableStyles ) |
| 128 | | AddStyleOption( i ) ; |
| 129 | | if ( match ) |
| 130 | | GetE( 'selStyle' ).value = match ; |
| 131 | | |
| 132 | | // Set the value for other inputs |
| 133 | | if ( ActiveEl ) |
| 134 | | { |
| 135 | | GetE( 'txtClass' ).value = ActiveEl.className ; |
| 136 | | GetE( 'txtId' ).value = ActiveEl.id ; |
| 137 | | GetE( 'txtLang' ).value = ActiveEl.lang ; |
| 138 | | GetE( 'txtInlineStyle').value = ActiveEl.getAttribute( 'style' ) ; |
| 139 | | GetE( 'txtTitle' ).value = ActiveEl.title ; |
| 140 | | GetE( 'selLangDir').value = ActiveEl.dir || GetNearestAncestorDirection( ActiveEl ) ; |
| | 139 | if ( CurrentContainers.length <= 1 ) |
| | 140 | { |
| | 141 | var target = CurrentContainers[0] ; |
| | 142 | for ( var i in styles ) |
| | 143 | { |
| | 144 | if ( ! /^_FCK_/.test( i ) && styles[i].Element == 'div' ) |
| | 145 | { |
| | 146 | if ( target && styles[i].CheckElementRemovable( target, true ) ) |
| | 147 | match = i ; |
| | 148 | selectableStyles[i] = styles[i] ; |
| | 149 | } |
| | 150 | } |
| | 151 | if ( !match ) |
| | 152 | AddStyleOption( "" ) ; |
| | 153 | for ( var i in selectableStyles ) |
| | 154 | AddStyleOption( i ) ; |
| | 155 | if ( match ) |
| | 156 | GetE( 'selStyle' ).value = match ; |
| | 157 | |
| | 158 | // Set the value for other inputs |
| | 159 | if ( target ) |
| | 160 | { |
| | 161 | GetE( 'txtClass' ).value = target.className ; |
| | 162 | GetE( 'txtId' ).value = target.id ; |
| | 163 | GetE( 'txtLang' ).value = target.lang ; |
| | 164 | GetE( 'txtInlineStyle').value = target.getAttribute( 'style' ) ; |
| | 165 | GetE( 'txtTitle' ).value = target.title ; |
| | 166 | GetE( 'selLangDir').value = target.dir || GetNearestAncestorDirection( target ) ; |
| | 167 | } |
| | 168 | } |
| | 169 | else |
| | 170 | { |
| | 171 | GetE( 'txtId' ).disabled = GetE( 'selStyle' ).disabled = true ; |
| 253 | | var dir = GetE( 'selLangDir' ).value ; |
| 254 | | if ( GetNearestAncestorDirection( ActiveEl ) != dir ) |
| 255 | | ActiveEl.dir = dir ; |
| 256 | | else |
| 257 | | ActiveEl.removeAttribute( 'dir' ) ; |
| 258 | | |
| 259 | | var styleName = GetE( 'selStyle' ).value ; |
| 260 | | if ( styleName ) |
| 261 | | FCKStyles.GetStyle( styleName ).ApplyToObject( ActiveEl ) ; |
| | 293 | for ( var i = 0 ; i < CurrentContainers.length ; i++ ) |
| | 294 | { |
| | 295 | var dir = GetE( 'selLangDir' ).value ; |
| | 296 | var styleName = GetE( 'selStyle' ).value ; |
| | 297 | if ( GetNearestAncestorDirection( CurrentContainers[i] ) != dir ) |
| | 298 | CurrentContainers[i].dir = dir ; |
| | 299 | else |
| | 300 | CurrentContainers[i].removeAttribute( 'dir' ) ; |
| | 301 | |
| | 302 | if ( styleName ) |
| | 303 | FCKStyles.GetStyle( styleName ).ApplyToObject( CurrentContainers[i] ) ; |
| | 304 | } |