Text in content types

I don't know if this is a bug or it was not meant to be added to the feature. In the text editor for example in a course presentation type:

  1. No way to insert a superscript. (small letters on the top of the text) : m-1
  2. No way to insert an image
  3. No way to insert an anchor (to link to another slide)
  4. No way to insert a table

These are displayed in the editor when pasted but disappear on "save".

Is there a way to improve this?

 

 

 

 

 

timothylim23's picture

Hi,

It is possible to do all of the examples listed. I've made a simple course presentation to demonstrate how it could be created:

https://h5p.org/node/28998

If you click on the link above you should be able to see an example of a superscript and an anchor link on the first slide, an image on the second slide and a table on the third.

  1. The text editors for the content types are still quite limited especially for sub and superscripts. One possible solution is to write the text in a different editor (like this one) and then copy it over. 
  2. Images can be inserted by pressing a button as shown in the screenshot that I have attached to this message.
  3. Anchors can be inserted the same way.
  4. Same again for tables. 

Perhaps have a go at creating some content types with your account on this website first. Do let me know if you have any problems.

Attachments: 

Hi Thimothy,
Thanks for your answer. But I was not talking about the slide interface where I know that you can add all these. I meant when you insert a text in a slide and you want to edit this text. For example you want to display this info as an icon and you want to insert some images , a table and an anchor you have a text editor with limited features (see attached capture please). It's the same when you use the accordion content type, you can't insert these in the text area.

For the superscript, yes indeed I already used my html editor and Xerte authoring tool without a success. What did you use? I am using H5p as a pluggin in moodle. Then I moved to Xerte because it has all the features I need. I wish they would be able to do a Moodle pluggin.

Attachments: 
timothylim23's picture

Hi Ali, I'm sorry for misunderstanding your question the first time around. 

I now see what you want to do. Unfortunately this functionality is indeed missing. Could you please describe why creating images, tables and anchors separately is not sufficient for what you want to do? Perhaps I could make a case to have these features developed in the coming releases.

We need to add 'superscript' and 'subscript' to the text editor for various content types so that our clients don't have to create content in another editor, and then copy and paste over.  Any news on when this will be implemented in a future release?  Or can you point me in the right direction to add the functionality myself?

tim's picture

Hi camerone, it's not something that the core team is planning to do in the near future. However there are many more H5P developers than just the core team and if you post in the request forum:

https://h5p.org/forum/16

Hopefully a developer from the community will pick it up. H5P is also open source and if you have access to a developer, you can go ahead and make a contribution to this repository:

https://github.com/h5p/h5p-editor-php-library 

Thank you for replying. I am a software engineer and while I could craft a solution myself I really would like to know what is blocking this simple task.  I shouldn't have to reinvent the wheel and introduce complexity for something that according to documentation from various sources including ckeditor's should be as simple as making some simple edits.  

What in the current configuration of your software is blocking the addition of buttons to the editor?  Multiple choice is one example of an h5p library that has the subscript and superscript buttons on the menu.  It looks like they're added via the semantics.json file.  Why doesn't the same method work for the advanced text library?  

The same is true for other instances of the editor that appear in the edit tab of different content types; there are subscript and superscript buttons on the menu and on others there are not.  Where/how do buttons get added to the editor's UI?  CKEditor config or the semantics for the library or somewhere else?  I'm working with the advanced text library and would like to know which configuration file needs to be edited.  I am looking at the network tab to see which file loads when I hit the pencil to edit the text.

This is the file that loads:

./sites/all/modules/contrib/h5p/modules/h5peditor/h5peditor/ckeditor/config.js

... But when I make changes to this file and reload, clearing the cache of course, there are no visual changes to the editor's UI.  In fact I can completely comment out this file, reload the page, click the pencil, confirm the changes were loaded but even with the entire file 'commented out' there is no visual change.  SO, I think something might be overriding it.  

 

 

tim's picture

Hi,

You should change the semantics.json file in the H5P.AdvancedText-1.1.h5p folder.

 

 

Just add "sub" and "sup" in "tags" (~line 10).

added "sup" and "sub" to H5P.AdvancedText-1.1 in the html widget's tags object and did the same adding to several other libraries.  Subscript and Superscript options still do not appear in the editor's menu bar.  Is this what is supposed to happen?  Is there another step involved?  

papi Jo's picture

Adding tags to the libraries semantics.json files is indeed the way to go, if you want to hack your libraries. But this does not work because upon installing the libraries, the semantics.json contents are copied to your h5p database. Any further modification of the semantics.json file are ignored. The only hack that does work is to make the changes directly in your h5p database, using e.g. phpmyadmin.

Usual warning applies here: any hacks that you make will be overwritten when you update the libraries.

As regards the contents of the text editor toolbar being different across the various H5P contents/activities, I guess decisions have been made by the H5P creators to provide the minimum number of tools in order to display an "uncluttered" interface for end-users. These decisions are certainly debatable and a specific "customize your editor toolbar" library should be made available in H5P distributions to allow contents creators to make their own editor toolbar with their own choice of tags, valid across all H5P libraries.

thomasmars's picture

Hi,

This is indeed correct.

There is an alternative however. You can change your semantics through hooks to make the changes persistent when updating libraries. This is currently available for Drupal and Wordpress and will soon be available for Moodle as well. The way this works is that your library assets (in this case semantcs.json) is modified right before it is loaded. This will create a hook that you can use with your latest changes without having to hard-code anything directly into the libraries, which would be lost upon upgrade.

In general however I suggest providing pull requests to a library if you think a feature that you are planning to implement could benefit other users as well :)

- Thomas

Enable H5P development mode. '(Always update uploaded H5P libraries regardless of patch version. Read library data from file (semantics.json).'

Here some Tags (tested in Drupal):
"tags": ["strong", "em", "del", "a", "ul", "ol","sub", "sup", "hr", "table"],
"font": {
"size": true,
"color": true,
"background": true
}

Usual warning applies here: any hacks that you make will be overwritten when you update the libraries. (Ta to papi Jo)

I tried copying text with subscript from the multiple choice content type into the accordian and it looked like it was going to work. However as soon as I hit the "update" button, my changes were eliminated.

tomaj's picture

It looks like this is by design. If we look at the semantics of Multiple Choice, it has support for the sup and sub elements. While Accordion doesn't.

- Tom