@lexical/overflow
Version:
This package contains selection overflow helpers and nodes for Lexical.
10 lines (8 loc) • 851 B
JavaScript
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import{defineExtension as e,ElementNode as t,$applyNodeReplacement as r}from"lexical";class n extends t{$config(){return this.config("overflow",{$transform(e){e.isEmpty()&&e.remove()},extends:t})}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 o(){return r(new n)}function s(e){return e instanceof n}const c=e({name:"@lexical/overflow",nodes:()=>[n]});export{o as $createOverflowNode,s as $isOverflowNode,c as OverflowExtension,n as OverflowNode};