Javascript调整CK编辑器大小不工作
我正在使用javascript编辑器,在过去几天里,我一直在为调整大小而烦恼。 我有一个称为ckEditorConfig的角度对象,我在其中存储了ckEditor的配置。目前,我可以看到正在设置一些属性(因此我知道它在某种程度上起作用)。但是,当我尝试调整编辑器的大小时,它不会调整到我想要的级别 下面是一段html和js代码片段,为我所说的内容增添了更多亮点:Javascript调整CK编辑器大小不工作,javascript,jquery,html,angularjs,ckeditor,Javascript,Jquery,Html,Angularjs,Ckeditor,我正在使用javascript编辑器,在过去几天里,我一直在为调整大小而烦恼。 我有一个称为ckEditorConfig的角度对象,我在其中存储了ckEditor的配置。目前,我可以看到正在设置一些属性(因此我知道它在某种程度上起作用)。但是,当我尝试调整编辑器的大小时,它不会调整到我想要的级别 下面是一段html和js代码片段,为我所说的内容增添了更多亮点: 这包含在我的控制器中 $scope.ckEditorConfig = { uiColor : '#FFFFFF', t
- 这包含在我的控制器中
}]))$scope.ckEditorConfig = { uiColor : '#FFFFFF', toolbarGroups: [ { name: 'undo' } ], removeButtons: '', extraPlugins: 'font,sourcedialog,sourcearea,stylescombo,colorbutton, colordialog', contentsCss: '/path/to/css', customConfig: '/path/to/js', width: 561, height: 150 }; websiteApp.directive('ckEditor', ['$timeout', function ($timeout) { return { require: '?ngModel', link: function ($scope, elm, attr, ngModel) { var ck = CKEDITOR.replace(elm[0]); if($scope.ckEditorConfig){ $.each($scope.ckEditorConfig, function(key, value){ ck.config[key] = value; }); } var height = ck.config.height; var width = ck.config.width; if(height && width){ ck.on('instanceReady', function(event){ var editor = event.editor; console.log('ck height: '+ height+', ck width: '+width); console.log('editor config height: '+ editor.config.height+', editor config width: '+editor.config.width); editor.resize(editor.config.width, editor.config.height, false, false); }); // ck.resize(height, width, true, false); } } };
> <textarea id="fflFieldLabel" class="txtArea" rows="1"
> ng-model="{{ngmodel}}" ck-editor></textarea>
>ng model=“{{ngmodel}}”ck编辑器>
试试这个:
<textarea id="fflFieldLabel" ></textarea>
CKEDITOR.replace('#myfield',{customConfig :'',width:'700px',height:'700px'});
替换('#myfield',{customConfig:'',宽度:'700px',高度:'700px'});
或者更改textarea标记的宽度和高度。希望它能起作用。如果您正在使用,并且不需要调用,则在初始化时,编辑器应根据配置自动设置大小
它与
<textarea name="editor1" id="editor1" rows="1" cols="80">
<p>Foo Bar Baz</p>
</textarea>
因此,可能存在一些集成问题,或者维度在其他地方被覆盖/更新?不,这没有任何区别
CKEDITOR.replace( 'editor1', { width: 450, height: 150 } );