Simditor with webpack
Asked Answered
A

2

6

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

Actinotherapy answered 5/12, 2018 at 20:13 Comment(0)
P
6

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!

Photomechanical answered 31/10, 2019 at 9:10 Comment(1)
Thanks! I had some trouble getting this to work before I'd realized I used the semantic versioning strings incorrectly. Lessons: don't use ^ and ~ and start fresh (yarn may or may have cached some newer simple* libs).Borden
M
2

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.

Maroney answered 6/12, 2018 at 14:40 Comment(1)
where should be this file module.js ? I did not faced with this file in node_modules/simditorAntecedents

© 2022 - 2024 — McMap. All rights reserved.