这是一个奇怪而简单的问题,我无法找到解决方案。我正在尝试<textarea>
在 Bootstrap 模式中获取 CLEditor。它加载得很好,问题是我无法在上面写字,除非我在按 F12 时打开 Chrome 的 DevTools。我知道我可以制作一个弹出窗口并在<textarea>
那里使用它,但在我看来,在模态中使用它看起来更好。
现在我只有模态,一个显示模态的按钮,以及来自 CLEditor 的 jQuery 函数。这是我的代码:
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<!-- ClEditor -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="inc/CLEditor/jquery.cleditor.css" />
<script src="inc/CLEditor/jquery.cleditor.min.js"></script>
<!-- Boostrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<title>Comisión de Análisis</title>
</head>
<body>
<div>
<button type="button" id="agr" class="btn btn-primary" data-toggle="modal" data-target="#modalAgregar" >Agregar subtema</button>
</div>
<!-- Modal agregar subtema -->
<div id="modalAgregar" class="modal fade bd-example-modal-lg w-50 mx-auto" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Añadiendo Subtema</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="forms" style="width:90%;margin:auto;">
<form action="" enctype="multipart/form-data" method="POST">
<br>
<div class="form-group">
<label for="tinput">Anotaciones:</label>
<textarea class="form-control" rows="3" name="anotaciones" id="tinput"></textarea>
</div>
<br>
<center><button type="submit" class="btn btn-success" style="width:30%; margin:auto;" >Agregar</button></center>
</form>
</div>
</div>
</div>
</div>
<!-- -->
<script>
$(document).ready( function () {
$("#tinput").cleditor();
});
</script>
</body>
编辑:尝试$("#tinput").cleditor()[0].refresh();
在一个openModal()
函数上使用,因为我发现另一个有类似问题的线程,但它没有用。