Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion client/modules/IDE/components/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import 'codemirror/addon/search/jump-to-line';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/addon/edit/closebrackets';
import 'codemirror/addon/selection/mark-selection';
import 'codemirror-colorpicker';

import { JSHINT } from 'jshint';
import { CSSLint } from 'csslint';
Expand Down Expand Up @@ -124,6 +125,10 @@ class Editor extends React.Component {
'-W041': false,
esversion: 7
}
},
colorpicker: {
type: 'sketch',
mode: 'edit'
}
});

Expand All @@ -149,7 +154,12 @@ class Editor extends React.Component {
[`${metaKey}-F`]: 'findPersistent',
[`${metaKey}-G`]: 'findPersistentNext',
[`Shift-${metaKey}-G`]: 'findPersistentPrev',
[replaceCommand]: 'replace'
[replaceCommand]: 'replace',
// Cassie Tarakajian: If you don't set a default color, then when you
// choose a color, it deletes characters inline. This is a
// hack to prevent that.
[`${metaKey}-K`]: (cm, event) =>
cm.state.colorpicker.popup_color_picker({ length: 0 })
});

this.initializeDocuments(this.props.files);
Expand Down
4 changes: 4 additions & 0 deletions client/modules/IDE/components/KeyboardShortcutModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ function KeyboardShortcutModal() {
<span className="keyboard-shortcut__command">{metaKeyName} + /</span>
<span>{t('KeyboardShortcuts.CodeEditing.CommentLine')}</span>
</li>
<li className="keyboard-shortcut-item">
<span className="keyboard-shortcut__command">{metaKeyName} + K</span>
<span>{t('KeyboardShortcuts.CodeEditing.ColorPicker')}</span>
</li>
</ul>
<h3 className="keyboard-shortcuts__title">General</h3>
<ul className="keyboard-shortcuts__list">
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/components/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Toolbar extends React.Component {
onClick={() => {
if (canEditProjectName) {
this.props.showEditProjectName();
setTimeout(() => this.projectNameInput.focus(), 0);
setTimeout(() => this.projectNameInput.focus(), 100);
}
}}
disabled={!canEditProjectName}
Expand Down
2 changes: 1 addition & 1 deletion client/modules/IDE/components/Toolbar.unit.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('<ToolbarComponent />', () => {
await waitFor(() => expect(props.showEditProjectName).toHaveBeenCalled());
});

it('non-owner can\t switch to sketch editing mode', async () => {
it("non-owner can't switch to sketch editing mode", async () => {
const props = renderComponent({ currentUser: 'not-me' });
const sketchName = screen.getByLabelText('Edit sketch name');

Expand Down
1 change: 1 addition & 0 deletions client/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@import 'node_modules/codemirror/lib/codemirror';
@import 'node_modules/codemirror/addon/lint/lint';
@import 'node_modules/codemirror-colorpicker/addon/codemirror-colorpicker';
@import 'node_modules/dropzone/dist/dropzone';
@import 'node_modules/primer-tooltips/build/build';

Expand Down
Loading