Skip to content

Commit f1ba3b6

Browse files
committed
bring up to date and add tests
1 parent 1461eb4 commit f1ba3b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3147
-3474
lines changed

src/actions/index.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ import {
2727
editorBlurred,
2828
editorFocused,
2929
editorFocusedRequestedLine,
30-
<<<<<<< HEAD
31-
<<<<<<< HEAD
32-
=======
33-
editorResized,
34-
=======
35-
>>>>>>> e90fafb... update window resize, update element highlighter, write unit test
36-
dragRowDivider,
37-
dragColumnDivider,
38-
>>>>>>> 66eba11... changes
3930
startDragColumnDivider,
4031
stopDragColumnDivider,
4132
notificationTriggered,
@@ -45,13 +36,10 @@ import {
4536
toggleEditorTextSize,
4637
toggleTopBarMenu,
4738
closeTopBarMenu,
48-
<<<<<<< HEAD
4939
startEditingInstructions,
5040
cancelEditingInstructions,
5141
showSaveIndicator,
5242
hideSaveIndicator,
53-
=======
54-
>>>>>>> fa1acd3... Element Highlighter
5543
} from './ui';
5644

5745
import {
@@ -68,7 +56,6 @@ import {
6856
userLoggedOut,
6957
} from './user';
7058

71-
<<<<<<< HEAD
7259
import {
7360
projectCompiled,
7461
projectCompilationFailed,
@@ -90,8 +77,6 @@ import {
9077
updateResizableFlex,
9178
} from './resizableFlex';
9279

93-
=======
94-
>>>>>>> fa1acd3... Element Highlighter
9580
export {
9681
clearConsoleEntries,
9782
consoleInputChanged,
@@ -114,17 +99,8 @@ export {
11499
editorBlurred,
115100
editorFocused,
116101
editorFocusedRequestedLine,
117-
<<<<<<< HEAD
118-
<<<<<<< HEAD
119102
previousConsoleHistory,
120103
nextConsoleHistory,
121-
=======
122-
editorResized,
123-
=======
124-
>>>>>>> e90fafb... update window resize, update element highlighter, write unit test
125-
dragRowDivider,
126-
dragColumnDivider,
127-
>>>>>>> 66eba11... changes
128104
startDragColumnDivider,
129105
stopDragColumnDivider,
130106
notificationTriggered,

src/actions/ui.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@ export const editorBlurred = createAction(
2121
'EDITOR_BLURRED',
2222
);
2323

24-
<<<<<<< HEAD
25-
export const editorResized = createAction(
26-
'EDITOR_RESIZED',
27-
=======
28-
export const dragRowDivider = createAction(
29-
'DRAG_ROW_DIVIDER',
30-
);
31-
32-
export const dragColumnDivider = createAction(
33-
'DRAG_COLUMN_DIVIDER',
34-
>>>>>>> e90fafb... update window resize, update element highlighter, write unit test
35-
);
36-
3724
export const startDragColumnDivider = createAction(
3825
'START_DRAG_COLUMN_DIVIDER',
3926
);

src/clients/github.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import trim from 'lodash-es/trim';
44

55
import retryingFailedImports from '../util/retryingFailedImports';
66
import performWithRetries from '../util/performWithRetries';
7-
<<<<<<< HEAD
87
import compileProject from '../util/compileProject';
98
import ExtendableError from '../util/ExtendableError';
10-
=======
11-
import generatePreview from '../util/previewFrame';
12-
>>>>>>> 621d5f6... Add saga, add ref to iframe element
139

1410
const COMMIT_MESSAGE = 'Created using Popcode: https://popcode.org';
1511
const MASTER = 'master';

src/components/Editor.jsx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
<<<<<<< HEAD
43
import bindAll from 'lodash-es/bindAll';
54
import constant from 'lodash-es/constant';
65
import get from 'lodash-es/get';
@@ -9,14 +8,6 @@ import noop from 'lodash-es/noop';
98

109
import {createAceEditor, createAceSessionWithoutWorker} from '../util/ace';
1110
import {EditorLocation} from '../records';
12-
import {cssSelectorAtCursor} from '../util/cssSelectorAtCursor';
13-
=======
14-
import ACE from 'brace';
15-
import bindAll from 'lodash/bindAll';
16-
import get from 'lodash/get';
17-
import throttle from 'lodash/throttle';
18-
import noop from 'lodash/noop';
19-
>>>>>>> 621d5f6... Add saga, add ref to iframe element
2011

2112
import 'brace/ext/searchbox';
2213
import 'brace/mode/html';
@@ -123,25 +114,6 @@ class Editor extends React.Component {
123114
this._startNewSession(this.props.source);
124115
this._resizeEditor();
125116
this._editor.on('focus', this._resizeEditor);
126-
<<<<<<< HEAD
127-
<<<<<<< HEAD
128-
<<<<<<< HEAD
129-
=======
130-
this._editor.on('blur', () => {
131-
this.props.onEditorBlurred();
132-
});
133-
this._editor.on('focus', () => {
134-
this.props.onEditorFocused(this.props.language);
135-
});
136-
=======
137-
>>>>>>> ec49c81... Handle fixed potion, handle body and html, handle resize, handle editor refocus to same line
138-
this._editor.setOptions({
139-
fontFamily: 'Inconsolata',
140-
fontSize: '14px',
141-
});
142-
>>>>>>> 23eb7f2... Updates to element highlighter
143-
=======
144-
>>>>>>> e90fafb... update window resize, update element highlighter, write unit test
145117
} else {
146118
this._editor.destroy();
147119
}
@@ -183,15 +155,6 @@ class Editor extends React.Component {
183155
this._editor.moveCursorTo(0, 0);
184156
this._resizeEditor();
185157
}
186-
187-
render() {
188-
return (
189-
<div
190-
className="editors__editor"
191-
ref={this._setupEditor}
192-
/>
193-
);
194-
}
195158
}
196159

197160
Editor.propTypes = {

src/components/EditorContainer.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ import PropTypes from 'prop-types';
33
import React, {forwardRef} from 'react';
44
import {t} from 'i18next';
55

6-
<<<<<<< HEAD
76
const EditorContainer = forwardRef((
87
{children, language, source, style, onHide},
98
ref,
109
) => {
11-
=======
12-
function EditorContainer({children, language, source, style, onHide, onRef}) {
13-
>>>>>>> fa1acd3... Element Highlighter
1410
let helpText;
1511

1612
if (source === '') {

src/components/EditorsColumn.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export default function EditorsColumn({
2424
requestedFocusedLine,
2525
onComponentHide,
2626
onComponentUnhide,
27+
onEditorBlurred,
2728
onEditorCursorChange,
29+
onEditorFocused,
2830
onEditorInput,
2931
onRef,
3032
onRequestedLineFocused,
@@ -69,7 +71,6 @@ export default function EditorsColumn({
6971
onCursorChange={onEditorCursorChange}
7072
onEditorBlurred={onEditorBlurred}
7173
onEditorFocused={onEditorFocused}
72-
onEditorResized={onEditorResized}
7374
onInput={partial(
7475
onEditorInput,
7576
currentProject.projectKey,
@@ -138,6 +139,7 @@ EditorsColumn.propTypes = {
138139
style: PropTypes.object.isRequired,
139140
onComponentHide: PropTypes.func.isRequired,
140141
onComponentUnhide: PropTypes.func.isRequired,
142+
onEditorBlurred: PropTypes.func.isRequired,
141143
onEditorCursorChange: PropTypes.func.isRequired,
142144
onEditorFocused: PropTypes.func.isRequired,
143145
onEditorInput: PropTypes.func.isRequired,

src/components/Preview.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import PreviewFrame from './PreviewFrame';
88
export default function Preview({
99
compiledProjects,
1010
consoleEntries,
11-
highlighterSelector,
11+
focusedSelector,
1212
showingErrors,
1313
onConsoleError,
1414
onConsoleLog,
@@ -25,6 +25,7 @@ export default function Preview({
2525
<PreviewFrame
2626
compiledProject={compiledProject}
2727
consoleEntries={consoleEntries}
28+
focusedSelector={focusedSelector}
2829
isActive={key === compiledProjects.keySeq().last()}
2930
key={compiledProject.compiledProjectKey}
3031
onConsoleError={onConsoleError}
@@ -51,7 +52,6 @@ export default function Preview({
5152
>&#xf021;</span>
5253
</div>
5354
{projectFrames}
54-
// focusedSelector={focusedSelector}
5555
</div>
5656
);
5757
}

src/components/PreviewFrame.jsx

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const sandboxOptions = [
1818
'allow-popups-to-escape-sandbox',
1919
'allow-scripts',
2020
'allow-top-navigation',
21-
'allow-same-origin',
2221
].join(' ');
2322

2423
let nextId = 1;
@@ -44,26 +43,11 @@ class PreviewFrame extends React.Component {
4443
);
4544
}
4645

47-
// componentWillReceiveProps(nextProps) {
48-
// if (nextProps.highlighterSelector !== this.props.highlighterSelector) {
49-
// this._postHighlighterSelectorToFrame(nextProps.highlighterSelector);
50-
// }
51-
// }
52-
// componentDidMount() {
53-
// window.addEventListener('message', this._onMessage);
54-
// this._postFocusedSelectorToFrame(this.props.focusedSelector);
55-
// }
56-
57-
// componentWillReceiveProps(nextProps) {
58-
// if (nextProps.focusedSelector !== this.props.focusedSelector) {
59-
// this._postFocusedSelectorToFrame(nextProps.focusedSelector);
60-
// }
61-
// }
62-
6346
componentDidUpdate({consoleEntries: prevConsoleEntries}) {
6447
const {consoleEntries, isActive} = this.props;
6548

6649
if (this._channel && isActive) {
50+
this._postFocusedSelectorToFrame(this.props.focusedSelector);
6751
for (const [key, {expression}] of consoleEntries) {
6852
if (!prevConsoleEntries.has(key) && expression) {
6953
this._evaluateConsoleExpression(key, expression);
@@ -152,18 +136,11 @@ class PreviewFrame extends React.Component {
152136
this.props.onConsoleLog(printedValue, compiledProjectKey);
153137
}
154138

155-
_postHighlighterSelectorToFrame(selector) {
156-
window.frames[0].postMessage(JSON.stringify({
157-
type: 'highlightElement',
158-
selector: {selector},
159-
}), '*');
160-
}
161-
162139
_postFocusedSelectorToFrame(selector) {
163-
this._frame_element.contentWindow.postMessage(JSON.stringify({
164-
type: 'org.popcode.highlightElement',
165-
selector,
166-
}), '*');
140+
this._channel.notify({
141+
method: 'highlightElement',
142+
params: selector,
143+
});
167144
}
168145

169146
_attachToFrame(frame) {

src/components/TopBar/CurrentUser.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import classnames from 'classnames';
12
import React from 'react';
23
import PropTypes from 'prop-types';
34
import {t} from 'i18next';

src/components/TopBar/CurrentUserMenu.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React, {Fragment} from 'react';
33
import {t} from 'i18next';
4-
import createMenu, {MenuItem} from './createMenu';
5-
import CurrentUserButton from './CurrentUserButton';
64

75
import createMenu, {MenuItem} from './createMenu';
86
import CurrentUserButton from './CurrentUserButton';

0 commit comments

Comments
 (0)