yabwe / medium-editor

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.
https://yabwe.github.io/medium-editor/
Other
16.08k stars 1.85k forks source link

Import for sveltekit #1584

Open bitdom8 opened 3 years ago

bitdom8 commented 3 years ago

Hi tried many ways to import for sveltekit but options won't work


import MediumEditor from 'medium-editor'
    const MediumEditor = () => import("./../../../node_modules/medium-editor/dist/js/medium-editor.min.js").then(delayModuleLoad)

    const delayModuleLoad = module =>
    new Promise(res =>
      setTimeout(() => res(module), Math.random() * 2000, console.log(999)),
    );

    console.log(MediumEditor())

    var editor
    MediumEditor.activeButtonClass = 'medium-editor-button-active'
    MediumEditor.placeholder = [{
        /* This example includes the default options for placeholder,
           if nothing is passed this is what it used */
        text: 222,
    }
    ]

    var editor = new MediumEditor('.editable', {
    anchorPreview: false
});
pavinduLakshan commented 11 months ago

Facing similar issues when using this lib with svelte