Use Monaco Editor and save code in submitpage.php when edit the content

Merged
DE
5mo ago
+748-57

What does this PR aim to accomplish?:

Use Monaco Editor and save code in submitpage.php when edit the content.

How does this PR accomplish the above?:

Editor -> Monaco

Save code in localStorage.


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributor's guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented on my proposed changes within the code.
  3. I have tested my changes.
  4. I am willing to help maintain this change if there are issues with it later.
  5. It is compatible with the GNU General Public License v3.0
  6. I have squashed any insignificant commits. (git rebase)
  7. I have checked that another pull request for this purpose does not exist.
  8. I have considered and confirmed that this submission will be valuable to others.
  9. I accept that this submission may not be used, and the pull request can be closed at the will of the maintainer.
  10. I give this submission freely and claim no ownership to its content.
  11. I have verified that my changes work correctly in both the new UI and the old/classic UI.

  • I have read the above and my PR is ready for review. Check this box to confirm

Summary by Sourcery

Replace the legacy CodeMirror integration with a Monaco-based editor abstraction and apply it to the submission page, including autosave and graceful fallbacks.

New Features:

  • Integrate Monaco editor loading and initialization utilities with a CodeMirror-compatible shim API.
  • Use Monaco as the primary code editor on the submission page, including keyboard shortcuts and local code persistence per problem or contest.
  • Show a small read-only Monaco code snippet (or text fallback) for generated freopen helper code in the error message area.

Bug Fixes:

  • Harden editor sizing by providing a fixed minimum height fallback when automatic Monaco layout calculation fails.

Enhancements:

  • Refine the submission page header structure for clearer dynamic rendering of problem or contest identifiers.

Build:

  • Bump script and package version numbers to 3.5.2.

Summary by Sourcery

Replace the legacy CodeMirror integration with a Monaco-based editor abstraction and apply it to the submission page, including autosave and safer error/standard-solution displays.

New Features:

  • Introduce a Monaco editor loader and CodeMirror-compatible shim used throughout the script.
  • Use a Monaco-based editor on the submission page with per-problem local storage and keyboard shortcuts, falling back to a textarea if Monaco fails to load.
  • Render a small read-only Monaco (or text) snippet for generated freopen helper code inside the error area.

Bug Fixes:

  • Prevent CE info and standard-solution pages from breaking when the underlying page shows access-denied or missing-problem messages, and clean up any transient error snippet editors between submissions.

Enhancements:

  • Refine the submission page header layout for clearer problem and contest identification and make editor sizing more robust, including viewport-fitting behavior.
  • Align dark-mode themes across Monaco- and CodeMirror-based views by using the Monaco dark theme name where applicable.

Build:

  • Bump userscript and package versions to 3.5.2 and update metadata for the new editor support.