Skip to content

Commit

Permalink
Add support for "defaultParagraphSeparator".
Browse files Browse the repository at this point in the history
This closes #75.
  • Loading branch information
jaredreich committed Mar 10, 2018
1 parent c64b861 commit 1742bf9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ pell.init({
// Use the output html, triggered by element's `oninput` event
onChange: html => console.log(html),

// <string>, optional, default = 'div'
// Instructs the editor which element to inject via the return key
defaultParagraphSeparator: 'div',

// <boolean>, optional, default = false
// Outputs <span style="font-weight: bold;"></span> instead of <b></b>
styleWithCSS: false,
Expand Down Expand Up @@ -195,6 +199,7 @@ const editor = pell.init({
document.getElementById('text-output').innerHTML = html
document.getElementById('html-output').textContent = html
},
defaultParagraphSeparator: 'p',
styleWithCSS: true,
actions: [
'bold',
Expand Down
1 change: 1 addition & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ <h3>HTML output:</h3>

var editor = window.pell.init({
element: document.getElementById('pell'),
defaultParagraphSeparator: 'p',
styleWithCSS: false,
onChange: function (html) {
document.getElementById('text-output').innerHTML = html
Expand Down
1 change: 1 addition & 0 deletions src/pell.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const init = settings => {
actionbar.appendChild(button)
})

if (settings.defaultParagraphSeparator) exec('defaultParagraphSeparator', settings.defaultParagraphSeparator)
if (settings.styleWithCSS) exec('styleWithCSS')

return settings.element
Expand Down

0 comments on commit 1742bf9

Please sign in to comment.