knockout-quill-binding
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -69,3 +69,5 @@ /******/ (function(modules) { // webpackBootstrap | ||
// see if user has set quill_options | ||
var options = Object.assign({}, default_options, allBindings.get('quill_options')); | ||
// see if the user has enabled the toolbar module | ||
@@ -162,11 +164,13 @@ allBindings.has('quill_toolbar') && Object.assign(options.modules, { | ||
// Get the user's current selection range(s) | ||
var selection = quill.getSelection(); | ||
if (quill.getHTML() !== ko.unwrap(html_observable)) { | ||
// Get the user's current selection range(s) | ||
var selection = quill.getSelection(); | ||
// Set the content of the quill editor to the current value of the | ||
// provided observable | ||
quill.setHTML(ko.unwrap(html_observable) || ""); | ||
// Set the content of the quill editor to the current value of the | ||
// provided observable | ||
quill.setHTML(ko.unwrap(html_observable) || ""); | ||
// Reset the selection ranges to what the user initially had selected | ||
quill.setSelection(selection); | ||
// Reset the selection ranges to what the user initially had selected | ||
quill.setSelection(selection); | ||
} | ||
} | ||
@@ -173,0 +177,0 @@ }; |
{ | ||
"name": "knockout-quill-binding", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Quill WYSIWYG binding for Knockout.js", | ||
@@ -5,0 +5,0 @@ "main": "knockout-quill.js", |
@@ -19,3 +19,5 @@ import Quill from 'quill'; | ||
// see if user has set quill_options | ||
const options = Object.assign({}, default_options, allBindings.get('quill_options')); | ||
// see if the user has enabled the toolbar module | ||
@@ -113,13 +115,15 @@ allBindings.has('quill_toolbar') && Object.assign(options.modules, { | ||
// Get the user's current selection range(s) | ||
const selection = quill.getSelection(); | ||
if (quill.getHTML() !== ko.unwrap(html_observable)) { | ||
// Get the user's current selection range(s) | ||
const selection = quill.getSelection(); | ||
// Set the content of the quill editor to the current value of the | ||
// provided observable | ||
quill.setHTML(ko.unwrap(html_observable) || ""); | ||
// Set the content of the quill editor to the current value of the | ||
// provided observable | ||
quill.setHTML(ko.unwrap(html_observable) || ""); | ||
// Reset the selection ranges to what the user initially had selected | ||
quill.setSelection(selection); | ||
// Reset the selection ranges to what the user initially had selected | ||
quill.setSelection(selection); | ||
} | ||
} | ||
}; |
179061
1853