Skip to content

Releases: jaandrle/SimpleEditor

version 0.7

16 Nov 12:57

Choose a tag to compare

Editor creation

JavaScript

  var i_am_instance= class_SimpleEditor.init({
      editor_element: iframe_NODE_element,
      default_value: default_content
  });

HTML

  <iframe id="editor" src='about:blank'></iframe>
  <button onclick="i_am_instance.format('bold');">Bold</button>

Methods

  • format(format_name):
    • primary for using as onclick listener
    • format_name= DOMString command name (i.e. 'Commands List' below);
  • getContent: return <iframe> HTML content
  • getTextContent: return <iframe> text content

Commands List

  • "bold", "italic", "underline": Toggle bold/italic format new or selected text
  • "removeFormat": remove format
  • "insertOrderedList", "insertUnorderedList", "insertParagraph": add <ol>, <ul>, or <p>
  • "createEmail", "createLink", "insertImage": Toggle email, URL link or create image
    • in case of email and URL link: the link is created from selected text (if detected), or you can add link via prompt
    • "insertImage": for now no detection implemented (in aditional, you must combine this with some uploader)
  • "justifyLeft", "justifyRight", "justifyCenter", "justifyFull": alingment change
  • Another possibilites in Document.execCommand()

Register validator

  • Email example:
      i_am_instance.setValidationFunction("createEmail", function emailValidation(email_candidate) {
        /*_@_*/ let e= email_candidate.split("@"); if(e.length!==2) return false;
        /*_@_._*/ e= [e[0], ...e[1].split(".")]; if(e.length!==3) return false;
        const _e= !/(#|\?|!|\\|\/|\||\.\.)/i.test(e[0]);
        return _e && e.reduce((r,o)=>r&&o.length>1&&!/\s/.test(o), _e);
      });

version 0.5

12 Nov 14:56

Choose a tag to compare

version 0.5 Pre-release
Pre-release
  • "attachEvent" added to fix IE<9 (but 'editor.body' doesn't exist => need fix)
  • crossbrowser 'createHeading' action for "format" (the second parameter is "Hx", "H1" is default)

version 0.4 Release candidate

02 Nov 10:25

Choose a tag to compare

Pre-release

External validation function support.

version 0.3 Release candidate

15 Jan 15:26

Choose a tag to compare

Pre-release

Main funkcionality is DONE.

WIP verze 0.3

12 Jan 19:05
89955c7

Choose a tag to compare

WIP verze 0.3 Pre-release
Pre-release
  • Oproti předchozím verzím značně minimalizovány možnosti vkládat "blbosti"