question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working if script loaded before codemiror

See original GitHub issue

Describe the bug If the picker script is loaded before codemiror script, color picker does not appear in codemirror. This is causes some issues if the scripts loaded on-demand for both codemiror and standalone usage. On some cases standalone picker is loaded before codemiror requested for loading.

To Reproduce Load picker script before codemiror script.

Additional context A public method like “rebuildForCodemirror()” can solve the issue. Currently following section which is private, initiates picker for code mirror. A public wrapper method for this part can be triggered when needed by using the API

 if (CodeMirror) {
        CodeMirror.defineOption("colorpicker", false, function (cm, val, old) {
            if (old && old != CodeMirror.Init) {

                if (cm.state.colorpicker) {
                    cm.state.colorpicker.destroy();
                    cm.state.colorpicker = null;
                }
                // remove event listener
            }
            if (val) {
                cm.state.colorpicker = new ColorView(cm, val);
            }
        });
    }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
zortextcommented, Oct 16, 2018

Perfect… Thank you.

1reaction
easylogiccommented, Oct 16, 2018

i released v1.9.46

please see to https://codepen.io/easylogic/pen/yRPZxJ

you can use load function

CodeMirrorColorPicker.load() // redefine codemirror addon for colorpicker 
CodeMirror.fromTextarea(...);   
Read more comments on GitHub >

github_iconTop Results From Across the Web

Codemirror editor is not loading content until clicked
focus(); var editor = CodeMirror. fromTextArea(document. getElementById("editor"), { mode: "text/html", height: "197px", lineNumbers: true }); ...
Read more >
Issues with dynamically adding add-ons after load - CodeMirror
Hello, I have a project I'm working on that creates multiple cm instances. On initial load, CM is loaded and works great.
Read more >
CodeMirror user manual
The reason that the script path has to be configured is that CodeMirror will load in a bunch of extra files when an...
Read more >
CodeMirror: User Manual - FRATO
The files in the CodeMirror distribution contain shims for loading them (and their dependencies) in AMD or CommonJS environments. If the variables exports ......
Read more >
Using maker.js without the CodeMirror-Editor #380 - GitHub
If I remember it right I got sometimes some issues where I had to remove something in the TypeScript - file. So far...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found