Skip to content
Snippets Groups Projects
Commit 90657497 authored by srosse's avatar srosse
Browse files

OO-4478: add link in the HTML editor's toolbar of video markers

parent 6e38d9e8
No related branches found
No related tags found
No related merge requests found
......@@ -854,14 +854,14 @@ public class FormUIFactory {
return rte;
}
public RichTextElement addRichTextElementForQTI21Match(String name, String i18nLabel, String initialHTMLValue, int rows,
int cols, VFSContainer baseContainer, FormItemContainer formLayout, UserSession usess, WindowControl wControl) {
public RichTextElement addRichTextElementVeryMinimalistic(String name, String i18nLabel, String initialHTMLValue, int rows,
int cols, boolean withLinks, VFSContainer baseContainer, FormItemContainer formLayout, UserSession usess, WindowControl wControl) {
// Create rich text element with bare bone configuration
RichTextElement rte = new RichTextElementImpl(name, initialHTMLValue, rows, cols, formLayout.getRootForm(), formLayout.getTranslator().getLocale());
setLabelIfNotNull(i18nLabel, rte);
// Now configure editor
Theme theme = wControl.getWindowBackOffice().getWindow().getGuiTheme();
rte.getEditorConfiguration().setConfigProfileFormVeryMinimalisticConfigEditor(usess, theme, baseContainer);
rte.getEditorConfiguration().setConfigProfileFormVeryMinimalisticConfigEditor(usess, theme, baseContainer, withLinks);
rte.getEditorConfiguration().setInvalidElements(RichTextConfiguration.INVALID_ELEMENTS_FORM_FULL_VALUE_UNSAVE_WITH_SCRIPT);
rte.getEditorConfiguration().setExtendedValidElements("script[src|type|defer]");
rte.getEditorConfiguration().disableTinyMedia();
......
......@@ -274,7 +274,7 @@ public class RichTextConfiguration implements Disposable {
* @param guiTheme
* @param baseContainer
*/
public void setConfigProfileFormVeryMinimalisticConfigEditor(UserSession usess, Theme guiTheme, VFSContainer baseContainer) {
public void setConfigProfileFormVeryMinimalisticConfigEditor(UserSession usess, Theme guiTheme, VFSContainer baseContainer, boolean withLinks) {
setConfigBasics(guiTheme);
// Add additional plugins
TinyMCECustomPluginFactory customPluginFactory = CoreSpringFactory.getImpl(TinyMCECustomPluginFactory.class);
......@@ -285,7 +285,11 @@ public class RichTextConfiguration implements Disposable {
// Don't allow javascript or iframes, if the file browser is there allow also media elements (the full values)
setQuotedConfigValue(INVALID_ELEMENTS, (baseContainer == null ? INVALID_ELEMENTS_FORM_SIMPLE_VALUE_UNSAVE : INVALID_ELEMENTS_FORM_FULL_VALUE_UNSAVE));
tinyConfig = TinyConfig.veryMinimalisticConfig;
if(withLinks) {
tinyConfig = TinyConfig.veryMinimalisticWithLinksConfig;
} else {
tinyConfig = TinyConfig.veryMinimalisticConfig;
}
setPathInStatusBar(false);
// Setup file and link browser
......
......@@ -32,6 +32,7 @@ public class TinyConfig {
protected static final TinyConfig editorCompactConfig;
protected static final TinyConfig fileEditorConfig;
protected static final TinyConfig minimalisticConfig;
protected static final TinyConfig veryMinimalisticWithLinksConfig;
protected static final TinyConfig veryMinimalisticConfig;
protected static final TinyConfig paragraphEditorConfig;
......@@ -72,6 +73,12 @@ public class TinyConfig {
String tools1 = "bold italic underline | image olatmatheditor";
veryMinimalisticConfig = new TinyConfig(plugins, null, tools1);
}
static {
String plugins = "contextmenu,colorpicker,textcolor,hr,charmap,image,insertdatetime,table,visualchars,visualblocks,noneditable,olatsmileys,paste,link,quotespliter,olatmatheditor,olatmovieviewer,tabfocus,visualchars,visualblocks,noneditable,media";
String tools1 = "bold italic underline | image olatmatheditor | link unlink";
veryMinimalisticWithLinksConfig = new TinyConfig(plugins, null, tools1);
}
//paragraph editor for content editor
static {
String plugins = "lists,contextmenu,textcolor,hr,noneditable,paste,link,olatmatheditor,tabfocus,noneditable";
......
......@@ -233,7 +233,7 @@ public class MatchEditorController extends FormBasicController {
List<FlowStatic> choiceFlow = choice.getFlowStatics();
String choiceContent = itemBuilder.getHtmlHelper().flowStaticString(choiceFlow);
String choiceId = "answer" + count++;
RichTextElement choiceEl = uifactory.addRichTextElementForQTI21Match(choiceId, "form.imd.answer", choiceContent, 4, -1, itemContainer,
RichTextElement choiceEl = uifactory.addRichTextElementVeryMinimalistic(choiceId, "form.imd.answer", choiceContent, 4, -1, false, itemContainer,
answersCont, ureq.getUserSession(), getWindowControl());
choiceEl.setUserObject(choice);
choiceEl.setEnabled(!readOnly);
......
......@@ -175,7 +175,7 @@ public class TrueFalseEditorController extends FormBasicController {
List<FlowStatic> choiceFlow = choice.getFlowStatics();
String choiceContent = itemBuilder.getHtmlHelper().flowStaticString(choiceFlow);
String choiceId = "answer" + count++;
RichTextElement choiceEl = uifactory.addRichTextElementForQTI21Match(choiceId, "form.imd.answer", choiceContent, 4, -1, itemContainer,
RichTextElement choiceEl = uifactory.addRichTextElementVeryMinimalistic(choiceId, "form.imd.answer", choiceContent, 4, -1, false, itemContainer,
answersCont, ureq.getUserSession(), getWindowControl());
choiceEl.setUserObject(choice);
choiceEl.setEnabled(!readOnly);
......
......@@ -118,7 +118,7 @@ public class MarkerEditController extends FormBasicController {
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
markerTextEl = uifactory.addRichTextElementForQTI21Match("text", "video.marker.text", "", 4, -1, null,
markerTextEl = uifactory.addRichTextElementVeryMinimalistic("text", "video.marker.text", "", 4, -1, true, null,
formLayout, ureq.getUserSession(), getWindowControl());
markerTextEl.getEditorConfiguration().disableImageAndMovie();
markerTextEl.getEditorConfiguration().setSimplestTextModeAllowed(TextMode.oneLine);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment