• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckeditor / ckeditor5-react / ca6e1779-8fe0-4d9b-af01-91100ac4e4bc

24 Sep 2024 01:45PM UTC coverage: 100.0%. Remained the same
ca6e1779-8fe0-4d9b-af01-91100ac4e4bc

Pull #536

circleci

martnpaneq
Updated dependency versions to remove warnings.
Pull Request #536: Updated dependency versions to remove warnings.

281 of 281 branches covered (100.0%)

Branch coverage included in aggregate %.

582 of 582 relevant lines covered (100.0%)

70.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/context/setCKEditorReactContextMetadata.ts
1
/**
2
 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
 * For licensing, see LICENSE.md.
4
 */
5

6
import type { Config, EditorConfig } from 'ckeditor5';
7

8
/**
9
 * The symbol cannot be used as a key because config getters require strings as keys.
10
 */
11
const ReactContextMetadataKey = '$__CKEditorReactContextMetadata';
11✔
12

13
/**
14
 * Sets the metadata in the object.
15
 *
16
 * @param metadata The metadata to set.
17
 * @param object The object to set the metadata in.
18
 * @returns The object with the metadata set.
19
 */
20
export function withCKEditorReactContextMetadata(
21
        metadata: CKEditorConfigContextMetadata,
22
        config: EditorConfig
23
): EditorConfig & { [ ReactContextMetadataKey ]: CKEditorConfigContextMetadata } {
24
        return {
5✔
25
                ...config,
26
                [ ReactContextMetadataKey ]: metadata
27
        };
28
}
29

30
/**
31
 * Tries to extract the metadata from the object.
32
 *
33
 * @param object The object to extract the metadata from.
34
 */
35
export function tryExtractCKEditorReactContextMetadata( object: Config<any> ): CKEditorConfigContextMetadata | null {
36
        return object.get( ReactContextMetadataKey );
11✔
37
}
38

39
/**
40
 * The metadata that is stored in the React context.
41
 */
42
export type CKEditorConfigContextMetadata = {
43

44
        /**
45
         * The name of the editor in the React context. It'll be later used in the `useInitializedCKEditorsMap` hook
46
         * to track the editor initialization and destruction events.
47
         */
48
        name?: string;
49

50
        /**
51
         * Any additional metadata that can be stored in the context.
52
         */
53
        [x: string | number | symbol]: unknown;
54
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc