Skip to content

Instantly share code, notes, and snippets.

@drinchev
Created March 30, 2016 10:25
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 drinchev/e8896914a58f3d3678fab75575577959 to your computer and use it in GitHub Desktop.
Save drinchev/e8896914a58f3d3678fab75575577959 to your computer and use it in GitHub Desktop.
TinyMCE External Editor
<!DOCTYPE html>
<html>
<head>
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script>
tinymce.init({
selector:'#editor',
min_height : 300,
plugins: ['image', 'media', 'link', 'autolink'],
toolbar2: "| link unlink anchor | image media | forecolor backcolor | print preview code ",
menubar: false,
inline: true,
toolbar: false
});
</script>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0; padding: 0;
}
.wrapper {
display: block;
max-width: 640px;
margin: 0 auto;
}
#toolbar {
background : black;
text-align: center;
padding: 10px;
width: 100%;
}
#toolbar button {
background: white;
color: black;
border: none;
border-radius: 4px;
font-size: 20px;
width: 50px;
}
#editor {
min-height: 500px;
}
.title {
border: none;
padding: 15px;
font-size: 24px;
width: 100%;
text-align: center;
}
.separator {
width: 50px;
display: inline-block;
}
</style>
</head>
<body>
<div id="toolbar">
<button onclick="tinymce.activeEditor.buttons.alignleft.onclick();">AL</button>
<button onclick="tinymce.activeEditor.buttons.aligncenter.onclick();">AC</button>
<button onclick="tinymce.activeEditor.buttons.alignright.onclick();">AR</button>
<div class="separator"></div>
<button onclick="tinymce.activeEditor.buttons.link.onclick();">L</button>
<button onclick="tinymce.activeEditor.buttons.media.onclick();">M</button>
<div class="separator"></div>
<button onclick="tinymce.activeEditor.buttons.bold.onclick();">B</button>
<button onclick="tinymce.activeEditor.buttons.italic.onclick();">I</button>
<button onclick="tinymce.activeEditor.buttons.underline.onclick();">U</button>
</div>
<div class="wrapper">
<input class="title" type="text" placeholder="Title" />
<div id="editor">Easy (and free!) You should check out our premium features.</div>
<hr />
Products and other
</div>
<script>
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment