Skip to content

Instantly share code, notes, and snippets.

@ibdknox
Created January 31, 2013 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibdknox/4686996 to your computer and use it in GitHub Desktop.
Save ibdknox/4686996 to your computer and use it in GitHub Desktop.
example of codemirror widgets getting cut off.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CodeMirror: Inline Widget Demo</title>
<link rel="stylesheet" href="../lib/codemirror.css">
<script src="../lib/codemirror.js"></script>
<script src="../mode/javascript/javascript.js"></script>
<link rel="stylesheet" href="../doc/docs.css">
<style type="text/css">
.CodeMirror {border: 1px solid black;}
.lint-error {font-family: arial; font-size: 70%; background: #ffa; color: #a00; padding: 2px 5px 3px; }
.lint-error-icon {color: white; background-color: red; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 7px;}
</style>
</head>
<body>
<h1>CodeMirror: Inline Widget Demo</h1>
<div id=code></div>
<script id="script">
window.onload = function() {
var sc = document.getElementById("script");
var content = sc.textContent || sc.innerText || sc.innerHTML;
window.editor = CodeMirror(document.getElementById("code"), {
lineNumbers: true,
mode: "javascript",
value: content
});
var span = document.createElement("span");
span.innerHTML = "this is some content";
window.editor.setBookmark({line:18}, span);
};
"long line to create a horizontal scrollbar, in order to test whether the (non-inline) widgets stay in place when scrolling to the right";
</script>
<p>This demo runs <a href="http://jshint.com">JSHint</a> over the code
in the editor (which is the script used on this page), and
inserts <a href="../doc/manual.html#addLineWidget">line widgets</a> to
display the warnings that JSHint comes up with.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment