Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
charset = utf-8
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/*
npm-debug.log
.idea/
.idea
.DS_Store
node_modules
*.log
dist
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
src/
webpack.config.js
yarn.lock
vite.config.ts
index.html
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.13.0
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 CodeX
Copyright (c) 2023 CodeX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 0 additions & 9 deletions dist/bundle.js

This file was deleted.

51 changes: 51 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<html>
<head>
<title>Editor.js example page</title>

<style>
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
</style>
</head>
<body>
<div id="editorjs"></div>

<button id="save-button">Save</button>
<pre id="output"></pre>

<script type="module">
import EditorJS from '@editorjs/editorjs';
import paragraph from './src/index.ts';

const editor = new EditorJS({
tools: {
paragraph: {
class: paragraph,
// inlineToolbar: ['marker', 'link'],
// shortcut: 'CMD+SHIFT+H',
// config: {},
}
},

data: {
blocks: [
{
type: 'paragraph',
data: {},
}
],
},
});

const saveButton = document.getElementById('save-button');
const output = document.getElementById('output');

saveButton.addEventListener('click', () => {
editor.save().then( savedData => {
output.innerHTML = JSON.stringify(savedData, null, 4);
})
})
</script>
</body>
</html>
26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,24 @@
"description": "Paragraph Tool for Editor.js",
"license": "MIT",
"repository": "https://github.com/editor-js/paragraph",
"main": "./dist/bundle.js",
"main": "dist/paragraph.umd.js",
"module": "dist/paragraph.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode development --watch"
"dev": "vite",
"build": "vite build"
},
"author": {
"name": "CodeX",
"email": "[email protected]"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"babel-loader": "^8.1.0",
"css-loader": "^3.5.3",
"raw-loader": "^4.0.1",
"style-loader": "^1.2.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"@codexteam/icons": "^0.0.4"
"@codexteam/icons": "^0.2.0",
"@editorjs/editorjs": "^2.26.4",
"@types/node": "^18.11.18",
"typescript": "^4.9.4",
"vite": "^4.0.4",
"vite-plugin-css-injected-by-js": "^2.3.1",
"vite-plugin-dts": "^1.7.1"
}
}
14 changes: 7 additions & 7 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.ce-paragraph {
line-height: 1.6em;
outline: none;
line-height: 1.6em;
outline: none;
}

.ce-paragraph[data-placeholder]:empty::before{
.ce-paragraph[data-placeholder]:empty::before {
content: attr(data-placeholder);
color: #707684;
font-weight: normal;
Expand All @@ -20,10 +20,10 @@
opacity: 0;
}

.ce-paragraph p:first-of-type{
margin-top: 0;
.ce-paragraph p:first-of-type {
margin-top: 0;
}

.ce-paragraph p:last-of-type{
margin-bottom: 0;
.ce-paragraph p:last-of-type {
margin-bottom: 0;
}
Loading