Changeset 244
- Timestamp:
- 2007-04-09 20:12:02 (20 months ago)
- Location:
- FCKeditor/branches/developers/mjk/editor
- Files:
-
- 11 modified
-
dialog/fck_anchor.html (modified) (1 diff)
-
dialog/fck_find.html (modified) (5 diffs)
-
dialog/fck_table.html (modified) (2 diffs)
-
fckdialog.html (modified) (5 diffs)
-
lang/en.js (modified) (1 diff)
-
_source/classes/fckeditingarea.js (modified) (3 diffs)
-
_source/commandclasses/fck_othercommands.js (modified) (2 diffs)
-
_source/internals/fckcommands.js (modified) (1 diff)
-
_source/internals/fck.js (modified) (8 diffs)
-
_source/internals/fcktoolbaritems.js (modified) (2 diffs)
-
_source/internals/fcktoolbarset.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/developers/mjk/editor/dialog/fck_anchor.html
r132 r244 65 65 if ( oAnchor ) 66 66 GetE('txtName').value = oAnchor.name ; 67 else 68 oAnchor = null ; 67 else if (FCK.Selection.GetType() == 'Text') 68 //for text anchors, use the selected text as default anchor name 69 if (FCK.Selection.SelectedText()) 70 GetE('txtName').value = FCK.Selection.SelectedText(); 71 69 72 70 73 window.parent.SetOkButton( true ) ; -
FCKeditor/branches/developers/mjk/editor/dialog/fck_find.html
r132 r244 24 24 <html xmlns="http://www.w3.org/1999/xhtml"> 25 25 <head> 26 <title> </title>26 <title>Find and Replace</title> 27 27 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 28 28 <meta content="noindex, nofollow" name="robots" /> 29 <script src="common/fck_dialog_common.js" type="text/javascript"></script> 30 <link href="common/fck_dialog_common.css" rel="stylesheet" type="text/css" /> 29 31 <script type="text/javascript"> 30 32 31 33 var oEditor = window.parent.InnerDialogLoaded() ; 34 var FCK = oEditor.FCK ; 35 var FCKLang = oEditor.FCKLang ; 36 var FCKConfig = oEditor.FCKConfig ; 37 var strFind = ''; 38 var bFirstFind = true; 39 40 window.parent.AddTab( 'Find', FCKLang.DlgFindTitle) ; 41 window.parent.AddTab( 'Replace', FCKLang.DlgReplaceTitle) ; 42 43 //show the tabs and hide the buttons -- because we draw buttons on the tabs 44 parent.document.getElementById("TabsRow").style.display = ""; 45 parent.document.getElementById("Buttons").style.display = "none"; 46 47 // Function called when a dialog tag is selected. 48 function OnDialogTabChange( tabCode ) 49 { 50 document.getElementById('replace').style.display = (tabCode == 'Find') ? 'none' : ''; 51 document.getElementById('replaceButtons').style.display = (tabCode == 'Find') ? 'none' : ''; 52 //fixme: allow hide/show of regex based on user privs 53 document.getElementById('regex').style.display = (tabCode == 'Replace') ? '' : 'none'; 54 55 } 32 56 33 57 function OnLoad() 34 58 { 35 // Whole word is available on IE only.36 if ( oEditor.FCKBrowserInfo.IsIE )37 document.getElementById('divWord').style.display = '' ;38 39 59 // First of all, translate the dialog box texts. 40 60 oEditor.FCKLanguageManager.TranslatePage( document ) ; 41 61 42 62 window.parent.SetAutoSize( true ) ; 63 if ( document.location.search.substr(1) == 'rep') 64 window.parent.SetSelectedTab('Replace'); 43 65 } 44 66 … … 48 70 ( document.getElementById('txtFind').value.length == 0 ) ; 49 71 } 50 51 function ReplaceTextNodes( parentNode, regex, replaceValue, replaceAll ) 52 { 53 for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) 54 { 55 var oNode = parentNode.childNodes[i] ; 56 if ( oNode.nodeType == 3 ) 57 { 58 var sReplaced = oNode.nodeValue.replace( regex, replaceValue ) ; 59 if ( oNode.nodeValue != sReplaced ) 60 { 61 oNode.nodeValue = sReplaced ; 62 if ( ! replaceAll ) 63 return true ; 64 } 65 } 66 else 67 { 68 if ( ReplaceTextNodes( oNode, regex, replaceValue ) ) 69 return true ; 70 } 71 } 72 return false ; 73 } 74 75 function GetRegexExpr() 76 { 77 var sExpr ; 78 79 if ( document.getElementById('chkWord').checked ) 80 sExpr = '\\b' + document.getElementById('txtFind').value + '\\b' ; 81 else 82 sExpr = document.getElementById('txtFind').value ; 83 84 return sExpr ; 85 } 86 87 function GetCase() 88 { 89 return ( document.getElementById('chkCase').checked ? '' : 'i' ) ; 90 } 91 92 function Ok() 93 { 94 if ( document.getElementById('txtFind').value.length == 0 ) 95 return ; 96 97 if ( oEditor.FCKBrowserInfo.IsIE ) 98 FindIE() ; 99 else 100 FindGecko() ; 101 } 102 72 function Find(bDB) 73 { 74 //start finding at the top -- IE does this automagically 75 if (bFirstFind) 76 { 77 FCK.Selection.SelectNode(oEditor.FCK.EditorDocument.body); 78 FCK.Selection.Collapse(); 79 } 80 if ( document.getElementById('txtFind').value.length == 0 ) 81 return false; 82 var bOut; 83 if ( oEditor.FCKBrowserInfo.IsIE ) 84 bOut = FindIE(document.getElementById('txtFind').value, 85 document.getElementById('chkCase').checked, 86 document.getElementById('chkWord').checked) ; 87 else 88 bOut = FindGecko(document.getElementById('txtFind').value, 89 document.getElementById('chkCase').checked, 90 document.getElementById('chkWord').checked) ; 91 if (!bOut && bDB) alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; 92 bFirstFind = false; 93 return bOut; 94 } 95 96 function Replace() //replace -- or if nothing selected, Find Next 97 { 98 if (document.getElementById('chkRegex').checked) 99 return ReplaceAllRegex(); 100 101 if (FCK.Selection.SelectedHTML()) 102 FCK.InsertHtml(filterReplaceText()); 103 Find(true); 104 } 105 106 function ReplaceAll() 107 { 108 if (document.getElementById('chkRegex').checked) 109 return ReplaceAllRegex(); 110 while (Find(false) && FCK.Selection.SelectedHTML()) 111 { 112 FCK.InsertHtml(filterReplaceText()); 113 } 114 } 115 116 function ReplaceAllRegex() 117 { 118 var strXHTML = FCK.GetXHTML(false); 119 strXHTML = strXHTML.replace(new RegExp(document.getElementById('txtFind').value, 120 document.getElementById('chkCase').checked ? 'g' : 'gi'), 121 document.getElementById('txtReplace').value); 122 FCK.SetHTML(strXHTML); 123 } 124 125 function filterReplaceText() 126 { 127 var sHtml = document.getElementById('txtReplace').value; 128 sHtml = sHtml.replace(/&/ig,'&'); 129 sHtml = sHtml.replace(/</ig,'<'); 130 sHtml = sHtml.replace(/>/ig,'>'); 131 return sHtml 132 } 103 133 var oRange ; 104 134 … … 106 136 oRange = oEditor.FCK.EditorDocument.body.createTextRange() ; 107 137 108 function FindIE( )138 function FindIE(strText, bCase, bWord) 109 139 { 110 140 var iFlags = 0 ; 111 141 112 if ( chkCase.checked)142 if (bCase) 113 143 iFlags = iFlags | 4 ; 114 144 115 if ( chkWord.checked)145 if (bWord) 116 146 iFlags = iFlags | 2 ; 117 118 var bFound = oRange.findText( document.getElementById('txtFind').value, 1, iFlags ) ; 119 120 if ( bFound ) 121 { 147 var bFound = oRange.findText(strText, 1, iFlags ) ; 148 149 if ( bFound ) { 122 150 oRange.scrollIntoView() ; 123 151 oRange.select() ; 124 152 oRange.collapse(false) ; 125 153 oLastRangeFound = oRange ; 154 return true; 126 155 } 127 156 else 128 157 { 129 158 oRange = oEditor.FCK.EditorDocument.body.createTextRange() ; 130 alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;131 159 } 132 } 133 134 function FindGecko() 160 return false; 161 } 162 163 function FindGecko(strText, bCase, bWord) 135 164 { 136 165 var bCase = document.getElementById('chkCase').checked ; … … 138 167 139 168 // window.find( searchString, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog ) ; 140 if ( !oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ) ) 141 alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; 142 } 143 </script> 169 var bFound = oEditor.FCK.EditorWindow.find( document.getElementById('txtFind').value, bCase, false, false, bWord, false, false ); 170 171 return (bFound); 172 } 173 174 function toggleRegex() 175 { 176 bRegex = document.getElementById('chkRegex').checked ; 177 document.getElementById('btnReplace').disabled = bRegex; 178 document.getElementById('btnFind').disabled = bRegex; 179 } 180 </script> 144 181 </head> 145 182 <body onload="OnLoad()" style="overflow: hidden"> 146 <table cellspacing="3" cellpadding="2" width="100%" border="0" >183 <table cellspacing="3" cellpadding="2" width="100%" border="0" height="130"> 147 184 <tr> 148 185 <td nowrap="nowrap"> … … 151 188 </td> 152 189 <td width="100%"> 153 <input id="txtFind" style="width: 100%" tabindex="1" type="text" /> 154 </td> 155 <td> 156 <input id="btnFind" style="padding-right: 5px; padding-left: 5px" onclick="Ok();" 157 type="button" value="Find" fcklang="DlgFindFindBtn" /> 190 <input id="txtFind" style="width: 100%" tabindex="1" type="text" 191 onkeyup = "document.getElementById('btnFind').disabled = ( document.getElementById('txtFind').value.length == 0 || document.getElementById('chkRegex').checked );" /> 192 </td> 193 </tr> 194 <tr id="replace" style="display:none"> 195 <td valign="top" nowrap="nowrap"> 196 <label for="txtReplace" fcklang="DlgReplaceReplaceLbl"> 197 Replace with:</label> 198 </td> 199 <td valign="top"> 200 <input id="txtReplace" style="width: 100%" tabindex="2" type="text" /> 158 201 </td> 159 202 </tr> 160 203 <tr> 161 <td valign="bottom" colspan="3"> 162 <input id="chkCase" tabindex="3" type="checkbox" /><label for="chkCase" fcklang="DlgReplaceCaseChk">Match 163 case</label> 164 <br /> 165 <div id="divWord" style="display: none"> 166 <input id="chkWord" tabindex="4" type="checkbox" /><label for="chkWord" fcklang="DlgReplaceWordChk">Match 167 whole word</label> 168 </div> 204 <td valign="middle" colspan="2"> 205 <table border="0"> 206 <tr> 207 <td> 208 <input id="chkCase" tabindex="3" type="checkbox" /><label for="chkCase" fcklang="DlgReplaceCaseChk">Match 209 case</label> 210 <br /> 211 <input id="chkWord" tabindex="4" type="checkbox" /><label for="chkWord" fcklang="DlgReplaceWordChk">Match 212 whole word</label> 213 </td> 214 <td id="regex" valign="top" style="display:none"> 215 <input id="chkRegex" tabindex="5" type="checkbox" onclick="toggleRegex()"/><label for="chkRegex">Regex</label> 216 </td> 217 </tr> 218 </table> 169 219 </td> 170 220 </tr> 171 221 </table> 222 <div style="text-align: right; margin-right: 5px"> 223 <span id="replaceButtons" style="display:none"> 224 <input type="button" id="btnReplaceAll" class="button" value="Replace All" onclick="ReplaceAll()" fcklang="DlgReplaceReplaceAllBtn" /> 225 <input type="button" id="btnReplace" class="button" value="Replace" onclick="Replace()" fcklang="DlgReplaceReplaceBtn" /></span> 226 <input type="button" id="btnFind" class="button" value="Find Next" onclick="Find()" disabled="disabled" /> 227 <input type="button" id="btnCancel" class="button" value="Close" onclick="top.Cancel()" /> 228 </div> 172 229 </body> 173 230 </html> -
FCKeditor/branches/developers/mjk/editor/dialog/fck_table.html
r132 r244 66 66 document.getElementById('selWidthType').value = "percent" ; 67 67 } 68 else if (iWidth.indexOf('px') >= 0) // Style Pixel = px68 else // Style Pixel = px, or width=nn 69 69 { // 70 70 iWidth = iWidth.substr(0,iWidth.length - 2); … … 89 89 document.getElementById('txtColumns').disabled = true ; 90 90 } 91 92 window.parent.SetOkButton( true ) ; 93 window.parent.SetAutoSize( true ) ; 91 window.parent.SetOkButton( true ) ; 92 window.parent.SetAutoSize( true ) ; 94 93 } 95 94 -
FCKeditor/branches/developers/mjk/editor/fckdialog.html
r153 r244 132 132 SetSelectedTab( this.TabCode ) ; 133 133 } 134 135 function AddTab( tabCode, tabText, startHidden )134 135 function AddTab( tabCode, tabText, startHidden, bNoTabRow ) 136 136 { 137 137 if ( typeof( oTabs[ tabCode ] ) != 'undefined' ) … … 162 162 163 163 oDiv.className = 'PopupTabSelected' ; 164 eTabsRow.style.display = '' ;164 if (!bNoTabRow) eTabsRow.style.display = '' ; 165 165 166 166 if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) … … 183 183 if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' ) 184 184 window.frames["frmMain"].OnDialogTabChange( tabCode ) ; 185 } 186 187 function GetSelectedTab() 188 { 189 for ( var sCode in oTabs ) 190 { 191 if (oTabs[sCode].className == 'PopupTabSelected') 192 return sCode; 193 } 185 194 } 186 195 … … 210 219 switch ( e.keyCode ) 211 220 { 212 case 13 : // ENTER 221 case 76 : // Ctrl+Alt+L: become lowercase 222 if (e.altKey && e.ctrlKey) 223 { 224 var oTarget = e.srcElement || e.target ; 225 if (oTarget.value) oTarget.value = oTarget.value.toLowerCase(); 226 return false; 227 } 228 break; 229 case 82 : // Ctrl+Alt+R: become Propercase 230 if (e.altKey && e.ctrlKey) 231 { 232 var oTarget = e.srcElement || e.target ; 233 if (oTarget.value) oTarget.value = oTarget.value.toLowerCase().replace(/(\S)(\S*\s*)/g, 234 function(str,p1,p2) {return p1.toUpperCase()+p2}); 235 return false; 236 } 237 break; 238 case 85 : // Ctrl+Alt+U: become UPPERCASE 239 if (e.altKey && e.ctrlKey) 240 { 241 var oTarget = e.srcElement || e.target ; 242 if (oTarget.value) oTarget.value = oTarget.value.toUpperCase(); 243 return false; 244 } 245 break; 246 247 case 13 : // ENTER 213 248 var oTarget = e.srcElement || e.target ; 214 249 if ( oTarget.tagName == 'TEXTAREA' ) … … 306 341 </td> 307 342 </tr> 308 <tr >343 <tr id="Buttons"> 309 344 <td class="PopupButtons"> 310 <table border="0" cellpadding="0" cellspacing="0" >345 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 311 346 <tr> 312 <td width="100%"> </td>313 <td nowrap="nowrap">314 <input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />347 <td nowrap="nowrap" align="right" width="100%"> 348 <span id="runtimeButtons"></span> 349 <input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" /> 315 350 316 351 <input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" /> -
FCKeditor/branches/developers/mjk/editor/lang/en.js
r174 r244 124 124 FlashProperties : "Flash Properties", 125 125 126 AnchorDelete : "Remove Anchor", 126 127 AnchorProp : "Anchor Properties", 127 128 ButtonProp : "Button Properties", -
FCKeditor/branches/developers/mjk/editor/_source/classes/fckeditingarea.js
r205 r244 49 49 eTargetElement.removeChild( eTargetElement.childNodes[0] ) ; 50 50 51 if ( this.Mode == FCK_EDITMODE_WYSIWYG ) 52 { 51 52 53 53 // Create the editing area IFRAME. 54 54 var oIFrame = this.IFrame = oTargetDocument.createElement( 'iframe' ) ; … … 120 120 else 121 121 FCKEditingArea_CompleteStart.call( this.Window ) ; 122 } 123 else 124 { 125 var eTextarea = this.Textarea = oTargetDocument.createElement( 'textarea' ) ; 126 eTextarea.className = 'SourceField' ; 127 eTextarea.dir = 'ltr' ; 128 eTextarea.style.width = eTextarea.style.height = '100%' ; 129 eTextarea.style.border = 'none' ; 130 eTargetElement.appendChild( eTextarea ) ; 131 132 eTextarea.value = html ; 133 134 // Fire the "OnLoad" event. 135 FCKTools.RunFunction( this.OnLoad ) ; 136 } 122 123 137 124 } 138 125 … … 214 201 try 215 202 { 216 if ( this.Mode == FCK_EDITMODE_WYSIWYG ) 217 { 218 // The following check is important to avoid IE entering in a focus loop. Ref: 219 // http://sourceforge.net/tracker/index.php?func=detail&aid=1567060&group_id=75348&atid=543653 220 if ( FCKBrowserInfo.IsIE && this.Document.hasFocus() ) 221 return ; 222 223 if ( FCKBrowserInfo.IsSafari ) 224 this.IFrame.focus() ; 225 else 226 { 227 this.Window.focus() ; 228 } 229 } 203 // The following check is important to avoid IE entering in a focus loop. Ref: 204 // http://sourceforge.net/tracker/index.php?func=detail&aid=1567060&group_id=75348&atid=543653 205 if ( FCKBrowserInfo.IsIE && this.Document.hasFocus() ) 206 return ; 207 if ( FCKBrowserInfo.IsSafari ) 208 this.IFrame.focus() ; 230 209 else 231 210 { 232 var oDoc = FCKTools.GetElementDocument( this.Textarea ) ; 233 if ( (!oDoc.hasFocus || oDoc.hasFocus() ) && oDoc.activeElement == this.Textarea ) 234 return ; 235 236 this.Textarea.focus() ; 211 this.Window.focus() ; 237 212 } 238 213 } -
FCKeditor/branches/developers/mjk/editor/_source/commandclasses/fck_othercommands.js
r243 r244 339 339 340 340 // FCKSelectAllCommand 341 // mjk: since source is in the main frame, this command is now 342 // redundant and probably should be removed. 341 343 var FCKSelectAllCommand = function() 342 344 { … … 346 348 FCKSelectAllCommand.prototype.Execute = function() 347 349 { 348 if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ) 349 { 350 FCK.ExecuteNamedCommand( 'SelectAll' ) ; 351 } 352 else 353 { 354 // Select the contents of the textarea 355 var textarea = FCK.EditingArea.Textarea ; 356 if ( FCKBrowserInfo.IsIE ) 357 { 358 textarea.createTextRange().execCommand( 'SelectAll' ) ; 359 } 360 else 361 { 362 textarea.selectionStart = 0; 363 textarea.selectionEnd = textarea.value.length ; 364 } 365 textarea.focus() ; 366 } 350 FCK.ExecuteNamedCommand( 'SelectAll' ) ; 367 351 } 368 352 -
FCKeditor/branches/developers/mjk/editor/_source/internals/fckcommands.js
r243 r244 50 50 51 51 case 'Find' : oCommand = new FCKDialogCommand( 'Find' , FCKLang.DlgFindTitle , 'dialog/fck_find.html' , 340, 170 ) ; break ; 52 case 'Replace' : oCommand = new FCKDialogCommand( 'Replace' , FCKLang.DlgReplaceTitle , 'dialog/fck_ replace.html', 340, 200 ) ; break ;52 case 'Replace' : oCommand = new FCKDialogCommand( 'Replace' , FCKLang.DlgReplaceTitle , 'dialog/fck_find.html?rep' , 340, 200 ) ; break ; 53 53 54 54 case 'Image' : oCommand = new FCKDialogCommand( 'Image' , FCKLang.DlgImgTitle , 'dialog/fck_image.html' , 450, 400 ) ; break ; -
FCKeditor/branches/developers/mjk/editor/_source/internals/fck.js
r219 r244 49 49 { 50 50 if ( this.EditMode == FCK_EDITMODE_SOURCE ) 51 return ( this.StartupValue != this.EditingArea.Textarea.value );51 return ( this.StartupValue != FCK._fromRawHTML(this.EditorDocument.body.innerHTML)); 52 52 else 53 53 return ( this.StartupValue != this.EditorDocument.body.innerHTML ) ; … … 57 57 { 58 58 if ( this.EditMode == FCK_EDITMODE_SOURCE ) 59 this.StartupValue = this.EditingArea.Textarea.value;59 this.StartupValue = FCK._fromRawHTML(this.EditorDocument.body.innerHTML); 60 60 else if ( this.EditorDocument.body ) 61 61 this.StartupValue = this.EditorDocument.body.innerHTML ; … … 196 196 // represent the exact contents of the source, as the user wanted it to be. 197 197 if ( FCK.EditMode == FCK_EDITMODE_SOURCE ) 198 return FCK. EditingArea.Textarea.value;