From f3ad3a6bd69e5bc41eea74b8daebf661d4ac5a45 Mon Sep 17 00:00:00 2001 From: Yair Even Or Date: Sat, 5 Feb 2022 17:33:47 +0200 Subject: [PATCH] added "readonly" to be able to be configured from the settings and not only as an attribute on the original input --- src/tagify.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tagify.js b/src/tagify.js index 56799538..965337f7 100644 --- a/src/tagify.js +++ b/src/tagify.js @@ -100,7 +100,7 @@ Tagify.prototype = { var _s = this.settings = extend({}, DEFAULTS, settings) _s.disabled = input.hasAttribute('disabled') - _s.readonly = input.hasAttribute('readonly') // if "readonly" do not include an "input" element inside the Tags component + _s.readonly = _s.readonly || input.hasAttribute('readonly') _s.placeholder = input.getAttribute('placeholder') || _s.placeholder || "" _s.required = input.hasAttribute('required') @@ -960,7 +960,7 @@ Tagify.prototype = { setReadonly( toggle, attrribute ){ var _s = this.settings - document.activeElement.blur() // exists possible edit-mode + document.activeElement.blur() // exit possible edit-mode _s[attrribute || 'readonly'] = toggle this.DOM.scope[(toggle ? 'set' : 'remove') + 'Attribute'](attrribute || 'readonly', true)