@lexical/headless 0.3.3 → 0.3.6
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/LexicalHeadless.dev.js +2 -1
- package/LexicalHeadless.prod.js +1 -1
- package/index.d.ts +18 -0
- package/package.json +2 -5
- package/LexicalHeadless.d.ts +0 -27
package/LexicalHeadless.dev.js
CHANGED
|
@@ -18,7 +18,8 @@ var lexical = require('lexical');
|
|
|
18
18
|
function createHeadlessEditor(editorConfig) {
|
|
19
19
|
const editor = lexical.createEditor(editorConfig);
|
|
20
20
|
editor._headless = true;
|
|
21
|
-
['registerDecoratorListener', 'registerRootListener', '
|
|
21
|
+
const unsupportedMethods = ['registerDecoratorListener', 'registerRootListener', 'registerMutationListener', 'getRootElement', 'setRootElement', 'getElementByKey', 'focus', 'blur'];
|
|
22
|
+
unsupportedMethods.forEach(method => {
|
|
22
23
|
editor[method] = () => {
|
|
23
24
|
throw new Error(`${method} is not supported in headless mode`);
|
|
24
25
|
};
|
package/LexicalHeadless.prod.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
'use strict';var c=require("lexical");exports.createHeadlessEditor=function(d){let a=c.createEditor(d);a._headless=!0;"registerDecoratorListener registerRootListener
|
|
7
|
+
'use strict';var c=require("lexical");exports.createHeadlessEditor=function(d){let a=c.createEditor(d);a._headless=!0;"registerDecoratorListener registerRootListener registerMutationListener getRootElement setRootElement getElementByKey focus blur".split(" ").forEach(b=>{a[b]=()=>{throw Error(`${b} is not supported in headless mode`);}});return a}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { EditorState, EditorThemeClasses, Klass, LexicalEditor, LexicalNode } from 'lexical';
|
|
9
|
+
export declare function createHeadlessEditor(editorConfig?: {
|
|
10
|
+
disableEvents?: boolean;
|
|
11
|
+
editorState?: EditorState;
|
|
12
|
+
namespace: string;
|
|
13
|
+
nodes?: ReadonlyArray<Klass<LexicalNode>>;
|
|
14
|
+
onError: (error: Error) => void;
|
|
15
|
+
parentEditor?: LexicalEditor;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
theme?: EditorThemeClasses;
|
|
18
|
+
}): LexicalEditor;
|
package/package.json
CHANGED
|
@@ -8,17 +8,14 @@
|
|
|
8
8
|
"headless"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.3.
|
|
11
|
+
"version": "0.3.6",
|
|
12
12
|
"main": "LexicalHeadless.js",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"lexical": "0.3.
|
|
14
|
+
"lexical": "0.3.6"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/facebook/lexical",
|
|
19
19
|
"directory": "packages/lexical-headless"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"utility-types": "^3.10.0"
|
|
23
20
|
}
|
|
24
21
|
}
|
package/LexicalHeadless.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
LexicalEditor,
|
|
11
|
-
LexicalNode,
|
|
12
|
-
EditorState,
|
|
13
|
-
EditorThemeClasses,
|
|
14
|
-
} from 'lexical';
|
|
15
|
-
|
|
16
|
-
import {Class} from 'utility-types';
|
|
17
|
-
|
|
18
|
-
export function createHeadlessEditor(editorConfig?: {
|
|
19
|
-
editorState?: EditorState;
|
|
20
|
-
theme?: EditorThemeClasses;
|
|
21
|
-
namespace: string;
|
|
22
|
-
parentEditor?: LexicalEditor;
|
|
23
|
-
nodes?: ReadonlyArray<Class<LexicalNode>>;
|
|
24
|
-
onError: (error: Error) => void;
|
|
25
|
-
disableEvents?: boolean;
|
|
26
|
-
readOnly?: boolean;
|
|
27
|
-
}): LexicalEditor;
|