Skip to content

Commit

Permalink
Merge pull request openwebwork#2639 from drgrice1/pg-codemirror-static
Browse files Browse the repository at this point in the history
Recover syntax highlighting for sample problems.
  • Loading branch information
Alex-Jordan authored Dec 17, 2024
2 parents af70879 + 3c73acc commit 7e386f9
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 79 deletions.
4 changes: 2 additions & 2 deletions htdocs/js/SampleProblemViewer/sample-problem.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
for (const pre of document.body.querySelectorAll('pre.CodeMirror')) {
CodeMirror.runMode(pre.textContent, 'PG', pre);
for (const pre of document.body.querySelectorAll('pre.PGCodeMirror')) {
PGCodeMirrorEditor.runMode(pre.textContent, pre);
}

for (const btn of document.querySelectorAll('.clipboard-btn')) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/js/SampleProblemViewer/sample-problem.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pre.CodeMirror {
pre.PGCodeMirror {
background-color: #fcfaf1;
}

Expand Down
159 changes: 89 additions & 70 deletions htdocs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion htdocs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.5.2",
"@openwebwork/pg-codemirror-editor": "^0.0.1-beta.25",
"@openwebwork/pg-codemirror-editor": "^0.0.1-beta.28",
"bootstrap": "~5.3.3",
"flatpickr": "^4.6.13",
"iframe-resizer": "^4.3.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
type => 'webwork', name => 'htdocs',
file => 'node_modules/@fortawesome/fontawesome-free/css/all.min.css'
}) =%>
<%= stylesheet $c->url({ type => 'webwork', name => 'htdocs',
file => 'node_modules/codemirror/lib/codemirror.css' }) =%>
<%= stylesheet $c->url({ type => 'webwork', name => 'htdocs',
file => 'js/SampleProblemViewer/sample-problem.css' }) =%>
<%= javascript $c->url({ type => 'webwork', name => 'htdocs',
file => 'node_modules/codemirror/addon/runmode/runmode-standalone.js' }), defer => undef =%>
<%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/PGCodeMirror/PG.js' }), defer => undef =%>
file => 'node_modules/@openwebwork/pg-codemirror-editor/dist/pg-codemirror-editor.js' }), defer => undef =%>
<%= javascript $c->url({ type => 'webwork', name => 'htdocs',
file => 'js/SampleProblemViewer/sample-problem.js' }), defer => undef =%>
</head>
Expand Down Expand Up @@ -94,7 +91,7 @@
type="button" data-code="<%= $_->{code} %>" aria-label="<%= maketext('copy to clipboard') %>">
<i class="fa-regular fa-clipboard fa-xl"></i>
</button>
<pre class="CodeMirror cm-s-default m-0 h-100 p-3 border border-secondary overflow-scroll"><% =%>\
<pre class="PGCodeMirror m-0 h-100 p-3 border border-secondary overflow-scroll"><% =%>\
<%= $_->{code} =%>\
</pre><% =%>\
</div>
Expand Down

0 comments on commit 7e386f9

Please sign in to comment.