Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- TinysMCE shithead script init here -->
- <script src="~/scripts/tinymce/tinymce.min.js"></script>
- <!-- Script to wire up your TinyMCE editor -->
- <script type="text/javascript">
- tinyMCE.PluginManager.add('stylebuttons', function (editor, url) {
- ['pre', 'p', 'code', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].forEach(function (name) {
- editor.addButton("style-" + name, {
- title: 'titlu',
- tooltip: "Titlu",
- image: '../Scripts/tinymce/plugins/emoticons/img/smiley-cool.gif',
- text: name.toUpperCase(),
- onClick: function () { editor.execCommand('mceToggleFormat', false, name); },
- onPostRender: function () {
- var self = this, setup = function () {
- editor.formatter.formatChanged(name, function (state) {
- self.active(state);
- });
- };
- editor.formatter ? setup() : editor.on('init', setup);
- }
- })
- });
- });
- function ValidationTinyMceSetup(editor) {
- var $textarea = $('#' + editor.editorId);
- // method to use to save editor contents to backend input field (TinyMCE hides real input and syncs it up
- // with values on form submit) -- we need to sync up the hidden input fields and call the valid()
- // method from jQuery unobtrusive validation if it is present
- function save(editor) {
- if (editor.isDirty) {
- editor.save();
- var $input = $('#' + editor.editorId);
- if (typeof $input.valid === 'function')
- $input.valid();
- }
- }
- // Save tinyMCE contents to input field on key/up down (efficiently so IE-old friendly)
- var typingTimerDown, typingTimerUp;
- var triggerDownSaveInterval = 1000; // time in ms
- var triggerUpSaveInterval = 500; // time in ms
- editor.onKeyDown.add(function (editor) {
- clearTimeout(typingTimerDown);
- typingTimerDown = setTimeout(function () { save(editor) }, triggerDownSaveInterval);
- });
- editor.onKeyUp.add(function () {
- clearTimeout(typingTimerUp);
- typingTimerUp = setTimeout(function () { save(editor) }, triggerUpSaveInterval);
- });
- // Save tinyMCE contents to input field on deactivate (when focus leaves editor)
- // this is via TAB
- editor.onKeyDown.add(function (editor, event) {
- if (event.keyCode === 9)
- save(editor);
- });
- // Initialize your tinyMCE Editor with your preferred options
- tinymce.init({
- menubar: false,
- elementpath: false,
- setup: ValidationTinyMceSetup,
- selector: 'textarea',
- content_style: "div, p { font-size: 15px; font-family:arial; }",
- forced_root_block: 'div',
- height: 300,
- width: 600,
- theme: 'modern',
- plugins: [
- 'advlist autolink lists link print preview hr media',
- 'template paste textpattern stylebuttons'
- ],
- toolbar1: 'bold italic | bullist numlist outdent indent | print preview media | style-h4 "',
- image_advtab: true,
- content_css: [
- '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
- '//www.tinymce.com/css/codepen.min.css'
- ],
- init_instance_callback: "insert_contents",
- });
- </script>
- <script type="text/javascript">
- function insert_contents(inst) {
- inst.setContent('<h3><strong>Profilul Candidatului</strong></h3><div>Exemplu Text liber</div><div>Exemplu Lista</div><ol><li>exemplu1</li><li>exemplu2</li></ol><h3><strong>Profilul Companiei</strong></h3><div><div>Exemplu Text liber</div><div>Exemplu Lista</div><ul style="list-style-type: disc;"><li>exemplu1</li><li>exemplu2</li></ul></div><div> </div><div> </div><div> </div>');
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement