|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <title>Markdown Editor</title> |
| 5 | + <script src="https://unpkg.com/vue"></script> |
| 6 | + <script src="https://unpkg.com/marked@0.3.6"></script> |
| 7 | + <script src="https://unpkg.com/lodash@4.16.0"></script> |
| 8 | + <script src="https://cdn.jsdelivr.net/gh/elmahio/elmah.io.javascript@3.4.1/dist/elmahio.min.js" type="text/javascript"></script> |
| 9 | + <link rel="stylesheet" type="text/css" href="/style.css" /> |
| 10 | + </head> |
| 11 | + <body> |
| 12 | + <div id="editor"> |
| 13 | + <textarea :value="input" @input="update"></textarea> |
| 14 | + <div v-html="compiledMarkdown"></div> |
| 15 | + <!-- Trigger a Vue.js warning with this line --> |
| 16 | + <!--div v-html="invalid"></div--> |
| 17 | + </div> |
| 18 | + |
| 19 | + <script> |
| 20 | + // Initialize the logger and subscribe to window.onerror |
| 21 | + var logger = new Elmahio({ |
| 22 | + apiKey: "API_KEY", |
| 23 | + logId: "LOG_ID" |
| 24 | + }); |
| 25 | + // Log errors from Vue.js to elmah.io |
| 26 | + Vue.config.errorHandler = function (err, vm, info) { |
| 27 | + logger.error(err.message, err); |
| 28 | + }; |
| 29 | + // Log warnings from Vue.js to elmah.io |
| 30 | + Vue.config.warnHandler = function (msg, vm, trace) { |
| 31 | + logger.warning(msg); |
| 32 | + }; |
| 33 | + new Vue({ |
| 34 | + el: "#editor", |
| 35 | + data: { |
| 36 | + input: "# hello" |
| 37 | + }, |
| 38 | + computed: { |
| 39 | + compiledMarkdown: function() { |
| 40 | + // Trigger a Vue.js error with this line |
| 41 | + //return x; |
| 42 | + return marked(this.input, { sanitize: true }); |
| 43 | + } |
| 44 | + }, |
| 45 | + methods: { |
| 46 | + update: _.debounce(function(e) { |
| 47 | + this.input = e.target.value; |
| 48 | + // Trigger a window.onerror with this line |
| 49 | + //throw new Error("Error in debounce"); |
| 50 | + }, 300) |
| 51 | + } |
| 52 | + }); |
| 53 | + </script> |
| 54 | + </body> |
| 55 | +</html> |
0 commit comments