ckeditor

CKEDITOR - prevent adding image dimensions as a css style

不问归期 提交于 2019-11-27 12:43:48
问题 How to prevent CKEDITOR from adding image dimensions as a style? Instead of this: <img src="image.jpg" style="height:100px; width:100px;"> I want this <img src="image.jpg" height="100px" width="100px"> 回答1: There is one more way to do this (much simpler), by using Disallowed Content introduced in CKEditor 4.4.0: CKEDITOR.replace( 'editor1', { disallowedContent : 'img{width,height}' } ); or in config.js: config.disallowedContent = 'img{width,height}'; This rule will disallow inline styles

Getting selected text with CKEditor Plugin on IE

只谈情不闲聊 提交于 2019-11-27 12:29:54
I have made a plugin for CKEditor, but it relies on the currently selected text. In FF and Chrome I can use: var selectedText = editor.getSelection().getNative(); but this doesn't work in IE and I only get [object Object] Any suggestions? This is what I use: var mySelection = editor.getSelection(); if (CKEDITOR.env.ie) { mySelection.unlock(true); selectedText = mySelection.getNative().createRange().text; } else { selectedText = mySelection.getNative(); } Use: editor.getSelection().getSelectedText(); Or: CKEDITOR.instances["txtTexto"].getSelection().getSelectedText() "txtTexto" = ID of textarea

ckeditor inline save/submit

风流意气都作罢 提交于 2019-11-27 11:33:24
问题 I can't work out how to grab the edited data from a CKEditor instance and post it to a url. I'm looking at something this: http://nightly.ckeditor.com/3995/samples/inlineall.html and I can't work out how the changes can be saved. Can I post the newly edited data to be posted to a PHP along with the ID of the element being edited? Similarly to this: editor.on('configLoaded', function(){ // do some stuff }); I was hoping I could do something like this: editor.on('clickAway', function(e){ id = e

How to configure ckeditor to not wrap content in <p> block?

为君一笑 提交于 2019-11-27 10:33:58
I am using ckeditor on my website to make it easier for users to input HTML. However, the data I get back from ckeditor is wrapped in <p></p> blocks. (Which I don't want.) Is there some configuration setting that forces the editor to not wrap the text in anything? Add the following to your config.js file for CKEditor: config.enterMode = CKEDITOR.ENTER_BR; Example: ... CKEDITOR.editorConfig = function (config) { config.enterMode = CKEDITOR.ENTER_BR; ... }; Details The configuration setting that controls this behavior is based on what you want to happen when the user presses Enter . Just in case

Force CKEDITOR to refresh config

笑着哭i 提交于 2019-11-27 10:32:29
问题 I created a cms application that use CKEDITOR and when I add some functionality to CKEDITOR I need to refresh some CKEDITOR .js /.css file. But CKEDITOR force the browser to cache them. I see that it uses a querystring to all .js/.css files This querystring reflect the CKEDITOR version I suppose: /Js/ckeditor/config.js?t=CAPD /Js/ckeditor/lang/it.js?t=CAPD /Js/ckeditor/plugins/onchange/plugin.js?t=CAPD Is there an embedded method to do that in CKEDITOR? I could not find anything in the

Getting the textarea value of a ckeditor textarea with javascript

不问归期 提交于 2019-11-27 09:58:24
问题 I'm a learner as far as JS goes and although I've spent a good few hours reading through tutorials which has helped lots but I'm still having problems figuring out exactly how I find out what a user is typing into a ckeditor textarea. What I'm trying to do is have it so that when someone types into the textarea, whatever they type appears in a div in a different part of the page. I've got a simple text input doing that just fine but because the text area is a ckEditor the similar code doesn't

CK Editor validates second time

◇◆丶佛笑我妖孽 提交于 2019-11-27 09:05:53
问题 I have two CKEditors in my HTML (I mean to say multiple ckeditors). Also I am using Validate plugin for checking if CKEditor is empty,if empty show error. Validation works perfectly, but it validates second time, whereas it should validate first time itself. I have checked all the questions and answers here, but none helped. I created a JS Fiddle. Code for validate : HTML <form action="" method="post" id="frmEditor"> <p> <label for="editor1"> Editor 1: </label> <textarea class="ckeditor" cols

CKEDITOR - how to add permanent onclick event?

我与影子孤独终老i 提交于 2019-11-27 08:31:09
I am looking for a way to make the CKEDITOR wysiwyg content interactive. This means for example adding some onclick events to the specific elements. I can do something like this: CKEDITOR.instances['editor1'].document.getById('someid').setAttribute('onclick','alert("blabla")'); After processing this action it works nice. But consequently if I change the mode to source-mode and then return to wysiwyg-mode, the javascript won't run. The onclick action is still visible in the source-mode, but is not rendered inside the textarea element. However, it is interesting, that this works fine everytime:

How to set cursor position to end of text in CKEditor?

北城以北 提交于 2019-11-27 08:21:10
Is there a way to set the cursor to be at the end of the contents of a CKEditor? This developer asked too, but received no answers: http://cksource.com/forums/viewtopic.php?f=11&t=19877&hilit=cursor+end I would like to set the focus at the end of the text inside a CKEditor. When I use: ckEditor.focus(); It takes me to the beginning of the text already inside the CKEditor. Dan's answer got strange results for me, but minor change (in addition to typo fix) made it work: var range = me.editor.createRange(); range.moveToElementEditEnd( range.root ); me.editor.getSelection().selectRanges( [ range ]

CKEDITOR使用与配置

蹲街弑〆低调 提交于 2019-11-27 07:39:37
安装:   下载CKEDITOR的文件,解压后复制到工程的WEBROOT目录下就OK! 引用CKEDITOR的JS文件:   新建JSP页面,添加其JS文件<script type="text/javascript" src="ckeditor/ckeditor.js"></script>    注意:1.src的路径。      2.不要写成<script type="text/javascript" src="ckeditor/ckeditor.js />样式,在现有的3.0.1版本中会出现CKEDITOR未定义的脚本错误提示,致使不能生成编辑器。 替换TEXTAREA标签: < textarea rows ="30" cols ="50" name ="editor01" > 请输入 . </ textarea > < script type ="text/javascript" > CKEDITOR.replace( ' editor01 ' ); </ script >   注意:要在textarea后面加入javascript.如果要在HEAD区写javasript,那么采用如下代码: < script type ="text/javascript" > window.onload = function () { CKEDITOR.replace( ' editor01