Caio Kawasaki
Caio Kawasaki

Reputation: 2950

Simditor with webpack

How to compile Simditor with Webpack?

I'm trying to compile Simditor using Laravel Mix, But I'm getting the following error:

Uncaught TypeError: Simditor.connect is not a function

Here is my js file:

window.$ = window.jQuery = require('jquery');
import 'simple-module';
import 'simditor';

$(document).ready(function () {
    $('.input.text-editor').each(function () {
        var editor = new Simditor({
            textarea: $(this).find('textarea')
        });
    });
});

Any ideia why I'm getting this error?

Editor website: simditor.tower.im

Upvotes: 6

Views: 1893

Answers (2)

Feuda
Feuda

Reputation: 2365

I tried several versions of simditor with webpack installation, one of it worked, after version 2.3.22, JS library directories of simditor and all dependencies become different than previous versions.

Here are my steps:

  1. Install simditor at the version 2.3.22 with webpack(Run yarn add [email protected] in Rails 6)
  2. import 'simple-module';
  3. import 'simple-hotkeys';
  4. import 'simple-uploader';
  5. import Simditor from 'simditor';

It works!

Upvotes: 6

Karli Ots
Karli Ots

Reputation: 779

I just found it out, that you cannot build that library with webpack, you need to download the library and include the files separately to html.

Tried all, and btw You need to include

mobilecheck.js
jquery.min.js
module.js
hotkeys.js
simditor.js

For this library to work!

I was using Symfony webpack encore.

Upvotes: 2

Related Questions