Skip to content

Commit

Permalink
Add back the "userChangedCode" event, for bingo'ing an badge'ing purp…
Browse files Browse the repository at this point in the history
…oses

Summary: This corresponds to a webapp change that bingo's the event.

Test Plan:
- Load a talk-through like Intro to Drawing, watch it, do *not* see "scratchpad_user_edited" sent to mark_conversions in NET tab
- Load a challenge, don't see the conversion, then make an edit, see the conversion
- Load /pjs?blocks, don't see the conversion, drag a block, see the conversion

Reviewers: john

Reviewed By: john

Subscribers: chris

Differential Revision: https://phabricator.khanacademy.org/D18337
  • Loading branch information
pamelafox committed Jun 1, 2015
1 parent 24dd8de commit b201897
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .arcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"project_id": "live-editor",
"conduit_uri": "https://phabricator.khanacademy.org/",
"lint.engine": "ArcanistConfigurationDrivenLintEngine"
}
5 changes: 4 additions & 1 deletion build/js/live-editor.editor_ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ window.AceEditor = Backbone.View.extend({

this.editor.on("change", function() {
self.trigger("change");
});
if (this.editor.curOp && this.editor.curOp.command.name) {
self.trigger("userChangedCode");
}
}.bind(this));

this.editor.on("click", function() {
self.trigger("click");
Expand Down
3 changes: 2 additions & 1 deletion build/js/live-editor.editor_structured_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ window.StructuredBlocksEditor = Backbone.View.extend({
setTimeout(function() {
$help.remove();
}, 300);
this.trigger("userChangedCode");
}
}.bind(this));

Expand Down Expand Up @@ -133,4 +134,4 @@ window.StructuredBlocksEditor = Backbone.View.extend({
}
});

LiveEditor.registerEditor("structured-blocks_pjs", StructuredBlocksEditor);
LiveEditor.registerEditor("structured-blocks_pjs", StructuredBlocksEditor);
6 changes: 6 additions & 0 deletions build/js/live-editor.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,12 @@ window.LiveEditor = Backbone.View.extend({
this.markDirty();
}.bind(this));

this.editor.on("userChangedCode", function() {
if (!this.record.recording && !this.record.playing) {
this.trigger("userChangedCode");
}
}.bind(this));

this.on("runDone", this.runDone.bind(this));

// This function will fire once after each synchrynous block which changes the cursor
Expand Down
5 changes: 4 additions & 1 deletion js/editors/ace/editor-ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ window.AceEditor = Backbone.View.extend({

this.editor.on("change", function() {
self.trigger("change");
});
if (this.editor.curOp && this.editor.curOp.command.name) {
self.trigger("userChangedCode");
}
}.bind(this));

this.editor.on("click", function() {
self.trigger("click");
Expand Down
3 changes: 2 additions & 1 deletion js/editors/structured-blocks/editor-structured-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ window.StructuredBlocksEditor = Backbone.View.extend({
setTimeout(function() {
$help.remove();
}, 300);
this.trigger("userChangedCode");
}
}.bind(this));

Expand Down Expand Up @@ -133,4 +134,4 @@ window.StructuredBlocksEditor = Backbone.View.extend({
}
});

LiveEditor.registerEditor("structured-blocks_pjs", StructuredBlocksEditor);
LiveEditor.registerEditor("structured-blocks_pjs", StructuredBlocksEditor);
6 changes: 6 additions & 0 deletions js/live-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ window.LiveEditor = Backbone.View.extend({
this.markDirty();
}.bind(this));

this.editor.on("userChangedCode", function() {
if (!this.record.recording && !this.record.playing) {
this.trigger("userChangedCode");
}
}.bind(this));

this.on("runDone", this.runDone.bind(this));

// This function will fire once after each synchrynous block which changes the cursor
Expand Down

0 comments on commit b201897

Please sign in to comment.