Cloze editor for TinyMCE

From MoodleDocs

An interface that integrates with Moodle's existing HTML editor (HTMLArea in 1.9 and TinyMCE in 2.x and 3.x) to support teachers in creating Cloze (Embedded answers) questions in the GIFT syntax.

Download


Overview

The integration (PHP/javascript) is essentially a new button in the HTML editor which brings up an interface that helps create CLOZE questions in the correct syntax. It will also read and edit existing CLOZE items (which you have selected with your cursor).

Here's a demonstrator (which can also be used to create your own CLOZE quizzes):

http://goo.gl/zxRQmN

Installation instructions

Installation for Moodle 1.9 version

  1. Unzip
  2. copy to your moodleroot directory, keeping the directory structure

The following files in your original Moodle installation will be overwritten with mod'd files (so make sure to BACK THEM UP before):

lib/weblib.php *
lib/editor/htmlarea/htmlarea.php
lib/editor/htmlarea/dialog.js
* Overwriting the weblib.php file is OPTIONAL:
  • If you choose to include this modified weblib.php file, the CLOZE-editor button will only show for teachers, and only in question-interfaces. In any other editor instances, and for students, it will be hidden. This is very convenient :)
  • If you refrain from overwriting the weblib.php file, the cloze editor plugin will still work, but the editor button will be visible in EVERY editor instance for teachers, but not for students. This might be disconcertirg for some teachers :(

Installation for Moodle 2.0, 2.1, 2.2 and 2.3

  1. Unzip.
  2. Copy the CONTENTS (excluding version.php!) of the directory clozeeditor to the directory lib/editor/tinymce on your Moodle installation, keeping the directory structure.

ATTENTION: DO NOT OVERWRITE lib/editor/tinymce/version.php as this would break TinyMCE; the version.php in the download package can be ignored/deleted.

The following file in your installation will be OVERWRITTEN with a mod'd file (so make sure to BACK IT UP):

lib/editor/tinymce/lib.php

Installation for Moodle 2.4 and higher versions

  1. Unzip
  2. Copy the contents of the directory to the directory lib/editor/tinymce/plugins on your Moodle installation, keeping the directory structure.
  3. Visit ' Administration > Site Administration > Notifications '
  4. Finish the installation process by clicking on the 'Upgrade Moodle database now' button.

Installation for Moodle 2.5 and higher versions

  1. Download the cloze editor ZIP-package from the Moodle plugins database
  2. In your Moodle "Site Administration" menu, go to "Plugins/Install add-ons"
  3. Look for the "Install add-on from ZIP file" section
  4. Select "TinyMCE HTML editor / tinymce (tinymce)" as "Plugin type"
  5. Drag and drop (or choose location and upload to server) the "clozeeditor.zip" file inside the ZIP package area

254 install from ZIP file.png

  1. Tick the acknowledgement statement check box
  2. At the add-on package validation, if everything is OK, click on the "Install add-on!" button
  3. If the screen goes blank and the installation pauses, hit the "Update screen" key (F5) as many times (about 5) as needed
  4. At the Plugins check window, click on the "Upgrade Moodle database now" button
  5. At the Final window showing Success, click on the "Continue" button

Installation for Moodle 2.7 and higher versions (Moodle 3.0, 3.1, 3.2 and 3.3 included)

  • As of April 2014, Moodle 2.7 and newer now includes two HTML text editors: the old TinyMCE and the Atto editor.
  • As long as the old TinyMCE editor is still included, you can still install the CLOZE editor add-on as described for Moodle 2.5 above
  • After successfully installing the add-on, you must go to ' Administration > Site administration > Plugins > Text editors > Manage editors '
  • You will see Moodle's available text editors:

27available editors default config.png

  • The Atto editor is now the default text editor for Moodle 2.7+. It is small, but has no CLOZE support:

27Atto editor.png

  • You must move up the TinyMCE editor:

27available editors default config click here.png

27available editors Moving Atto down makes TinyMCE top.png

  • And the CLOZE editor works beautifully in Moodle 2.7+ (including 3.0 and 3.1!):

27TinyMCE editor with CLOZE plugin working OK.png

Using the cloze editor

  • We will be asking the students to choose the correct word used in a poem by Emily Dickinson:
  • The cloze editor button is a small yellow question mark in the HTML editor.

Cloze editor symbol.png

  • Write a small text (e.g., the poem) in the HTML editor

to make a prairie 1.png

  • Select a word to be replaced by a CLOZE (in this case, bee)

to make a prairie 2.png

  • Click on the small yellow question mark Cloze editor symbol small.png
  • Choose the type of CLOZE sub-question format that you want (in this case, a drop-down menu in-line in the text)

to make a prairie 3.png

  • The correct answer has been placed automatically.
  • Check it and write some feedback if you want

to make a prairie 3.png

  • Fill in the wrong answers (if any)

to make a prairie 4.png

  • Click on the 'Insert' button to process

to make a prairie 5.png

  • The correct CLOZE syntax will be shown within the editor window

to make a prairie 6.png

  • Save the question
  • Check that the question works as intended

to make a prairie 7.png

Editing existing CLOZE items

  • Select an existing CLOZE item with your cursor (including the curly outer brackets). Then click on the small yellow question mark. The editor will come up, with the fields correctly populated for this item.

The cloze editor button and Moodle roles

  • The CLOZE-editor button in Moodle 2.x will show for teachers and students alike, every time they use the HTML editor, even when they are writing something else not related to a cloze question (e.g.: a forum post).

Other languages

  • All the English language strings of the cloze editor are available for translation at AMOS
  • If your Language pack does not have the English language strings translated, you can make a Language customization, so that you you can have the cloze editor in your preferred language.
  • The following image shows a Mexican Spanish translation of the English language strings of this add-on.

cloze editor language customization.png

  • And here are the translated strings being used inside the plugin:

Cloze editor in spanish.png

  • The following image shows a French translation of this add-on:

CLOZE editor fr language.png

Fixing 'the screen is not wide enough' problem

With some browsers the screen is not wide enough. CLOZE editor issue screen not wide enough.png

  • In order to fix this, you will need to edit the file at lib/editor/tinymce/plugins/clozeeditor/tinymce/editorplugin.js
  • There, change width (originally 490) to 620.

CLOZE editor editing editor plugin js.png

  • You can use an editor such as Notepad ++. Do not use Word for Windows.
  • Don't forget to clear all caches: both browser AND Moodle caches

Cloze editor for Atto

In 2016, an additional plugin, the Cloze editor for Atto was created by Daniel Thies.

Cloze editor for TinyMCE 6 (standard editor since Moodle 4.2)

At Moodle mootDACH in Zürich in June 2023 work on a version for the new TinyMCE (TinyMCE 6 standard editor since Moodle 4.2) startet. The current state can be found at https://github.com/srobotta/moodle-tiny_cloze

See also