Skip to content

Commit 17e23e2

Browse files
committed
added basic colorpicker
* shows a color pick option when using hex codes or rgb values * invoke color picker using Ctrl+K
1 parent 998a0eb commit 17e23e2

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

client/modules/IDE/components/Editor.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import 'codemirror/addon/search/jump-to-line';
2828
import 'codemirror/addon/edit/matchbrackets';
2929
import 'codemirror/addon/edit/closebrackets';
3030
import 'codemirror/addon/selection/mark-selection';
31+
import 'codemirror-colorpicker';
3132

3233
import { JSHINT } from 'jshint';
3334
import { CSSLint } from 'csslint';
@@ -124,6 +125,10 @@ class Editor extends React.Component {
124125
'-W041': false,
125126
esversion: 7
126127
}
128+
},
129+
colorpicker: {
130+
type: 'sketch',
131+
mode: 'edit'
127132
}
128133
});
129134

@@ -149,7 +154,8 @@ class Editor extends React.Component {
149154
[`${metaKey}-F`]: 'findPersistent',
150155
[`${metaKey}-G`]: 'findPersistentNext',
151156
[`Shift-${metaKey}-G`]: 'findPersistentPrev',
152-
[replaceCommand]: 'replace'
157+
[replaceCommand]: 'replace',
158+
[`${metaKey}-K`]: (cm, event) => cm.state.colorpicker.popup_color_picker()
153159
});
154160

155161
this.initializeDocuments(this.props.files);

client/styles/main.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
@import 'node_modules/codemirror/lib/codemirror';
1010
@import 'node_modules/codemirror/addon/lint/lint';
11+
@import 'node_modules/codemirror-colorpicker/addon/codemirror-colorpicker';
1112
@import 'node_modules/dropzone/dist/dropzone';
1213
@import 'node_modules/primer-tooltips/build/build';
1314

package-lock.json

Lines changed: 46 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"classnames": "^2.2.6",
157157
"clipboard": "^1.7.1",
158158
"codemirror": "^5.58.2",
159+
"codemirror-colorpicker": "^1.9.72",
159160
"connect-mongo": "^1.3.2",
160161
"console-feed": "^2.8.11",
161162
"cookie-parser": "^1.4.3",

0 commit comments

Comments
 (0)