Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@bento-editor/core
Advanced tools
Bento is build on top of Slate. Bento's primary objective is to provide Notion-like editor using Slate APIs. For Bento having this aim, you'll find Bento similar to Slate and Notion regarding its terminology, function, etc.
To better understand Bento, we highly recommend you to read Slate's documents:
and try out Notion.
Editor
Editable
is the main UI field to display user-editted data, think it as a canvas on which you edit content.
Element
Though for users who have experience using Notion or Notion-like editors the term Block
would be their familiar, we stick to using the term Element
so as to follow the Slate's definition. Block and Element are the same, anyway.
Text
(, or Leaf
)On the same reason we call inline-level components as Text. Because Slate uses the term Leaf
to, we guess, refer to the same component and we think that's redundant, we stick to using only Text
in as many situations as possible.
Node
refers to both Element and Text. Read the first section of this Slate's doc to see the difference between them.
Attributes
Each Node has its own set of attributes and their set, or structure, that varies depending on which Node type they are of. One example for an attribute is the href
attribute of @bento-editor/element-link
which is used to create a link; href: 'https://cam-inc.co.jp'
would be regarded as <a href="https://cam-inc.co.jp" />
.
Package
is a deliverable parcel which contains a single Node, is to be plugged in to Bento, and can be owned by Bento or you. Examples are Bento-owned packages on the npm registory like @bento-editor/element-paragraph, and any package you create tailored to your service domain like element-{Your Service Name}-media
to handle your-service-specific media objects.
Toolbox
, Toolbar
and Toolmenu
First of all, please read Notion's document of 'Writing & editing basics' to grab the idea of those tools: Toolbox, Toolbar and Toolmenu.
+
icon on Notion Editor.⋮⋮
icon on Notion Editor.Bento has specific types for Node: type Element
and type Text
in this file.
Bento restricts all packages, including yours, to follow those types, but they are simple and straight-forward; You'll just need to define some of the characters found on the Terminology section one-by-one :)
You can read their code of all the Bento-owned packages prefixed with element-
or text-
as examples when creating your own package.
Though Bento has most of its UI fixed, it allows users to change some of its design tokens by configuring their key-values, like so:
import { Editor } from '@bento-editor/core';
const config = {
themeToken: {
color: {
background: 'lightblue',
backgroundOn: 'darkblue',
}
}
};
const YourEditor = () => {
return (
<Editor config={config} />
);
};
Remember that Bento doesn't intend to offer full-customizable functions related to design, rather Bento offers you the way to adjust its design to your service UI design by allowing you to change only design tokens like color, space, font size, etc. Read this for detail about all the customizable tokens.
Bento watches users' prefers-color-scheme
CSS media feature and switches design tokens accordingly. Pass token values for both light
and dark
modes separately like this:
const config = {
themeToken: {
color: {
light: {
background: 'lightblue',
backgroundOn: 'darkblue',
},
dark: {
background: 'darkblue',
backgroundOn: 'lightblue',
},
}
}
};
FAQs
Core for Bento Editor
The npm package @bento-editor/core receives a total of 557 weekly downloads. As such, @bento-editor/core popularity was classified as not popular.
We found that @bento-editor/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.