OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 */ | 336 */ |
337 setContent: function(content, contentEncoded, mimeType) | 337 setContent: function(content, contentEncoded, mimeType) |
338 { | 338 { |
339 if (!this._loaded) { | 339 if (!this._loaded) { |
340 this._loaded = true; | 340 this._loaded = true; |
341 this._textEditor.setText(content || ""); | 341 this._textEditor.setText(content || ""); |
342 this._textEditor.markClean(); | 342 this._textEditor.markClean(); |
343 } else | 343 } else |
344 this._textEditor.editRange(this._textEditor.range(), content || ""); | 344 this._textEditor.editRange(this._textEditor.range(), content || ""); |
345 | 345 |
346 this._textEditor.mimeType = this._simplifyMimeType(mimeType); | 346 mimeType = this._simplifyMimeType(mimeType); |
347 | |
348 // A hack around the fact that files with "php" extension might be eithe r standalone or html embedded php scripts. | |
349 if (mimeType === "text/x-php" && content.match(/\<\?.*\?\>/gi)) | |
apavlov
2013/07/01 12:46:48
The "i" flag is not necessary, since you are not c
| |
350 mimeType = "application/x-httpd-php"; | |
351 | |
352 this._textEditor.mimeType = mimeType; | |
347 | 353 |
348 this._textEditor.beginUpdates(); | 354 this._textEditor.beginUpdates(); |
349 | 355 |
350 this._setTextEditorDecorations(); | 356 this._setTextEditorDecorations(); |
351 | 357 |
352 this._wasShownOrLoaded(); | 358 this._wasShownOrLoaded(); |
353 | 359 |
354 if (this._delayedFindSearchMatches) { | 360 if (this._delayedFindSearchMatches) { |
355 this._delayedFindSearchMatches(); | 361 this._delayedFindSearchMatches(); |
356 delete this._delayedFindSearchMatches; | 362 delete this._delayedFindSearchMatches; |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
812 * @return {Element} | 818 * @return {Element} |
813 */ | 819 */ |
814 createLink: function(hrefValue, isExternal) | 820 createLink: function(hrefValue, isExternal) |
815 { | 821 { |
816 var targetLocation = WebInspector.ParsedURL.completeURL(this._sourceFram e._url, hrefValue); | 822 var targetLocation = WebInspector.ParsedURL.completeURL(this._sourceFram e._url, hrefValue); |
817 return WebInspector.linkifyURLAsNode(targetLocation || hrefValue, hrefVa lue, undefined, isExternal); | 823 return WebInspector.linkifyURLAsNode(targetLocation || hrefValue, hrefVa lue, undefined, isExternal); |
818 }, | 824 }, |
819 | 825 |
820 __proto__: WebInspector.TextEditorDelegate.prototype | 826 __proto__: WebInspector.TextEditorDelegate.prototype |
821 } | 827 } |
OLD | NEW |