-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
26,763 additions
and
23,843 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** @type { import("eslint").Linter.Config } */ | ||
module.exports = { | ||
root: true, | ||
extends: ['eslint:recommended', 'plugin:svelte/recommended', 'prettier'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
extraFileExtensions: ['.svelte'] | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true, | ||
node: true | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
/node_modules/ | ||
/public/build/ | ||
|
||
.DS_Store | ||
package-lock.json | ||
/node_modules | ||
/build | ||
/dist | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
/node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
/static | ||
.env | ||
.env.* | ||
!.env.example | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"useTabs": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"printWidth": 100, | ||
"plugins": ["prettier-plugin-svelte"], | ||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,60 @@ | ||
|
||
# svelte editorjs | ||
## sveditorjs v2 | ||
|
||
simple editorjs wrapper in svelte | ||
sveditorjs can be embed into any svelte or sveltekit project,the editor is wraped around editorjs ,for block editing that outputs clean json document.json can be consumed by any app. | ||
|
||
![alt text](https://github.com/pouchcms/sveditorjs/blob/master/ScreenShot%20Tool%20-20231030152142.png?raw=true) | ||
on version we added support for sveltekit | ||
and added a utility helper | ||
that generates html | ||
|
||
## docs and example | ||
see the docs and example here [sveditorjs](https://sveditorjs.vercel.app): | ||
|
||
```bash | ||
npm install sveditorjs | ||
|
||
//load the editor | ||
|
||
import {Editor,editor} from 'sveditorjs'; | ||
|
||
Editor => is the editor svelte component | ||
editor => is the editor instance | ||
|
||
required props are data and url endpoint for image uploads | ||
|
||
npm install --save sveditorjs | ||
``` | ||
|
||
follow doc at | ||
[docs](https://editorjs.io/) | ||
for advance usage | ||
|
||
|
||
```js | ||
<script> | ||
//this for testing purpose | ||
import {Editor,editor} from "sveditorjs"; | ||
|
||
|
||
import Editor ,{genHtml} from "$lib/index.js"; | ||
|
||
let modes = { | ||
'js': 'JavaScript', | ||
'py': 'Python', | ||
'go': 'Go', | ||
'cpp': 'C++', | ||
'cs': 'C#', | ||
'md': 'Markdown', | ||
} | ||
let data = {}; //correct editorjs json data | ||
let urls = {} //this object should be | ||
//{ | ||
upload:"", | ||
load:"", | ||
} | ||
async function handleChange(ev){ | ||
console.log(ev.detail) | ||
let editor = ev.detail.editor; | ||
editor.save().then(async (savedData)=>{ | ||
// do something with data | ||
console.log(window.current_sveditor); | ||
// use helper to gen html | ||
let html = await genHtml(savedData); | ||
console.log(html); | ||
}).catch((err)=>{console.log(err)}) | ||
} | ||
</script> | ||
<Editor > | ||
|
||
<Editor data={data} urls={urls} modes={modes} top="true" aside="true" on:editor_ready={(ev)=>{console.log("ready",ev.detail)}} on:editor_change ={(ev)=>{handleChange(ev)}} > | ||
<svelte:fragment slot="top" > | ||
top | ||
</svelte:fragment> | ||
<svelte:fragment slot="aside" > | ||
aside | ||
</svelte:fragment> | ||
<svelte:fragment slot="extra" > | ||
extra unstyled | ||
</svelte:fragment> | ||
</Editor> | ||
|
||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./.svelte-kit/tsconfig.json", | ||
"compilerOptions": { | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext" | ||
} | ||
} |
Oops, something went wrong.