项目作者: fesk

项目描述 :
Very lightweight plain javascript inline rich text/HTML editor
高级语言: JavaScript
项目地址: git://github.com/fesk/fed.git
创建时间: 2021-02-16T11:44:45Z
项目社区:https://github.com/fesk/fed

开源协议:GNU General Public License v3.0

下载


fed

fed.js v1.04 very minimal / lightweight inline rich text/HTML editor, plain javascript. fed = [f]esk’s [ed]itor.
Copyright (c) 2021, Nick Besant hwf@fesk.net. All rights reserved.
licenced under GPLv3, see LICENCE.txt

NOTE: BY DEFAULT, THIS USES FONTAWESOME ICONS FOR ITS TOOLBAR. YOU WILL NEED TO INCLUDE
FONTAWESOME ICONS IN YOUR PAGE, OR OVERRIDE fed_icons

usage:
include fed.js and fed.css on your page (make sure you also have FontAwesome’s icons included);

  1. <link href="/path/to/fed/fed.css" rel="stylesheet">
  2. <script src="/path/to/fed/fed.js"></script>
  3. let my_ed = new fed(divelement,{options});

Options info

  1. divelement can be queryselector string like #editor or .class, or a plain
  2. string which is assumed to be an ID, or a DOM element
  3. options is an object with;
  4. do_keybinding:bool (default true) - do/don't bind keys
  5. grabtab:bool (default false) - override default TAB behaviour. Don't do this,
  6. it breaks accessibility even further.
  7. language:str (default en-GB) - a key in fed_strings
  8. strings:object (defaults to built-in fed_strings) - use to provide translated tips
  9. icons:object (defaults to built-in fed_icons) - replace icons (defaults to
  10. FontAwesome's basic icons). You will need to make
  11. sure you include _icostart and _icoend keys.
  12. allow_sourceview:bool (default true) - show the view source button
  13. allow_images:bool (default true) - show an image selector button
  14. img_max_size:int (default 1024*1024) - max size of individual image, if
  15. user adds a larger image, string 'image_too_big' is shown
  16. in the console, and 'error' callbacks (see .on()) are called.

highlights;

  1. .setcontents() and .getcontents() - set / get current content
  2. .on('edit',function(inst)) - add your function to be called when user makes an edit
  3. .destroy() - remove wrapper and toolbar and restore DIV back to original state
  4. .wrapper - the DIV element that wraps the toolbar and the edit content
  5. .toolbar - the toolbar DIV
  6. .content - the DIV containing the stuff being edited, this is the element you passed in the constructor