Alex-D / Trumbowyg

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

SVG icons not loading #325

Closed AttitudeMonger closed 8 years ago

AttitudeMonger commented 8 years ago

I downloaded the zipped structure, built it with bower and loaded the index.html page in examples. The icons are not showing up.

As per the documentation here: http://alex-d.github.io/Trumbowyg/documentation.html#svg-icons, I added this line of code before $('#editor').trumbowyg();:

$.trumbowyg.svgPath = '/Users/attitude/Desktop/Trumbowyg-develop/dist/ui/icons.svg';

Same result. How do I get the icons to load correctly? Or is it that because they will be loaded by XHR, they will show up only in a server-client environment, not if the page is loaded in the browser locally?

Alex-D commented 8 years ago

You need to be in HTTP(S)

AttitudeMonger commented 8 years ago

Okay, I will try it. Can you give me an idea about the directory structure? Which files are important? I can see there are three - the .svg file and .css file in dist/ui, and .js file in dist. Is that all? Do I need to include the directory which contains lots of svg image files as well? If so, what should be its directory level with respect to these three files?

Alex-D commented 8 years ago

You should only use files from dist folder. The only constraint by default is to have SVG next to CSS.

SuN-80 commented 8 years ago

Same thing here. I added the path to svg sprite:

svgPath: '/path/to/icons.svg'

...but it remains undefined in the DOM. It works if I hard code this value on L688. There must be something wrong with how this value is parsed.

Alex-D commented 8 years ago

I can't help you without context.