Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/code",
"version": "2.9.3",
"version": "2.9.4",
"keywords": [
"codex editor",
"code",
Expand Down
16 changes: 5 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './index.css';
import { getLineStartPosition } from './utils/string';
import { IconBrackets } from '@codexteam/icons';
import type { API, BlockTool, BlockToolConstructorOptions, BlockToolData, PasteConfig, PasteEvent, SanitizerConfig, ToolboxConfig } from '@editorjs/editorjs';
import type { API, BlockTool, BlockToolConstructorOptions, BlockToolData, HTMLPasteEvent, PasteConfig, SanitizerConfig, ToolboxConfig } from '@editorjs/editorjs';

/**
* CodeTool for Editor.js
Expand Down Expand Up @@ -160,16 +160,10 @@ export default class CodeTool implements BlockTool {
* onPaste callback fired from Editor`s core
* @param event - event with pasted content
*/
public onPaste(event: PasteEvent): void {
const detail = event.detail;

if ('data' in detail) {
const content = detail.data as string;

this.data = {
code: content || '',
};
}
public onPaste(event: HTMLPasteEvent): void {
this.data = {
code: event.detail.data.innerHTML,
};
}

/**
Expand Down