Skip to content

Commit c318b1e

Browse files
committed
fix: issue with triggering change when initiating
1 parent a2a1ad8 commit c318b1e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Fields/Quill2.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ public static function js($id, $options)
414414
window[_instance+'_atValues'] = _config.atValues;
415415
window[_instance+'_hashtagValues'] = _config.hashValues;
416416
window[_instance+'_linkValues'] = _config.linkValues;
417+
window[_instance+'_originalValue'] = element.value;
418+
417419
418420
window[_instance] = new Quill('#'+_id+'_Editor', {
419421
theme: _config.theme,
@@ -475,7 +477,11 @@ public static function js($id, $options)
475477
document.getElementById(_id+'_Editor').firstChild.innerHTML = element.value;
476478
477479
window[_instance].on('editor-change', function () {
478-
if (document.getElementById(_id).getAttribute('disabled') !== 'disabled') {
480+
if (
481+
document.getElementById(_id).getAttribute('disabled') !== 'disabled'
482+
&& document.getElementById(_id).getAttribute('readonly') !== 'readonly'
483+
&& document.getElementById(_id+'_Editor').firstChild.innerHTML !== window[_instance+'_originalValue']
484+
) {
479485
element.value = document.getElementById(_id+'_Editor').firstChild.innerHTML;
480486
481487
let event = new CustomEvent('grafite-form-change', { 'bubbles': true });

0 commit comments

Comments
 (0)