From 1742bf9fe4b7bef9d81d887071ca5be543ff4896 Mon Sep 17 00:00:00 2001 From: Jared Reich Date: Sat, 10 Mar 2018 08:53:01 -0700 Subject: [PATCH] Add support for "defaultParagraphSeparator". This closes #75. --- README.md | 5 +++++ demo.html | 1 + src/pell.js | 1 + 3 files changed, 7 insertions(+) diff --git a/README.md b/README.md index ac4eb55..38c066c 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,10 @@ pell.init({ // Use the output html, triggered by element's `oninput` event onChange: html => console.log(html), + // , optional, default = 'div' + // Instructs the editor which element to inject via the return key + defaultParagraphSeparator: 'div', + // , optional, default = false // Outputs instead of styleWithCSS: false, @@ -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', diff --git a/demo.html b/demo.html index 31870c5..86f49f8 100644 --- a/demo.html +++ b/demo.html @@ -50,6 +50,7 @@

HTML output:

var editor = window.pell.init({ element: document.getElementById('pell'), + defaultParagraphSeparator: 'p', styleWithCSS: false, onChange: function (html) { document.getElementById('text-output').innerHTML = html diff --git a/src/pell.js b/src/pell.js index e256a80..ccd2584 100644 --- a/src/pell.js +++ b/src/pell.js @@ -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