Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
4.02k stars 614 forks source link

Advice: Simplify the usage for newbie #322

Closed zengfanfan closed 8 years ago

zengfanfan commented 8 years ago

i want a very lightwieght (and fewer features is ok). when i got trumbowyg zip downloaded, i use it as other plugins :

  1. link dist/xxx.min.css in header
  2. script jquery (exists in the project, v2.2.0) before </body>
  3. add dist/xxx.min.js
  4. call the constructor on the element
<script>
$(function(){
  $('.editor').trumbowyg({
    lang:'zh_cn',
  });
});
</script>

but after doing this on trumbowyg , it doesnot work. (see end of this text)

when i check on the "get started" steps

it seems i have to use npm and something else blabla, when i install these stuff, it initial so many http(s) requests! i dont know what complex things that i surely dont need was installed in my pc, and i dont want that.

so if this project depends on jquery(and ...), why dont you just include the jquery.min.js, and so as bootstrap or any other dependencies.

PLZ INCLUDE THEM IN THE ZIP or DIST! 'cause if something exists (e.g. jquery), i just simply delete it and refer it from my path.

i mean, IT'S SO HARD TO USE !

issue after "normal steps for usage(methioned above)"

issue1: all the icons of the buttons is missed (blank is shown instead). issue2: and the console throw out some error:

Uncaught TypeError: Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'.
trumbowyg.js:189

chrome version: 51.0.2704.106 m (64-bit) OS: windows 8.1

--- forgive me for the english grammar but i think you can understand what im saying .... :)

zengfanfan commented 8 years ago

i do set svgPath before the construtor:

<script src="/static/plugins/jQuery.min.js"></script>
<script src="/static/plugins/trumbowyg/trumbowyg.js"></script>
<script src="/static/plugins/trumbowyg/langs/zh_cn.min.js"></script>
<script>
$(function(){
  $.trumbowyg.svgPath = '/static/plugins/trumbowyg/ui/icons.svg';
  $('.editor').trumbowyg({
      lang:'zh_cn',
      btns: [
        ['strong', 'em', 'underline'], ['link'], ['superscript', 'subscript'],
        'btnGrp-justify', 'btnGrp-lists', ['horizontalRule'],
        ['removeformat'], ['fullscreen'],
      ],
    });
});
</script>

but still no icon shown.

zengfanfan commented 8 years ago

forget about issue 1 (icon) when i specify mime-type to "image/svg+xml" of svg file, it shows well ! fine !!

and issue 2 disapeared too.

zengfanfan commented 8 years ago

no issue left.

but plz think about the advice, what we have to do is "normal steps", take off the npm

bigalgeorge commented 8 years ago

I agree; maybe not remove the files in ZIP but put stuff in a REQUIRED directory eg minimal stuff to get it going. For author it is easy but when we go to web page the product looks great but there is no information as to whats needed to make a minimum use installation.

Alex-D commented 8 years ago

If you follow the home http://alex-d.github.io/Trumbowyg/#get-started

If you have some ideas, you can just do a PR to suggest improvements :)

zengfanfan commented 8 years ago

what i checked is this "https://github.com/Alex-D/Trumbowyg/#getting-started", nmp only. and in the home, it's good. thanks.

the SVG issue is because i use a Http server coded by my own, and yes it's imperfect. i dont know if it's a common issue ...

emm, i've never pull any request on github before, maybe i'll learn howto when i'm free sometime. anyway thanks for your advice.

Alex-D commented 8 years ago

What's you checked is "Contribute" part of the readme. Maybe a need to be that more clear.