← Joel on Software

Making the web better. With blocks!

让网络变得更好。带积木!
Thu, 27 Jan 2022 17:14:00 +0000  ·  Joel on Software  ·  原文

You’ve probably seen web editors based on the idea of blocks .

您可能见过基于块概念的网页编辑器。

I’m typing this in WordPress, which has a little + button that brings up a long list of potential blocks that you can insert into this page:

我在 WordPress 中输入此内容,它有一个小 + 按钮,可显示一长串可插入此页面的潜在块列表:

This kind of “insert block” user interface concept is showing up in almost every blogging tool, web editor, note-taking app, and content management system.

这种“插入块”用户界面概念几乎出现在每个博客工具、网页编辑器、笔记应用程序和内容管理系统中。

People like it and it makes sense.

人们喜欢它并且这是有道理的。

We have seem to have standardized on one thing: the / key to insert a new block.

我们似乎已经标准化了一件事:插入新块的 / 键。

Everything else, though, is completely proprietary and non-standard.

然而,其他一切都是完全专有的和非标准的。

I thought, wouldn’t it be cool if blocks were interchangeable and reusable across the web?

我想,如果块可以在网络上互换和重用,那不是很酷吗?

Until now, every app that wants blocks has to implement them from scratch.

到目前为止,每个需要块的应用程序都必须从头开始实现它们。

Want a calendar block?

想要日历块吗?

Some kind of fancy Kanban board?

某种奇特的看板?

Something to embed image galleries?

有什么东西可以嵌入图片库吗?

Code it up yourself, buddy.

自己编码吧,伙计。

As a result of the non-standardization of blocks, our end-users suffer.

由于块的非标准化,我们的最终用户遭受了损失。

If someone is using my blog engine, they can only use those blocks that I had time to implement.

如果有人使用我的博客引擎,他们只能使用我有时间实现的那些块。

Those blocks may be pretty basic or incomplete.

这些块可能非常基本或不完整。

Users might want to use a fancier block that they saw in WordPress or Medium or Notion, but my editor doesn’t have it.

用户可能想要使用他们在 WordPress、Medium 或 Notion 中看到的更精美的块,但我的编辑器没有。

Blocks can’t be shared or moved around very easily, and our users are limited to the features and capabilities that we had time to re-implement.

块不能很容易地共享或移动,并且我们的用户只能使用我们有时间重新实现的特性和功能。

It’s just a protocol that embedding applications can use to embed blocks.

它只是嵌入应用程序可以用来嵌入块的协议。

Any block can be used in any embedding application if they all follow the protocol.

如果任何块都遵循协议,则它们可以在任何嵌入应用程序中使用。

Our hope is that this will make life much easier for app developers to support a huge variety of block types.

我们希望这将使应用程序开发人员的生活变得更加轻松,以支持各种各样的块类型。

At the same time, anyone can develop a block once and have it work in any blog platform, note-taking app, or content management system.

同时,任何人都可以开发一个块一次,并使其在任何博客平台、笔记应用程序或内容管理系统中运行。

It is all 100% free, open, and any sample code we develop showing how to use the protocol will be open-source.

它是 100% 免费、开放的,我们开发的任何展示如何使用该协议的示例代码都将是开源的。

We’ve released a very early draft of the Block Protocol, and we’ve started building some very simple blocks and a simple editor that can host them.

我们已经发布了区块协议的早期草案,并且我们已经开始构建一些非常简单的区块和一个可以托管它们的简单编辑器。

We’re hoping to foster an open source community that creates a huge open source library of amazing blocks:

我们希望培育一个开源社区,创建一个包含令人惊叹的区块的巨大开源库:

What can be a block?

什么可以是块?

Anything that makes sense in a document: a paragraph, list, table, diagram, or a kanban board.

文档中任何有意义的内容:段落、列表、表格、图表或看板。

Anything that makes sense on the web: an order form, a calendar, a video.

