Skip to content

Instantly share code, notes, and snippets.

@fitnr
Created July 2, 2014 19:17
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 fitnr/d8eb1f57f9f585ffa253 to your computer and use it in GitHub Desktop.
Save fitnr/d8eb1f57f9f585ffa253 to your computer and use it in GitHub Desktop.
Tinymouse - a simple tinymce editor to have on hand
<html>
<head>
<title>TinyMouse</title>
<!-- TinyMCE -->
<script type="text/javascript" src="tinymce-dist/tinymce.min.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "exact",
elements: "elm1",
theme : "modern",
theme_advanced_buttons1: "styleselect,bold,italic,underline,|,bullist,numlist,|,code,",
fix_list_elements : true,
plugins : "paste",
auto_focus : "elm1",
style_formats : [
{title: 'plain text', inline: 'p'},
{title: 'header 1', block : 'h1' },
{title: 'header 2', block : 'h2' },
{title: 'header 2', block : 'h3' },
{title: 'arr link', inline : 'a', classes: 'arr' }
],
//apply_source_formatting : true,
entity_encoding: "named"
});
</script>
<style type="text/css">
body {
padding: 0;
}
form {
width: 100%;
height: 100%;
padding: 5px;
}
#elm1 {
height: 75%;
}
#elm1, #elm2 {
width: 95%;
margin: 0;
width: 95%;
}
#elm2 {
height: 25%;
}
#elm1_tbl {
width: 100%;
}
</style>
</head>
<body>
<form id="form">
<textarea id="elm1" name="elm1">
</textarea>
<p>
<a href="#" id="action">Get HTML</a>
</p>
<textarea id="elm2" name="elm2">
</textarea>
</form>
<script type="text/javascript">
var e = document.getElementById('action');
e.addEventListener('click', function() {
document.getElementById('elm2').value = tinyMCE.get('elm1').getContent();
return false;
});
</script>
</body>
</html>
@fitnr
Copy link
Author

fitnr commented Jul 2, 2014

Drop https://github.com/tinymce/tinymce-dist in the folder to make it go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment