editate 0.6.21 → 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/lib/doc/operation.d.ts +5 -1
- package/lib/editor.d.ts +5 -1
- package/lib/index.cjs +527 -468
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +518 -461
- package/lib/index.js.map +1 -1
- package/lib/plugins/blockLock.d.ts +19 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/scrollToSelection.d.ts +1 -8
- package/package.json +4 -1
|
@@ -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,12 +1,5 @@
|
|
|
1
1
|
import { Editor } from '../editor.js';
|
|
2
|
-
export interface ScrollToSelectionOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Scroll smoothly instead of jumping.
|
|
5
|
-
* @default false
|
|
6
|
-
*/
|
|
7
|
-
smooth?: boolean;
|
|
8
|
-
}
|
|
9
2
|
/**
|
|
10
3
|
* A plugin to scroll to the selection on document change.
|
|
11
4
|
*/
|
|
12
|
-
export declare const scrollToSelectionPlugin: (editor: Editor
|
|
5
|
+
export declare const scrollToSelectionPlugin: (editor: Editor) => void;
|
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",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@chenglou/pretext": "^0.0.8",
|
|
40
|
+
"@dnd-kit/helpers": "^0.5.0",
|
|
41
|
+
"@dnd-kit/react": "^0.5.0",
|
|
40
42
|
"@playwright/test": "^1.60.0",
|
|
41
43
|
"@size-limit/preset-small-lib": "^12.0.0",
|
|
42
44
|
"@storybook/addon-docs": "^10.4.0",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"@types/prismjs": "^1.26.6",
|
|
47
49
|
"@types/react": "^19.2.0",
|
|
48
50
|
"@types/react-dom": "^19.2.0",
|
|
51
|
+
"ai": "^7.0.42",
|
|
49
52
|
"diff": "^9.0.0",
|
|
50
53
|
"esbuild": "^0.28.0",
|
|
51
54
|
"jsdom": "^29.1.1",
|