mirror of
https://github.com/processwire/processwire.git
synced 2025-08-23 06:44:38 +02:00
Add PR #146 - Make it possible to activate inline CKEditor instances via keyboard
This commit is contained in:
committed by
Ryan Cramer
parent
d8a5352ab9
commit
1bd35d212a
@@ -219,7 +219,7 @@ function ckeSaveReadyNormal($inputfield) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouseover event that activates inline CKEditor instances
|
||||
* Mouseover or focus event that activates inline CKEditor instances
|
||||
*
|
||||
* @param event
|
||||
*
|
||||
@@ -235,6 +235,12 @@ function ckeInlineMouseoverEvent(event) {
|
||||
$t.effect('highlight', {}, 500);
|
||||
$t.attr('contenteditable', 'true');
|
||||
var configName = $t.attr('data-configName');
|
||||
if(event.type == 'focusin') {
|
||||
CKEDITOR.once('instanceReady', function(event) {
|
||||
$(':focus').blur();
|
||||
event.editor.focus();
|
||||
});
|
||||
}
|
||||
var editor = CKEDITOR.inline($(this).attr('id'), ProcessWire.config[configName]);
|
||||
ckeInitEvents(editor);
|
||||
$t.addClass("InputfieldCKEditorLoaded");
|
||||
@@ -348,7 +354,7 @@ $(document).ready(function() {
|
||||
*/
|
||||
|
||||
CKEDITOR.disableAutoInline = true;
|
||||
$(document).on('mouseover', '.InputfieldCKEditorInlineEditor', ckeInlineMouseoverEvent);
|
||||
$(document).on('mouseover focus', '.InputfieldCKEditorInlineEditor', ckeInlineMouseoverEvent);
|
||||
$(document).on('submit', 'form.InputfieldForm', function() {
|
||||
ckeSaveReadyInline($(this));
|
||||
// note: not necessary for regular editors since CKE takes care
|
||||
|
File diff suppressed because one or more lines are too long
@@ -34,7 +34,7 @@ class InputfieldCKEditor extends InputfieldTextarea {
|
||||
public static function getModuleInfo() {
|
||||
return array(
|
||||
'title' => 'CKEditor',
|
||||
'version' => 164,
|
||||
'version' => 165,
|
||||
'summary' => __('CKEditor textarea rich text editor.', __FILE__),
|
||||
'installs' => array('MarkupHTMLPurifier'),
|
||||
);
|
||||
@@ -535,7 +535,7 @@ class InputfieldCKEditor extends InputfieldTextarea {
|
||||
$value = $this->purifyValue($this->attr('value'));
|
||||
|
||||
$out =
|
||||
"<div id='{$this->id}_ckeditor' class='InputfieldCKEditorInline InputfieldCKEditorInlineEditor' data-configName='$this->configName'>$value</div>" .
|
||||
"<div id='{$this->id}_ckeditor' class='InputfieldCKEditorInline InputfieldCKEditorInlineEditor' tabindex='0' data-configName='$this->configName'>$value</div>" .
|
||||
"<input type='hidden' name='$this->name' id='$this->id' value='" . self::PLACEHOLDER_TEXT . "' />";
|
||||
|
||||
return $out;
|
||||
|
Reference in New Issue
Block a user