javascript - CKEditor - 图像属性对话框为空

标签 javascript jquery ckeditor

我使用默认的图像插件和通常的值:

  CKEDITOR.replace( 'editor', 

                      {
                        filebrowserBrowseUrl: '/app/myimages.html',
                        filebrowserUploadUrl: '/app/myfiles.html',
                        filebrowserImageBrowseUrl: '/app/myimages.html'
}

通过图像选择对话框进行选择后,图像会在编辑器中正确显示。

但是当我右键单击图像并选择“图像属性”菜单时。
打开的对话框不包含图像 URL 或宽度或高度等。它基本上没有值。

最佳答案

查看我的评论。但对我来说,它覆盖了 onShow()。

CKEDITOR.on('dialogDefinition', function( ev ) {
			// Take the dialog window name and its definition from the event data.
			var dialogName = ev.data.name;
			var dialogDefinition = ev.data.definition;
			
			if ( dialogName == 'image' ) {
				/*dialogDefinition.onShow = function() {
					this.selectPage( 'info' );
				};*/ // do not override this function, it will cause a JS on save (setCustomData can not be found on null object), and the edit image will not fill in its fields.
				
				dialogDefinition.removeContents( 'Link' ); // remove these tabs
				dialogDefinition.removeContents( 'advanced' );
				dialogDefinition.removeContents( 'Upload' );
				
				var contents = dialogDefinition.getContents( 'info' );
				//contents.remove( 'htmlPreview' ); // will cause a JS error if disabled.
				contents.remove( 'ratioLock' );
				contents.remove( 'txtHSpace' );
				contents.remove( 'txtVSpace' );
				contents.remove( 'txtAlt' );
				contents.remove( 'txtBorder' );
				
				contents.get('txtWidth').width = 'auto';
				contents.get('txtHeight').width = 'auto';
				contents.get('txtUrl').disabled = 'disabled';
			}
		});

关于javascript - CKEditor - 图像属性对话框为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26647343/

相关文章:

javascript - 如何在 Rails 4 中通过 Turbolinks 使用页面/查看特定的 Javascript?

javascript - Backbone 和 bindAll : "func is undefined"

javascript - 当离线或在线连接到互联网时,我如何更改我的图像,

javascript - 如何使用 r.js 优化器从我的 javascript 库中删除所有 require 和定义语句?

jQuery:如何将 $(this) 作为函数参数传递?

javascript - ckeditor中插入html按钮的onclick事件

android - CKEditor 4.4.7 不显示在任何移动浏览器上

javascript - CKEditor(5) - 如何删除选择表小部件?

javascript - 如何解决路径填充颜色

JQuery Load 函数返回 405 Method not Allowed