Editor issues

borisvmalysh's picture

First, let me thank the team! You guyes RULE!!!
But there are a couple of cuestions I'm having lately:

1 - can I change the font size and arrange the text more freely in a fill-in or drag&drop text activity?

2 - is there a way to embed code into an activity right in the editor?

Like when in moodle you have the "<>" button which opens the html editor for the text.

Again, thank you ladies and gentlemen!

thomasmars's picture

I'm glad you're enjoying H5P :)

1) You are restricted to only textual layout changes for "Fill in the Blanks" and "Drag Text". If you have some experience writing css you can modify the css yourself, have a look at the css guide. If you have more advanced needs the "Drag and Drop" may satisfy them, but be aware that its editor is quite a bit more complex.

2) It is not possible to embed code into an activity, this is mainly for security reasons, we don't want arbitrary code to be runnable when viewing an H5P

Thanks for the praise, let us know if you run into any other problems, and feel free to create a pull request for #1 issue or post it as a feature request in our other forum with a specification on how you would like for it to work.

- Thomas

borisvmalysh's picture

Happy new year everybody!!! And mery christmas (both catholic and orthodox)!
By code I meant HTML. But in the HTML code you can also build in CSS and JS. And I wanted to use this.

The idea I have is timed demonstration of words to memorize and passing the words to fill-in boxes (with variables). This requieres JS code embedded. 
Well... If the creators think of the code as a potential threat I can only be sorry. But still very thankful for the work done. Because even with limited functional H5V rules ))

thomasmars's picture

Hi, there might be merit to allowing HTML tags, or at least a subset of HTML at some point. I don't think this is a prioritation though, but you can always make a feature request for it in the forums so a developer is more likely to pick it up.

I don't think arbitrary JS will be allowed in H5Ps, since the sharable nature of H5P has too much potential to be abused. The security implications are too high. Consider a malicious author creating an H5P on his site and shares it with multiple other sites. The H5P with the malicious script can be downloaded and re-used by author sites, and thus passed around to even more sites. The malicious script is run on all clients that opens the H5P.

If you had a specific feature in mind for a content type then pull requests for the given content type is encouraged. If you want to create an addon/script just for yourself then you can use the built-in hooks for extending H5Ps. You can learn more about this in the Drupal hooks and Wordpress hooks and the developer documentation.

Happy new year,

papi Jo's picture

By "code" I think borisvmalysh means HTML tags. It would help us understand his question if boris gave examples of which kind of HTML tags he would like to use in his texts.

hakangur's picture

For example, I would love to be able to add <div style="max-height: 400px; overflow-y: scroll;">TEXT</div> for long passages in the Question Set.

thomasmars's picture

In the editors where CKEditor is used it should be possible to paste in html code, however it might have certain tag and style restrictions.
For controlling height and styles more granularly I recommend having a look at the css hooks that you can use to extend H5P with: https://h5p.org/documentation/for-developers/visual-changes.

Do you think arbitrary HTML should be allowed inside CKEditor fields in the editor ? On one hand it gives the author more power, on the other hand it introduces additional complexity and it will increase the risk that authors make content that will work poorly in certain settings/on certain devices.

- Thomas

hakangur's picture

I wish all the developers and users a Happy New Year.

thomasmars's picture

Happy new year! :)

hakangur's picture

Having read the most recent posts here on adding codes to the editor field, I agree that the initial decision of h5p developers to eliminate this option from the very beginning is correct. h5p content can be edited by anyone and, as such, it calls for additional protection. The text editor toolbar might well be developed with the addition of a few more buttons (table, underline, font colour, for example), but this is not a must.

tim's picture

Yes, it is tough balance between allowing authors as much control as possible and restricting potential bugs from occuring. Since the code is open source, h5p is fully customizable for the most ambitious of authors.