Skip to content

Commit 1cccfc3

Browse files
committed
feat: adding entity to event data []
1 parent a86f67a commit 1cccfc3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/rich-text/src/plugins/shared/EmbeddedBlockUtil.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { TrackingPluginActions } from '../Tracking';
2929

3030
export function getWithEmbeddedBlockEvents(
3131
nodeType: BLOCKS.EMBEDDED_ENTRY | BLOCKS.EMBEDDED_ASSET | BLOCKS.EMBEDDED_RESOURCE,
32-
sdk: FieldAppSDK
32+
sdk: FieldAppSDK,
3333
): KeyboardHandler<HotkeyPlugin> {
3434
return (editor, { options: { hotkey } }) =>
3535
(event) => {
@@ -61,7 +61,7 @@ export async function selectEntityAndInsert(
6161
nodeType,
6262
sdk,
6363
editor,
64-
logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction']
64+
logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'],
6565
) {
6666
logAction('openCreateEmbedDialog', { nodeType });
6767

@@ -83,7 +83,7 @@ export async function selectEntityAndInsert(
8383
select(editor, selection);
8484
insertBlock(editor, nodeType, entity);
8585
ensureFollowingParagraph(editor, [BLOCKS.EMBEDDED_ASSET, BLOCKS.EMBEDDED_ENTRY]);
86-
logAction('insert', { nodeType });
86+
logAction('insert', { nodeType, entity });
8787
}
8888
// If user chose to create a new entity, this might open slide-in to edit the
8989
// entity. In this case, no point in focusing RTE which is now in the slide below.
@@ -96,7 +96,7 @@ export async function selectEntityAndInsert(
9696
export async function selectResourceEntityAndInsert(
9797
sdk,
9898
editor,
99-
logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction']
99+
logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'],
100100
) {
101101
logAction('openCreateEmbedDialog', { nodeType: BLOCKS.EMBEDDED_RESOURCE });
102102

@@ -135,7 +135,7 @@ function ensureFollowingParagraph(editor: PlateEditor, nodeTypes: BLOCKS[]) {
135135
const lastNode = getLastNodeByLevel(editor, level);
136136

137137
const isTextContainer = (TEXT_CONTAINERS as string[]).includes(
138-
(lastNode?.[0].type ?? '') as string
138+
(lastNode?.[0].type ?? '') as string,
139139
);
140140

141141
// If the new block isn't followed by a sibling text container (e.g. paragraph)

packages/rich-text/src/plugins/shared/EmbeddedInlineUtil.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { TrackingPluginActions } from '../../plugins/Tracking';
1515

1616
export function getWithEmbeddedEntryInlineEvents(
1717
nodeType: INLINES.EMBEDDED_ENTRY | INLINES.EMBEDDED_RESOURCE,
18-
sdk: FieldAppSDK
18+
sdk: FieldAppSDK,
1919
): KeyboardHandler<HotkeyPlugin> {
2020
return function withEmbeddedEntryInlineEvents(editor, { options: { hotkey } }) {
2121
return function handleEvent(event) {
@@ -55,7 +55,7 @@ const createInlineEntryNode = (nodeType, entity) => {
5555
export async function selectEntityAndInsert(
5656
editor,
5757
sdk,
58-
logAction: TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onToolbarAction']
58+
logAction: TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onToolbarAction'],
5959
) {
6060
const nodeType = INLINES.EMBEDDED_ENTRY;
6161
logAction('openCreateEmbedDialog', { nodeType });
@@ -75,7 +75,7 @@ export async function selectEntityAndInsert(
7575
// (i.e. when using hotkeys and slide-in)
7676
select(editor, selection);
7777
insertNodes(editor, createInlineEntryNode(nodeType, entry));
78-
logAction('insert', { nodeType });
78+
logAction('insert', { nodeType, entity: entry });
7979
}
8080
rteSlide.onActive(() => {
8181
rteSlide.unwatch();
@@ -86,7 +86,7 @@ export async function selectEntityAndInsert(
8686
export async function selectResourceEntityAndInsert(
8787
editor,
8888
sdk,
89-
logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction']
89+
logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction'],
9090
) {
9191
const nodeType = INLINES.EMBEDDED_RESOURCE;
9292
logAction('openCreateEmbedDialog', { nodeType });

0 commit comments

Comments
 (0)