在Vaadin流组件的TinyMCE中使用自定义皮肤出现问题。

huangapple go评论64阅读模式
英文:

Trouble using custom skins within the TinyMCE for flow Vaadin component

问题

我正在进行一个项目,在项目中我正在使用 Vaadin 组件 "TinyMCE for flow"(https://vaadin.com/directory/component/tinymce-for-flow)。这个组件使用了一个 setConfig 方法,该方法接受一个字符串参数作为 JSON,用于配置与常规 TinyMCE 的初始化相同的特殊选项。我找到了适用于此组件所使用的 TinyMCE 版本(4.9)的自定义皮肤,并使用 setConfig 函数来配置 skin_url 属性,如下所示:

editor.setConfig("{ \"selector\": \"textarea\", \"skin_url\": \"charcoal\"}");

其中,皮肤文件 charcoal 位于调用此方法的文件所在的同一目录中。我是否正确地为设置此组件的皮肤而使用了这个方法?我还尝试过使用皮肤文件的完整文件路径,但效果也不如预期,这两种方法都只是返回了一个看不见的 TinyMCE 编辑器。您知道可能出现了什么问题吗?

(注:此组件使用的是 TinyMCE 4.9 版本,而不是版本 5。这意味着我尝试使用新的内置深色模式特性,但在此组件中不可用。)

英文:

I'm working on a project where I'm using the vaadin component "TinyMCE for flow" (https://vaadin.com/directory/component/tinymce-for-flow) and this component utilizes a setConfig method which takes a string argument for json, which you would use for configuring the special options that the init for regular tinymce would configure. I found a custom skin for the version of tinymce this component uses (4.9) and used the setConfig function to configure the skin_url attribute as follows:

editor.setConfig("{ \"selector\": \"textarea\", \"skin_url\": \"charcoal\"}");

Where the skin file charcoal is inside the same directory as the file I'm calling this method inside of. Am I using this incorrectly for setting the skin of this component? I have also tried using the complete file path for the skin file but that has also not worked out, all both of these does is just returns an invisible tinyMCE editor. Any idea what could be happening here?

(Note: this component is using tinyMCE 4.9, its not 5. Meaning, id try to use the new built in dark mode features but that isn't available in this component)

答案1

得分: 1

在我这里似乎正常工作,只要我将charcoal目录存储在我的应用程序的静态资源文件夹下。我有一个Spring Boot测试应用程序,所以在那种情况下,该目录位于src/main/resources/META-INF/resources/charcoal。在非Spring项目中,它将位于/src/main/webapp/charcoal。在这里可以查看有关将资源存储在文档中的更多信息:https://vaadin.com/docs/v14/flow/importing-dependencies/tutorial-ways-of-importing.html#resource-cheat-sheet

英文:

Seems to work ok for me as long as I store the charcoal directory under the static resources folder in my app. I have a Spring Boot test app, so in that case, the directory is at src/main/resources/META-INF/resources/charcoal. In a non-Spring project, it would be /src/main/webapp/charcoal. See more about storing resources in the docs here: https://vaadin.com/docs/v14/flow/importing-dependencies/tutorial-ways-of-importing.html#resource-cheat-sheet

huangapple
  • 本文由 发表于 2020年10月6日 03:52:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/64215302.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定