@minnalstack/editor-plugin-block-keys 0.0.0-stage → 0.4.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aranghat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
1
+ # @minnalstack/editor-plugin-block-keys
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ What Backspace, Delete and Enter do between blocks.
4
+
5
+ ```sh
6
+ npm install @minnalstack/editor-plugin-block-keys
7
+ ```
8
+
9
+ MIT licensed.
@@ -0,0 +1,19 @@
1
+ import { EditorPlugin, type PluginContext } from '@minnalstack/editor-core';
2
+ export declare const BackspaceAtStart: import("@minnalstack/editor-core").Command<void>;
3
+ export declare const DeleteAtEnd: import("@minnalstack/editor-core").Command<void>;
4
+ export declare const LeaveBlock: import("@minnalstack/editor-core").Command<void>;
5
+ export declare const InsertAbove: import("@minnalstack/editor-core").Command<void>;
6
+ export declare const ImageEnter: import("@minnalstack/editor-core").Command<void>;
7
+ export declare const KeepLayoutEnter: import("@minnalstack/editor-core").Command<void>;
8
+ /**
9
+ * What Backspace and Delete do between blocks, where the editor's own keys would merge text into an image, or delete a divider unseen. A plugin's keys come first, so
10
+ * these apply wherever the other plugins, such as lists and tables, have let the key go on.
11
+ */
12
+ export declare class BlockKeysPlugin extends EditorPlugin {
13
+ readonly name = "block-keys";
14
+ readonly requires: {
15
+ blockTypes: string[];
16
+ };
17
+ configure(context: PluginContext): void;
18
+ }
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAiB,MAAM,0BAA0B,CAAC;AAG3F,eAAO,MAAM,gBAAgB,kDAA0G,CAAC;AACxI,eAAO,MAAM,WAAW,kDAAgG,CAAC;AACzH,eAAO,MAAM,UAAU,kDAAsF,CAAC;AAC9G,eAAO,MAAM,WAAW,kDAA4F,CAAC;AACrH,eAAO,MAAM,UAAU,kDAAqF,CAAC;AAC7G,eAAO,MAAM,eAAe,kDAA8I,CAAC;AAK3K;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAkB,IAAI,gBAAgB;IACtC,SAAkB,QAAQ;QAAK,UAAU;MAAkB;IAElD,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAyJ/C;CACF"}
package/dist/index.js ADDED
@@ -0,0 +1,183 @@
1
+ import { EditorPlugin, defineCommand } from '@minnalstack/editor-core';
2
+ import { caretAtEnd, caretAtStart, isTopLevel, siblingsOf, topLevelOf } from '@minnalstack/editor-plugin-kit';
3
+ export const BackspaceAtStart = defineCommand('block.backspaceAtStart', { description: 'What Backspace does at the start of a block' });
4
+ export const DeleteAtEnd = defineCommand('block.deleteAtEnd', { description: 'What Delete does at the end of a block' });
5
+ export const LeaveBlock = defineCommand('block.leave', { description: 'Starts a paragraph after the block' });
6
+ export const InsertAbove = defineCommand('block.insertAbove', { description: 'Starts a paragraph above the block' });
7
+ export const ImageEnter = defineCommand('image.enter', { description: 'Starts a paragraph after an image' });
8
+ export const KeepLayoutEnter = defineCommand('block.keepLayoutEnter', { description: 'Starts the next paragraph with the same layout, and leaves an anchor where it is' });
9
+ const textTypesThatBecomeParagraphs = new Set(['heading', 'quote', 'code', 'callout']);
10
+ const layoutAttributes = new Set(['align', 'indent', 'lineHeight']);
11
+ /**
12
+ * What Backspace and Delete do between blocks, where the editor's own keys would merge text into an image, or delete a divider unseen. A plugin's keys come first, so
13
+ * these apply wherever the other plugins, such as lists and tables, have let the key go on.
14
+ */
15
+ export class BlockKeysPlugin extends EditorPlugin {
16
+ name = 'block-keys';
17
+ requires = { blockTypes: ['paragraph'] };
18
+ configure(context) {
19
+ /** A block whose text is a caption on something else: an image, a video or post from another service, or from `rich-doc` v6 a table. */
20
+ const hasCaption = (type) => type === 'image' || type === 'embed' || (type === 'table' && context.preset.definition.types['table']?.text === true);
21
+ context.commands.add(BackspaceAtStart, {
22
+ canExecute: (ctx) => {
23
+ if (!caretAtStart(ctx.editor))
24
+ return false;
25
+ const block = ctx.editor.document.find(ctx.editor.selection.block);
26
+ return block !== undefined && block.type !== 'details' && (block.type === 'cell' || isTopLevel(ctx.editor, block.id));
27
+ },
28
+ execute: (ctx) => {
29
+ const { editor } = ctx;
30
+ const block = editor.document.find(editor.selection.block);
31
+ // A cell keeps its place: merging two cells would break the table.
32
+ if (block.type === 'cell')
33
+ return true;
34
+ // As in a word processor, an indent comes off a level at a time before anything else happens.
35
+ const indent = block.attrs['indent'];
36
+ if (typeof indent === 'number')
37
+ return editor.edit((edit) => edit.setAttributes(block.id, { indent: indent > 1 ? indent - 1 : null }));
38
+ // A caption belongs to its image. An empty one takes Backspace to mean the image, which is selected first, so that nothing goes unseen.
39
+ if (hasCaption(block.type)) {
40
+ if (block.text === '')
41
+ return editor.edit((edit) => edit.selectBlock(block.id));
42
+ return true;
43
+ }
44
+ if (textTypesThatBecomeParagraphs.has(block.type)) {
45
+ return editor.edit((edit) => {
46
+ const id = edit.changeBlockType(block.id, 'paragraph');
47
+ edit.setSelection({ block: id, offset: 0 });
48
+ });
49
+ }
50
+ const before = siblingsOf(editor, block.id).before;
51
+ if (before === undefined)
52
+ return false;
53
+ // An image takes the caret to its caption, and a table too if it has one, which is just above. An empty one on a table doesn't show until the caret is in the table.
54
+ if (hasCaption(before.type) && (before.type !== 'table' || before.text !== ''))
55
+ return editor.edit((edit) => edit.setSelection({ block: before.id, offset: before.text.length }));
56
+ if (before.type === 'table') {
57
+ const last = before.children.at(-1)?.children.at(-1);
58
+ return last !== undefined && editor.edit((edit) => edit.setSelection({ block: last.id, offset: last.text.length }));
59
+ }
60
+ // A list takes the text into its last item.
61
+ if (before.type === 'list') {
62
+ let last = before.children.at(-1);
63
+ while (last !== undefined && last.children.at(-1)?.type === 'list')
64
+ last = last.children.at(-1).children.at(-1);
65
+ if (last === undefined)
66
+ return false;
67
+ const at = last.text.length;
68
+ const into = last.id;
69
+ return editor.edit((edit) => {
70
+ edit.insertInline({ block: into, offset: at }, block.inline);
71
+ edit.removeBlock(block.id);
72
+ edit.setSelection({ block: into, offset: at });
73
+ });
74
+ }
75
+ // A block with no text, such as a divider, is selected first, so nothing goes unseen. An empty paragraph just goes.
76
+ if (before.text === '' && before.children.length === 0 && before.type !== 'paragraph') {
77
+ return editor.edit((edit) => {
78
+ if (block.text === '')
79
+ edit.removeBlock(block.id);
80
+ edit.selectBlock(before.id);
81
+ });
82
+ }
83
+ return false;
84
+ },
85
+ });
86
+ context.keys.add('Backspace', BackspaceAtStart);
87
+ context.commands.add(DeleteAtEnd, {
88
+ canExecute: (ctx) => {
89
+ if (!caretAtEnd(ctx.editor))
90
+ return false;
91
+ const block = ctx.editor.document.find(ctx.editor.selection.block);
92
+ return block !== undefined && block.type !== 'details' && (block.type === 'cell' || isTopLevel(ctx.editor, block.id));
93
+ },
94
+ execute: (ctx) => {
95
+ const { editor } = ctx;
96
+ const block = editor.document.find(editor.selection.block);
97
+ if (block.type === 'cell' || hasCaption(block.type))
98
+ return true;
99
+ const after = siblingsOf(editor, block.id).after;
100
+ if (after === undefined)
101
+ return false;
102
+ if (hasCaption(after.type) || after.type === 'details' || after.type === 'table' || after.type === 'list') {
103
+ // A table's caption is below its rows, so going down into one starts in its first cell.
104
+ const first = after.type !== 'table' && (hasCaption(after.type) || after.type === 'details') ? after : after.children[0]?.children[0] ?? after.children[0];
105
+ return first !== undefined && editor.edit((edit) => edit.setSelection({ block: first.id, offset: 0 }));
106
+ }
107
+ if (after.text === '' && after.children.length === 0 && after.type !== 'paragraph')
108
+ return editor.edit((edit) => edit.selectBlock(after.id));
109
+ return false;
110
+ },
111
+ });
112
+ context.keys.add('Delete', DeleteAtEnd);
113
+ // There is no caret below a table or an image at the end of a document, so this gets out of any block.
114
+ context.commands.add(LeaveBlock, {
115
+ canExecute: (ctx) => ctx.editor.selection !== null,
116
+ execute: (ctx) => {
117
+ const { editor } = ctx;
118
+ const top = topLevelOf(editor, editor.selection.block);
119
+ return top !== undefined && editor.edit((edit) => {
120
+ const id = edit.insertBlock('paragraph', { where: { after: top.id } });
121
+ edit.setSelection({ block: id, offset: 0 });
122
+ });
123
+ },
124
+ });
125
+ context.keys.add('Mod-Enter', LeaveBlock);
126
+ // And above one: a table at the very start of a document otherwise has no caret above it.
127
+ context.commands.add(InsertAbove, {
128
+ canExecute: (ctx) => ctx.editor.selection !== null,
129
+ execute: (ctx) => {
130
+ const { editor } = ctx;
131
+ const top = topLevelOf(editor, editor.selection.block);
132
+ return top !== undefined && editor.edit((edit) => {
133
+ const id = edit.insertBlock('paragraph', { where: { before: top.id } });
134
+ edit.setSelection({ block: id, offset: 0 });
135
+ });
136
+ },
137
+ });
138
+ context.keys.add('Mod-Shift-Enter', InsertAbove);
139
+ // A caption is one line: Enter finishes it, and doesn't split the image in two.
140
+ context.commands.add(ImageEnter, {
141
+ canExecute: (ctx) => {
142
+ const selection = ctx.editor.selection;
143
+ return selection !== null && hasCaption(ctx.editor.document.find(selection.block)?.type);
144
+ },
145
+ execute: (ctx) => {
146
+ const { block: id, anchor, head, isEmpty } = ctx.editor.selection;
147
+ return ctx.editor.edit((edit) => {
148
+ // Enter over selected text replaces it, as it does anywhere else.
149
+ if (!isEmpty && anchor.block === head.block)
150
+ edit.deleteText({ block: id, from: Math.min(anchor.offset, head.offset), to: Math.max(anchor.offset, head.offset) });
151
+ const paragraph = edit.insertBlock('paragraph', { where: { after: id } });
152
+ edit.setSelection({ block: paragraph, offset: 0 });
153
+ });
154
+ },
155
+ });
156
+ context.keys.add('Enter', ImageEnter);
157
+ // The editor's own Enter leaves a new paragraph at the end of one with no attributes, and in the middle of one copies them all, an anchor too.
158
+ context.commands.add(KeepLayoutEnter, {
159
+ canExecute: (ctx) => {
160
+ const selection = ctx.editor.selection;
161
+ if (selection?.kind !== 'text' || selection.anchor.block !== selection.head.block)
162
+ return false;
163
+ const block = ctx.editor.document.find(selection.block);
164
+ return block !== undefined && Object.keys(block.attrs).some((key) => layoutAttributes.has(key) || key === 'anchor') && (block.type === 'paragraph' || (block.type === 'heading' && !caretAtEnd(ctx.editor)));
165
+ },
166
+ execute: (ctx) => {
167
+ const { block: id, anchor, head, isEmpty } = ctx.editor.selection;
168
+ const block = ctx.editor.document.find(id);
169
+ const from = Math.min(anchor.offset, head.offset);
170
+ const atEnd = Math.max(anchor.offset, head.offset) === block.text.length;
171
+ const layout = Object.fromEntries(Object.entries(block.attrs).filter(([key]) => layoutAttributes.has(key)));
172
+ return ctx.editor.edit((edit) => {
173
+ if (!isEmpty)
174
+ edit.deleteText({ block: id, from, to: Math.max(anchor.offset, head.offset) });
175
+ // In the middle, it is one block becoming two, and both keep what it had. At the end, it is a new paragraph, and only the layout carries on.
176
+ edit.splitBlock({ block: id, offset: from }, atEnd ? { attrs: layout } : {});
177
+ });
178
+ },
179
+ });
180
+ context.keys.add('Enter', KeepLayoutEnter);
181
+ }
182
+ }
183
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE9G,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC,wBAAwB,EAAE,EAAE,WAAW,EAAE,6CAA6C,EAAE,CAAC,CAAC;AACxI,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,mBAAmB,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC,CAAC;AACzH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,mBAAmB,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC,CAAC;AACrH,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC,CAAC;AAC7G,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC,uBAAuB,EAAE,EAAE,WAAW,EAAE,kFAAkF,EAAE,CAAC,CAAC;AAE3K,MAAM,6BAA6B,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAC5G,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,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C,CAAC,CAAC;gBAC5G,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBAC9B,IAAI,CAAC,OAAO;wBAAE,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBAC7F,6IAA6I;oBAC7I,IAAI,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC/E,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC7C,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@minnalstack/editor-plugin-block-keys",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.1",
4
+ "license": "MIT",
5
+ "description": "What Backspace, Delete and Enter do between blocks.",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "types": "./dist/index.d.ts",
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "sideEffects": false,
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/MinnalStack/Minnal-Editor.git",
21
+ "directory": "packages/plugin-block-keys"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc -p tsconfig.json"
25
+ },
26
+ "dependencies": {
27
+ "@minnalstack/editor-plugin-kit": "0.4.1"
28
+ },
29
+ "peerDependencies": {
30
+ "@minnalstack/editor-core": "^0.4.1"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.org/"
35
+ }
36
+ }