Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyMCE6: /current/ in Webjar URL #1053

Open
f-wunderlich opened this issue Sep 30, 2024 · 6 comments
Open

TinyMCE6: /current/ in Webjar URL #1053

f-wunderlich opened this issue Sep 30, 2024 · 6 comments

Comments

@f-wunderlich
Copy link

The wicketstuff-tinymce6 module hardcodes the path to the TinyMCE JS in the Webjar with "current" instead of the version number. How is that supposed to work?

TinyMCESettings:
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");

pom.xml:
org.webjars.npm
tinymce
6.8.3

$ jar tf ~/.m2/repository/org/webjars/npm/tinymce/6.8.3/tinymce-6.8.3.jar | grep tinymce.js
META-INF/resources/webjars/tinymce/6.8.3/tinymce.js

Unsurprisingly, the example does not work:
$ mvn -Dexec.mainClass=org.wicketstuff.examples.tinymce.Start -Dexec.classpathScope=test test-compile exec:java
[...]
[qtp493343679-81] WARN org.apache.wicket.request.resource.PackageResource - resource [path = webjars/tinymce/current/tinymce.js, style = null, variation = null, locale = null]: Unable to find resource (status=404)

Either change the path in TinyMCESettings to match the Webjar ("6.8.3" instead of "current"), or use something like org.webjars:webjars-servlet-2.x and get rid of the "current/" segment in the path.

As far as I can tell, this "current" segment is only generated by de.agilecoders.wicket.webjars:wicket-webjars which is quite useless as it only works for its own IWebjarsResourceReference derived classes (see WebjarsResourceFinder#find) and with a massive amount of code only replicates what the container does anyway. In any case, neither is this artifact used by the TinyMCE6 module, nor would it work if it was, since TinyMCESettings declares standard JavaScriptResourceReferences.

@martin-g
Copy link
Member

@renoth ^^

@martin-g
Copy link
Member

@f-wunderlich The idea is to use current + WebjarsResourceReference and update the version only in pom.xml.
Using JavaScriptResourceReference must be a mistake.

It is not very clear how https://github.com/webjars/webjars-servlet-2.x works from its README. It might do the same or something else. I cannot tell...

@f-wunderlich
Copy link
Author

For de.agilecoders.wicket.webjars:wicket-webjars I believe the following is necessary:

  • add a dependency in pom.xml
  • invoke WicketWebjars.install(this) in TinyMCE6ExampleApplication#init
  • replace the JavaScriptResourceReference in TinyMCESettings with WebjarsJavaScriptResourceReference

The org.webjars:webjars-servlet-2.x artifact is documented at the official Webjars website:
https://www.webjars.org/documentation#servlet2
It is useless for anything halfway modern since it uses javax.servlet classes and can only serve as an example on how to make web applications agnostic of the webjar version they are using with maybe 20 lines of code:
https://github.com/webjars/webjars-servlet-2.x/blob/master/src/main/java/org/webjars/servlet/WebjarsServlet.java

@martin-g
Copy link
Member

@f-wunderlich Do you want to send a Pull Request?

@renoth
Copy link
Contributor

renoth commented Oct 30, 2024

IMHO it doesnt matter that much anymore because TinyMCE 6 is EOL tomorrow tinymce/tinymce#9609 and TinyMCE 7 self hosted will be GPLv2 which will make it unusable for most people. Any good alternatives with Wicket?

Shitstorm-Thread here tinymce/tinymce#9496

@solomax
Copy link
Contributor

solomax commented Dec 3, 2024

We can create module for tinymce7 and add separate LICENSE file :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants