editate 0.6.20 → 0.6.22
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 +1 -0
- package/lib/doc/operation.d.ts +5 -1
- package/lib/editor.d.ts +5 -1
- package/lib/index.cjs +530 -411
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +433 -314
- package/lib/index.js.map +1 -1
- package/lib/plugins/blockLock.d.ts +19 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/scrollToSelection.d.ts +5 -0
- package/package.json +10 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InferLeafBlockNode } from '../doc/types-infer.js';
|
|
2
|
+
import { DocNode, Range } from '../doc/types.js';
|
|
3
|
+
import { Editor } from '../editor.js';
|
|
4
|
+
/**
|
|
5
|
+
* A plugin to make specific blocks read-only.
|
|
6
|
+
*
|
|
7
|
+
* Locked blocks can still be selected and copied, but operations editing them are cancelled,
|
|
8
|
+
* except ones that unlock the block and ones targeting the root (e.g. undo / redo).
|
|
9
|
+
*/
|
|
10
|
+
export declare function blockLockPlugin<T extends DocNode>(editor: Editor<T>, options: {
|
|
11
|
+
/**
|
|
12
|
+
* A function to check if the block is locked or not.
|
|
13
|
+
*/
|
|
14
|
+
isLocked: (node: InferLeafBlockNode<T>) => boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
/**
|
|
17
|
+
* Check if the selection or specified range touches a locked block, which means editing operations on it will be cancelled.
|
|
18
|
+
*/
|
|
19
|
+
export declare function LockedInRange(editor: Editor, range?: Range): boolean;
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './transfer/index.js';
|
|
2
|
+
export { blockLockPlugin, LockedInRange } from './blockLock.js';
|
|
2
3
|
export { debugPlugin } from './debug.js';
|
|
3
4
|
export { keymapPlugin } from './keymap.js';
|
|
4
5
|
export { Undo, Redo, Undoable, Redoable } from './history.js';
|
|
6
|
+
export { scrollToSelectionPlugin } from './scrollToSelection.js';
|
|
5
7
|
export { selectionRectPlugin } from './selectionRect.js';
|
|
6
8
|
export { singlelinePlugin } from './singleline.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "editate",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.22",
|
|
4
4
|
"description": "An experimental, type-safe, framework agnostic and small (5kB+) contenteditable state manager.",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -36,14 +36,19 @@
|
|
|
36
36
|
"@standard-schema/spec": "^1.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@chenglou/pretext": "^0.0.8",
|
|
40
|
+
"@dnd-kit/helpers": "^0.5.0",
|
|
41
|
+
"@dnd-kit/react": "^0.5.0",
|
|
39
42
|
"@playwright/test": "^1.60.0",
|
|
40
43
|
"@size-limit/preset-small-lib": "^12.0.0",
|
|
41
44
|
"@storybook/addon-docs": "^10.4.0",
|
|
42
45
|
"@storybook/react-vite": "^10.4.0",
|
|
43
46
|
"@textlint/kernel": "^15.0.0",
|
|
44
47
|
"@textlint/textlint-plugin-text": "^15.0.0",
|
|
48
|
+
"@types/prismjs": "^1.26.6",
|
|
45
49
|
"@types/react": "^19.2.0",
|
|
46
50
|
"@types/react-dom": "^19.2.0",
|
|
51
|
+
"ai": "^7.0.42",
|
|
47
52
|
"diff": "^9.0.0",
|
|
48
53
|
"esbuild": "^0.28.0",
|
|
49
54
|
"jsdom": "^29.1.1",
|
|
@@ -53,13 +58,14 @@
|
|
|
53
58
|
"patch-package": "^8.0.0",
|
|
54
59
|
"path-browserify": "^1.0.1",
|
|
55
60
|
"prettier": "^3.8.1",
|
|
56
|
-
"
|
|
61
|
+
"prismjs": "^1.30.0",
|
|
57
62
|
"react": "^19.2.6",
|
|
58
63
|
"react-dom": "^19.2.6",
|
|
59
64
|
"react-is": "^19.2.6",
|
|
60
65
|
"remark-gfm": "^4.0.1",
|
|
61
66
|
"remark-parse": "^11.0.0",
|
|
62
67
|
"rimraf": "6.1.3",
|
|
68
|
+
"shiki": "^4.3.1",
|
|
63
69
|
"size-limit": "^12.0.0",
|
|
64
70
|
"storybook": "^10.4.0",
|
|
65
71
|
"terser": "^5.48.0",
|
|
@@ -97,7 +103,8 @@
|
|
|
97
103
|
"solid",
|
|
98
104
|
"angular",
|
|
99
105
|
"preact",
|
|
100
|
-
"alpine"
|
|
106
|
+
"alpine",
|
|
107
|
+
"marko"
|
|
101
108
|
],
|
|
102
109
|
"author": "inokawa <stratoooo-taster@yahoo.co.jp> (https://github.com/inokawa/)",
|
|
103
110
|
"license": "MIT",
|