@lexical/overflow 0.13.1 → 0.14.2
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/LexicalOverflow.dev.esm.js +60 -0
- package/LexicalOverflow.esm.js +12 -0
- package/LexicalOverflow.js +1 -1
- package/LexicalOverflow.prod.esm.js +7 -0
- package/README.md +2 -0
- package/package.json +5 -3
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
import { ElementNode, $applyNodeReplacement } from 'lexical';
|
|
8
|
+
|
|
9
|
+
/** @module @lexical/overflow */
|
|
10
|
+
/** @noInheritDoc */
|
|
11
|
+
class OverflowNode extends ElementNode {
|
|
12
|
+
static getType() {
|
|
13
|
+
return 'overflow';
|
|
14
|
+
}
|
|
15
|
+
static clone(node) {
|
|
16
|
+
return new OverflowNode(node.__key);
|
|
17
|
+
}
|
|
18
|
+
static importJSON(serializedNode) {
|
|
19
|
+
return $createOverflowNode();
|
|
20
|
+
}
|
|
21
|
+
static importDOM() {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
constructor(key) {
|
|
25
|
+
super(key);
|
|
26
|
+
this.__type = 'overflow';
|
|
27
|
+
}
|
|
28
|
+
exportJSON() {
|
|
29
|
+
return {
|
|
30
|
+
...super.exportJSON(),
|
|
31
|
+
type: 'overflow'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
createDOM(config) {
|
|
35
|
+
const div = document.createElement('span');
|
|
36
|
+
const className = config.theme.characterLimit;
|
|
37
|
+
if (typeof className === 'string') {
|
|
38
|
+
div.className = className;
|
|
39
|
+
}
|
|
40
|
+
return div;
|
|
41
|
+
}
|
|
42
|
+
updateDOM(prevNode, dom) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
insertNewAfter(selection, restoreSelection = true) {
|
|
46
|
+
const parent = this.getParentOrThrow();
|
|
47
|
+
return parent.insertNewAfter(selection, restoreSelection);
|
|
48
|
+
}
|
|
49
|
+
excludeFromCopy() {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function $createOverflowNode() {
|
|
54
|
+
return $applyNodeReplacement(new OverflowNode());
|
|
55
|
+
}
|
|
56
|
+
function $isOverflowNode(node) {
|
|
57
|
+
return node instanceof OverflowNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { $createOverflowNode, $isOverflowNode, OverflowNode };
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
import * as modDev from './LexicalOverflow.dev.esm.js';
|
|
8
|
+
import * as modProd from './LexicalOverflow.prod.esm.js';
|
|
9
|
+
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
|
10
|
+
export const $createOverflowNode = mod.$createOverflowNode;
|
|
11
|
+
export const $isOverflowNode = mod.$isOverflowNode;
|
|
12
|
+
export const OverflowNode = mod.OverflowNode;
|
package/LexicalOverflow.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict'
|
|
8
|
-
const LexicalOverflow = process.env.NODE_ENV === 'development' ? require('./LexicalOverflow.dev.js') : require('./LexicalOverflow.prod.js')
|
|
8
|
+
const LexicalOverflow = process.env.NODE_ENV === 'development' ? require('./LexicalOverflow.dev.js') : require('./LexicalOverflow.prod.js');
|
|
9
9
|
module.exports = LexicalOverflow;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
import{ElementNode as e,$applyNodeReplacement as t}from"lexical";class r extends e{static getType(){return"overflow"}static clone(e){return new r(e.__key)}static importJSON(e){return n()}static importDOM(){return null}constructor(e){super(e),this.__type="overflow"}exportJSON(){return{...super.exportJSON(),type:"overflow"}}createDOM(e){const t=document.createElement("span"),r=e.theme.characterLimit;return"string"==typeof r&&(t.className=r),t}updateDOM(e,t){return!1}insertNewAfter(e,t=!0){return this.getParentOrThrow().insertNewAfter(e,t)}excludeFromCopy(){return!0}}function n(){return t(new r)}function o(e){return e instanceof r}export{n as $createOverflowNode,o as $isOverflowNode,r as OverflowNode};
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -8,14 +8,16 @@
|
|
|
8
8
|
"overflow"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.14.2",
|
|
12
12
|
"main": "LexicalOverflow.js",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"lexical": "0.
|
|
14
|
+
"lexical": "0.14.2"
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/facebook/lexical",
|
|
19
19
|
"directory": "packages/lexical-overflow"
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"module": "LexicalOverflow.esm.js",
|
|
22
|
+
"sideEffects": false
|
|
21
23
|
}
|