Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cursor navigation and backspace functionality CodeTool #76

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
38 changes: 38 additions & 0 deletions dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Code Plugin Test | EditorJS</title>
</head>
<body>
<div id="editorjs"></div>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/header@latest"></script>
<script src="../dist/code.umd.js"></script>
neSpecc marked this conversation as resolved.
Show resolved Hide resolved
<script>
const editor = new EditorJS({
holder: 'editorjs',
data: {
time: 1700475383740,
blocks: [
{
id: 'aRMoZePSTD',
type: 'header',
data: { text: 'Welcome to Editor.js', level: 2 },
},
{
id: 'fcG8CCR5F8',
type: 'code',
data: { code: 'print("Namaste World")' },
},
],
},
tools: {
code: CodeTool,
header: Header,
},
});
</script>
</body>
</html>
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.2",
"version": "2.9.3",
"keywords": [
"codex editor",
"code",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class CodeTool implements BlockTool {
this._data = data;

if (this.nodes.textarea) {
this.nodes.textarea.textContent = data.code;
this.nodes.textarea.value = data.code;
}
}

Expand Down Expand Up @@ -299,7 +299,7 @@ export default class CodeTool implements BlockTool {

wrapper.classList.add(this.CSS.baseClass, this.CSS.wrapper);
textarea.classList.add(this.CSS.textarea, this.CSS.input);
textarea.textContent = this.data.code;
textarea.value = this.data.code;

textarea.placeholder = this.placeholder;

Expand Down
Loading