This repository has been archived by the owner on Jan 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Replace Trix with Quill editor
Notes: * Considering Quill as a replacement for Trix, because of [a desire to have more semantically-correct markup](#53) as the final output. * Quill is nice, but has its own set of issues. Namely, it inserts `<p><br></p>` tags. * The `matchVisual` [workaround](slab/quill#1379) has since been removed from Quill. * We _could_ strip `<p><br></p>` from the HTML before rendering, but I worry that storing those tags in the DB would make it harder to transition away from Quill down the road.
- Loading branch information
Showing
11 changed files
with
94 additions
and
339 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
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,26 @@ | ||
const Quill = require('quill'); | ||
|
||
const options = { | ||
modules: { | ||
toolbar: [ | ||
[{ header: [1, 2, false] }], | ||
['bold', 'italic', 'underline', 'strike'], | ||
['link', 'blockquote', 'code-block'], | ||
[{ list: 'ordered' }, { list: 'bullet' }], | ||
], | ||
}, | ||
theme: 'snow', | ||
}; | ||
|
||
document.addEventListener("turbolinks:load", () => { | ||
const editors = document.querySelectorAll('.wysiwyg'); | ||
|
||
[].forEach.call(editors, (editor) => { | ||
const quill = new Quill(editor, options); | ||
const input = editor.nextElementSibling; | ||
|
||
quill.on('text-change', (delta, oldDelta, source) => { | ||
input.value = editor.firstChild.innerHTML; | ||
}); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.