From a1a51480062a466dc4b57997128c23f94e659c50 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 | 88 +++++++++++++------ htdocs/package.json | 3 +- .../AchievementNotificationEditor.html.ep | 3 +- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/htdocs/package-lock.json b/htdocs/package-lock.json index b439141302..d3785bd72d 100644 --- a/htdocs/package-lock.json +++ b/htdocs/package-lock.json @@ -8,7 +8,8 @@ "license": "GPL-2.0+", "dependencies": { "@fortawesome/fontawesome-free": "^6.5.2", - "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.6", + "@openwebwork/codemirror-lang-pg": "^0.0.1-beta.11", + "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.15", "bootstrap": "~5.3.3", "flatpickr": "^4.6.13", "iframe-resizer": "^4.3.11", @@ -296,9 +297,9 @@ } }, "node_modules/@lezer/common": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.2.tgz", - "integrity": "sha512-Z+R3hN6kXbgBWAuejUNPihylAL1Z5CaFqnIe0nTX8Ej+XlIy3EGtXxn6WtLMO+os2hRkQvm2yvaGMYliUzlJaw==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", + "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==", "license": "MIT" }, "node_modules/@lezer/css": { @@ -364,9 +365,9 @@ } }, "node_modules/@openwebwork/codemirror-lang-pg": { - "version": "0.0.1-beta.5", - "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.1-beta.5.tgz", - "integrity": "sha512-7TAI1h/V9+2pwhM/AJtj5HZyDHDqN4ly1dEiW1klaXbv4AX0aYQr8aCU9PYrUOEUJnWH7JKWgh26ft/Ti+r71g==", + "version": "0.0.1-beta.11", + "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.1-beta.11.tgz", + "integrity": "sha512-c1iju7fHmvmSh+EyjIReYYjZZeU+k0JVAezQKyktr5TW3ChbS3AUfeTVsIeSXSzhSwRd1n517cdWIU4ooTsQhw==", "license": "MIT", "dependencies": { "@codemirror/language": "^6.10.2", @@ -375,15 +376,15 @@ } }, "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.15", + "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.15.tgz", + "integrity": "sha512-4pE6CbZ0zTT0rB5EuYT3z1DwWnokjheYyb7BquFib2XQzERy7SQbOhZOtIjgpldDIMO4OdbTA1Z4cZ2RBcP9nQ==", "license": "MIT", "dependencies": { "@codemirror/lang-html": "^6.4.9", "@codemirror/lang-xml": "^6.1.0", "@codemirror/theme-one-dark": "^6.1.2", - "@openwebwork/codemirror-lang-pg": "^0.0.1-beta.5", + "@openwebwork/codemirror-lang-pg": "^0.0.1-beta.9", "@replit/codemirror-emacs": "^6.1.0", "@replit/codemirror-vim": "^6.2.1", "cm6-theme-basic-dark": "^0.2.0", @@ -395,7 +396,8 @@ "cm6-theme-solarized-dark": "^0.2.0", "cm6-theme-solarized-light": "^0.2.0", "codemirror": "^6.0.1", - "codemirror-lang-perl": "^0.1.5-beta.1", + "codemirror-lang-mt": "^0.0.2-beta.1", + "codemirror-lang-perl": "^0.1.5-beta.2", "thememirror": "^2.0.1" } }, @@ -794,10 +796,24 @@ "@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", - "integrity": "sha512-iAp+G5UHpoQwrtCs1kD5yKuZ/tYYh812aI66FDoJYnOESysr/BlTaoTsgH9u3fskEcA6SRYmB3UqpkxiFH5fvw==", + "version": "0.1.5-beta.2", + "resolved": "https://registry.npmjs.org/codemirror-lang-perl/-/codemirror-lang-perl-0.1.5-beta.2.tgz", + "integrity": "sha512-dD+78Hb2nr9/HlYV0xYKX0CxomS8KlclCvddBFDmt0LQaFZ4+x/eMJ9UK+EmNFzFHJofZuf9rXj9S0ueCuInWA==", "license": "MIT", "dependencies": { "@codemirror/language": "^6.10.2", @@ -2351,9 +2367,9 @@ } }, "@lezer/common": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.2.tgz", - "integrity": "sha512-Z+R3hN6kXbgBWAuejUNPihylAL1Z5CaFqnIe0nTX8Ej+XlIy3EGtXxn6WtLMO+os2hRkQvm2yvaGMYliUzlJaw==" + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", + "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==" }, "@lezer/css": { "version": "1.1.9", @@ -2412,9 +2428,9 @@ } }, "@openwebwork/codemirror-lang-pg": { - "version": "0.0.1-beta.5", - "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.1-beta.5.tgz", - "integrity": "sha512-7TAI1h/V9+2pwhM/AJtj5HZyDHDqN4ly1dEiW1klaXbv4AX0aYQr8aCU9PYrUOEUJnWH7JKWgh26ft/Ti+r71g==", + "version": "0.0.1-beta.11", + "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.1-beta.11.tgz", + "integrity": "sha512-c1iju7fHmvmSh+EyjIReYYjZZeU+k0JVAezQKyktr5TW3ChbS3AUfeTVsIeSXSzhSwRd1n517cdWIU4ooTsQhw==", "requires": { "@codemirror/language": "^6.10.2", "@lezer/highlight": "^1.2.1", @@ -2422,14 +2438,14 @@ } }, "@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.15", + "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.15.tgz", + "integrity": "sha512-4pE6CbZ0zTT0rB5EuYT3z1DwWnokjheYyb7BquFib2XQzERy7SQbOhZOtIjgpldDIMO4OdbTA1Z4cZ2RBcP9nQ==", "requires": { "@codemirror/lang-html": "^6.4.9", "@codemirror/lang-xml": "^6.1.0", "@codemirror/theme-one-dark": "^6.1.2", - "@openwebwork/codemirror-lang-pg": "^0.0.1-beta.5", + "@openwebwork/codemirror-lang-pg": "^0.0.1-beta.9", "@replit/codemirror-emacs": "^6.1.0", "@replit/codemirror-vim": "^6.2.1", "cm6-theme-basic-dark": "^0.2.0", @@ -2441,7 +2457,8 @@ "cm6-theme-solarized-dark": "^0.2.0", "cm6-theme-solarized-light": "^0.2.0", "codemirror": "^6.0.1", - "codemirror-lang-perl": "^0.1.5-beta.1", + "codemirror-lang-mt": "^0.0.2-beta.1", + "codemirror-lang-perl": "^0.1.5-beta.2", "thememirror": "^2.0.1" } }, @@ -2666,10 +2683,23 @@ "@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", - "integrity": "sha512-iAp+G5UHpoQwrtCs1kD5yKuZ/tYYh812aI66FDoJYnOESysr/BlTaoTsgH9u3fskEcA6SRYmB3UqpkxiFH5fvw==", + "version": "0.1.5-beta.2", + "resolved": "https://registry.npmjs.org/codemirror-lang-perl/-/codemirror-lang-perl-0.1.5-beta.2.tgz", + "integrity": "sha512-dD+78Hb2nr9/HlYV0xYKX0CxomS8KlclCvddBFDmt0LQaFZ4+x/eMJ9UK+EmNFzFHJofZuf9rXj9S0ueCuInWA==", "requires": { "@codemirror/language": "^6.10.2", "@lezer/highlight": "^1.2.1", diff --git a/htdocs/package.json b/htdocs/package.json index bdbc7bfb86..13cc295c8a 100644 --- a/htdocs/package.json +++ b/htdocs/package.json @@ -14,7 +14,8 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^6.5.2", - "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.7", + "@openwebwork/codemirror-lang-pg": "^0.0.1-beta.11", + "@openwebwork/pg-codemirror-editor": "^0.0.1-beta.15", "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;