clarity-project/sir-trevor-formatters

Error on including sir-trevor-formatters

Closed this issue · 4 comments

shon commented

Below is my simple html code to try out formatters

<head>
    <link rel="stylesheet" href="bower_components/sir-trevor-js/sir-trevor.css">
    <link rel="stylesheet" href="bower_components/sir-trevor-js/sir-trevor-icons.css">
    <link rel="stylesheet" href="other/sir-trevor-formatters/strike-through.css">
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="bower_components/underscore/underscore-min.js"></script>
    <script src="bower_components/Eventable/eventable.js"></script>
    <script src="bower_components/sir-trevor-js/sir-trevor.js"></script>
    <script src="other/sir-trevor-formatters/strike-through.js"></script>
</head>

<textarea class="js-st-instance"></textarea>

<script>
$(document).ready(function(e) {
    new SirTrevor.Editor({ el: $('.js-st-instance') });
});
</script>

All libs are of latest versions.

Console throws below error

TypeError: $ is not a function

If I comment out formatters.js the error goes away.

BTW Thanks a lot for this. Exactly what I was looking for.

Hello!

Sorry for no response long time.
Which formatters.js you are talking about? This one - "sir-trevor-formatters/strike-through.js"? Or some other third-part library?

shon commented

Hi @varloc2000 ,
Sorry for replying late. I am talking about strike-through as this is the one I tried. Almost exactly like the code above.
Thanks.

I get "Uncaught TypeError: undefined is not a function" when I include the file "justify.js"

Error goes away when I comment out the include.

Using SirTrevor 4.0

Thanks for your report!

First of all - sorry for my not finished and not correct doc. I don't try to use this formatters apart, accordingly with my example.

Now I implement example page and include formatters - that's what I see:

SirTrevor has some important dependencies which not included in my example - underscore and eventable.

Soon i post new example and formatters for correct work.

Official ST doc to correctly include ST itself