Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 在编辑器中使用文本框_Asp.net Mvc_Asp.net Core Mvc_Monaco Editor - Fatal编程技术网

Asp.net mvc 在编辑器中使用文本框

Asp.net mvc 在编辑器中使用文本框,asp.net-mvc,asp.net-core-mvc,monaco-editor,Asp.net Mvc,Asp.net Core Mvc,Monaco Editor,我是摩纳哥编辑的新手,它“真的很好”。我只是注意到它在文本框控件上不起作用 它正在处理div <div id="ComponentTemplateHTML" style="width:1000px;height:600px;border:1px solid grey"></div> 但在文本框或文本区域中,它不起作用 <textarea asp-for="ComponentTemplateHTML" style="width:1000px;height:60

我是摩纳哥编辑的新手,它“真的很好”。我只是注意到它在文本框控件上不起作用

它正在处理div

<div id="ComponentTemplateHTML" style="width:1000px;height:600px;border:1px solid grey"></div>

但在文本框或文本区域中,它不起作用

 <textarea asp-for="ComponentTemplateHTML" style="width:1000px;height:600px;border:1px solid grey"></textarea>



require.config({ paths: { 'vs': '../../lib/monaco-editor/min/vs' } });
        require(['vs/editor/editor.main'], function () {


monaco.editor.create(document.getElementById("ComponentTemplateHTML"), {
            language: "css",
            scrollbar: {
                vertical: 'auto',
                horizontal: 'auto'
            }
        });

require.config({path:{'vs':'../../lib/monaco editor/min/vs'}});
require(['vs/editor/editor.main'],函数(){
monaco.editor.create(document.getElementById(“ComponentTemplateHTML”){
语言:“css”,
滚动条:{
垂直:“自动”,
水平:“自动”
}
});

提交表单时,只需将内容从
div
复制到
textarea
,即可将表单作为输入发送出去。记住将
textarea
隐藏或动态设置
textarea

jQuery示例


默认情况下,编辑器创建文本区域,但包装器需要一个div元素。
$( "#your-form-id" ).submit(function( event ) {
  $ ('#your-textarea-id').val( $('#your-monaco-div-id') );
});