摩纳哥编辑器未捕获的语法错误:无效的正则表达式:/^*-+:*$/: 没有可重复的内容
我在我的应用程序中使用摩纳哥编辑器。我在 Firefox 和某些版本的 Chrome 上遇到此错误,但不知怎的,它在 Chrome
控制台显示的版本 96 上运行良好:
无效的正则表达式:/^*-+:*$/: Nothing to Repeat
这是代码:
$(function () {
require.config({ paths: { vs: '/static/node_modules/monaco-editor/min/vs' } });
let editor;
require(['vs/editor/editor.main'], () => {
editor = monaco.editor.create(document.getElementById("content"), {
theme: 'vs-dark',
language: "yaml",
model: monaco.editor.createModel(`{{content | safe }}`),
wordWrap: 'on',
automaticLayout: true,
minimap: {
enabled: false
},
scrollbar: {
useShadows: false,
verticalHasArrows: true,
horizontalHasArrows: true,
vertical: 'auto',
horizontal: 'auto',
verticalScrollbarSize: 17,
horizontalScrollbarSize: 17,
arrowSize: 30
}
});
});
I'm using Monaco editor in my app. I get this error on Firefox and some versions of Chrome and somehow it works fine with version 96 of Chrome
Console displays:
Invalid regular expression: /^*-+:*$/: Nothing to repeat
This is the code:
$(function () {
require.config({ paths: { vs: '/static/node_modules/monaco-editor/min/vs' } });
let editor;
require(['vs/editor/editor.main'], () => {
editor = monaco.editor.create(document.getElementById("content"), {
theme: 'vs-dark',
language: "yaml",
model: monaco.editor.createModel(`{{content | safe }}`),
wordWrap: 'on',
automaticLayout: true,
minimap: {
enabled: false
},
scrollbar: {
useShadows: false,
verticalHasArrows: true,
horizontalHasArrows: true,
vertical: 'auto',
horizontal: 'auto',
verticalScrollbarSize: 17,
horizontalScrollbarSize: 17,
arrowSize: 30
}
});
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要转义第一个
*
或起始^
。您不能重复起始^
。选择使用一种文字或另一种。因此“零个或多个^
”或以*
开头。或者
You need to escape the first
*
or the starting^
. You cannot repeat the starting^
. Choose to use one literal or the other. So 'zero or more^
' or starting with*
.or