commit fa3a6d9c4c8d50bea4e84eb3fd669548e793a5f9
parent 8e49d947e71bf510981459260ef5dd00c9d7dfea
Author: Sanjog Sharma <sanjogsharma@gmail.com>
Date: Tue, 6 Jul 2021 21:48:03 +0545
editor input is not reflected back immediately on value subscription
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/ko-striveneditor.js b/src/ko-striveneditor.js
@@ -2,9 +2,9 @@ import StrivenEditor from './striveneditor';
export default class KoStrivenEditor {
constructor(ko, bindingName = 'striveneditor') {
- if(!ko.bindingHandlers.striveneditor) {
+ if (!ko.bindingHandlers.striveneditor) {
ko.bindingHandlers.striveneditor = {
- init: function(
+ init: function (
element,
valueAccessor,
allBindings,
@@ -51,7 +51,9 @@ export default class KoStrivenEditor {
editor.body.oninput = e => {
pauseUpdate = true;
value(editor.getContent());
- pauseUpdate = false;
+ setTimeout(function () {
+ pauseUpdate = false;
+ }, 0);
};
// Subscribe to the value observable to detect when it is changed and update the editor