Krajee

Advanced Usage Example 1

Thankful to Krajee! BUY A COFFEEor to get more out of us.

Advanced usage of the plugin to customize the display and layout of toolbar buttons. For example,the toolbarHeaderL and toolbarFooterL properties have been changed for this example to hide some of the range of buttons.

In addition, this example shows how to set the labels for few buttons via buttonLabels. The undo and redo button labels have been added for this example.

Lastly, this example also shows how you can display twitter emojis instead of browser default supported emojis. For displaying twitter emojis, set the useTwemoji property to true. Next load the Twitter emoji library twemoji.min.js (from the Twitter Emojis repo) on your page. This must be loaded before the markdown-editor.min.js library script as depicted below:

<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js"></script>
<-- load all the markdown editor js script after twitter emoji script -->
<script src="https://cdn.jsdelivr.net/gh/kartik-v/krajee-markdown-editor@1.0.0/js/markdown-editor.min.js"></script>

Note, the demo example(s) uses:

  • this as the raw input source for the markdown textarea.

  • these assets loaded on the page in the order mentioned.

Tip

Not seeing the updated content on this page! Hard refresh your browser to clean cache for this page (e.g. SHIFT-F5 on Windows Chrome)


Example
Code
<textarea id="editor-a1" name="editor-a1" class="form-control" rows="15">
{RAW MARKDOWN DATA}
</textarea>

<script type="text/javascript">
$('#editor-a1').markdownEditor({
    useTwemoji: true,
    toolbarHeaderL: [
        ['undo', 'redo'],
        ['bold', 'italic', 'ins', 'del', 'sup', 'sub', 'mark'],
        ['link', 'image'],
        ['code', 'codeblock'],
        ['emoji']
    ],
    toolbarFooterL: ['export'],
    buttonLabels: {
        undo: 'Undo',
        redo: 'Redo'
    }
});
</script>

Note

You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.

The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.

 
visitors to Krajee Jquery Plugins since 22-May-2017