Forms > Bootstrap Editors

  • My Income $47,171
  • Site Traffic  45%
  • Site Orders  2447

Markdown

Markdown API

Markdown API

Method Name Description
showEditor() Toggle on the editor visibility
showPreview() Toggle on the preview visibility
hidePreview() Toggle off the editor visibility
isDirty() Check the editor content state, return true if the original content was changed
getContent() Get the editor content
setContent(string content) Set the editor content
findSelection(string words) Find some words/sentence within the editor and returned selection object(containing word position and other useful information).
getSelection() Get the current selected chunk of words within the editor.
setSelection(int start, int end) Tell the editor to select a span of words from start to end.
replaceSelection(string content) Replace the current selected chunk of words within the editor with any content.
getNextTab() Get the next tab memory. Returned selection object(containing word position and other useful information).
setNextTab(int start, int end) Tell the editor to select a span of words from start to end at next tab keypress event.
enableButtons(string name) Enabled a button by name that described in buttons or additionalButtons arrays. Passing all will enabled all buttons.
disableButtons(string name) Disabled a button by name that described in buttons or additionalButtons arrays. Passing all will disabled all buttons.

Summernote (Lightweight)

Example

Summernote Example

var edit = function() { $('.click2edit').summernote() };
HTML:
<button id="edit" class="btn btn-primary" onclick="edit()" type="button">Edit 1</button>
<button id="save" class="btn btn-primary" onclick="save()" type="button">Save 2</button>
<div class="click2edit">click2edit</div>
Script:
var edit = function() {
  $('.click2edit').summernote({focus: true});
};
var save = function() {
  var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
  $('.click2edit').destroy();
};
Documentation:

Full API for Summernote.js, including keybored shortcuts, PHP Examples, Django installation, and Rails (gem) integration can be found here