Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.name_mapper='^@lexical/dragon$' -> '<PROJECT_ROOT>/packages/lexical-drago
module.name_mapper='^@lexical/eslint-plugin$' -> '<PROJECT_ROOT>/packages/lexical-eslint-plugin/flow/LexicalEslintPlugin.js.flow'
module.name_mapper='^@lexical/extension$' -> '<PROJECT_ROOT>/packages/lexical-extension/flow/LexicalExtension.js.flow'
module.name_mapper='^@lexical/extension/AutoFocusExtension$' -> '<PROJECT_ROOT>/packages/lexical-extension/flow/LexicalExtensionAutoFocusExtension.js.flow'
module.name_mapper='^@lexical/extension/BlockIdExtension$' -> '<PROJECT_ROOT>/packages/lexical-extension/flow/LexicalExtensionBlockIdExtension.js.flow'
module.name_mapper='^@lexical/extension/ClearEditorExtension$' -> '<PROJECT_ROOT>/packages/lexical-extension/flow/LexicalExtensionClearEditorExtension.js.flow'
module.name_mapper='^@lexical/extension/ClickAfterLastBlockExtension$' -> '<PROJECT_ROOT>/packages/lexical-extension/flow/LexicalExtensionClickAfterLastBlockExtension.js.flow'
module.name_mapper='^@lexical/extension/config$' -> '<PROJECT_ROOT>/packages/lexical-extension/flow/LexicalExtensionConfig.js.flow'
Expand Down
3 changes: 3 additions & 0 deletions packages/lexical-devtools/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"@lexical/extension/AutoFocusExtension": [
"../lexical-extension/src/AutoFocusExtension.ts"
],
"@lexical/extension/BlockIdExtension": [
"../lexical-extension/src/BlockIdExtension.ts"
],
"@lexical/extension/ClearEditorExtension": [
"../lexical-extension/src/ClearEditorExtension.ts"
],
Expand Down
13 changes: 13 additions & 0 deletions packages/lexical-extension/flow/LexicalExtension.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@

export type {AutoFocusConfig} from '@lexical/extension/AutoFocusExtension';
export {AutoFocusExtension} from '@lexical/extension/AutoFocusExtension';
export type {
BlockIdConfig,
BlockIdOutput,
} from '@lexical/extension/BlockIdExtension';
export {
$defaultIsIdentifiedBlock,
$getBlockById,
$getBlockId,
$isRootChildBlock,
BlockIdExtension,
blockIdState,
generateBlockId,
} from '@lexical/extension/BlockIdExtension';
export type {ClearEditorConfig} from '@lexical/extension/ClearEditorExtension';
export {
ClearEditorExtension,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* 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.
*
* @flow strict
*/

import type {LexicalExtension, LexicalNode, StateConfig} from 'lexical';
import type {Signal} from '@lexical/extension/signals';

declare export var blockIdState: StateConfig<'blockId', string | void>;

declare export function $getBlockId(node: LexicalNode): string | null;

declare export function $getBlockById(id: string): LexicalNode | null;

declare export function $defaultIsIdentifiedBlock(node: LexicalNode): boolean;

declare export function $isRootChildBlock(node: LexicalNode): boolean;

declare export function generateBlockId(): string;

export type BlockIdConfig = {
disabled: boolean,
$isIdentifiedBlock: (node: LexicalNode) => boolean,
generateId: () => string,
};

export interface BlockIdOutput {
disabled: Signal<boolean>;
$getBlockById: (id: string) => LexicalNode | null;
$isIdentifiedBlock: (node: LexicalNode) => boolean;
}

declare export var BlockIdExtension: LexicalExtension<
BlockIdConfig,
'@lexical/extension/BlockId',
BlockIdOutput,
unknown,
>;
16 changes: 16 additions & 0 deletions packages/lexical-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@
"production": "./dist/LexicalExtensionAutoFocusExtension.prod.js",
"default": "./dist/LexicalExtensionAutoFocusExtension.js"
},
"./BlockIdExtension": {
"source": "./src/BlockIdExtension.ts",
"types@<5.2": "./dist/typescript-too-old.d.ts",
"types": "./dist/BlockIdExtension.d.ts",
"development": "./dist/LexicalExtensionBlockIdExtension.dev.js",
"production": "./dist/LexicalExtensionBlockIdExtension.prod.js",
"default": "./dist/LexicalExtensionBlockIdExtension.js"
},
"./BlockIdExtension.js": {
"source": "./src/BlockIdExtension.ts",
"types@<5.2": "./dist/typescript-too-old.d.ts",
"types": "./dist/BlockIdExtension.d.ts",
"development": "./dist/LexicalExtensionBlockIdExtension.dev.js",
"production": "./dist/LexicalExtensionBlockIdExtension.prod.js",
"default": "./dist/LexicalExtensionBlockIdExtension.js"
},
"./ClearEditorExtension": {
"source": "./src/ClearEditorExtension.ts",
"types@<5.2": "./dist/typescript-too-old.d.ts",
Expand Down
Loading
Loading