OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 innerConfig.name = oldModeName; | 2107 innerConfig.name = oldModeName; |
2108 var codeMirrorMode = CodeMirror.getMode(config, innerConfig); | 2108 var codeMirrorMode = CodeMirror.getMode(config, innerConfig); |
2109 codeMirrorMode.name = modeName; | 2109 codeMirrorMode.name = modeName; |
2110 codeMirrorMode.token = tokenOverride.bind(null, codeMirrorMode.token); | 2110 codeMirrorMode.token = tokenOverride.bind(null, codeMirrorMode.token); |
2111 return codeMirrorMode; | 2111 return codeMirrorMode; |
2112 } | 2112 } |
2113 | 2113 |
2114 function tokenOverride(superToken, stream, state) | 2114 function tokenOverride(superToken, stream, state) |
2115 { | 2115 { |
2116 var token = superToken(stream, state); | 2116 var token = superToken(stream, state); |
2117 return token ? tokenPrefix + token : token; | 2117 return token ? tokenPrefix + token.split(/ +/).join(" " + tokenPrefix) :
token; |
2118 } | 2118 } |
2119 } | 2119 } |
2120 | 2120 |
2121 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-")
; | 2121 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("css", "css-")
; |
2122 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript",
"js-"); | 2122 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("javascript",
"js-"); |
2123 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-")
; | 2123 WebInspector.CodeMirrorTextEditor._overrideModeWithPrefixedTokens("xml", "xml-")
; |
2124 | 2124 |
2125 (function() { | 2125 (function() { |
2126 var backgroundColor = InspectorFrontendHost.getSelectionBackgroundColor(); | 2126 var backgroundColor = InspectorFrontendHost.getSelectionBackgroundColor(); |
2127 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; | 2127 var backgroundColorRule = backgroundColor ? ".CodeMirror .CodeMirror-selecte
d { background-color: " + backgroundColor + ";}" : ""; |
2128 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); | 2128 var foregroundColor = InspectorFrontendHost.getSelectionForegroundColor(); |
2129 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; | 2129 var foregroundColorRule = foregroundColor ? ".CodeMirror .CodeMirror-selecte
dtext:not(.CodeMirror-persist-highlight) { color: " + foregroundColor + "!import
ant;}" : ""; |
2130 if (!foregroundColorRule && !backgroundColorRule) | 2130 if (!foregroundColorRule && !backgroundColorRule) |
2131 return; | 2131 return; |
2132 | 2132 |
2133 var style = document.createElement("style"); | 2133 var style = document.createElement("style"); |
2134 style.textContent = backgroundColorRule + foregroundColorRule; | 2134 style.textContent = backgroundColorRule + foregroundColorRule; |
2135 document.head.appendChild(style); | 2135 document.head.appendChild(style); |
2136 })(); | 2136 })(); |
OLD | NEW |