第一次打开模态时第一次正确但开放模式第二次tynimce转换为textarea,如果第一次刷新页面全部正确,单独使用此控件就有此问题
查看
<div class="modal-body">
<?php $form = ActiveForm::begin(); ?>
<div class="row">
<div class="col-md-12">
<?= $form->field($model, 'descripcion')->widget(TinyMce::className(), [
'options' => ['rows' => 6],
'language' => 'es',
'clientOptions' => [
'plugins' => [
"advlist autolink lists link charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
],
enter code here
'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
]
]);?>
</div>
</div>
</div>
控制器
public function actionCreate()
{
$model = new proyecto();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['index']);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
索引
<script>
$(function(){
$('.modalButton').click(function(){
var a = $(this).attr('value');
$('#modal').modal('show')
.find('#modalContent')
.load($(this).attr('value'));
console.log(a);
})
});
</script>
<span title="Create" value="'.$url.'" class="modalButton" ><i class="glyphicon glyphicon-refresh"></i></span>
<div class="modal fade" id="modal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" id="modalContent"></div>
</div>
答案 0 :(得分:0)
当模态未在第二次初始化时,会发生bcoz。 所以对于tinymice,在modal结束时破坏tinymice然后在一段延迟时间重新初始化tinymice。 检查以下代码
$('#popupID').on(
'hidden.bs.modal',
function() {
tinymce.EditorManager.execCommand('mceRemoveEditor', true,
'textareaID');
setTimeout(function() {
tinymce.EditorManager.execCommand('mceAddEditor', true,
'textareaID');
}, 3000);
});
答案 1 :(得分:0)
$text = $_POST['input'];
$words = explode(' ', $text);
sort($words);
$result = array_combine($words, array_fill(0, count($words), 0));
$len = count($words);
for ($i = 0; $i < $len; $i++) {
echo $words[$i] . " ";
}echo "<br> <br>";
foreach ($words as $word) {
$result[$word] ++;
}
foreach ($result as $word => $count) {
echo "$word = $count<br>";
}
您的DOM元素已被MCE修改为已修改。所以......我们必须重置这个 我的JS在我的项目中工作