Releases: jaandrle/SimpleEditor
Releases · jaandrle/SimpleEditor
version 0.7
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
- "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
External validation function support.
version 0.3 Release candidate
Main funkcionality is DONE.
WIP verze 0.3
- Oproti předchozím verzím značně minimalizovány možnosti vkládat "blbosti"