@lexical/headless 0.2.7 → 0.3.0

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.
@@ -13,12 +13,13 @@ import type {
13
13
  EditorThemeClasses,
14
14
  } from 'lexical';
15
15
 
16
+ import {Class} from 'utility-types';
17
+
16
18
  export function createHeadlessEditor(editorConfig?: {
17
- namespace?: string;
18
19
  editorState?: EditorState;
19
20
  theme?: EditorThemeClasses;
20
21
  parentEditor?: LexicalEditor;
21
- nodes?: $ReadOnlyArray<Class<LexicalNode>>;
22
+ nodes?: ReadonlyArray<Class<LexicalNode>>;
22
23
  onError: (error: Error) => void;
23
24
  disableEvents?: boolean;
24
25
  readOnly?: boolean;
@@ -14,13 +14,11 @@ var lexical = require('lexical');
14
14
  * This source code is licensed under the MIT license found in the
15
15
  * LICENSE file in the root directory of this source tree.
16
16
  *
17
- *
18
17
  */
19
18
  function createHeadlessEditor(editorConfig) {
20
19
  const editor = lexical.createEditor(editorConfig);
21
20
  editor._headless = true;
22
21
  ['registerDecoratorListener', 'registerRootListener', 'registerMutationListeners', 'getRootElement', 'setRootElement', 'getElementByKey', 'focus', 'blur'].forEach(method => {
23
- // $FlowFixMe
24
22
  editor[method] = () => {
25
23
  throw new Error(`${method} is not supported in headless mode`);
26
24
  };
@@ -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
- var c=require("lexical");exports.createHeadlessEditor=function(d){const a=c.createEditor(d);a._headless=!0;"registerDecoratorListener registerRootListener registerMutationListeners getRootElement setRootElement getElementByKey focus blur".split(" ").forEach(b=>{a[b]=()=>{throw Error(`${b} is not supported in headless mode`);}});return a};
7
+ 'use strict';var c=require("lexical");exports.createHeadlessEditor=function(d){let a=c.createEditor(d);a._headless=!0;"registerDecoratorListener registerRootListener registerMutationListeners getRootElement setRootElement getElementByKey focus blur".split(" ").forEach(b=>{a[b]=()=>{throw Error(`${b} is not supported in headless mode`);}});return a}
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@lexical/headless`
2
2
 
3
- This package allows creating headless lexical editor (that does not rely on DOM, e.g. for Node.js environment), and use its
3
+ This package allows you to use interact with Lexical in a headless environment (one that does not rely on DOM, e.g. for Node.js environment), and use its
4
4
  main features like editor.update(), editor.registerNodeTransform(), editor.registerUpdateListener()
5
5
  to create, update or traverse state.
6
6
 
package/package.json CHANGED
@@ -8,10 +8,10 @@
8
8
  "headless"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.2.7",
11
+ "version": "0.3.0",
12
12
  "main": "LexicalHeadless.js",
13
13
  "peerDependencies": {
14
- "lexical": "0.2.7"
14
+ "lexical": "0.3.0"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",