mirror of
https://github.com/processwire/processwire.git
synced 2025-08-23 23:02:58 +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
|
* @param event
|
||||||
*
|
*
|
||||||
@@ -235,6 +235,12 @@ function ckeInlineMouseoverEvent(event) {
|
|||||||
$t.effect('highlight', {}, 500);
|
$t.effect('highlight', {}, 500);
|
||||||
$t.attr('contenteditable', 'true');
|
$t.attr('contenteditable', 'true');
|
||||||
var configName = $t.attr('data-configName');
|
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]);
|
var editor = CKEDITOR.inline($(this).attr('id'), ProcessWire.config[configName]);
|
||||||
ckeInitEvents(editor);
|
ckeInitEvents(editor);
|
||||||
$t.addClass("InputfieldCKEditorLoaded");
|
$t.addClass("InputfieldCKEditorLoaded");
|
||||||
@@ -348,7 +354,7 @@ $(document).ready(function() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CKEDITOR.disableAutoInline = true;
|
CKEDITOR.disableAutoInline = true;
|
||||||
$(document).on('mouseover', '.InputfieldCKEditorInlineEditor', ckeInlineMouseoverEvent);
|
$(document).on('mouseover focus', '.InputfieldCKEditorInlineEditor', ckeInlineMouseoverEvent);
|
||||||
$(document).on('submit', 'form.InputfieldForm', function() {
|
$(document).on('submit', 'form.InputfieldForm', function() {
|
||||||
ckeSaveReadyInline($(this));
|
ckeSaveReadyInline($(this));
|
||||||
// note: not necessary for regular editors since CKE takes care
|
// 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() {
|
public static function getModuleInfo() {
|
||||||
return array(
|
return array(
|
||||||
'title' => 'CKEditor',
|
'title' => 'CKEditor',
|
||||||
'version' => 164,
|
'version' => 165,
|
||||||
'summary' => __('CKEditor textarea rich text editor.', __FILE__),
|
'summary' => __('CKEditor textarea rich text editor.', __FILE__),
|
||||||
'installs' => array('MarkupHTMLPurifier'),
|
'installs' => array('MarkupHTMLPurifier'),
|
||||||
);
|
);
|
||||||
@@ -535,7 +535,7 @@ class InputfieldCKEditor extends InputfieldTextarea {
|
|||||||
$value = $this->purifyValue($this->attr('value'));
|
$value = $this->purifyValue($this->attr('value'));
|
||||||
|
|
||||||
$out =
|
$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 . "' />";
|
"<input type='hidden' name='$this->name' id='$this->id' value='" . self::PLACEHOLDER_TEXT . "' />";
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
|
Reference in New Issue
Block a user