Skip to content

URLForMode callback along with modeURL #6294

@tolmasky

Description

@tolmasky

I have my modes compiled with shasums attached that way I can serve them as immutbale resources (so for example /javascript/javascript-sha256-23958394893040blahblah). This makes the current replacement-based modeURL system difficult to use for dynamically loading modes. I actually currently get away with passing in a fake string object that has a replace method:

CodeMirror.modeURL = { replace: (_, mode) => lookupComplexURLForMode(mode) };

While this works today, it is certainly not ideal as I have to rely on knowledge that replace() gets called. Having modeURL accept a function, or a separate URLForMode option for a callback that returns the URL given a mode would make my code more future-proof.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions