mirror of
https://github.com/codex-team/editor.js
synced 2026-03-15 15:15:47 +01:00
Unique ids in blocks with nanoid (#1667)
* feat: Add unique ids for each block * fix: Improve code based on code review * feat(block ids): Use nanoid library for block id generation * Remove unused files * Add tests * Fix lint & test * fix: Remove unnecessary id generation, use nanoid(10) to shorten the id, add changelog and some documentation Also improved some documentation along the lines and fixed linting * Update copy-paste.spec.ts * fix id generation, add api method * Update blocks.spec.ts * update tests Co-authored-by: cobb <kebincheng@yeah.net> Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com> Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com> Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
This commit is contained in:
parent
ef0c7d76a7
commit
de364175eb
21 changed files with 333 additions and 18 deletions
|
|
@ -197,6 +197,7 @@
|
|||
data: {
|
||||
blocks: [
|
||||
{
|
||||
id: "zcKCF1S7X8",
|
||||
type: "header",
|
||||
data: {
|
||||
text: "Editor.js",
|
||||
|
|
@ -205,12 +206,14 @@
|
|||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "b6ji-DvaKb",
|
||||
data : {
|
||||
text : 'Hey. Meet the new Editor. On this page you can see it in action — try to edit this text. Source code of the page contains the example of connection and configuration.'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "header",
|
||||
id: "7ItVl5biRo",
|
||||
data: {
|
||||
text: "Key features",
|
||||
level: 3
|
||||
|
|
@ -218,6 +221,7 @@
|
|||
},
|
||||
{
|
||||
type : 'list',
|
||||
id: "SSBSguGvP7",
|
||||
data : {
|
||||
items : [
|
||||
{
|
||||
|
|
@ -238,6 +242,7 @@
|
|||
},
|
||||
{
|
||||
type: "header",
|
||||
id: "QZFox1m_ul",
|
||||
data: {
|
||||
text: "What does it mean «block-styled editor»",
|
||||
level: 3
|
||||
|
|
@ -245,18 +250,21 @@
|
|||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "bwnFX5LoX7",
|
||||
data : {
|
||||
text : 'Workspace in classic editors is made of a single contenteditable element, used to create different HTML markups. Editor.js <mark class=\"cdx-marker\">workspace consists of separate Blocks: paragraphs, headings, images, lists, quotes, etc</mark>. Each of them is an independent contenteditable element (or more complex structure) provided by Plugin and united by Editor\'s Core.'
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "mTrPOHAQTe",
|
||||
data : {
|
||||
text : `There are dozens of <a href="https://github.com/editor-js">ready-to-use Blocks</a> and the <a href="https://editorjs.io/creating-a-block-tool">simple API</a> for creation any Block you need. For example, you can implement Blocks for Tweets, Instagram posts, surveys and polls, CTA-buttons and even games.`
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "header",
|
||||
id: "1sYMhUrznu",
|
||||
data: {
|
||||
text: "What does it mean clean data output",
|
||||
level: 3
|
||||
|
|
@ -264,34 +272,40 @@
|
|||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "jpd7WEXrJG",
|
||||
data : {
|
||||
text : 'Classic WYSIWYG-editors produce raw HTML-markup with both content data and content appearance. On the contrary, Editor.js outputs JSON object with data of each Block. You can see an example below'
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "0lOGNUKxqt",
|
||||
data : {
|
||||
text : `Given data can be used as you want: render with HTML for <code class="inline-code">Web clients</code>, render natively for <code class="inline-code">mobile apps</code>, create markup for <code class="inline-code">Facebook Instant Articles</code> or <code class="inline-code">Google AMP</code>, generate an <code class="inline-code">audio version</code> and so on.`
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "WvX7kBjp0I",
|
||||
data : {
|
||||
text : 'Clean data is useful to sanitize, validate and process on the backend.'
|
||||
}
|
||||
},
|
||||
{
|
||||
type : 'delimiter',
|
||||
id: "H9LWKQ3NYd",
|
||||
data : {}
|
||||
},
|
||||
{
|
||||
type : 'paragraph',
|
||||
id: "h298akk2Ad",
|
||||
data : {
|
||||
text : 'We have been working on this project more than three years. Several large media projects help us to test and debug the Editor, to make its core more stable. At the same time we significantly improved the API. Now, it can be used to create any plugin for any task. Hope you enjoy. 😏'
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'image',
|
||||
id: "9802bjaAA2",
|
||||
data: {
|
||||
url: 'assets/codex2x.png',
|
||||
caption: '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue