[#12] Fix undefined return of .modules if no monaco plugin is installed.#13
[#12] Fix undefined return of .modules if no monaco plugin is installed.#13Gk0Wk wants to merge 2 commits intoSmilyOrg:mainfrom
Conversation
SmilyOrg
left a comment
There was a problem hiding this comment.
Thanks for looking into this! Left a comment :)
| $tw.modules.forEachModuleOfType('monaco', function (title, exportModules) { | ||
| // Actually, no need to call require(title) | ||
| }); |
There was a problem hiding this comment.
Looks like you're right. In that case this whole block can be deleted, right?
I copied this from CodeMirror's engine.js assuming it was needed, so I wonder why it was added there? 🤔
There was a problem hiding this comment.
$tw.modules.forEachModuleOfType = function(moduleType,callback) {
var modules = $tw.modules.types[moduleType];
$tw.utils.each(modules,function(element,title) {
callback(title,$tw.modules.execute(title));
});
};this method has already executed each code of module tiddlers.
Only why CodeMirror adds these codes, I think maybe there is no auto-loading mechanism at the beginning btw, or maybe the codes themselves are unnecessary. The reason why the CodeMirror plugin does not have errors is that the CodeMirror plugin must contain at least one plugin.
I think we should do the same - using the tw-monaco plugin must be used to write tw in the first place, right?
There was a problem hiding this comment.
Sorry for the late response!
I initially tried to model it closer to CodeMirror with features being separate plugins, but then I realized it might just make it harder to install. So I ended up with the main monaco plugin and a monaco-wikitext plugin that adds wikitext-specific functionality.
We can go a little further and just merge all the monaco-wikitext functionality into the main monaco plugin as I'm not sure there is any need for it to be separate anyway. If people only want some parts of it that could be done via plugin configuration.
What do you think?
No description provided.