jquery.min.js:2未捕获类型错误:无法读取属性';更换';未定义类型(javascript)(laravel)
我正在尝试导入拖放编辑器 但我有这些错误jquery.min.js:2未捕获类型错误:无法读取属性';更换';未定义类型(javascript)(laravel),javascript,jquery,laravel,laravel-blade,jquery-keditor,Javascript,Jquery,Laravel,Laravel Blade,Jquery Keditor,我正在尝试导入拖放编辑器 但我有这些错误 jquery.min.js:2 Uncaught TypeError: Cannot read property 'replace' of undefined at initModalSource (examples.js:96) at HTMLDocument.<anonymous> (examples.js:3) at e (jquery.min.js:2) at t (jquery.min.js:
jquery.min.js:2 Uncaught TypeError: Cannot read property 'replace' of undefined
at initModalSource (examples.js:96)
at HTMLDocument.<anonymous> (examples.js:3)
at e (jquery.min.js:2)
at t (jquery.min.js:2)
initModalSource @ examples.js:96
(anonymous) @ examples.js:3
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout (async)
S.readyException @ jquery.min.js:2
(anonymous) @ jquery.min.js:2
e @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout (async)
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
t @ jquery.min.js:2
setTimeout (async)
(anonymous) @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
fire @ jquery.min.js:2
c @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
B @ jquery.min.js:2
jquery.min.js:2未捕获类型错误:无法读取未定义的属性“replace”
在initModalSource(examples.js:96)
在HTMLDocument,”);
toolbar.appendTo(document.body);
附加(btnViewSource);
工具栏.附加(btnViewContent);
工具栏.追加(btnBackToList);
btnViewSource.on('click',函数(){
$(“#模态源”).modal('show');
});
btnViewContent.on('单击',函数(){
var modal=$(“#modal content”);
modal.find('.content html').html(
美丽TML(
$(“#内容区”).keditor('getContent'))
)
);
modal.modal('show');
});
}
函数initModalContent(){
var模态=$(
'' +
' ' +
' ' +
' ' +
“×;”+
“内容”+
' ' +
' ' +
' ' +
' ' +
' ' +
“结束”+
' ' +
' ' +
' ' +
''
);
modal.appendTo(document.body);
}
函数initModalSource(){
var模态=$(
'' +
' ' +
' ' +
' ' +
“×;”+
“来源”+
' ' +
' ' +
“”+
“”+
“”+
“
”+
' ' +
' ' +
' ' +
' ' +
' ' +
' ' +
' ' +
' ' +
' ' +
' ' +
“结束”+
' ' +
' ' +
' ' +
''
);
var htmlCode=$('[data keditor=“html”]')。html();
var htmlInclude=$('').html($('[data keditor=“html include”]').clone()).html();
htmlInclude=htmlInclude.replace('data-keditor=“html include”','');
htmlInclude=htmlInclude.replace(/\/g');
modal.find('.sourcehtml').html(beautifyHtml(htmlCode+htmlInclude));
var jsCode=$('[data keditor=“script”]')。html();
jsCode=jsCode.replace(/\/g',);
modal.find('.sourcejs').html(beautifyJs(jsCode));
modal.appendTo(document.body);
}
函数HTML(htmlCode){
htmlCode=html_美化(htmlCode{
“缩进大小”:“4”,
“缩进字符”:“,
“函数后面的空格”:true,
“以新行结尾”:真
});
htmlCode=htmlCode.replace(//g',);
返回PR.prettyPrintOne(htmlCode,'lang html');
}
函数美化JS(jsCode){
jsCode=js_美化(jsCode{
“缩进大小”:“4”,
“缩进字符”:“,
“函数后面的空格”:true,
“以新行结尾”:真
});
返回PR.prettyPrintOne(jsCode,'lang js');
}
})(jQuery);
在我看来,我只有这个
<div id="content-area"></div>
<script>
$(function () {
$('#content-area').keditor();
});
</script>
$(函数(){
$(“#内容区”).keditor();
});
我正在使用
css:
- 字体真棒
- 编辑
- keditor组件
- 美化
- keditor示例
- jquery min 3.5.1
- jQueryUI1.12.1
- 编辑
- formBuilder 2.5.3分钟
- fromRender 2.5.3分钟
- 凯迪特
- keditor组件
- 美化
- 美化
- 美化html
- 例子
我怎样才能解决这个问题?谢谢:)您忘记在
script
元素上添加数据keditor=“script”
,这会导致代码失败。您还需要在link rel=“stylesheet”
元素上添加data type=“keditor style”
这是在正确的元素上具有正确属性的代码。
出于某种原因,它在这里不起作用,但你可以在里面试试
(函数($){
//问题中未提供模拟函数
const noop=str=>str;
const html_bestify=noop;
const js_bestify=noop;
常数PR={
打印前:noop
}
$(函数(){
initModalSource();
initModalContent();
initToolbar();
});
函数initToolbar(){
变量工具栏=$('');
var btnViewSource=$(“查看源”);
var btnViewContent=$(“获取内容”);
变量btnBackToList=$('');
toolbar.appendTo(document.body);
附加(btnViewSource);
工具栏.附加(btnViewContent);
工具栏.追加(btnBackToList);
btnViewSource.on('click',函数(){
$(“#模态源”).modal('show');
});
btnViewContent.on('单击',函数(){
var modal=$(“#modal content”);
modal.find('.content html').html(
美丽TML(
$(“#内容区”).keditor('getContent'))
)
);
modal.modal('show');
});
}
函数initModalContent(){
var模态=$(
'' +
' ' +
'
<div id="content-area"></div>
<script>
$(function () {
$('#content-area').keditor();
});
</script>