Skip to content

Commit

Permalink
Fix enqueue and syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
corsacca committed Dec 16, 2024
1 parent d37c726 commit a756693
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dt-core/admin/components/setup-wizard-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class SetupWizardModules extends OpenLitElement {
super()

this.stage = 'prompt'
this.data = setupWizardShare.data
this.data = window.setupWizardShare.data
this.useCases = []
this.option = {}
}
Expand Down
6 changes: 3 additions & 3 deletions dt-core/admin/components/setup-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class SetupWizard extends LitElement {
constructor() {
super()

this.translations = setupWizardShare.translations
this.translations = window.setupWizardShare.translations
this.steps = []
this.currentStepNumber = 0

Expand All @@ -250,8 +250,8 @@ export class SetupWizard extends LitElement {
}

firstUpdated() {
if (this.steps.length === 0 && setupWizardShare && setupWizardShare.steps && setupWizardShare.steps.length !== 0) {
this.steps = setupWizardShare.steps
if (this.steps.length === 0 && window.setupWizardShare && window.setupWizardShare.steps && window.setupWizardShare.steps.length !== 0) {
this.steps = window.setupWizardShare.steps
}
}

Expand Down
6 changes: 5 additions & 1 deletion dt-core/admin/menu/menu-setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public function __construct() {
remove_action( 'network_admin_notices', 'update_nag', 3 );
remove_action( 'network_admin_notices', 'maintenance_nag', 3 );
});
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
add_filter( 'script_loader_tag', [ $this, 'filter_script_loader_tag' ], 10, 2 );
}

public function enqueue_scripts(){
dt_theme_enqueue_script( 'setup-wizard', 'dt-core/admin/components/setup-wizard.js', [], true );
dt_theme_enqueue_script( 'setup-wizard-open-element', 'dt-core/admin/components/setup-wizard-open-element.js', [ 'setup-wizard' ], true );
dt_theme_enqueue_script( 'setup-wizard-modules', 'dt-core/admin/components/setup-wizard-modules.js', [ 'setup-wizard', 'setup-wizard-open-element' ], true );
Expand All @@ -52,7 +57,6 @@ public function __construct() {
'steps' => $this->setup_wizard_steps(),
'data' => $this->setup_wizard_data(),
] );
add_filter( 'script_loader_tag', [ $this, 'filter_script_loader_tag' ], 10, 2 );
}

public function has_access_permission() {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"author": "Disciple.Tools",
"license": "GPL-2.0-or-later",
"homepage": "https://disciple.tools",
"type": "module",
"devDependencies": {
"@babel/eslint-parser": "^7.18.2",
"@babel/preset-env": "^7.24.4",
Expand Down

0 comments on commit a756693

Please sign in to comment.