我希望在创建链接中将默认目标更改为_blank
' DefaultLinkTarget' => ' _blank',
如何做到这一点!
<?php
use dosamigos\ckeditor\CKEditor;
?>
<?=
$form->field($model, 'summary')->widget(CKEditor::className(), [
'options' => ['rows' => 1],
'clientOptions' => [
'language' => 'fa',
// 'DefaultLinkTarget' => '_blank',
'height' => '200'
],
'preset' => 'full',
])
?>
答案 0 :(得分:0)
您可以使用选项目标
<?=
$form->field($model, 'summary')->widget(CKEditor::className(), [
'options' => ['rows' => 1, 'target' =>'_blank'],
'clientOptions' => [
'language' => 'fa',
// 'DefaultLinkTarget' => '_blank',
'height' => '200'
],
'preset' => 'full',
])
?>
或尝试在页面中添加脚本
<script>
// Sets the default config value to _blank.
CKEDITOR.config.DefaultLinkTarget = '_blank';
</script>
答案 1 :(得分:0)
我不确定你是在谈论CKEditor还是FCKeditor,但是在CKEditor中没有这样的配置设置。您需要使用dialogDefinition事件。代码是:
<script>
var editor = CKEDITOR.replace( 'editor1', { });
CKEDITOR.on( 'dialogDefinition', function( ev ) {
var dialogDefinition = ev.data.definition;
if ( ev.data.name == 'link' ){
dialogDefinition.getContents( 'target' ).get( 'linkTargetType' )['default'] = '_blank';
}
});
</script>