Using not depended to codemirror.js
See original GitHub issueWithout loading codemirror, color picker cannot be initiated
//include colorpicker js file and css file then=>
var ColorPicker = CodeMirrorColorPicker.ColorPicker;
var colorpicker = new ColorPicker({
color: 'blue', // init color code
type : 'palette' // or 'sketch', default type is 'chromedevtool'
})
this throws an error “Uncaught ReferenceError: CodeMirrorColorPicker is not defined”
To make it accessible I added one line to the end of ColorPicker method in the js file.
var index = _extends({}, Util, ColorPicker);
// added this line -->
window.CMColorPicker=ColorPicker.ColorPicker;
//--
return index;
and then tried
var colorpicker = new CMColorPicker({
color: 'blue',
position: 'inline',
container : $('color-container'),
type : 'ring'
});
This makes it work, But some types displayed distorted. please see attached file. This is how “ring” type is displayed.
By the way I think this is one of the best color picker tool on the web. Great job!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Using not depended to codemirror.js · Issue #24 - GitHub
To make it accessible I added one line to the end of ColorPicker method in the js file. ... var colorpicker = new...
Read more >CodeMirror 5 User Manual
CodeMirror works with language-specific modes. Modes are JavaScript programs that help color (and optionally indent) text written in a given language. The ...
Read more >Reference Manual - CodeMirror
Not to be confused with EditorView.editable , which controls whether the editor's DOM is set to be editable (and thus focusable). static phrases:...
Read more >CodeMirror System Guide
System Guide. This is the guide to the CodeMirror editor system. It provides a prose description of the system's functionality. For the item-by-item ......
Read more >Cannot get CodeMirror to work when using require()
Hi, I installed CodeMirror via npm and cannot get it to work properbly when using require(). I've tried using this code: var js...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@zortext
haha my mistake.
see to below code
you must use function named by
create
to making for multi type colorpicker.CodeMirrorColorPicker.ColorPicker is default colorpicker that has a ‘chromedevtool’ type
I found the issue.
new CodeMirrorColorPicker.create()
works finenew CodeMirrorColorPicker.ColorPicker()
causes the issue.https://codepen.io/anon/pen/EdNbEQ