Closed arguiot closed 5 years ago
Which version of the code are you running? And how are you building the library? The for (var state of ...)
in your debugger looks a little strange—why is the let
compiled to var
but the of
-loop still in there?
I’m using the latest version (master), and here is my rollup config:
export default {
input: "./lib.js",
output: {
format: "umd",
file: "../StudIO/Editor/CodeMirror/EditorView/libCM.js",
sourcemap: false,
name: "StudIO"
},
plugins: [
resolve(),
commonjs()
]
}
After that, I also replace as you saw all let
with var
because I wanted to make the code run on older browser... Not sure this part is useful now, so I might remove that.
Actually, you were right, thanks, it resolves this issue (so I'll mark it as closed), but I'm now getting another error when I'm creating the EditorView
Error: Non-view extensions found in view
Error: Non-view extensions found in view
I guess this means that either you are passing a state extension when creating an EditorView
, or you somehow have multiple instances of the view package loaded, and an extension that targets one of them is loaded in another.
Apparently, the issue is with legacyMode
, as I pass the mode to EditorState
as an extension.
I create the mode using:
let mode = legacyMode({
mode: m
})
where m
is the export of a legacy mode
No legacyMode
function exists in the current codebase, though.
I think that the legacyMode function that I’m importing is from an old commit, but the js file was kept because it wasn’t part of the repository... anyway.
Is there a similar function I can use for importing all modes to CM6?
Is there a similar function I can use for importing all modes to CM6?
As things stand, modes have to be at least superficially ported to work with the stream-syntax package. You can find some examples in the legacy-modes
directory.
I want to create an
EditorState
, using this code:But, for some reasons, I'm getting this error:
I strongly think it's related to what
state.behavior
is outputting: on the following image, you can see that I get the Booleantrue
when I runstate.behavior(stateField)
, while it should be an iterable object (like an array or a JSON object)Here is where the debugger is stopping:
https://github.com/codemirror/codemirror.next/blob/7cbbe0105c044aea586252f94afb106ca5022b46/state/src/state.ts#L133