ckeditor

CKEditor strips inline attributes

怎甘沉沦 提交于 2019-11-27 05:14:29
I have been using CKEditor for some time and it has worked great. I've pretty much gotten rid of any problems that ive had but this one i cant seem to figure out. When i add inline attributes to elements for instance style = "color: #ff0;" on a <p></p> tag they are stripped out when i switch from wysiwyg to source view. No saving or submission is done and ckeditor is has been added to my site which is my own script. Any ideas as to what would cause this. All of the search results i can find correspond to this happening in Drupal but Drupal seems to be the problem not the editor in all

How do I customize a ckeditor 4.2 builtin plugin like links?

社会主义新天地 提交于 2019-11-27 04:43:18
If I want to add a tab to the links plugin, what's the best practice approach? I don't want to alter the release code just override it with a version with my customizations. So it's easy to update with new releases. Does CKEDITOR 4.2 have a how-to for this? I'm using the new inline style toolbars. If I get the source code can I rebuild the release version without the links plugin? and then do an external plugin using my customized version of the links plugin? You got to observe dialogDefinition event to do this: CKEDITOR.on( 'dialogDefinition', function( evt ) { var dialog = evt.data; if (

Turn off enclosing <p> tags in CKEditor 3.0

家住魔仙堡 提交于 2019-11-27 04:10:37
问题 Is there a possibility to turn off the automatic enclosing of all written content within <p></p> in CKEditor 3.x? I tried CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR; but this just changes the inline linebreaks to <br /> while leaving the enclosing paragraph. Currently writing "Test" produces this output <p> Test</p> but I want it to be simply Test Is there a configuration property for this or would another inline editor to be better suited for this? 回答1: CKEDITOR.config.enterMode =

How do I set a value in CKEditor with Javascript?

那年仲夏 提交于 2019-11-27 03:48:29
I am wondering how I can set a value in CKEditor using Javascript? I have tried the following, but neither of them work... document.[form name].[textarea name].value=data; $('#textareaID').val(data); However, both these work without the editor applied. Is there a way I can do this with the editor? efeyc Use the CKEditor method setData() : CKEDITOR.instances[**fieldname**].setData(**your data**) Wick The insertHtml() and insertText() methods will insert data into the editor window, adding to whatever is there already. However, to replace the entire editor content, use setData() . Use insertHtml

How can I add(programatically) google fonts to ckeditor

那年仲夏 提交于 2019-11-27 03:34:04
问题 I have just download CKEditor and its great. Although I have noticed that it slacks fonts. So I thought it would be a good idea to be able to add Google Web Fonts to CKEditor to add to its functionality. I have searched online but I could only find how to manually go in and add each font in config.js file. Can someone please help me add all Google Web Fonts to CKEditor programatically and show how. 回答1: Ok I found the answer. I am posting it here so it could be helpful for anyone else who's

How to listen to basic events in CKEditor?

爱⌒轻易说出口 提交于 2019-11-27 03:12:02
问题 I can't figure out how to listen to focus, click, onKeyUp and other basic dom events in ckeditor. In the events summary there is only a few events regarding the lifecycle of ckeditor. And the "textArea" of ckeditor is an iframe, and it's html itself, so it is not clear on what dom node to listen. 回答1: It's not a big deal, just do the following, works for focus, blur, click etc. var ckeditor = CKEDITOR.instances['textArea_id']; ckeditor.on('focus', fnHandler, context, data, priority); or a

ckeditor removing empty span automatically

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 03:10:32
问题 i am using ckeditor and i have vary strange issue. it remove automatically empty <span> for example <span class="new-class"></span> removed automatically. i am searching for solution for last 2 days but no success. i try to put following code in config.js CKEDITOR.config.allowedContent = true; but no success. i also add following code in html where i use ckeditor but no success. <script> var editor = CKEDITOR.replace( 'editor1', { allowedContent: true, } ); </script> thanks 回答1: You'll find

How to set the height of CKEditor 5 (Classic Editor)

孤人 提交于 2019-11-27 03:03:27
问题 In CKEditor 4 to change the editor height there was a configuration option: config.height. How do I change the height of CKEditor 5? (the Classic Editor) 回答1: Answering my own question as it might help others. CKEditor 5 no longer comes with a configuration setting to change its height. The height can be easily controlled with CSS. There is one tricky thing though, if you use the Classic Editor: <div id="editor1"></div> ClassicEditor .create( document.querySelector( '#editor1' ) ) .then(

CKEditor5基本商使用,图片上传,添加插件

南楼画角 提交于 2019-11-27 02:57:35
CKEditor5 本篇博客是在react环境中封装的原生的CKEditor5,VUE环境也可以参考。 基本使用 安装依赖 npm install -- save @ckeditor / ckeditor5 - build - classic or yarn add @ckeditor / ckeditor5 - build - classic 完整的代码 import React , { Component } from 'react' import ClassicEditor from '@ckeditor/ckeditor5-build-classic' class DefaultCKEditor extends Component { componentDidMount ( ) { this . init ( ) ; } init = ( ) => { ClassicEditor . create ( document . querySelector ( '#editor' ) ) . then ( editor => { } ) . catch ( error => { } ) ; } render ( ) { return ( < textarea name = "content" id = "editor" > < / textarea > ) } } export

How to use custom keyboard shortcuts within CKeditor with jQuery?

孤街浪徒 提交于 2019-11-27 02:54:24
问题 I have replaced the textarea my users use to edit content with CKeditor. Before this change, users were used to save there text by pressing Ctrl + S . This is done through the jQuery Hotkeys Plugin. Since CKeditor puts its text editor within an iframe the shortcut does not work when editing text. I hope someone can help me find a solution. 回答1: After a morning struggling with it, I finally found the way to do that! CKeditor already offers a hotkey functionality (see the CKeditor documentation