Quick idea for a Google Doc node with in-place viewing and editing

I've often wished document editing were more user-friendly in Drupal. So I came up with this very half-baked idea to embed the viewing and editing of a Google Doc in a node field. Following is a proof of concept. The code is embedded in this very field to selectively render the viewing or editing mode of the document (Note the Edit Google Doc link below):
<?php if(arg(0) == 'node' && arg(2) == 'gdoc') { // Editing ?>
Cancel Editing

<?php } else { // Viewing ?>
Edit Google Doc

<?php } ?>

Edit Google Doc To get the proper editing link, I used the one given to me by the document when I click "Share". To get the viewing link, I had to publish the document to the Web and used the link in that dialog.

This proof of concept could be turned into a module that packages this functionality as a new Field API type, responding to viewing or editing modes by embedding the corresponding URL. For tighter integration with Drupal, several ideas some to mind:

  • Create a new document when creating the node.
  • Using Google API to retrieve document text for indexing.
  • Injecting a custom CSS into the Google Doc iframe to style it with the Drupal theme.
That's it! Enjoy.

Comments

That's a nice proof of concept, definitely spurs up some ideas... Keep up the good!

Of related interest: Embedded Google Docs Viewer, a Drupal 7 field formatter that renders an uploaded file using the GDocs Viewer.

Great job, can't wait to integrate D7 with Google Docs

This is amazing!

I go back and forth with WordPress and Drupal because I can get a WordPress site up in minutes and a Drupal site can take weeks. But I love Drupal.

Anyway, I've been working on my WordPress site thinking that the editing/formatting in Google Docs is SO much nicer than the WordPress editor that maybe I should find some way to use Google Docs as my posts. This would be PERFECT what you have created here.

Just wanted to chime in with my two cents worth!