From 162501f06f86fa23afb1eedf1a46bfbc374b66d0 Mon Sep 17 00:00:00 2001 From: Maxim Solodovnik Date: Tue, 3 Dec 2024 14:36:23 +0700 Subject: [PATCH] Fixes ##1053: Webjars resources are being loaded as expected --- .../examples/tinymce/TinyMCE6ExampleApplication.java | 3 +++ tinymce6-parent/tinymce6/pom.xml | 4 ++++ .../wicketstuff/tinymce6/settings/TinyMCESettings.java | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tinymce6-parent/tinymce6-examples/src/main/java/org/wicketstuff/examples/tinymce/TinyMCE6ExampleApplication.java b/tinymce6-parent/tinymce6-examples/src/main/java/org/wicketstuff/examples/tinymce/TinyMCE6ExampleApplication.java index 138d3645cf..430e8399ce 100644 --- a/tinymce6-parent/tinymce6-examples/src/main/java/org/wicketstuff/examples/tinymce/TinyMCE6ExampleApplication.java +++ b/tinymce6-parent/tinymce6-examples/src/main/java/org/wicketstuff/examples/tinymce/TinyMCE6ExampleApplication.java @@ -2,6 +2,8 @@ import org.apache.wicket.protocol.http.WebApplication; +import de.agilecoders.wicket.webjars.WicketWebjars; + /** * @author Iulian-Corneliu COSTAN */ @@ -16,6 +18,7 @@ public TinyMCE6ExampleApplication() protected void init() { super.init(); + WicketWebjars.install(this); getCspSettings().blocking().clear(); } diff --git a/tinymce6-parent/tinymce6/pom.xml b/tinymce6-parent/tinymce6/pom.xml index bf0f4f1ac1..cbf694d33e 100644 --- a/tinymce6-parent/tinymce6/pom.xml +++ b/tinymce6-parent/tinymce6/pom.xml @@ -29,6 +29,10 @@ + + de.agilecoders.wicket.webjars + wicket-webjars + org.webjars.npm tinymce diff --git a/tinymce6-parent/tinymce6/src/main/java/org/wicketstuff/tinymce6/settings/TinyMCESettings.java b/tinymce6-parent/tinymce6/src/main/java/org/wicketstuff/tinymce6/settings/TinyMCESettings.java index 9dad3ef5de..d941208075 100644 --- a/tinymce6-parent/tinymce6/src/main/java/org/wicketstuff/tinymce6/settings/TinyMCESettings.java +++ b/tinymce6-parent/tinymce6/src/main/java/org/wicketstuff/tinymce6/settings/TinyMCESettings.java @@ -36,6 +36,8 @@ License, or (at your option) any later version. import org.slf4j.LoggerFactory; import org.wicketstuff.tinymce6.TinyMceBehavior; +import de.agilecoders.wicket.webjars.request.resource.WebjarsJavaScriptResourceReference; + /** * Settings class for TinyMCE editor. User can add/remove buttons, enable/disable resizing, change * positions, orientation, alignment and much more. @@ -49,10 +51,8 @@ public class TinyMCESettings implements Serializable private static final Logger LOG = LoggerFactory.getLogger(TinyMCESettings.class); private static final String NEWLINE_TAB = "\n\t"; - public static final ResourceReference TINYMCE_JS_REF = new JavaScriptResourceReference( - TinyMceBehavior.class, "../../../webjars/tinymce/current/tinymce.js"); - public static final ResourceReference TINYMCE_JS_REF_MIN = new JavaScriptResourceReference( - TinyMceBehavior.class, "../../../webjars/tinymce/current/tinymce.min.js"); + public static final ResourceReference TINYMCE_JS_REF = new WebjarsJavaScriptResourceReference("tinymce/current/tinymce.js"); + public static final ResourceReference TINYMCE_JS_REF_MIN = new WebjarsJavaScriptResourceReference("tinymce/current/tinymce.min.js"); private final Language language; private boolean resizing = false;