Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
established quill and changed db for saving as json
- Loading branch information
Showing
12 changed files
with
992 additions
and
35 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,23 @@ | ||
import Quill from 'quill'; | ||
export let TextEditor = { | ||
mounted() { | ||
console.log('Mounting'); | ||
let quill = new Quill(this.el, { | ||
theme: 'snow' | ||
}); | ||
|
||
quill.on('text-change', (delta, oldDelta, source) => { | ||
if (source == 'api') { | ||
console.log("An API call triggered this change."); | ||
} else if (source == 'user') { | ||
console.log(this); | ||
this.pushEventTo(this.el.phxHookId, "text-editor", {"text_content": quill.getContents()}) | ||
} | ||
}); | ||
|
||
|
||
}, | ||
updated(){ | ||
console.log('U'); | ||
} | ||
} |
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,34 @@ | ||
<script> | ||
import { onMount } from "svelte"; | ||
export let placeholder; | ||
let editor; | ||
export let toolbarOptions = [ | ||
[{ header: 1 }, { header: 2 }, "blockquote", "link", "image", "video"], | ||
["bold", "italic", "underline", "strike"], | ||
[{ list: "ordered" }, { list: "ordered" }], | ||
[{ align: [] }], | ||
["clean"], | ||
]; | ||
onMount(async () => { | ||
const { default: Quill } = await import("quill"); | ||
let quill = new Quill(editor, { | ||
modules: { | ||
toolbar: toolbarOptions, | ||
}, | ||
theme: "snow", | ||
placeholder: placeholder, | ||
}); | ||
}); | ||
</script> | ||
|
||
<div class="editor-wrapper"> | ||
<div bind:this={editor} /> | ||
</div> | ||
|
||
<style> | ||
@import "https://cdn.quilljs.com/1.3.6/quill.snow.css"; | ||
</style> |
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
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
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
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
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 @@ | ||
{ | ||
"dependencies": { | ||
"@editorjs/editorjs": "^2.23.2", | ||
"@editorjs/header": "^2.6.2", | ||
"quill": "^1.3.7", | ||
"svelte-editorjs": "^0.1.0" | ||
} | ||
} |
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
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
Oops, something went wrong.