Team blog: Developers

Review anything from Wikidata

You can now review anything that has an entry on Wikidata, Wikimedia’s universal database of concepts. That means almost anything that has a Wikipedia entry, as well as lots of things that don’t — e.g., scientific papers, or individual episodes of webcomics. All you need to do is select the “Search Wikidata” function when starting a new review, like so:

Example of a Wikidata search

We’re excluding some Wikimedia-specific stuff from the search results — if you get a “no relevant results” message, that’s why.

Of course, when you select a Wikidata item, you don’t have to manually add a label or description. They’ll be imported from Wikidata in all supported languages. In future we’ll import additional properties, as well, and keep them in sync with the Wikidata source.

If you don’t have JavaScript enabled, the search feature won’t show up, but Wikidata URLs will still be treated magically: labels and descriptions will be fetched on our end.

This feature is brand new, and there are certainly going to be some issues with it. If you find one, please report it. :-)


Labeling things

When you review something by picking a URL, you have to give a name to the thing you review — the title of a book, the name of a product, and so on. Before today, you had to do this in an extra step after writing a review. Now you can do it from the “New review” form using the “label” field. It will be automatically completed for you if we already know something about that URL, like so:

Screenshot of URL completion

In future, we’ll support finding things to review by picking them from sources like Wikidata and OpenStreetMap, and may also do other things to fetch information automatically from known sites like Amazon.com. For now, this should already take a little friction out of the process.

Note that this change requires JavaScript — without JavaScript, you’ll get the same user experience as before the change.


Spoilers are no fun

We’ve had support for spoiler warnings in reviews and other content for a while, but the new rich-text editor did not support them. It does now. Here’s what it looks like in the editor:

Animation of spoiler warning in RTE

This is possible thanks to the high level of hackability of our editor component, ProseMirror. There are still a few kinks to work out (as always), but given that spoilers ruin the fun for everyone, it’s good to have the first version out!


Supporting distraction-free writing

Writing requires focus, which is why I’m a big fan of distraction-free editors (see my review of Typora, for example). In that spirit, I’ve added support for full-screen editing to lib.reviews. Here’s what it looks like (if your browser window is tiny).

Animated GIF showing full screen editing UI

Note that technically this is full-window editing rather than full-screen editing. This is intentional. My assumption is that in most cases, users will still want to have easy access to their other tabs and windows. But you’re in control: if you want to get rid of everything else, just switch the browser into full-screen mode, as well (F11 in Firefox or Chrome).

This mode should also help with larger reviews with lots of images that benefit from the additional screen real estate.


User preferences without clutter?

I’m not a big fan of classic user preference dialogs where you have to hunt a million sections for the thing you care about. Where it’s possible to do it intuitively, I prefer to integrate preferences into the part of the application they regulate, where the user is likely to look for them.

In this vein, I just added a little pushpin widget to load the rich-text editor by default. Here’s what it looks like:

User preference switcher animation

Under the hood, it makes an API call to toggle the preference. This means it’s a real preference, not stored in your browser. Any new review or other long form text field you write or edit will be loaded in rich text until you click the pushpin again. Is it intuitive? I don’t know — feel free to comment on the relevant bug if you think it can be improved. But I do like that it doesn’t make me go hunting in a “user preferences” section.

Speaking of clutter, I also find it important to prune features that no longer make sense. Accordingly, we’ll be removing the “live preview” feature soon, since it’s made largely obsolete by the rich-text editor. If you disagree, speak up on the bug :-).


Rich-text editor is now live

I just deployed the initial release of the new rich-text editor for all large text fields on the site (reviews, blog posts, team descriptions, bios). If you have JavaScript enabled, you should see the mode-switcher below the relevant text fields. Here’s what it looks like in action:

Animated RTE example

This editor is powered by ProseMirror, which is more a toolkit for building editors than a drop-in solution. We’ve hacked it to serve the purposes of this site. Features include:

  • You can switch back and forth between markdown and rich-text, and edit in either representation. (Most markdown editing tools only render a preview.)

  • When in rich-text mode, you can use markdown shortcuts such as >, *, 1., # at the beginning of a line to get quotes, bullet point lists, numbered lists, or headlines.

  • Want a bigger editor? In browsers that support it, you can drag-increase the size of the markdown editor. When you switch to rich-text, the new height will be preserved. In future, we may implement a proper full-screen mode.

  • All UI messages can be translated via translatewiki.net (become a translator).

ProseMirror itself is still in early development (watch out for this bug with trailing spaces), and I’m sure there are problems in the integration as well. Please don’t hesitate to report bugs!

We’ll continue to chip away at related issue, and will also start turning our attention to other shiny features such as

  • metadata for review subjects

  • import of items from Wikidata

  • API, API, API!


Coming soon: A new editor

Some new users have requested a nicer way to write reviews, so I’ve decided to give the editing UI some love before moving on to some other high priority tasks. I’m currently working on integrating ProseMirror, which is an open source rich-text editor library.

ProseMirror is extremely modular – it’s basically a “build your own editor” kind of deal. The downside is that it takes longer to build something; the upside is that it’s possible to build advanced functionality and to customize the UI more easily.

Markdown is not going anywhere. One of the PM examples demonstrates the side-by-side use of markdown and rich-text editing. The goal is to create a similar user experience for lib.reviews. This way, users will be able to choose the editing environment they prefer on a case-by-case basis.


A nicer language selector

The language list was starting to get cluttered (thanks to translators!), so we’re now using a dropdown, which should make things more manageable for some time to come.

Language selector dropdown

If you frequently change languages, two tips:

  • You can access the dropdown with the access key “L”, e.g., “Alt+L” in Chromium.
  • By typing the language code inside the dropdown, you can quickly select your favorite language, no matter what language the user interface is currently in.

(Note that this change adds a new interface text for the language button, which will take a little while to get translated into all the supported languages.)


Search features deployed

We now have the first round of search features. This includes autocompletion (requires JavaScript):

Search autocompletion

And it includes full-text search across reviews, including highlighting:

Full-text match

See the search page for some tips on valid search operators (a full technical breakdown of supported operators can be found here).

A note on language support:

  • If you’re searching in a language other than English, content in that language will show up.
  • Content in English will always be searched.
  • In addition, we make certain fallback assumptions, e.g., Brazilian Portuguese also searches European Portuguese.

In future, it may be desirable to make those search options user-configurable, as well.

The search feature is based on ElasticSearch, an open source search backend used by many websites, including Wikipedia.

As always, please don’t hesitate to report bugs, or find us on #lib.reviews if you want to chat.


ようこそ: Japanese is live!

Thanks to Higa4, the Japanese language version of lib.reviews is now live (preview).

Is your language still missing? See our earlier blog post for instructions on how to get involved in translating lib.reviews.


 Older blog posts