Skip to content

joshp23/denote.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

denote.js

Render Quill Deltas to Tomboy Note XML

Use

Include denote.js in your web page:

<script src="./js/denote.js"></script>

Create a new instance of the denote class and give it an object or string to parse to Tomboy Note format as delta

var dd = new denote(delta);
var parsed = dd.parse();
var data = parsed.toNote();

Then do what you will with the data.
Note: the toolbar options for Quill in the example folder are the only options that denote.js will render.

Example

// Evoke Quill after including it in your html, etc.
var Delta = Quill.import('delta');
var quill = new Quill('#editor-container', {
  modules: {
	toolbar: [
	  [{ size: [ 'small', false, 'large', 'huge' ]}],
	  ['bold', 'italic', 'underline', 'strike'],
	  [{ 'background':'yellow' }, 'code'],
	  ['clean'],
	  [{ 'list': 'bullet' }]
      ]
  },
  placeholder: 'Compose an epic...',
  theme: 'snow'
});
// Populate a hidden input area on form submit
var form = document.querySelector('form');
form.onsubmit = function() {
	// denote.js
	var delta = quill.getContents();
	var dd = new denote(delta);
	var parsed = dd.parse();
	var data = parsed.toNote();
	// Populate hidden form on submit
	var note = document.querySelector('input[name=note]');
	note.value = data;
};

Gratitude

This project was inspired by Deltoid.js

Support Dev

All of my published code is developed and maintained in spare time, if you would like to support development of this, or any of my published code, I have set up a Liberpay account for just this purpose. Thank you.

Donate using Liberapay