Jump to content

LoolEditor: LibreOffice / Collabora inline editing for office documents


BitPoet
 Share

Recommended Posts

As threatened in the Pub sub forum in the "What are you currently building?" thread, I've toyed around with Collabora CODE and built file editing capabilities for office documents (Libre-/OpenOffice formats and MS Office as well as a few really old file types) into a PW module.

If you are running OwnCloud or NextCloud, you'll perhaps be familiar with the Collabora app for this purpose.

LoolEditor

Edit office files directly in ProcessWire

Edit your docx, odt, pptx, xlsx or whatever office files you have stored in your file fields directly from ProcessWire's page editor. Upload, click the edit icon, make your changes and save. Can be enabled per field, even in template context.

Currently supports opening and saving of office documents. Locking functionality is in development.

See the README on GitHub for installation instructions. You should be reasonably experienced with configuring HTTPS and running docker images to get things set up quickly.

Pull requests are welcome!

Here is a short demonstration:

LoolEditorScreenrecording2.thumb.gif.c40d779f5b31421d38dd08f1fcda12ca.gif

  • Like 17
  • Thanks 2
Link to comment
Share on other sites

That kind of inline editing has been on my radar for ages. Until now, all solutions were either incredibly complicated or died before reaching maturity (e.g. WebODF). CODE is going to be the final piece in so many puzzles :-)

  • Like 2
Link to comment
Share on other sites

Update 11/4/2018:

  • Locking is implemented (though I haven't seen any hints that CODE uses it). Probably needs some serious testing.
  • Editing has now to be enabled on a per-field basis (Details tab in file field configuration). Template context is supported.
  • Added more inline comments to the code and did some cleanup.
  • Like 3
Link to comment
Share on other sites

Update:

LoolEditor now uses its own simple modal without a title bar since the editor's close button also closes the modal. Things feel a lot smoother now. :)

I think PW is currently the only CMS that integrates LibreOffice for free ;)

  • Like 7
Link to comment
Share on other sites

1 hour ago, BitPoet said:

I think PW is currently the only CMS that integrates LibreOffice for free ;)

Whether it's currently the only one or not, that would deserve an online article and be good advertising for ProcessWire.

As ProcessWire forum topics/posts play well with Google, modifying the topic's title would perhaps be enough or a good start.

  • Like 3
Link to comment
Share on other sites

5 minutes ago, Christophe said:

Whether it's currently the only one or not, that would deserve an online article and be good advertising for ProcessWire.

That's what I'm thinking too. I'd like to add a few neat things though before I actively go for more spotlight on it on the web. Auto save is a neat feature but probably not wanted in all scenarios, so I want to make it optional, and another feature I definitely want to get "wired" :) in is lool's revision history. Currently, it's far too easy to overwrite a perfectly fine document with no way back.

  • Like 6
Link to comment
Share on other sites

  • 3 months later...

This is probably one of the most amazing PW modules I've ever seen.

I have pondered about a way to implement a feature where you have a table that automatically calculates totals. And then also: if you have several such "sub-tables", to generate a grand-total table from the "sub-tables". I thought about using JS to do this on the fly, or with hooks (checking td/th CSS classes and :nth-child selectors), or using Google Spreadsheet's API... maybe using your module would solve all this.

What's a good starting point for getting my feet wet with Docker?

Link to comment
Share on other sites

  • 2 months later...
On 7/28/2018 at 12:11 PM, dragan said:

What's a good starting point for getting my feet wet with Docker?

Somehow your reply slipped by me. In case it's not too late: docker really is fairly simple if you have a reasonably current platform. I have it running on Ubuntu 16 inside a VirtualBox VM and on a recently installed Ubuntu 18.04 server. In both cases, it's little more than running "apt-get install docker".

To get Collabora CODE installed and running is quite smooth too, though you have to look out for one or two pitfalls. The first step is always running "docker pull collabora/code". This command should get things up and running on the CODE side:

server_name=my.host.name docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=my\\.host\\.name" --restart always --cap-add MKNOD --add-host="my.host.name:my.hosts.ip" collabora/code

Of course you have to replace my.host.name with your official hostname (same for my\\.host\\.name) and insert your real IP instead of my.hosts.ip. For the latter, use the internal IP if your server is behind a NAT. Any environment settings ("-e" arguments) are usually documented in the docs for the individual docker image.

Docker will take care of restarting your container when the docker service itself is spun up.

You can see your running docker containers by typing "docker ps". The output will end with some fancy name (like "lucid_pike") here:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                      NAMES
1e5ed6b3922c        collabora/code      "/bin/sh -c 'bash st…"   18 hours ago        Up 18 hours         127.0.0.1:9980->9980/tcp   lucid_pike

This name is used to point other docker commands to the instance. You can e.g. view its logs with "docker logs lucid_pike".

Link to comment
Share on other sites

Update:

I finally found a little time to work on the module. The WOPI endpoint (the "server" script that LibreOffice Online talks to) is now created by the installer.

Also, there was a bug when PW was installed in a subdirectory, which has been fixed.

The next thing I'm going to work on is revision history. This is quite underdocumented territory, so hold your fingers crossed ?

  • Like 1
Link to comment
Share on other sites

And here's another update:

I worked on history support. Now each time a document is saved, the "old" version is saved away (under site/assets/cache/.loolversions/$pageid/ with a unique hash as a name) and an entry is added into the versioning table (lool_versions). These versions can already be listed in the UI (File -> Version history opens a sidebar at the right).

Also, the UI language for the editor can now be set in PW's profile settings.

If you feel daring, you can grab the latest dev branch and take it for a test drive.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...