public/lib/editor/tiny/readme_moodle.md
Please note that we have a clone of the official TinyMCE repository which contains the working build and branch for each release. This ensures build repeatability and gives us the ability to patch stable versions of Moodle for security fixes where relevant.
Each Moodle branch has a similar branch in the https://github.com/moodlehq/tinymce.
The Moodle main branch is named as the upcoming STABLE branch name, for example during the development of Moodle 4.5.0, the upcoming STABLE branch name will be MOODLE_405_STABLE.
N/A
MOODLEDIR=/your_moodle_dir/lib/editor/tiny
tinymce=`mktemp -d`
cd "${tinymce}"
git clone https://github.com/tinymce/tinymce.git
cd tinymce
git checkout -b MOODLE_405_STABLE
git reset --hard [desired version]
yarn
git commit -m 'MDL: Add build configuration'
yarn
yarn build
Note: If you encounter a problem during the build, please check your node version. The latest node version that worked for this build was v21.
rm -rf "${MOODLEDIR}/js"
cp -r modules/tinymce/js "${MOODLEDIR}/js"
# Tag the next Moodle version.
git tag v4.5.0
git remote add moodlehq --tags
git push moodlehq MOODLE_405_STABLE
langdir=`mktemp -d`
cd "${langdir}"
unzip path/to/langs.zip
node "${MOODLEDIR}/tools/createLangStrings.mjs"
This will generate a language file for each available Language, as well as a tinystrings.json, and a strings.php which will be used in the subsequent steps.
tinystrings.json file into the Moodle directorycp tinystrings.json "${MOODLEDIR}/tinystrings.json"
strings.php file over the existing tiny strings:sed -i "/string\['tiny:/d" "${MOODLEDIR}/lang/en/editor_tiny.php"
cat strings.php >> "${MOODLEDIR}/lang/en/editor_tiny.php"
Review the changes to the language strings file carefully. You may need to:
en_fix issues. Review the git history of the language strings file to verify.Commit the changes.
If required, the remaining language strings can be fed into AMOS.
Note: A set of language files are also generated for all supported translations and may be submitted to AMOS if desired.
MOODLEDIR=/your_moodle_dir/lib/editor/tiny
tinymce=`mktemp -d`
cd "${tinymce}"
git clone https://github.com/tinymce/tinymce.git
cd tinymce
git remote add moodlehq https://github.com/moodlehq/tinymce
git fetch moodlehq
git checkout -b MOODLE_405_STABLE moodlehq/MOODLE_405_STABLE
yarn
yarn build
Note: If you encounter a problem during the build, please check your node version. The latest node version that worked for this build was v21.
rm -rf "${MOODLEDIR}/js"
cp -r modules/tinymce/js "${MOODLEDIR}/js"
Note: You may need to remove some parts of some patches, such as tests, changelog entries, etc. to get the patch to apply.
Note: The generated code may be significantly larger than the source patch