OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.View} | 7 * @extends {WebInspector.View} |
8 */ | 8 */ |
9 WebInspector.DocumentationView = function() | 9 WebInspector.DocumentationView = function() |
10 { | 10 { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 for (var i = 0; i < examples.length; ++i) { | 211 for (var i = 0; i < examples.length; ++i) { |
212 var example = section.createChild("div", "documentation-example"); | 212 var example = section.createChild("div", "documentation-example"); |
213 var exampleDescription = example.createChild("div", "documentation-e
xample-description-section"); | 213 var exampleDescription = example.createChild("div", "documentation-e
xample-description-section"); |
214 if (examples[i].liveUrl) { | 214 if (examples[i].liveUrl) { |
215 var liveUrl = exampleDescription.createChild("a", "documentation
-example-link"); | 215 var liveUrl = exampleDescription.createChild("a", "documentation
-example-link"); |
216 liveUrl.classList.add("documentation-box"); | 216 liveUrl.classList.add("documentation-box"); |
217 liveUrl.href = examples[i].liveUrl; | 217 liveUrl.href = examples[i].liveUrl; |
218 liveUrl.textContent = WebInspector.UIString("Example"); | 218 liveUrl.textContent = WebInspector.UIString("Example"); |
219 } | 219 } |
220 exampleDescription.appendChild(this._renderBlock(examples[i].descrip
tion)); | 220 if (examples[i].description) |
| 221 exampleDescription.appendChild(this._renderBlock(examples[i].des
cription)); |
221 var code = example.createChild("div", "documentation-code"); | 222 var code = example.createChild("div", "documentation-code"); |
222 code.classList.add("source-code"); | 223 code.classList.add("source-code"); |
223 code.textContent = examples[i].code; | 224 code.textContent = examples[i].code; |
224 if (!examples[i].language) | 225 if (!examples[i].language) |
225 continue; | 226 continue; |
226 var syntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(WebIns
pector.DocumentationView._languageToMimeType[examples[i].language.toLowerCase()]
, true); | 227 var syntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(WebIns
pector.DocumentationView._languageToMimeType[examples[i].language.toLowerCase()]
, true); |
227 syntaxHighlighter.syntaxHighlightNode(code); | 228 syntaxHighlighter.syntaxHighlightNode(code); |
228 } | 229 } |
229 }, | 230 }, |
230 | 231 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 function computeDescriptors(column) | 341 function computeDescriptors(column) |
341 { | 342 { |
342 var token = textEditor.tokenAtTextPosition(textSelection.startLine,
column); | 343 var token = textEditor.tokenAtTextPosition(textSelection.startLine,
column); |
343 if (!token) | 344 if (!token) |
344 return []; | 345 return []; |
345 var tokenText = textEditor.line(textSelection.startLine).substring(t
oken.startColumn, token.endColumn); | 346 var tokenText = textEditor.line(textSelection.startLine).substring(t
oken.startColumn, token.endColumn); |
346 return urlProvider.itemDescriptors(tokenText); | 347 return urlProvider.itemDescriptors(tokenText); |
347 } | 348 } |
348 } | 349 } |
349 } | 350 } |
OLD | NEW |