如何让 CKeditor 从 Hspace 和 Vspace 切换到正确的 CSS
我正在与 CKeditor 合作,无论出于何种原因,他们在 UI 中包含了 Hspace 和 Vspace。允许用户像这样操作他们的图像是一个方便的想法,但这些已经被弃用了。
有谁将CKeditor的Hspace和Vspace转换为CSS,并知道如何解释其转换吗?
我是一个 JavaScript 新手..
I'm working with CKeditor, and for whatever reason, they included Hspace and Vspace in their UI. Convenient idea to allow users to manipulate their images like so, but those are way deprecated.
Has anyone converted CKeditor's Hspace and Vspace to CSS, and know how to explain its conversion?
I am a javascript novice..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
hspace
和vspace
是以像素为单位的边距。转换应该是直接、即时和简单的。您希望在哪里进行更正?我对 CKEditor 的来源一无所知,因此我提出了三个选项。
选项 1:在提交时使用正确的 CSS 替换
hspace
和vspace
属性。这可能会影响以后的可编辑性。选项 2:在渲染时使用适当的 CSS 替换
hspace
和vspace
属性。如果您以正确的方式(HTML 解析器)执行此操作,这可能会很慢。选项 3:在渲染时在客户端用适当的 CSS 替换
hspace
和vspace
属性。这在 jQuery、Prototype、Mootools 或您正在使用的任何库中应该是微不足道的。jQuery 来救援!像这样的东西可以工作。
hspace
andvspace
are margins in pixels. The conversion should be direct, immediate and simple.Where do you want the correction to take place? I don't know anything about CKEditor's source, so that leads me to propose three options.
Option 1: Replace the
hspace
andvspace
attributes with proper CSS at submit time. This might impact editability later.Option 2: Replace the
hspace
andvspace
attributes with proper CSS at render time. This might be slow if you do it the right way (HTML parser).Option 3: Replace the
hspace
andvspace
attributes with proper CSS on the client side at render time. This should be trivial in jQuery, Prototype, Mootools, or whatever library you're using.jQuery to the rescue! Something like this could work.
您使用什么版本的 CKEditor?
加载 http://ckeditor.com/demo 并查看该图像的生成源:
style="左边距:10px;右边距:10px;浮动:左;宽度:120px;高度:168px;"所以你不需要做任何事情。
What version of CKEditor are you using?
Load http://ckeditor.com/demo and look at the generated source for that image:
style="margin-left: 10px; margin-right: 10px; float: left; width: 120px; height: 168px;" so you don't have to do anything.