Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collab highlight #140

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4785b6e
Collaboration feature
MartinWangIBM Feb 24, 2017
39c1269
Fix xfer test
MartinWangIBM Apr 12, 2017
823c4fe
collab configuration
SidneyJiang May 26, 2017
c207f1a
forgot this
SidneyJiang May 26, 2017
19d17cd
fix out of multi workspace implementation, part 1
SidneyJiang Jun 2, 2017
8271eb3
more fix
SidneyJiang Jun 2, 2017
f42c450
now sharedworkspaces are multi workspace based
SidneyJiang Jun 6, 2017
626bfdd
load first sharedworkspace if loc is sharedworkspace/tree
SidneyJiang Jun 7, 2017
f262ed6
more fix
SidneyJiang Jun 13, 2017
9d31a2d
more
SidneyJiang Jun 13, 2017
33f4e1e
fixes
SidneyJiang Jun 15, 2017
94e7902
ugly fixes, now at this point, everything works as demoed, next step …
SidneyJiang Jun 15, 2017
c81fb19
cleaned 50% garbage code
SidneyJiang Jun 15, 2017
6b09d59
cleaned more stuff, added file copied socket handler
SidneyJiang Jun 16, 2017
36b62e5
forgot this file
SidneyJiang Jun 16, 2017
8c802a3
call the fixes end for now
SidneyJiang Jun 16, 2017
766732c
move doc from client code to server
SidneyJiang Jun 16, 2017
4128b78
ready to merge
SidneyJiang Jun 16, 2017
2769a8b
hide collab
SidneyJiang Jun 16, 2017
f52b08a
tweak
SidneyJiang Jun 16, 2017
48c0b43
fixed simpleMocha failure
SidneyJiang Jun 19, 2017
608fed4
fixed undefied removeEventListener
SidneyJiang Jun 19, 2017
e808006
remove unneeded lines
SidneyJiang Jun 20, 2017
599917e
more cleanup before merge
SidneyJiang Jun 20, 2017
31964f4
use this version of request
SidneyJiang Jun 20, 2017
fe1c59e
initial attempt
SidneyJiang Jun 23, 2017
f827c2b
keep going
SidneyJiang Jun 23, 2017
f5e7256
now all seems working
SidneyJiang Jun 23, 2017
2c77da9
clean the configurations
SidneyJiang Jun 23, 2017
a3451d2
Clean collaboration
rsenekal Jun 27, 2017
4662117
Add Collab Highlight Feature
arshiannafi Jun 27, 2017
ceb2f80
Refactoring PeerHighlight
rsenekal Jun 27, 2017
1dc0b09
Refactoring PeerHighlight
arshiannafi Jun 27, 2017
b4589ee
Update 'onDestroy' method
arshiannafi Jun 29, 2017
5e6c9d1
Fix: remove highlight when peer leaves
arshiannafi Jun 29, 2017
279ac83
Restore altered code
arshiannafi Aug 4, 2017
435ee92
Fix: Collab Highlight width inconsistency
rsenekal Aug 4, 2017
6cd735f
Merge branch 'master' into collab_highlight4
arshiannafi Aug 9, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function
};

OrionSocketAdapter.prototype.constructor = OrionSocketAdapter;

/**
* Send authenticate message
*/
Expand Down Expand Up @@ -307,6 +307,7 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function

case 'client-left':
this.collabClient.removePeer(msg.clientId);
this.collabClient.textView._removePeerHighlight(msg.clientId);
break;

default:
Expand Down Expand Up @@ -574,7 +575,7 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function
};

OrionEditorAdapter.prototype.getSelection = function () {
return ot.Selection.createCursor(this.editor.getSelection().start);
return new ot.Selection([new ot.Selection.Range(this.editor.getSelection().start, this.editor.getSelection().end)]);
};

OrionEditorAdapter.prototype.setSelection = function (selection) {
Expand Down Expand Up @@ -608,15 +609,6 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function
var lastLine = this.model.getLineCount()-1;
var lineStartOffset = this.model.getLineStart(currLine);

if (offset) {
//decide whether or not it is worth sending (if line has changed or needs updating).
if (currLine !== this.myLine || currLine === lastLine || currLine === 0) {
// Send this change
} else {
return;
}
}

this.myLine = currLine;

// Self-tracking
Expand All @@ -630,7 +622,12 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function
if (this.changeInProgress) {
this.selectionChanged = true;
} else {
this.trigger('selectionChange');
if(!this.editor._listener.mouseDown){
// Trigger 'selectionChange' (send messges) only if mouse is up.
// This prevents from sending multiple messages
// while user is selecting.
this.trigger('selectionChange');
}
}
};

Expand All @@ -646,7 +643,10 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function
var peer = this.collabClient.getPeer(clientId);
var name = peer ? peer.name : undefined;
color = peer ? peer.color : color;

this.updateLineAnnotation(clientId, selection, name, color);
this.updateHighlight(clientId, selection, name, color);

var self = this;
return {
clear: function() {
Expand All @@ -655,6 +655,13 @@ define(['orion/collab/collabPeer', 'orion/collab/ot', 'orion/uiUtils'], function
};
};

OrionEditorAdapter.prototype.updateHighlight = function(id, selection, name, color, force) {
// Extracting 'highlight' information out of 'selection' object
var ranges = selection.ranges[0];

this.collabClient.textView._addHighlight(id, color, ranges.anchor, ranges.head);
}

OrionEditorAdapter.prototype.updateLineAnnotation = function(id, selection, name, color, force) {
force = !!force;
name = name || 'Unknown';
Expand Down
Loading