forked from facebook/lexical
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(selection): separate @lexical/selection/index into multiple files (…
- Loading branch information
Showing
7 changed files
with
1,321 additions
and
1,151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* 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. | ||
* | ||
*/ | ||
export const CSS_TO_STYLES: Map<string, Record<string, string>> = new Map(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* 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 type {ICloneSelectionContent} from './lexical-node'; | ||
import type {GridSelection, LexicalNode, NodeKey} from 'lexical'; | ||
|
||
import {$cloneWithProperties} from './lexical-node'; | ||
|
||
export function $cloneGridSelectionContent( | ||
selection: GridSelection, | ||
): ICloneSelectionContent { | ||
const nodeMap = selection.getNodes().map<[NodeKey, LexicalNode]>((node) => { | ||
const nodeKey = node.getKey(); | ||
|
||
const clone = $cloneWithProperties<LexicalNode>(node); | ||
|
||
return [nodeKey, clone]; | ||
}); | ||
|
||
return { | ||
nodeMap, | ||
range: [selection.gridKey], | ||
}; | ||
} |
Oops, something went wrong.