Changeset 2209
- Timestamp:
- 2008-07-11 13:37:09 (20 months ago)
- Location:
- FCKeditor/trunk
- Files:
-
- 18 modified
- 2 copied
-
editor/dialog/fck_div.html (copied) (copied from FCKeditor/branches/features/div_container/editor/dialog/fck_div.html)
-
editor/lang/en-au.js (modified) (1 diff)
-
editor/lang/en-ca.js (modified) (1 diff)
-
editor/lang/en.js (modified) (2 diffs)
-
editor/lang/en-uk.js (modified) (1 diff)
-
editor/lang/zh-cn.js (modified) (1 diff)
-
editor/lang/zh.js (modified) (1 diff)
-
editor/skins/default/fck_strip.gif (modified) (previous)
-
editor/skins/office2003/fck_strip.gif (modified) (previous)
-
editor/skins/silver/fck_strip.gif (modified) (previous)
-
editor/_source/classes/fckdomrange.js (modified) (2 diffs)
-
editor/_source/commandclasses/fckblockquotecommand.js (copied) (copied from FCKeditor/branches/features/div_container/editor/_source/commandclasses/fckblockquotecommand.js)
-
editor/_source/commandclasses/fck_othercommands.js (modified) (1 diff)
-
editor/_source/internals/fckcommands.js (modified) (1 diff)
-
editor/_source/internals/fck_contextmenu.js (modified) (1 diff)
-
editor/_source/internals/fckdomtools.js (modified) (2 diffs)
-
editor/_source/internals/fckselection_gecko.js (modified) (1 diff)
-
editor/_source/internals/fcktoolbaritems.js (modified) (1 diff)
-
fckconfig.js (modified) (2 diffs)
-
_whatsnew.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/lang/en-au.js
r2143 r2209 74 74 IncreaseIndent : "Increase Indent", 75 75 Blockquote : "Blockquote", 76 CreateDiv : "Create Div Container", 77 EditDiv : "Edit Div Container", 78 DeleteDiv : "Remove Div Container", 76 79 Undo : "Undo", 77 80 Redo : "Redo", -
FCKeditor/trunk/editor/lang/en-ca.js
r2143 r2209 74 74 IncreaseIndent : "Increase Indent", 75 75 Blockquote : "Blockquote", 76 CreateDiv : "Create Div Container", 77 EditDiv : "Edit Div Container", 78 DeleteDiv : "Remove Div Container", 76 79 Undo : "Undo", 77 80 Redo : "Redo", -
FCKeditor/trunk/editor/lang/en.js
r2143 r2209 74 74 IncreaseIndent : "Increase Indent", 75 75 Blockquote : "Blockquote", 76 CreateDiv : "Create Div Container", 77 EditDiv : "Edit Div Container", 78 DeleteDiv : "Remove Div Container", 76 79 Undo : "Undo", 77 80 Redo : "Redo", … … 514 517 DlgAboutLicenseTab : "License", 515 518 DlgAboutVersion : "version", 516 DlgAboutInfo : "For further information go to" 519 DlgAboutInfo : "For further information go to", 520 521 // Div Dialog 522 DlgDivGeneralTab : "General", 523 DlgDivAdvancedTab : "Advanced", 524 DlgDivStyle : "Style", 525 DlgDivInlineStyle : "Inline Style" 517 526 }; -
FCKeditor/trunk/editor/lang/en-uk.js
r2143 r2209 74 74 IncreaseIndent : "Increase Indent", 75 75 Blockquote : "Blockquote", 76 CreateDiv : "Create Div Container", 77 EditDiv : "Edit Div Container", 78 DeleteDiv : "Remove Div Container", 76 79 Undo : "Undo", 77 80 Redo : "Redo", -
FCKeditor/trunk/editor/lang/zh-cn.js
r2143 r2209 74 74 IncreaseIndent : "增加缩进量", 75 75 Blockquote : "块引用", 76 CreateDiv : "新增 Div 标籤", 77 EditDiv : "更改 Div 标籤", 78 DeleteDiv : "删除 Div 标籤", 76 79 Undo : "撤消", 77 80 Redo : "重做", -
FCKeditor/trunk/editor/lang/zh.js
r2143 r2209 74 74 IncreaseIndent : "增加縮排", 75 75 Blockquote : "引用文字", 76 CreateDiv : "新增 Div 標籤", 77 EditDiv : "變更 Div 標籤", 78 DeleteDiv : "移除 Div 標籤", 76 79 Undo : "復原", 77 80 Redo : "重複", -
FCKeditor/trunk/editor/_source/classes/fckdomrange.js
r2106 r2209 43 43 // For text nodes, the node itself is the StartNode. 44 44 var eStart = innerRange.startContainer ; 45 var eEnd = innerRange.endContainer ;46 45 47 46 var oElementPath = new FCKElementPath( eStart ) ; … … 51 50 this.StartBlockLimit = oElementPath.BlockLimit ; 52 51 53 if ( eStart != eEnd ) 54 oElementPath = new FCKElementPath( eEnd ) ; 55 56 // The innerRange.endContainer[ innerRange.endOffset ] is not 57 // usually part of the range, but the marker for the range end. So, 58 // let's get the previous available node as the real end. 59 var eEndNode = eEnd ; 60 if ( innerRange.endOffset == 0 ) 52 if ( innerRange.collapsed ) 61 53 { 62 while ( eEndNode && !eEndNode.previousSibling ) 63 eEndNode = eEndNode.parentNode ; 64 65 if ( eEndNode ) 66 eEndNode = eEndNode.previousSibling ; 54 this.EndNode = this.StartNode ; 55 this.EndContainer = this.StartContainer ; 56 this.EndBlock = this.StartBlock ; 57 this.EndBlockLimit = this.StartBlockLimit ; 67 58 } 68 else if ( eEndNode.nodeType == 1 ) 69 eEndNode = eEndNode.childNodes[ innerRange.endOffset - 1 ] ; 70 71 this.EndNode = eEndNode ; 72 this.EndContainer = eEnd ; 73 this.EndBlock = oElementPath.Block ; 74 this.EndBlockLimit = oElementPath.BlockLimit ; 59 else 60 { 61 var eEnd = innerRange.endContainer ; 62 63 if ( eStart != eEnd ) 64 oElementPath = new FCKElementPath( eEnd ) ; 65 66 // The innerRange.endContainer[ innerRange.endOffset ] is not 67 // usually part of the range, but the marker for the range end. So, 68 // let's get the previous available node as the real end. 69 var eEndNode = eEnd ; 70 if ( innerRange.endOffset == 0 ) 71 { 72 while ( eEndNode && !eEndNode.previousSibling ) 73 eEndNode = eEndNode.parentNode ; 74 75 if ( eEndNode ) 76 eEndNode = eEndNode.previousSibling ; 77 } 78 else if ( eEndNode.nodeType == 1 ) 79 eEndNode = eEndNode.childNodes[ innerRange.endOffset - 1 ] ; 80 81 this.EndNode = eEndNode ; 82 this.EndContainer = eEnd ; 83 this.EndBlock = oElementPath.Block ; 84 this.EndBlockLimit = oElementPath.BlockLimit ; 85 } 75 86 } 76 87 -
FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js
r2143 r2209 576 576 } 577 577 }; 578 579 var FCKDeleteDivCommand = function() 580 { 581 } 582 FCKDeleteDivCommand.prototype = 583 { 584 GetState : function() 585 { 586 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) 587 return FCK_TRISTATE_DISABLED ; 588 589 var node = FCKSelection.GetParentElement() ; 590 var path = new FCKElementPath( node ) ; 591 return path.BlockLimit && path.BlockLimit.nodeName.IEquals( 'div' ) ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ; 592 }, 593 594 Execute : function() 595 { 596 // Create an undo snapshot before doing anything. 597 FCKUndo.SaveUndoStep() ; 598 599 // Find out the nodes to delete. 600 var nodes = FCKDomTools.GetSelectedDivContainers() ; 601 602 // Remember the current selection position. 603 var range = new FCKDomRange( FCK.EditorWindow ) ; 604 range.MoveToSelection() ; 605 var bookmark = range.CreateBookmark() ; 606 607 // Delete the container DIV node. 608 for ( var i = 0 ; i < nodes.length ; i++) 609 FCKDomTools.RemoveNode( nodes[i], true ) ; 610 611 // Restore selection. 612 range.MoveToBookmark( bookmark ) ; 613 range.Select() ; 614 } 615 } ; -
FCKeditor/trunk/editor/_source/internals/fckcommands.js
r2143 r2209 96 96 case 'Outdent' : oCommand = new FCKIndentCommand( 'outdent', FCKConfig.IndentLength * -1 ) ; break ; 97 97 case 'Blockquote' : oCommand = new FCKBlockQuoteCommand() ; break ; 98 case 'CreateDiv' : oCommand = new FCKDialogCommand( 'CreateDiv', FCKLang.CreateDiv, 'dialog/fck_div.html', 380, 210, null, null, true ) ; break ; 99 case 'EditDiv' : oCommand = new FCKDialogCommand( 'EditDiv', FCKLang.EditDiv, 'dialog/fck_div.html', 380, 210, null, null, false ) ; break ; 100 case 'DeleteDiv' : oCommand = new FCKDeleteDivCommand() ; break ; 98 101 99 102 case 'TableInsertRowAfter' : oCommand = new FCKTableCommand('TableInsertRowAfter') ; break ; -
FCKeditor/trunk/editor/_source/internals/fck_contextmenu.js
r2143 r2209 295 295 } 296 296 }} ; 297 298 case 'DivContainer': 299 return { 300 AddItems : function( menu, tag, tagName ) 301 { 302 var currentBlocks = FCKDomTools.GetSelectedDivContainers() ; 303 304 if ( currentBlocks.length > 0 ) 305 { 306 menu.AddSeparator() ; 307 menu.AddItem( 'EditDiv', FCKLang.EditDiv, 75 ) ; 308 menu.AddItem( 'DeleteDiv', FCKLang.DeleteDiv, 76 ) ; 309 } 310 }} ; 311 297 312 // @Packager.Remove.Start 298 313 default : -
FCKeditor/trunk/editor/_source/internals/fckdomtools.js
r2159 r2209 697 697 SetElementMarker : function ( markerObj, element, attrName, value) 698 698 { 699 var id = String( parseInt( Math.random() * 0xfffffff , 10 ) ) ;699 var id = String( parseInt( Math.random() * 0xffffffff, 10 ) ) ; 700 700 element._FCKMarkerId = id ; 701 701 element[attrName] = value ; … … 1021 1021 // In the DTD # == text node. 1022 1022 return ( childDTD['#'] && !FCKListsLib.NonEditableElements[ nodeName ] ) ; 1023 }, 1024 1025 GetSelectedDivContainers : function() 1026 { 1027 var currentBlocks = [] ; 1028 var range = new FCKDomRange( FCK.EditorWindow ) ; 1029 range.MoveToSelection() ; 1030 1031 var startNode = range.GetTouchedStartNode() ; 1032 var endNode = range.GetTouchedEndNode() ; 1033 var currentNode = startNode ; 1034 1035 if ( startNode == endNode ) 1036 { 1037 while ( endNode.nodeType == 1 && endNode.lastChild ) 1038 endNode = endNode.lastChild ; 1039 endNode = FCKDomTools.GetNextSourceNode( endNode ) ; 1040 } 1041 1042 while ( currentNode && currentNode != endNode ) 1043 { 1044 if ( currentNode.nodeType != 3 || !/^[ \t\n]*$/.test( currentNode.nodeValue ) ) 1045 { 1046 var path = new FCKElementPath( currentNode ) ; 1047 var blockLimit = path.BlockLimit ; 1048 if ( blockLimit && blockLimit.nodeName.IEquals( 'div' ) && currentBlocks.IndexOf( blockLimit ) == -1 ) 1049 currentBlocks.push( blockLimit ) ; 1050 } 1051 1052 currentNode = FCKDomTools.GetNextSourceNode( currentNode ) ; 1053 } 1054 1055 return currentBlocks ; 1023 1056 } 1024 1057 } ; -
FCKeditor/trunk/editor/_source/internals/fckselection_gecko.js
r2072 r2209 76 76 if ( oSel ) 77 77 { 78 // make the common case fast - for collapsed/nearly collapsed selections just return anchor.parent. 78 // if anchorNode == focusNode, see if the selection is text only or including nodes. 79 // if text only, return the parent node. 80 // if the selection includes DOM nodes, then the anchorNode is the nearest container. 79 81 if ( oSel.anchorNode && oSel.anchorNode == oSel.focusNode ) 80 return oSel.anchorNode.parentNode ; 82 { 83 var oRange = oSel.getRangeAt( 0 ) ; 84 if ( oRange.collapsed || oRange.startContainer.nodeType == 3 ) 85 return oSel.anchorNode.parentNode ; 86 else 87 return oSel.anchorNode ; 88 } 81 89 82 90 // looks like we're having a large selection here. To make the behavior same as IE's TextRange.parentElement(), -
FCKeditor/trunk/editor/_source/internals/fcktoolbaritems.js
r1565 r2209 72 72 case 'Indent' : oItem = new FCKToolbarButton( 'Indent' , FCKLang.IncreaseIndent, null, null, false, true, 29 ) ; break ; 73 73 case 'Blockquote' : oItem = new FCKToolbarButton( 'Blockquote' , FCKLang.Blockquote, null, null, false, true, 73 ) ; break ; 74 case 'CreateDiv' : oItem = new FCKToolbarButton( 'CreateDiv' , FCKLang.CreateDiv, null, null, false, true, 74 ) ; break ; 74 75 75 76 case 'Link' : oItem = new FCKToolbarButton( 'Link' , FCKLang.InsertLinkLbl, FCKLang.InsertLink, null, false, true, 34 ) ; break ; -
FCKeditor/trunk/fckconfig.js
r2157 r2209 106 106 '/', 107 107 ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], 108 ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote' ],108 ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'], 109 109 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], 110 110 ['Link','Unlink','Anchor'], … … 146 146 ] ; 147 147 148 FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form' ] ;148 FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ; 149 149 FCKConfig.BrowserContextMenuOnCtrl = false ; 150 150 -
FCKeditor/trunk/_whatsnew.html
r2188 r2209 43 43 from the Link dialog are now encoded by default to prevent being harvested by spammers. 44 44 (Kudos to asuter for proposing the patch) </li> 45 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2234">#2234</a>] Added the 46 ability to create, modify and remove Div containers.</li> 45 47 </ul> 46 48 <p>