Skip to content

Commit 30d40cd

Browse files
authored
Merge pull request #1 from germanbisurgi/master
Add the "JSONEditor" instance to the global window.jsonEditors array.
2 parents a93d87f + f73b21f commit 30d40cd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/JsonEditorWidget.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ public function run()
139139

140140
// Add the "JSONEditor" instance to the global window object, otherwise the instance is only available in "ready()" function scope
141141
$widgetJs = "window.{$widgetId} = new JSONEditor(document.getElementById('{$containerId}'), {$clientOptions});\n";
142+
// Add the "JSONEditor" instance to the global window.jsonEditors array.
143+
$widgetJs .= "if (!window.jsonEditors) { window.jsonEditors = []; } window.jsonEditors.push({$widgetId});";
142144

143145
$readyFunction = '';
144146
try {

0 commit comments

Comments
 (0)