Changeset 665
- Timestamp:
- 2007-08-16 10:56:39 (17 months ago)
- Location:
- FCKeditor/branches/features/overlay_selection
- Files:
-
- 5 modified
- 18 copied
-
. (copied) (copied from FCKeditor/trunk)
-
editor/dialog/fck_docprops.html (copied) (copied from FCKeditor/trunk/editor/dialog/fck_docprops.html)
-
editor/fckeditor.html (copied) (copied from FCKeditor/trunk/editor/fckeditor.html)
-
editor/lang/en-au.js (copied) (copied from FCKeditor/trunk/editor/lang/en-au.js)
-
editor/lang/en-ca.js (copied) (copied from FCKeditor/trunk/editor/lang/en-ca.js)
-
editor/lang/en.js (copied) (copied from FCKeditor/trunk/editor/lang/en.js)
-
editor/lang/en-uk.js (copied) (copied from FCKeditor/trunk/editor/lang/en-uk.js)
-
editor/lang/zh-cn.js (copied) (copied from FCKeditor/trunk/editor/lang/zh-cn.js)
-
editor/lang/zh.js (copied) (copied from FCKeditor/trunk/editor/lang/zh.js)
-
editor/plugins/dragresizetable (copied) (copied from FCKeditor/trunk/editor/plugins/dragresizetable)
-
editor/plugins/dragresizetable/fckplugin.js (copied) (copied from FCKeditor/trunk/editor/plugins/dragresizetable/fckplugin.js) (1 diff)
-
editor/_source (copied) (copied from FCKeditor/trunk/editor/_source)
-
editor/_source/fckeditorapi.js (copied) (copied from FCKeditor/trunk/editor/_source/fckeditorapi.js)
-
editor/_source/internals/fck_contextmenu.js (modified) (1 diff)
-
editor/_source/internals/fckdialog_gecko.js (copied) (copied from FCKeditor/trunk/editor/_source/internals/fckdialog_gecko.js)
-
editor/_source/internals/fckdomtools.js (copied) (copied from FCKeditor/trunk/editor/_source/internals/fckdomtools.js)
-
editor/_source/internals/fck_gecko.js (copied) (copied from FCKeditor/trunk/editor/_source/internals/fck_gecko.js)
-
editor/_source/internals/fck.js (modified) (3 diffs)
-
editor/_source/internals/fcktablehandler_ie.js (modified) (1 diff)
-
editor/_source/internals/fcktools.js (modified) (1 diff)
-
fckconfig.js (modified) (3 diffs)
-
fckpackager.xml (copied) (copied from FCKeditor/trunk/fckpackager.xml)
-
_whatsnew.html (copied) (copied from FCKeditor/trunk/_whatsnew.html)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/features/overlay_selection/editor/plugins/dragresizetable/fckplugin.js
r661 r665 301 301 "_MouseFindHandler" : function( FCK, evt ) 302 302 { 303 if ( FCK. _MouseDownFlag )303 if ( FCK.MouseDownFlag ) 304 304 return ; 305 305 var node = evt.srcElement || evt.target ; -
FCKeditor/branches/features/overlay_selection/editor/_source/internals/fck_contextmenu.js
r643 r665 66 66 var bIsTable = ( tagName == 'TABLE' ) ; 67 67 var bIsCell = ( !bIsTable && FCKSelection.HasAncestorNode( 'TABLE' ) ) ; 68 if ( FCKBrowserInfo.IsIE && FCKTableHandler._HasCellSelection() ) 69 bIsCell = true ; 68 70 69 71 if ( bIsCell ) -
FCKeditor/branches/features/overlay_selection/editor/_source/internals/fck.js
r647 r665 767 767 evt = window.event ; 768 768 if ( evt.type == 'mousedown' ) 769 FCK. _MouseDownFlag = true ;769 FCK.MouseDownFlag = true ; 770 770 else if ( evt.type == 'mouseup' ) 771 FCK. _MouseDownFlag = false ;771 FCK.MouseDownFlag = false ; 772 772 else if ( evt.type == 'mousemove' ) 773 773 FCK.Events.FireEvent( 'OnMouseMove', evt ) ; … … 789 789 790 790 // Listen for mousedown and mouseup events for tracking drag and drops. 791 FCK. _MouseDownFlag = false ;791 FCK.MouseDownFlag = false ; 792 792 FCKTools.AddEventListener( FCK.EditorDocument, 'mousemove', _FCK_MouseEventsListener ) ; 793 793 FCKTools.AddEventListener( FCK.EditorDocument, 'mousedown', _FCK_MouseEventsListener ) ; … … 815 815 if ( FCK.Status != FCK_STATUS_NOTLOADED ) 816 816 return ; 817 818 if ( FCKConfig.Debug ) 819 FCKDebug._GetWindow() ; 817 820 818 821 FCK.SetStatus( FCK_STATUS_ACTIVE ) ; -
FCKeditor/branches/features/overlay_selection/editor/_source/internals/fcktablehandler_ie.js
r132 r665 26 26 var aCells = new Array() ; 27 27 28 var oRange = FCK.EditorDocument.selection.createRange() ; 29 // var oParent = oRange.parentElement() ; 30 var oParent = FCKSelection.GetParentElement() ; 31 32 if ( oParent && oParent.tagName.Equals( 'TD', 'TH' ) ) 33 aCells[0] = oParent ; 34 else 35 { 36 oParent = FCKSelection.MoveToAncestorNode( 'TABLE' ) ; 37 38 if ( oParent ) 28 if ( this._HasCellSelection() ) 29 { 30 var minPos = FCKTools.GetWindowPosition( window, this._DragSelectBlock ) ; 31 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 32 minPos.x += 100 - offset.x ; 33 minPos.y += 100 - offset.y ; 34 var maxPos = { 'x' : minPos.x + this._DragSelectBlock.offsetWidth - 200, 35 'y' : minPos.y + this._DragSelectBlock.offsetHeight - 200 } ; 36 37 for ( var i = 0 ; i < this._SelectedTable.rows.length ; i++ ) 39 38 { 40 // Loops throw all cells checking if the cell is, or part of it, is inside the selection 41 // and then add it to the selected cells collection. 42 for ( var i = 0 ; i < oParent.cells.length ; i++ ) 39 var r = this._SelectedTable.rows[i] ; 40 for ( var j = 0 ; j < r.cells.length ; j++ ) 43 41 { 44 var oCellRange = FCK.EditorDocument.selection.createRange() ; 45 oCellRange.moveToElementText( oParent.cells[i] ) ; 46 47 if ( oRange.inRange( oCellRange ) 48 || ( oRange.compareEndPoints('StartToStart',oCellRange) >= 0 && oRange.compareEndPoints('StartToEnd',oCellRange) <= 0 ) 49 || ( oRange.compareEndPoints('EndToStart',oCellRange) >= 0 && oRange.compareEndPoints('EndToEnd',oCellRange) <= 0 ) ) 50 { 51 aCells[aCells.length] = oParent.cells[i] ; 52 } 42 var cellPos = FCKTools.GetWindowPosition( FCK.EditorWindow, r.cells[j] ) ; 43 /* 44 FCKDebug.Output( cellPos.x + ":" + cellPos.y + ";" + minPos.x + ":" + minPos.y + ";" 45 + maxPos.x + ":" + maxPos.y ) ; 46 */ 47 if ( cellPos.x >= minPos.x && cellPos.y >= minPos.y 48 && cellPos.x <= maxPos.x && cellPos.y <= maxPos.y ) 49 aCells.push( r.cells[j] ) ; 53 50 } 54 51 } 55 52 } 53 else 54 { 55 var oParent = FCKSelection.GetParentElement() ; 56 if ( oParent && oParent.tagName.Equals( 'TD', 'TH' ) ) 57 aCells.push( oParent ) ; 58 } 56 59 57 60 return aCells ; 58 61 } 62 63 FCKTableHandler._DragSelectBlock = null ; 64 65 FCKTableHandler._SelectedTable = null ; 66 67 FCKTableHandler._AnchorCell = null ; 68 69 FCKTableHandler._CellSelectMode = false ; 70 71 FCKTableHandler.MouseMoveHandler = function( FCK, evt ) 72 { 73 if ( ! FCK.MouseDownFlag ) 74 { 75 if ( FCKTableHandler._SelectedTable ) 76 FCKTableHandler._CancelCellSelectMode() ; 77 return ; 78 } 79 80 var target = evt.srcElement || evt.target ; 81 var mouse = { 'x' : evt.clientX, 'y' : evt.clientY } ; 82 if ( target.ownerDocument != FCK.EditorDocument ) 83 { 84 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 85 mouse.x -= offset.x ; 86 mouse.y -= offset.y ; 87 } 88 89 if ( FCKTableHandler._CellSelectMode ) 90 FCKTableHandler._DragSelectHandler( FCK, target, mouse ) ; 91 else 92 FCKTableHandler._FindSelectHandler( FCK, target, mouse ) ; 93 } 94 95 FCKTableHandler.OuterMouseMoveHandler = function( evt ) 96 { 97 return FCKTableHandler.MouseMoveHandler( FCK, evt ) ; 98 } 99 100 FCKTableHandler.MouseUpHandler = function( evt ) 101 { 102 FCKTableHandler._CancelCellSelectMode() ; 103 FCK.MouseDownFlag = false ; 104 } 105 106 FCKTableHandler.MouseDownHandler = function( evt ) 107 { 108 if ( evt.button == 1 && FCKTableHandler._CellSelectMode == false && FCKTableHandler._SelectedTable ) 109 FCKTableHandler._ClearCellSelectOverlay() ; 110 } 111 112 FCKTableHandler._HasCellSelection = function() 113 { 114 return this._SelectedTable && this._DragSelectBlock && this._DragSelectBlock.style.display != 'none' ; 115 } 116 117 FCKTableHandler._CancelCellSelectMode = function() 118 { 119 this._CellSelectMode = false ; 120 } 121 122 FCKTableHandler._ClearCellSelectOverlay = function() 123 { 124 if ( this._DragSelectBlock ) 125 this._DragSelectBlock.style.display = 'none' ; 126 this._SelectedTable = null ; 127 this._AnchorCell = null ; 128 } 129 130 FCKTableHandler._FindSelectHandler = function( FCK, target, mouse ) 131 { 132 try 133 { 134 if ( ! target || target.nodeType != 1 ) 135 return ; 136 } 137 catch ( e ) 138 { 139 return ; 140 } 141 142 var targetTag = target.tagName.toLowerCase() ; 143 if ( targetTag == 'td' ) 144 { 145 this._AnchorCell = target ; 146 this._SelectedTable = FCKTools.GetElementAscensor( target, 'table' ) ; 147 this._CellSelectMode = true ; 148 } 149 } 150 151 FCKTableHandler._DragSelectHandler = function( FCK, target, mouse) 152 { 153 // 1. find out the table cell on which the mouse cursor has rested on. 154 var table = this._SelectedTable ; 155 var tablePosition = FCKTools.GetWindowPosition( FCK.EditorWindow, table ) ; 156 157 if ( mouse.x < tablePosition.x || mouse.y < tablePosition.y 158 || mouse.x > tablePosition.x + table.offsetWidth 159 || mouse.y > tablePosition.y + table.offsetHeight ) 160 return ; 161 162 var cells = [] ; 163 for ( var i = 0 ; i < table.rows.length ; i++ ) 164 { 165 var r = table.rows[i] ; 166 for ( var j = 0 ; j < r.cells.length ; j++ ) 167 cells.push( r.cells[j] ) ; 168 } 169 170 var boundingCell = null ; 171 for ( var i = 0 ; i < cells.length ; i++ ) 172 { 173 var pos = FCKTools.GetWindowPosition( FCK.EditorWindow, cells[i] ) ; 174 if ( mouse.x >= pos.x && mouse.y >= pos.y && mouse.x <= pos.x + cells[i].offsetWidth 175 && mouse.y <= pos.y + cells[i].offsetHeight ) 176 { 177 boundingCell = cells[i] ; 178 break ; 179 } 180 } 181 182 if ( boundingCell == null ) 183 return ; 184 185 // 2. if mouse cursor is on a different cell compared to anchor cell, display the overlay select block. 186 if ( boundingCell != this._AnchorCell ) 187 { 188 if ( this._DragSelectBlock == null ) 189 { 190 var overlay = document.createElement( 'div' ) ; 191 overlay.style.position = 'absolute' ; 192 overlay.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=10,enabled=true)' ; 193 document.body.appendChild( overlay ) ; 194 195 var filler = document.createElement( 'img' ) ; 196 filler.border = 0 ; 197 filler.src = FCKConfig.BasePath + 'images/spacer.gif' ; 198 filler.style.position = 'absolute' ; 199 overlay.appendChild( filler ) ; 200 var visibleBlock = document.createElement( 'div' ) ; 201 FCKTools.SetNodeStyles( visibleBlock, { 'position' : 'absolute', 'backgroundColor' : 'blue' } ) ; 202 overlay.appendChild( visibleBlock ) ; 203 this._DragSelectBlock = overlay ; 204 205 FCKTools.AddEventListener( FCK.EditorDocument, "mouseup", this.MouseUpHandler ) ; 206 FCKTools.AddEventListener( document, "mouseup", this.MouseUpHandler ) ; 207 FCKTools.AddEventListener( document, "mousemove", this.OuterMouseMoveHandler ) ; 208 FCKTools.AddEventListener( FCK.EditorDocument, "mousedown", this.MouseDownHandler ) ; 209 FCKTools.AddEventListener( document, "mousedown", this.MouseDownHandler ) ; 210 FCK.ContextMenu._InnerContextMenu.AttachToElement( overlay ) ; 211 } 212 213 this._DragSelectBlock.style.display = '' ; 214 var r = FCK.EditorDocument.body.createControlRange() ; 215 r.add( this._SelectedTable ) ; 216 r.select() ; 217 } 218 219 // 3. if there is a select block, update its position and resize it. 220 if ( ! this._HasCellSelection() ) 221 return ; 222 this._FocusCell = boundingCell ; 223 this._RefreshSelectionBlock( FCK ) ; 224 } 225 226 FCKTableHandler._RefreshSelectionBlock = function( FCK ) 227 { 228 var anchorPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._AnchorCell ) ; 229 var focusPos = FCKTools.GetWindowPosition( FCK.EditorWindow, this._FocusCell ) ; 230 var minPos = 231 { 232 'x' : ( anchorPos.x < focusPos.x ? anchorPos.x : focusPos.x ), 233 'y' : ( anchorPos.y < focusPos.y ? anchorPos.y : focusPos.y ) 234 } ; 235 var maxPos = 236 { 237 'x' : ( anchorPos.x + this._AnchorCell.offsetWidth > focusPos.x + this._FocusCell.offsetWidth ? 238 anchorPos.x + this._AnchorCell.offsetWidth : focusPos.x + this._FocusCell.offsetWidth ), 239 'y' : ( anchorPos.y + this._AnchorCell.offsetHeight > focusPos.y + this._FocusCell.offsetHeight ? 240 anchorPos.y + this._AnchorCell.offsetHeight : focusPos.y + this._FocusCell.offsetHeight ) 241 } ; 242 var offset = FCKTools.GetDocumentPosition( window, FCK.EditingArea.IFrame ) ; 243 var overlayStyle = 244 { 245 'left' : ( minPos.x - 100 + offset.x ) + 'px', 246 'top' : ( minPos.y - 100 + offset.y ) + 'px', 247 'width' : ( maxPos.x - minPos.x + 200 ) + 'px', 248 'height': ( maxPos.y - minPos.y + 200 ) + 'px' 249 } ; 250 var imgStyle = 251 { 252 'left' : '0px', 253 'top' : '0px', 254 'width' : overlayStyle.width, 255 'height': overlayStyle.height 256 } ; 257 var visibleBlockStyle = 258 { 259 'left' : '100px', 260 'top' : '100px', 261 'width' : ( maxPos.x - minPos.x ) + 'px', 262 'height': ( maxPos.y - minPos.y ) + 'px' 263 } ; 264 FCKTools.SetNodeStyles( this._DragSelectBlock, overlayStyle ) ; 265 FCKTools.SetNodeStyles( this._DragSelectBlock.getElementsByTagName( 'img' )[0], imgStyle ) ; 266 FCKTools.SetNodeStyles( this._DragSelectBlock.getElementsByTagName( 'div' )[0], visibleBlockStyle ) ; 267 } 268 269 FCK.Events.AttachEvent( "OnMouseMove", FCKTableHandler.MouseMoveHandler ) ; -
FCKeditor/branches/features/overlay_selection/editor/_source/internals/fcktools.js
r650 r665 548 548 return node ; 549 549 } 550 551 FCKTools.SetNodeStyles = function( domNode, styleDict ) 552 { 553 for ( var i in styleDict ) 554 domNode.style[i] = styleDict[ i ] ; 555 } -
FCKeditor/branches/features/overlay_selection/fckconfig.js
r612 r665 40 40 FCKConfig.FullPage = false ; 41 41 42 FCKConfig.Debug = false ;42 FCKConfig.Debug = true ; 43 43 FCKConfig.AllowQueryStringDebug = true ; 44 44 … … 49 49 50 50 // FCKConfig.Plugins.Add( 'autogrow' ) ; 51 //FCKConfig.Plugins.Add( 'dragresizetable' );51 FCKConfig.Plugins.Add( 'dragresizetable' ); 52 52 FCKConfig.AutoGrowMax = 400 ; 53 53 … … 175 175 // This will be applied to the body element of the editor 176 176 FCKConfig.BodyId = '' ; 177 FCKConfig.BodyClass = ' ' ;177 FCKConfig.BodyClass = 'cpage' ; 178 178 179 179 FCKConfig.DefaultLinkTarget = '' ;