mozilla / hotdish

Explorations on being together in the browser
Mozilla Public License 2.0
111 stars 13 forks source link

drive etherpad as activity log #243

Closed gregglind closed 10 years ago

gregglind commented 10 years ago

Etherpad has moving parts

Idea:

  1. pintab of "etherpad-hotdish"
  2. on message "write to etherpad"

write to etherpad:

  1. `jquery.trigger('click', $('innerdocbody'))
  2. simulate typing (http://j-ulrich.github.com/jquery-simulate-ext)

This approach feels super gross though! Ideas welcome.

ianb commented 10 years ago

To get the an editor object:

var editor;
padeditor.ace.callWithAce(function (x) {
  editor = x;
});
function getLineLength() {
  return editor.ace_getRep().lines.length();
}
function insertAtEnd(text) {
  var lastLine = getLineLength() - 1;
  padeditor.ace.replaceRange([lastLine, 0], [lastLine, 0], text + "\n");
}

Things might get funny if the last line isn't empty, but Etherpad seems to attempt to create an empty last line automatically.

gregglind commented 10 years ago

Several bits:

  1. the pin-tab behaviour is really bad (I can't figure out how to 'unpin' before shutdown, so that they don't get restored. Maybe switching to 'tab 0' is better?
  2. Timing is all busted: 'padeditor' doesn't exist yet.
ianb commented 10 years ago

Quite a bit of progress in a41a286b002cca22b054efa3cab13939b11372b3 – it's basically working now. Getting one and only one etherpad link open is hard, and the solution I have is nasty (cullOtherTabs). processMessage in data/activitylog/etherpad-helper.js is what takes our messages and turns them into updates to the document.

Getting the tab opening right would be nice. Closing it goes "off the record" (for yourself – every client adds its own activity), but is hardly intuitive. Tweaking what actually goes in it would also be good (and is the fun part).

ianb commented 10 years ago

281 is a followup, we'll call this done.