From 20b242d3f7c2b3346d6715da35b6dc6612d539b5 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 11 Oct 2024 10:01:38 -0500 Subject: [PATCH] Use the Mojolicious template language for CodeMirror when editing achievement notifications. The new codemirror-lang-mt package is used for this, and support for that language has been added to the pg-codemirror-editor. --- htdocs/package-lock.json | 43 ++++++++++++++++--- htdocs/package.json | 2 +- .../AchievementNotificationEditor.html.ep | 3 +- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/htdocs/package-lock.json b/htdocs/package-lock.json index b439141302..4f1e049a2b 100644 --- a/htdocs/package-lock.json +++ b/htdocs/package-lock.json @@ -8,7 +8,7 @@ "license": "GPL-2.0+", "dependencies": { "@fortawesome/fontawesome-free": "^6.5.2", - "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.6", + "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.10", "bootstrap": "~5.3.3", "flatpickr": "^4.6.13", "iframe-resizer": "^4.3.11", @@ -375,9 +375,9 @@ } }, "node_modules/@openwebwork/pg-codemirror-editor": { - "version": "0.0.1-beta.7", - "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.7.tgz", - "integrity": "sha512-ILrr+/8hX0HYLvfg6LD1sOJt44073Wofus187K39p6RWBArXGvZ2GQvHCwReVxj+z0CzHnbJ4lKFyVF+UEY+SA==", + "version": "0.0.1-beta.10", + "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.10.tgz", + "integrity": "sha512-/MghEiwWdgV9B/gDj0gu6ZCdw2vC7TjW0PjD3w8uWbcGb21yLN4dy1+JNzb7N6XxmUq9fYJm3LEsso7gXw8EOw==", "license": "MIT", "dependencies": { "@codemirror/lang-html": "^6.4.9", @@ -395,6 +395,7 @@ "cm6-theme-solarized-dark": "^0.2.0", "cm6-theme-solarized-light": "^0.2.0", "codemirror": "^6.0.1", + "codemirror-lang-mt": "^0.0.2-beta.1", "codemirror-lang-perl": "^0.1.5-beta.1", "thememirror": "^2.0.1" } @@ -794,6 +795,20 @@ "@codemirror/view": "^6.0.0" } }, + "node_modules/codemirror-lang-mt": { + "version": "0.0.2-beta.1", + "resolved": "https://registry.npmjs.org/codemirror-lang-mt/-/codemirror-lang-mt-0.0.2-beta.1.tgz", + "integrity": "sha512-KfWdRQJmeeAiXrU72JHDwwFkZkWaO0yHmhXurdJhVYrRNc/TAOlDHOulA9lQBkritcoFoo2UyyybuoE2FWHtFw==", + "license": "MIT", + "dependencies": { + "@codemirror/lang-css": "^6.3.0", + "@codemirror/lang-html": "^6.4.9", + "@codemirror/lang-javascript": "^6.2.2", + "@codemirror/language": "^6.10.2", + "@lezer/highlight": "^1.2.1", + "@lezer/lr": "^1.4.2" + } + }, "node_modules/codemirror-lang-perl": { "version": "0.1.5-beta.1", "resolved": "https://registry.npmjs.org/codemirror-lang-perl/-/codemirror-lang-perl-0.1.5-beta.1.tgz", @@ -2422,9 +2437,9 @@ } }, "@openwebwork/pg-codemirror-editor": { - "version": "0.0.1-beta.7", - "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.7.tgz", - "integrity": "sha512-ILrr+/8hX0HYLvfg6LD1sOJt44073Wofus187K39p6RWBArXGvZ2GQvHCwReVxj+z0CzHnbJ4lKFyVF+UEY+SA==", + "version": "0.0.1-beta.10", + "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.10.tgz", + "integrity": "sha512-/MghEiwWdgV9B/gDj0gu6ZCdw2vC7TjW0PjD3w8uWbcGb21yLN4dy1+JNzb7N6XxmUq9fYJm3LEsso7gXw8EOw==", "requires": { "@codemirror/lang-html": "^6.4.9", "@codemirror/lang-xml": "^6.1.0", @@ -2441,6 +2456,7 @@ "cm6-theme-solarized-dark": "^0.2.0", "cm6-theme-solarized-light": "^0.2.0", "codemirror": "^6.0.1", + "codemirror-lang-mt": "^0.0.2-beta.1", "codemirror-lang-perl": "^0.1.5-beta.1", "thememirror": "^2.0.1" } @@ -2666,6 +2682,19 @@ "@codemirror/view": "^6.0.0" } }, + "codemirror-lang-mt": { + "version": "0.0.2-beta.1", + "resolved": "https://registry.npmjs.org/codemirror-lang-mt/-/codemirror-lang-mt-0.0.2-beta.1.tgz", + "integrity": "sha512-KfWdRQJmeeAiXrU72JHDwwFkZkWaO0yHmhXurdJhVYrRNc/TAOlDHOulA9lQBkritcoFoo2UyyybuoE2FWHtFw==", + "requires": { + "@codemirror/lang-css": "^6.3.0", + "@codemirror/lang-html": "^6.4.9", + "@codemirror/lang-javascript": "^6.2.2", + "@codemirror/language": "^6.10.2", + "@lezer/highlight": "^1.2.1", + "@lezer/lr": "^1.4.2" + } + }, "codemirror-lang-perl": { "version": "0.1.5-beta.1", "resolved": "https://registry.npmjs.org/codemirror-lang-perl/-/codemirror-lang-perl-0.1.5-beta.1.tgz", diff --git a/htdocs/package.json b/htdocs/package.json index bdbc7bfb86..a137d0abf8 100644 --- a/htdocs/package.json +++ b/htdocs/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^6.5.2", - "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.7", + "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.10", "bootstrap": "~5.3.3", "flatpickr": "^4.6.13", "iframe-resizer": "^4.3.11", diff --git a/templates/ContentGenerator/Instructor/AchievementNotificationEditor.html.ep b/templates/ContentGenerator/Instructor/AchievementNotificationEditor.html.ep index 4a26f76c8f..e759725636 100644 --- a/templates/ContentGenerator/Instructor/AchievementNotificationEditor.html.ep +++ b/templates/ContentGenerator/Instructor/AchievementNotificationEditor.html.ep @@ -23,8 +23,7 @@ % } %
- % # FIXME: This should not be using perl. Mojolicious templates have embedded perl, but are not perl. - <%= generate_codemirror_html($c, 'achievementNotification', $achievementNotification, 'perl') =%>
+ <%= generate_codemirror_html($c, 'achievementNotification', $achievementNotification, 'mt-text') =%> % % # Output action forms % my $default_choice;