From 44480347e8acd17ef7ceb4c18b468c0f42706328 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 | 135 +++++++++++------- htdocs/package.json | 2 +- .../AchievementNotificationEditor.html.ep | 3 +- 3 files changed, 84 insertions(+), 56 deletions(-) diff --git a/htdocs/package-lock.json b/htdocs/package-lock.json index b439141302..a472a5e704 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.20", "bootstrap": "~5.3.3", "flatpickr": "^4.6.13", "iframe-resizer": "^4.3.11", @@ -75,9 +75,9 @@ } }, "node_modules/@codemirror/autocomplete": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.1.tgz", - "integrity": "sha512-iWHdj/B1ethnHRTwZj+C1obmmuCzquH29EbcKr0qIjA9NfDeBDJ7vs+WOHsFeLeflE4o+dHfYndJloMKHUkWUA==", + "version": "6.18.3", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.3.tgz", + "integrity": "sha512-1dNIOmiM0z4BIBwxmxEfA1yoxh1MF/6KPBbh20a5vphGV0ictKlgQsbJs6D6SkR6iJpGbpwRsa6PFMNlg9T9pQ==", "license": "MIT", "dependencies": { "@codemirror/language": "^6.0.0", @@ -93,9 +93,9 @@ } }, "node_modules/@codemirror/commands": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.7.0.tgz", - "integrity": "sha512-+cduIZ2KbesDhbykV02K25A5xIVrquSPz4UxxYBemRlAT2aW8dhwUgLDwej7q/RJUHKk4nALYcR1puecDvbdqw==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.7.1.tgz", + "integrity": "sha512-llTrboQYw5H4THfhN4U3qCnSZ1SOJ60ohhz+SzU0ADGtwlc533DtklQP0vSFaQuCPDn3BPpOd1GbbnUtwNjsrw==", "license": "MIT", "dependencies": { "@codemirror/language": "^6.0.0", @@ -189,9 +189,9 @@ } }, "node_modules/@codemirror/search": { - "version": "6.5.6", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.6.tgz", - "integrity": "sha512-rpMgcsh7o0GuCDUXKPvww+muLA1pDJaFrpq/CCHtpQJYz8xopu4D1hPcKRoDD0YlF8gZaqTNIRa4VRBWyhyy7Q==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.7.tgz", + "integrity": "sha512-6+iLsXvITWKHYlkgHPCs/qiX4dNzn8N78YfhOFvPtPYCkuXqZq10rAfsUMhOq7O/1VjJqdXRflyExlfVcu/9VQ==", "license": "MIT", "dependencies": { "@codemirror/state": "^6.0.0", @@ -218,9 +218,9 @@ } }, "node_modules/@codemirror/view": { - "version": "6.34.1", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.34.1.tgz", - "integrity": "sha512-t1zK/l9UiRqwUNPm+pdIT0qzJlzuVckbTEMVNFhfWkGiBQClstzg+78vedCvLSX0xJEZ6lwZbPpnljL7L6iwMQ==", + "version": "6.34.3", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.34.3.tgz", + "integrity": "sha512-Ph5d+u8DxIeSgssXEakaakImkzBV4+slwIbcxl9oc9evexJhImeu/G8TK7+zp+IFK9KuJ0BdSn6kTBJeH2CHvA==", "license": "MIT", "dependencies": { "@codemirror/state": "^6.4.0", @@ -296,9 +296,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 +364,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.14", + "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.1-beta.14.tgz", + "integrity": "sha512-OGFBmoZlH+IbjnEF0b7K9QVXW1MdSYWDV8DpFYK5X5fSF0W+d8xkO3f7IdhkZ3RWrchdUecXNw2wDhgBien5jQ==", "license": "MIT", "dependencies": { "@codemirror/language": "^6.10.2", @@ -375,15 +375,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.20", + "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.20.tgz", + "integrity": "sha512-l3/R7F3haQR6V9WgeMKNfbnTM7tD38H/8u6fFYgBa3FX16J/Um4X25Y3Ld4YS/zFNFjgV54dmksGBRXuPD8Nsg==", "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.14", "@replit/codemirror-emacs": "^6.1.0", "@replit/codemirror-vim": "^6.2.1", "cm6-theme-basic-dark": "^0.2.0", @@ -395,7 +395,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.3", + "codemirror-lang-perl": "^0.1.5-beta.4", "thememirror": "^2.0.1" } }, @@ -794,10 +795,24 @@ "@codemirror/view": "^6.0.0" } }, + "node_modules/codemirror-lang-mt": { + "version": "0.0.2-beta.3", + "resolved": "https://registry.npmjs.org/codemirror-lang-mt/-/codemirror-lang-mt-0.0.2-beta.3.tgz", + "integrity": "sha512-95e1QMKCFqasvHMCEekVpA59SQzfsgqJERsHee0j6RyYJ2JoKFcZmrfZdKbZMNRCxtlHHPsnI1NqTSQcJNpQbQ==", + "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.4", + "resolved": "https://registry.npmjs.org/codemirror-lang-perl/-/codemirror-lang-perl-0.1.5-beta.4.tgz", + "integrity": "sha512-qVbbloMHHZwh5/TCxnrDMCdLz1kO3PgU8zmikTsb0A31N36nx28QS4q8CYQO5oHkJdnip/nnW0FjUbdmMC+eyQ==", "license": "MIT", "dependencies": { "@codemirror/language": "^6.10.2", @@ -2161,9 +2176,9 @@ }, "dependencies": { "@codemirror/autocomplete": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.1.tgz", - "integrity": "sha512-iWHdj/B1ethnHRTwZj+C1obmmuCzquH29EbcKr0qIjA9NfDeBDJ7vs+WOHsFeLeflE4o+dHfYndJloMKHUkWUA==", + "version": "6.18.3", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.3.tgz", + "integrity": "sha512-1dNIOmiM0z4BIBwxmxEfA1yoxh1MF/6KPBbh20a5vphGV0ictKlgQsbJs6D6SkR6iJpGbpwRsa6PFMNlg9T9pQ==", "requires": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", @@ -2172,9 +2187,9 @@ } }, "@codemirror/commands": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.7.0.tgz", - "integrity": "sha512-+cduIZ2KbesDhbykV02K25A5xIVrquSPz4UxxYBemRlAT2aW8dhwUgLDwej7q/RJUHKk4nALYcR1puecDvbdqw==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.7.1.tgz", + "integrity": "sha512-llTrboQYw5H4THfhN4U3qCnSZ1SOJ60ohhz+SzU0ADGtwlc533DtklQP0vSFaQuCPDn3BPpOd1GbbnUtwNjsrw==", "requires": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", @@ -2261,9 +2276,9 @@ } }, "@codemirror/search": { - "version": "6.5.6", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.6.tgz", - "integrity": "sha512-rpMgcsh7o0GuCDUXKPvww+muLA1pDJaFrpq/CCHtpQJYz8xopu4D1hPcKRoDD0YlF8gZaqTNIRa4VRBWyhyy7Q==", + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.7.tgz", + "integrity": "sha512-6+iLsXvITWKHYlkgHPCs/qiX4dNzn8N78YfhOFvPtPYCkuXqZq10rAfsUMhOq7O/1VjJqdXRflyExlfVcu/9VQ==", "requires": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", @@ -2287,9 +2302,9 @@ } }, "@codemirror/view": { - "version": "6.34.1", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.34.1.tgz", - "integrity": "sha512-t1zK/l9UiRqwUNPm+pdIT0qzJlzuVckbTEMVNFhfWkGiBQClstzg+78vedCvLSX0xJEZ6lwZbPpnljL7L6iwMQ==", + "version": "6.34.3", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.34.3.tgz", + "integrity": "sha512-Ph5d+u8DxIeSgssXEakaakImkzBV4+slwIbcxl9oc9evexJhImeu/G8TK7+zp+IFK9KuJ0BdSn6kTBJeH2CHvA==", "requires": { "@codemirror/state": "^6.4.0", "style-mod": "^4.1.0", @@ -2351,9 +2366,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 +2427,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.14", + "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.1-beta.14.tgz", + "integrity": "sha512-OGFBmoZlH+IbjnEF0b7K9QVXW1MdSYWDV8DpFYK5X5fSF0W+d8xkO3f7IdhkZ3RWrchdUecXNw2wDhgBien5jQ==", "requires": { "@codemirror/language": "^6.10.2", "@lezer/highlight": "^1.2.1", @@ -2422,14 +2437,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.20", + "resolved": "https://registry.npmjs.org/@openwebwork/pg-codemirror-editor/-/pg-codemirror-editor-0.0.1-beta.20.tgz", + "integrity": "sha512-l3/R7F3haQR6V9WgeMKNfbnTM7tD38H/8u6fFYgBa3FX16J/Um4X25Y3Ld4YS/zFNFjgV54dmksGBRXuPD8Nsg==", "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.14", "@replit/codemirror-emacs": "^6.1.0", "@replit/codemirror-vim": "^6.2.1", "cm6-theme-basic-dark": "^0.2.0", @@ -2441,7 +2456,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.3", + "codemirror-lang-perl": "^0.1.5-beta.4", "thememirror": "^2.0.1" } }, @@ -2666,10 +2682,23 @@ "@codemirror/view": "^6.0.0" } }, + "codemirror-lang-mt": { + "version": "0.0.2-beta.3", + "resolved": "https://registry.npmjs.org/codemirror-lang-mt/-/codemirror-lang-mt-0.0.2-beta.3.tgz", + "integrity": "sha512-95e1QMKCFqasvHMCEekVpA59SQzfsgqJERsHee0j6RyYJ2JoKFcZmrfZdKbZMNRCxtlHHPsnI1NqTSQcJNpQbQ==", + "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.4", + "resolved": "https://registry.npmjs.org/codemirror-lang-perl/-/codemirror-lang-perl-0.1.5-beta.4.tgz", + "integrity": "sha512-qVbbloMHHZwh5/TCxnrDMCdLz1kO3PgU8zmikTsb0A31N36nx28QS4q8CYQO5oHkJdnip/nnW0FjUbdmMC+eyQ==", "requires": { "@codemirror/language": "^6.10.2", "@lezer/highlight": "^1.2.1", diff --git a/htdocs/package.json b/htdocs/package.json index bdbc7bfb86..915b6be7dd 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.20", "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;