
The technology behind the new Google Docs editor - yanw
http://googledocs.blogspot.com/2010/05/whats-different-about-new-google-docs.html
======
bdr
An editor like this would be great for teaching programming. I've been
thinking about something like this since Zed's new Python book came out.
Having taught several complete beginners, the greatest friction in first
learning to program doesn't come from bad pedagogy, but at step 0: getting the
environment set up. A web-based coding and learning environment, complete with
syntax highlighting and whitespace management, would be wonderful.

~~~
moeffju
Have you looked at Mozilla Bespin? <https://bespin.mozillalabs.com/>

~~~
bdr
No, thanks!

~~~
eli_s
care to elaborate?

~~~
pbiggar
I think he meant 'No; thanks!'

------
agotterer
The replacement of the built in html editor is what all the wysiwyg's need to
get so that code generation stays consistent across browsers. Think they will
open source at least that portion?

~~~
mvaerle
I hope for the same. The Bespin project by Mozilla is also interesting in this
space, they've built a text engine based on canvas. They target code editing
but at least they're solving a (very important) part of the same problem.

~~~
chime
I have been seriously considering going the Bespin/canvas way myself. I wrote
<http://bulletxt.zetabee.com/demo> using a bunch of textarea tags but having
seen how well Bespin works, I think it would be much better to code it on
canvas. It would work much better across all the different browsers.

~~~
joelgwebber
One important thing to consider before going down that route -- the font
metrics in the Canvas API are extremely impoverished, so it will be very
difficult to do much more than a simple text editor. In particular, there's no
support for constraints, wrapping, etc. You can only ask for the width of a
given string. This is particularly nasty if you want to do, e.g., asian
languages that are hard to segment. The browser desperately needs real font
metrics, segmentation, etc.

~~~
chime
You're right. Though I could do what Google is doing. They're not doing direct
font-on-Canvas, which would be pretty cool actually. They're creating/editing
divs/spans on the fly. I already do that with textareas but the problem is
textareas work differently on different browsers where different events get
fired for similar actions. So technically, I'm doing almost the same thing
they're doing at a basic level (pressing enter in middle of a sentence creates
a new textarea below the current one and move the text after the cursor into
the new textarea).

What I was wondering if I should do or not is create my own cursor management.
The benefit of that will be better control over copy-paste, drag-drop etc. I
am trying to build an undo system for Bulletxt and in some browsers, you can
just drag-drop text in the same text-area without firing any keypress/up/down
events. Then I have to hook on to the onupdated/onchanged events which may not
offer enough granularity if you make multiple drag-drop actions. Additionally
if you drag text from one textarea and drop it into the other, I can't always
tell what the source was in all the browsers. Writing my own layout-engine
would definitely solve that issue. Plus undo would be very easy because every
mouse-click/keyboard would be an event that can be undone.

------
JeffJenkins
This is really impressive. Although, I didn't know about contenteditable until
a few weeks ago so I thought all of the rich text editors were doing this
until then. Is the main thing that rich text editors like TinyMCE give you the
toolbar buttons and making inconsistencies in browsers go away?

~~~
ElbertF
The browser handles pretty much everything inside the editor including the
handlebars for resizing images and tables. Editors like TinyMCE and CKEditor
are still very impressive, I've made my own RTE once and it's one giant PITA
to get everything to work nicely, especially across browsers.

------
gruseom
Would anyone who has experience working with operational transformation care
to comment on it? It's mentioned in the OP as the basis for real-time
collaborative editing and seems pretty important (and interesting!) for this
type of app.

~~~
Hexstream
As always, wikipedia is a good start:

<http://en.wikipedia.org/wiki/Operational_transformation>

~~~
gruseom
That link is (a) obvious to the point of tautology; (b) included in the OP;
(c) irrelevant to my question, which was addressed to any HNers who have
personally worked with this material.

------
jackowayed
Was this based on Etherpad? The Etherpad editor is setup similarly (with it
being a whole bunch of <div>'s instead of a normal text field).

~~~
macrael
My recollection is that the ether pad guys went to work on Wave. But they may
have moved around.

~~~
rictic
With realtime multi-person editing and operational transforms showing up in
Google Docs my guess is that there's a decent amount of cross-pollination
going on there.

------
mixmax
_Tab stops and other basic features are impossible to support if you’re using
the browser’s HTML layout engine for your text._

Can't you just place the document you're editing inside a DIV and use left and
right margins for tabstops and change them with javascript? Or am I completely
missing something?

~~~
eclark
Placing tabs in the middle of text is the hard part. Not just putting it at
the begining.

~~~
mixmax
Ahh, I misunderstood tabstops - I thought they were only the left and right
margins. Thanks for clearing it up.

------
MWinther
I really enjoy the collaborative editing functionality, I wish there were
native apps with the same thing. Or at least that their collaboration approach
was closer to the google one than the "handle version sent by e-mail" variant.

~~~
jodrellblank
There are native apps which do the same thing - Microsoft OneNote 2007 and
2010 can do it on Windows, SubEthaEdit on Mac OS X, and a small ecosystem of
variously working offerings on Linux, from Emacs and Screen based scripts to
libobby based editors.

Word 2010 is doing it with a different approach - multiple people can open a
shared document, and it will tell you who is working, but it waits for you to
save before your edits are shared with the others, and waits for you to
request updating with other people's edits before changing your document
around with them.

[http://blogs.msdn.com/microsoft_office_word/archive/2009/09/...](http://blogs.msdn.com/microsoft_office_word/archive/2009/09/09/co-
authoring-in-word-2010.aspx)

------
cake
I don't get it. The explanation is confusing to me, on the one side they say
they don't rely on the browser as they used to : _and the browser takes care
of letting the user edit that text_ and yet they talk about the new GDocs
_entirely in JavaScript_. JavaScript runs on the browser.

Can someone explain how the new GDocs is different technically speaking ?

~~~
positr0n
They old way they used javascript, but they browser code, not their
javascript, handled how the document actually looks on the screen.

The new way their javascript handles _everything,_ including how the document
actually looks on the screen.

------
geedee77
That's really annoying - I've been working on a similar thing on and off for
about two years but never had the time to commit to it properly ... oh well, I
guess I can just check the google code and see where I could've improved.

------
mark_l_watson
That is really slick. Too bad that old documents can't be automatically
converted (wait for that feature, sure it is coming).

------
santry
Is this technology derived from their acquisition of EtherPad? Or is this from
Google Wave? Or both?

~~~
andreyf
This version of Docs uses operational transformations, the idea for which
almost certainly came from Wave. However, the actual code in Wave is written
using GWT (Java compiled to JS), whereas Docs is written in JS straight.

------
camwest
This still doesn't seem to be an option for Google Apps for your Domain users.

------
nirai
Truth is Google Docs is utterly broken and unusable.

Google Beta corp is fond of releasing promising but half-arsed products,
indefinitely & conveniently labeled Beta, and they seldom demonstrate any
urgency to fix and improve them.

------
chanux
Maybe these are coming from etherpad brains.

------
thefahim
That is amazing!

~~~
tel
It is, but here on HN comments which do not add to the conversation are nit
encouraged. Just upvote!

