Skip to content

Commit

Permalink
fix code editor
Browse files Browse the repository at this point in the history
  • Loading branch information
froger-me committed Jan 13, 2024
1 parent 7bab419 commit 91120a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion js/admin/license.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global Wppus, console */
jQuery(document).ready(function ($) {
editor = wp.codeEditor.initialize($('#wppus_license_data'), WppusAdminLicense.cm_settings);
var editor = wp.codeEditor;
var initEditor = true;

$('#add_license_trigger').on('click', function() {
showLicensePanel($('#wppus_license_panel'), function() {
Expand Down Expand Up @@ -102,6 +103,11 @@ jQuery(document).ready(function ($) {

function populateLicensePanel(licenseData) {

if (initEditor) {
editor = editor.initialize($('#wppus_license_data'), WppusAdminLicense.cm_settings);
initEditor = false;
}

if ($.isPlainObject(licenseData)) {
$('#wppus_license_id').html(licenseData.id);
$('#wppus_license_key').val(licenseData.license_key);
Expand Down Expand Up @@ -145,6 +151,7 @@ jQuery(document).ready(function ($) {
$('#wppus_license_key').val($('#wppus_license_key').data('random_key'));
$('#wppus_license_date_created').val(new Date().toISOString().slice(0, 10));
$('#wppus_license_max_allowed_domains').val(1);
editor.codemirror.setValue('{}');
}
}

Expand Down
2 changes: 1 addition & 1 deletion js/admin/license.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 91120a0

Please sign in to comment.