网络上任何有意义的东西:订单、日历、视频。

Anything that lets you interact with structured or typed data: I’ll get to that in a minute.

任何可以让你与结构化或类型化数据交互的东西:我马上就会讲到。

If you work on any kind of editor—be it a blogging tool, a note-taking app, a content management system, or anything like that—you should allow your users to embed blocks that conform to the Block Protocol.

如果您使用任何类型的编辑器(无论是博客工具、笔记应用程序、内容管理系统还是类似的东西),您都应该允许您的用户嵌入符合块协议的块。

This way you can write the embedding code once and immediately make your editor able to embed a rich variety of block types with no extra work on your part.

这样,您只需编写一次嵌入代码,即可立即使您的编辑器能够嵌入丰富多样的块类型,而无需您进行额外的工作。

If you work on any kind of custom data type that might make sense to embed in web pages, you should support the Block Protocol.

如果您处理任何可能有意义的嵌入网页的自定义数据类型,您应该支持块协议。

That way anybody with a hosting application that supports the protocol can embed your custom data type.

这样,任何拥有支持该协议的托管应用程序的人都可以嵌入您的自定义数据类型。

Because it’s all 100% open, we hope that the Block Protocol will become a web standard and commonly used across the Internet.

因为它是 100% 开放的,所以我们希望区块协议能够成为网络标准并在互联网上普遍使用。

That will mean that common block types, from paragraphs and lists to images and videos, will get better and better.

这意味着从段落和列表到图像和视频的常见块类型将变得越来越好。

But it will also mean that some esoteric block types will be embeddable anywhere.

但这也意味着一些深奥的块类型将可以嵌入到任何地方。

Want to create a block that shows the Great Circle routing for a flight between two airports?

想要创建一个块来显示两个机场之间航班的大圆航线?

Write the code for the block once and it can be embedded anywhere.

为该块编写一次代码,就可以将其嵌入到任何地方。

Oh, and one more thing .

哦,还有一件事。

Blocks can be highly structured, that is, they can have types.

块可以是高度结构化的,也就是说,它们可以具有类型。

That means that they magically become machine-readable without screen scraping.

这意味着它们神奇地变得机器可读,无需屏幕抓取。

For example, if you want to create an event block to represent an event on a calendar, you will be able to specify a schema that describes the event data type in a standard way.

例如,如果您想创建一个事件块来表示日历上的事件,您将能够指定一个以标准方式描述事件数据类型的架构。

That way tools like calendars can instantly parse and understand web pages that contain your event block, reliably.

这样,日历等工具就可以立即可靠地解析和理解包含事件块的网页。

Over time, it will mean that anyone can easy publish complex, typed data sets on the web that are automatically machine-readable without extra work.

随着时间的推移,这将意味着任何人都可以轻松地在网络上发布复杂的类型化数据集,这些数据集可以自动被机器读取,而无需额外的工作。

(Have you ever seen one of those websites where there’s a link to “download the data set in .XLS format”?

(您是否见过其中有一个链接“下载 .XLS 格式的数据集”的网站?

Yeah, say goodbye to that.)

是的,告别了。)

We’re going public with this very early in the development process because we need a lot of help!

我们在开发过程的早期就公开了这一点,因为我们需要很多帮助!

Everything we have so far is version 0.1.

到目前为止我们拥有的都是 0.1 版本。

It’s simple and not very good yet and going to need some iteration before it has the hope of truly being a useful web protocol.

它很简单,但还不是很好,需要一些迭代才能真正成为一个有用的网络协议。

This is an open protocol, free and non-proprietary, and it’s going to make the open web much better if widely adopted, so we need to start getting people involved early, giving us feedback, and building new things!

这是一个开放协议,免费且非专有,如果广泛采用,它将使开放网络变得更好,因此我们需要尽早开始让人们参与进来,向我们提供反馈,并构建新事物!

中文为机器翻译,仅供参考。