diff --git a/common/js/plugins/ckeditor/ckeditor/plugins/divarea/plugin.js b/common/js/plugins/ckeditor/ckeditor/plugins/divarea/plugin.js new file mode 100644 index 000000000..572baebcc --- /dev/null +++ b/common/js/plugins/ckeditor/ckeditor/plugins/divarea/plugin.js @@ -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( + '
' + ); + + 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' ); + } ); + } +} ); diff --git a/common/js/plugins/ckeditor/ckeditor/plugins/ios_enterkey/plugin.js b/common/js/plugins/ckeditor/ckeditor/plugins/ios_enterkey/plugin.js new file mode 100644 index 000000000..cb2921cf8 --- /dev/null +++ b/common/js/plugins/ckeditor/ckeditor/plugins/ios_enterkey/plugin.js @@ -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(); + } + }); + }); + } +}); diff --git a/modules/editor/skins/ckeditor/editor.html b/modules/editor/skins/ckeditor/editor.html index abad83a45..c41290d99 100644 --- a/modules/editor/skins/ckeditor/editor.html +++ b/modules/editor/skins/ckeditor/editor.html @@ -145,8 +145,12 @@ var auto_saved_msg = "{$lang->msg_auto_saved}"; settings.ckeconfig.removePlugins = {json_encode(implode(',', $editor_remove_plugins))}; + // https://github.com/rhymix/rhymix/issues/932 if (CKEDITOR.env.iOS) { - settings.ckeconfig.removePlugins = settings.ckeconfig.removePlugins ? (settings.ckeconfig.removePlugins + ',enterkey') : ''; + settings.ckeconfig.extraPlugins = (settings.ckeconfig.extraPlugins ? (settings.ckeconfig.extraPlugins + ',') : '') + 'divarea,ios_enterkey'; + settings.loadXeComponent = false; + var additional_styles = '.cke_wysiwyg_div { padding: 8px !important; }'; + $('head').append('' + additional_styles + css_content.replace(/\.xe_content\.editable/g, '.cke_wysiwyg_div') + ''); }