Skip to content

Commit 51051af

Browse files
committed
Disable by variable reference rather than finding last added editor in array
1 parent 085e622 commit 51051af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JsonEditorWidget.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ public function run()
184184
$readyFunction = '';
185185
$readyFunction .= "{$widgetId}.on('change', function() { document.getElementById('{$inputId}').value = JSON.stringify({$widgetId}.getValue()); });\n";
186186
if ($this->disabled) {
187-
// Disabled last added json editor
188-
$readyFunction .= 'window.jsonEditors.slice(-1)[0].disable()';
187+
// Disabled current added json editor
188+
$readyFunction .= "window['$widgetId'].disable()";
189189
}
190190
$widgetJs .= "{$widgetId}.on('ready', function() {\n{$readyFunction}\n});";
191191

0 commit comments

Comments
 (0)