Fix CKEditor Korean line break issue in iOS #932

- iOS에서는 divarea 플러그인과 @largeden 님의 ios_enterkey 플러그인을 사용
- iOS에서는 divarea 플러그인과 호환되지 않는 에디터 컴포넌트를 로딩하지 않음
  - 추후 호환성 문제가 해결되면 다시 사용하도록 변경할 수 있음
- 기본 폰트 등의 스타일이 cke_wysiwyg_div 클래스에도 적용되도록 조치함
This commit is contained in:
Kijin Sung 2018-03-08 14:23:47 +09:00
parent 73a46bbac5
commit ddb2a8afa1
3 changed files with 67 additions and 1 deletions

View file

@ -0,0 +1,38 @@
/**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @fileOverview The "divarea" plugin. It registers the "wysiwyg" editing
* mode using a DIV element.
*/
CKEDITOR.plugins.add( 'divarea', {
afterInit: function( editor ) {
// Add the "wysiwyg" mode.
// Do that in the afterInit function, so it'll eventually overwrite
// the mode defined by the wysiwygarea plugin.
editor.addMode( 'wysiwyg', function( callback ) {
var editingBlock = CKEDITOR.dom.element.createFromHtml(
'<div class="cke_wysiwyg_div cke_reset cke_enable_context_menu" hidefocus="true"></div>'
);
var contentSpace = editor.ui.space( 'contents' );
contentSpace.append( editingBlock );
editingBlock = editor.editable( editingBlock );
editingBlock.detach = CKEDITOR.tools.override( editingBlock.detach,
function( org ) {
return function() {
org.apply( this, arguments );
this.remove();
};
} );
editor.setData( editor.getData( 1 ), callback );
editor.fire( 'contentDom' );
} );
}
} );

View file

@ -0,0 +1,24 @@
/**
* iOS enter key fix for IME
*
* https://github.com/rhymix/rhymix/issues/932
*/
CKEDITOR.plugins.add( 'ios_enterkey',
{
icons: 'ios_enterkey',
init: function(editor)
{
editor.on('contentDom', function()
{
var editable = editor.editable();
editable.attachListener(editable, 'keyup', function(e)
{
if(e.data.getKey() === 13)
{
$(editor.document.$).find('.cke_wysiwyg_div').blur();
$(editor.document.$).find('.cke_wysiwyg_div').focus();
}
});
});
}
});