| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also | 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> | 8 --> |
| 9 | 9 |
| 10 <link rel="import" href="../polymer/polymer.html"> | 10 <link rel="import" href="../polymer/polymer.html"> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 attached: function() { | 28 attached: function() { |
| 29 marked.setOptions({ | 29 marked.setOptions({ |
| 30 highlight: this.highlight.bind(this) | 30 highlight: this.highlight.bind(this) |
| 31 }); | 31 }); |
| 32 if (!this.text) { | 32 if (!this.text) { |
| 33 this.text = this.innerHTML; | 33 this.text = this.innerHTML; |
| 34 } | 34 } |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 textChanged: function () { | 37 textChanged: function (oldVal, newVal) { |
| 38 this.innerHTML = marked(this.text); | 38 if (newVal) { |
| 39 this.innerHTML = marked(this.text); |
| 40 } |
| 39 }, | 41 }, |
| 40 | 42 |
| 41 highlight: function(code, lang) { | 43 highlight: function(code, lang) { |
| 42 var event = this.fire('marked-js-highlight', {code: code, lang: lang}); | 44 var event = this.fire('marked-js-highlight', {code: code, lang: lang}); |
| 43 return event.detail.code || code; | 45 return event.detail.code || code; |
| 44 } | 46 } |
| 45 | 47 |
| 46 }); | 48 }); |
| 47 | 49 |
| 48 </script> | 50 </script> |
| 49 </polymer-element> | 51 </polymer-element> |
| 50 | 52 |
| OLD | NEW |