editor-js / code Goto Github PK
View Code? Open in Web Editor NEWCode Tool for Editor.js 2.0
License: MIT License
Code Tool for Editor.js 2.0
License: MIT License
Don't wrap long lines: use overflow-x instead
white-space: pre;
overflow-x: auto;
word-wrap: normal;
In v2.4.1, reserved HTML characters like <>&
are replaced by HTML entities on saving data.
Here's a code sandbox to quickly reproduce the issue: https://codesandbox.io/s/peaceful-dhawan-wz02y?file=/index.js
Steps to reproduce:
The code block's content changes and displays the HTML entities of the characters.
Ex: php, css, js, ...
some library like stdio.h
is not showing
#include <stdio.h>
becomes
#include
The code block can be better looking
and a Tab feature must me there
We need to migrate this project to TypeScript and provide type declarations. Make sure types for the plugin are available when using it in Typescript project with Editor.js
When you load already saved data into the editor and there is a code-block, you cannot delete characters with backspace (with del you can), neither can you navigate with the arrow-keys inside the code-block. It simply jumps to the block above instantly (in my example a header block).
Example:
const editor = new EditorJS({
data: {
"time":1700475383740,
"blocks":[
{"id":"aRMoZePSTD","type":"header","data":{"text":"My title","level":2}},
{"id":"fcG8CCR5F8","type":"code","data":{"code":"here is some code"}}
],
"version":"2.28.2"
},
tools: {
code: CodeTool,
header: Header
}
});
Versions:
Bundled with: esbuild, like this: ./node_modules/.bin/esbuild src/index.js --bundle --outfile=dist/index.js
Browser: Latest Firefox, it works in Chrome
Most times, spell check isn't required in code. Adding spellcheck="false"
to the textarea should disable spell check.
For a valid code block, can the code
property under any circumstances (now or in the future) be null
or omitted? Or is it guaranteed to always be present and non-null
for this block to be valid?
Context: I'm a back-end .NET developer needing to parse Editor.js documents. The readme does not explicitly guarantee that code
will always be present and non-null. Back-end deserialization/parsing in strongly typed languages would be easier with some guarantees about which properties can and can not be null/omitted. (Ideally, any such guarantees should be added to the readme to ensure they are formalized and kept in the future.)
In class CodeTool:
Current Behaviour:
In getters and setters functions we use this._data.
Whereas in other parts like onPaste function, constructor, drawView , we are using this.data to access the data variable.
Proposed Fix:
Change this.data to this._data everywhere.
Why is this needed?
If we dont do this then when migrating to typescript we get a naming conflict error. As data() getter and data variable are of same name.
Hi, im getting some error..
bundle.js:10:5220: Unexpected token (10:5220)
bundler : parceljs
Pretty useless having a code block without the ability to enter tabs. :)
Due to issue #10, could you bump the version of the plugin?
for a better ux
When editing the code block, editor-js onChange function is never fired
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.