@opositatest/markdown-text-editor 1.4.1 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -6
- package/dist/editor.js +10245 -10165
- package/dist/react/index.js +7937 -7857
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,22 +34,69 @@ The editor currently focuses on text-first rich content that serializes cleanly
|
|
|
34
34
|
- Inline styles: bold, italic, underline, strikethrough, and inline code
|
|
35
35
|
- Display math blocks written in LaTeX
|
|
36
36
|
|
|
37
|
-
Indented / nested blocks are **not** part of the supported surface:
|
|
37
|
+
Indented / nested blocks are **not** part of the supported surface, with one exception: a list item nested under
|
|
38
|
+
another list item is a nested list in Markdown, so `Tab` creates it (see [Tab key](#tab-key)). The formatting
|
|
39
|
+
toolbar still offers no *Anidar bloque* / *Desanidar bloque* action.
|
|
38
40
|
|
|
39
41
|
### Tab key
|
|
40
42
|
|
|
41
43
|
`Tab` behaves like it does in any other form control: it moves focus to the next focusable element of the
|
|
42
|
-
host page (`Shift-Tab` moves to the previous one), so
|
|
43
|
-
trap. `Escape` still blurs the editor.
|
|
44
|
+
host page (`Shift-Tab` moves to the previous one), so a paragraph, a heading or a quote never indents, and the
|
|
45
|
+
editor never uses the browser's focus as a trap. `Escape` still blurs the editor.
|
|
44
46
|
|
|
45
|
-
The
|
|
47
|
+
The exceptions are BlockNote's own behaviours *inside* a block:
|
|
46
48
|
|
|
49
|
+
- **Lists** (bullet, numbered, checklist, toggle): `Tab` on the second and later items nests the item under the
|
|
50
|
+
previous one, and `Shift-Tab` lifts a nested item back out. A nested list is the one kind of indentation
|
|
51
|
+
Markdown can express, so it round-trips as `* parent` / ` * child`. The **first** item of a list cannot nest
|
|
52
|
+
(there is nothing above it to nest into), so `Tab` there leaves the editor - there is always a way out of the
|
|
53
|
+
field with the keyboard.
|
|
47
54
|
- **Code blocks**: `Tab` inserts two spaces. `Shift-Tab` leaves the editor.
|
|
48
55
|
- **Tables**: `Tab` / `Shift-Tab` move between cells. At the first/last cell they leave the editor instead of
|
|
49
56
|
indenting the table.
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
The nest/un-nest buttons BlockNote ships in the formatting toolbar are filtered out (`EXCLUDED_ITEM_KEYS` in
|
|
59
|
+
`src/components/app-block-note-view/app-formatting-toolbar.tsx`, pinned by `app-formatting-toolbar.test.tsx`):
|
|
60
|
+
they indent whatever block is selected - a paragraph, a list under a paragraph, a paragraph under a list item -
|
|
61
|
+
and Markdown reads all of those lines back as *siblings*, so the nesting the user saw would disappear on the
|
|
62
|
+
next save. Only `Tab` inside a list nests, and only when the result is still a list. That filter matches on the
|
|
63
|
+
upstream item `key` (`nestBlockButton` / `unnestBlockButton`), so an upstream rename would silently bring the
|
|
64
|
+
buttons back rather than fail loudly.
|
|
65
|
+
|
|
66
|
+
Markdown that already contains nested lists is parsed and re-exported unchanged, and a paragraph nested under a
|
|
67
|
+
list item is currently flattened out of it when the document is saved again.
|
|
68
|
+
|
|
69
|
+
### Numbered apartados and literal numbers
|
|
70
|
+
|
|
71
|
+
A number you type is **never** turned into an automatic list, so the number you wrote is the number that is
|
|
72
|
+
saved. Typing `1. `, `2. `, `3.ª`… at the start of a line just writes that text, exactly like the BOE does, and
|
|
73
|
+
apartados that are cited elsewhere by number are never renumbered:
|
|
74
|
+
|
|
75
|
+
- `1. No será preciso…` and `3. Tampoco será preciso…` stay two lines of text, aligned the same way, even when
|
|
76
|
+
the second one skips a number.
|
|
77
|
+
- Markdown cannot express "1, 3": inside a list only the first item's number is kept and the editor paints every
|
|
78
|
+
other number from the item's position, which is why an automatic list cannot hold a number you wrote.
|
|
79
|
+
|
|
80
|
+
This is also why paragraph text that starts with a block marker is escaped when the document is saved
|
|
81
|
+
(`3. No será preciso` is stored as `3\. No será preciso`). Without the escape, that line would come back as a
|
|
82
|
+
numbered list item, so the number would stop being text and start being renumbered. The escape renders exactly
|
|
83
|
+
the same in any Markdown renderer.
|
|
84
|
+
|
|
85
|
+
To create an actual numbered list, use the slash menu (`/lista numerada`), the block type selector or
|
|
86
|
+
`Ctrl/⌘+Shift+7`; it keeps its own positional numbering, and Markdown documents that already contain lists are
|
|
87
|
+
loaded as lists.
|
|
88
|
+
|
|
89
|
+
### Pasting
|
|
90
|
+
|
|
91
|
+
Pasted content is taken at face value: the `text/html` flavour when the source provides it, plain text otherwise.
|
|
92
|
+
It is never *guessed* to be Markdown, because the plain text of a legal document is full of lines starting with
|
|
93
|
+
`1. `, and parsing it as Markdown turned the apartados into an automatic list that then renumbered them (`1.`,
|
|
94
|
+
`3.` came back as `1.`, `2.`).
|
|
95
|
+
|
|
96
|
+
- `Ctrl/⌘+V` from a web page keeps the HTML structure — headings, bold, links — with the numbers as text.
|
|
97
|
+
- `Ctrl/⌘+Shift+V` (paste without formatting) inserts the text literally, which is what the **Quitar formato**
|
|
98
|
+
button suggests when the source formatting is not wanted.
|
|
99
|
+
- Explicit Markdown still works: `text/markdown` on the clipboard, and the editor's own `pasteMarkdown()`.
|
|
53
100
|
|
|
54
101
|
### Math / LaTeX blocks
|
|
55
102
|
|
|
@@ -121,6 +168,8 @@ Selecting text opens the formatting toolbar. Its **Quitar formato** action conve
|
|
|
121
168
|
text blocks to paragraphs and removes inline styles, colors, code formatting, and links in one
|
|
122
169
|
undoable operation. Non-text blocks such as images, tables, and formulas are left unchanged.
|
|
123
170
|
|
|
171
|
+
The toolbar never offers nesting/un-nesting (see [Tab key](#tab-key)); text alignment is still available.
|
|
172
|
+
|
|
124
173
|
The action tooltip also shows the browser shortcut for pasting without source formatting:
|
|
125
174
|
`Ctrl/⌘ + Shift + V`.
|
|
126
175
|
|