Medium Engineering

medium.com/medium-eng · Company blog · on HN since 2014

Medium's engineering team writes about the company's tech stack, the rich text editor, and bugs encountered while running the platform.

What HN saysHN repeatedly cites "Why ContentEditable Is Terrible" in discussions of rich text editors, and also links its stack write-ups.
29HN people shared it
12linked it in comments
19stories submitted
678story points
11 years agolast shared
2014people per year2026

Most-shared posts

  1. 1
  2. 2
    Medium's Technology Stack
    4 people · 82 points · first shared 2015 · 39 comments on HN
  3. 3
  4. 4
    The curious case of disappearing Polish S
    3 people · 297 points · first shared 2015 · 117 comments on HN
  5. 5
    How Medium Goes Social Using Golang and Neo4j
    1 people · 14 points · first shared 2014 · 3 comments on HN
  6. 6
    How I rewrote ‘Yo’ in 4 hours
    1 people · 7 points · first shared 2014 · discussion on HN
  7. 7
    Why ContentEditable is Terrible
    1 people · 3 points · first shared 2014 · 1 comments on HN
  8. 8
    Five Goofy Things Medium Did That Break Accessibility
    1 people · 3 points · first shared 2015 · discussion on HN
  9. 9
    The Code Review Mindset
    1 people · 1 points · first shared 2014 · discussion on HN
  10. 10
  11. 11
    Engineering Values Engineering
    1 people · 1 points · first shared 2015 · discussion on HN

What HN people wrote when they linked it

dpup · 2015-10-26
Thanks for clarifying and yes, lots of interesting stories to be told around the edges of this post. Some are already written and linked. For example, I'd recommend Why ContentEditable is Terrible by Nick. https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40…
asteadman · 2016-03-08
content editable has it's own problems (https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40… and more modern rich text editors do build up some kind of model of the data they are representing. My favorite is prosemirror, which presents the user a contenteditable, but maps changes as transformations to it's own internal document model. Each version of the document is immutable and it uses a fast diffing algo (similar to react) to determine the DOM mutation steps necessary to represent the newest version document. As a result, it becomes "trivial" to support multi-user collaboration, since you just import the other user's transformations to the document model as they come in (http://prosemirror.net/demo/collab.html#edit-Example). Since the entire document is now modeled as a tree structure, it becomes easy to do custom serialization/deserialization, ie: to markdown and back again (http://prosemirror.net/demo/markdown.html).
Rotten194 · 2015-12-08
Also, on a more technical level 4chan's ads aren't served from a well known ad host like Google, so they wouldn't be blocked by a typical blacklist without filtering URLs containing ad -- which some adblockers do, causing [all kinds of problems] [0]. [0]: https://medium.com/medium-eng/the-unluckiest-paragraphs-751dd36d2d30
davidhariri · 2015-11-30
From what I understand, this is how Medium organizes the fast retrieval and editing of their rich text. You might want to read this for more information: https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40… I may have missed something, though :-|
choonkeat · 2015-10-29
While the Ruby community wasn’t looking, the rest of the world has moved on to having standalone servers to manage & process their file uploads. Latest example: https://medium.com/medium-eng/the-stack-that-helped-medium-drive-2-6-m…
avivo · 2015-08-28
This is very cool. I'm curious if you have thoughts on this post about Medium's implementation and where you agree or diverged. https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40…
awkward · 2015-05-11
That's assuming users aren't resetting their locale. It's not uncommon for non english users to assume that the english version of a site is the real deal and their version is an inferior localization done by some backbenchers at whatever company made it. For example, here's a story about how the majority of power users in Poland use an english keyboard with specialized key bindings, because using a polish keyboard marks you as a n00b: https://medium.com/medium-eng/the-curious-case-of-disappearing-polish-…
i336_ · 2016-04-13
> "There are far, far, far too many advice articles on this site. It’s one thing to say ‘I lost my job and this is how it affected/changed me,’ that’s personal experience. But advice articles always contain the same implied subtext: you’re doing it wrong and I’m the genius who is going to show you how to do it the right way. Hence, how to fix your relationship, how to manage your spare time, ten things your boss does that you haven’t figured out, etc. etc." I've seen this attitude in so many different situations IRL and online. It's so refreshing to read it so clearly and fearlessly stated like that. It's unfortunate that Medium have attracted all the seagulls (https://www.youtube.com/watch?v=p-3e0EkvIEM), because they've done so much awesome technical work on the platform, for example with editing (https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40… How can platforms like Medium cultivate a culture that deprioritizes and devalues the types of spam content the article author is referring to? EDIT: Accidentally pasted the quote twice, fixed (thanks yxlx)
mhodgson · 2016-02-23
Looks like a nice entrant to the space. React is very well suited to this problem space and they clearly understand many of the pitfalls and problems. A few questions/concerns: 1. It doesn't look like the undo/redo state is global to the page. The built in undo/redo stack in browsers is global to the page so this is the expectation users will have. If you use multiple instances of Draft.js in your page they will each have their own stack, which is less than ideal. I realize having a singleton to manage this across all editor instances is more difficult in the React/Flux paradigm, but it would be much better from a user experience perspective. Related to this: 2. I don't think you can nest Draft.js instances. There are a number of simple cases where you might want to do this (e.g. custom block with image + caption). To support this in the future it seems you would need to account for it in the selection and undo/redo stack state handling. 3. The data format has a lot of repetition in how it stores inline styles[1]. I'm interested to know why they chose to represent the data this way instead of using indices. For instance, you can represent a inline bold style with a json object like so: {type: 'BOLD', startOffset: 5, endOffset: 10}. The format they chose to use is easier to render directly, but more difficult to parse visually and less space efficient (except in the case of styles that only cover a few characters). Finally, it seems most modern WYSIWYG editors mentioned…
spicyj · 2016-02-22
(Biased React dev here.) The key insight in Draft.js is that it's incredibly difficult to keep your model in sync with the browser's contenteditable behavior unless you intercept many of the behaviors and perform them entirely in the model, then change the DOM accordingly. Medium found the same thing when building their editor: https://medium.com/medium-eng/why-contenteditable-is-terrible-122d8a40… In order to build high-quality text editors, you need to be in control of what's happening in the DOM. There's obviously many ways to control the DOM. React is a solid base for this, as are many other libraries. Facebook uses React extensively so it made sense to use as a base for Draft to avoid needing to essentially rewrite React and to make it even easier to integrate with existing React apps. Of course, you can also use Draft easily inside a non-React app. The entire Draft model is also separate code decoupled from the UI and you're free to use the model and implement the views yourself if you're allergic to React or aren't targeting the DOM. The Facebook Groups app uses Draft's model but implements custom views for it in React Native.

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close