Revision 5a392100
Von Sven Schöling vor mehr als 7 Jahren hinzugefügt
js/kivi.js | ||
---|---|---|
157 | 157 |
}; |
158 | 158 |
|
159 | 159 |
ns.focus_ckeditor_when_ready = function(element) { |
160 |
$(element).ckeditor(function() { ns.focus_ckeditor(element); });
|
|
160 |
$(element).data('ckeditorInstance').on('instanceReady', function() { ns.focus_ckeditor(element); });
|
|
161 | 161 |
}; |
162 | 162 |
|
163 | 163 |
ns.focus_ckeditor = function(element) { |
164 |
var editor = $(element).ckeditorGet(); |
|
165 |
var editable = editor.editable(); |
|
166 |
|
|
167 |
if (editable.is('textarea')) { |
|
168 |
var textarea = editable.$; |
|
169 |
|
|
170 |
if (CKEDITOR.env.ie) |
|
171 |
textarea.createTextRange().execCommand('SelectAll'); |
|
172 |
else { |
|
173 |
textarea.selectionStart = 0; |
|
174 |
textarea.selectionEnd = textarea.value.length; |
|
175 |
} |
|
176 |
|
|
177 |
textarea.focus(); |
|
178 |
|
|
179 |
} else { |
|
180 |
if (editable.is('body')) |
|
181 |
editor.document.$.execCommand('SelectAll', false, null); |
|
164 |
$(element).data('ckeditorInstance').focus(); |
|
165 |
}; |
|
182 | 166 |
|
183 |
else { |
|
184 |
var range = editor.createRange(); |
|
185 |
range.selectNodeContents(editable); |
|
186 |
range.select(); |
|
187 |
} |
|
167 |
ns.selectall_ckeditor = function(element) { |
|
168 |
var editor = $(element).ckeditorGet(); |
|
169 |
var editable = editor.editable(); |
|
170 |
if (editable.is('textarea')) { |
|
171 |
var textarea = editable.$; |
|
172 |
|
|
173 |
if (CKEDITOR.env.ie) |
|
174 |
textarea.createTextRange().execCommand('SelectAll'); |
|
175 |
else { |
|
176 |
textarea.selectionStart = 0; |
|
177 |
textarea.selectionEnd = textarea.value.length; |
|
178 |
} |
|
179 |
} else { |
|
180 |
if (editable.is('body')) |
|
181 |
editor.document.$.execCommand('SelectAll', false, null); |
|
188 | 182 |
|
189 |
editor.forceNextSelectionCheck(); |
|
190 |
editor.selectionChange(); |
|
183 |
else { |
|
184 |
var range = editor.createRange(); |
|
185 |
range.selectNodeContents(editable); |
|
186 |
range.select(); |
|
187 |
} |
|
191 | 188 |
|
192 |
editor.focus(); |
|
193 |
} |
|
194 |
}; |
|
189 |
editor.forceNextSelectionCheck(); |
|
190 |
editor.selectionChange(); |
|
191 |
} |
|
192 |
} |
|
195 | 193 |
|
196 | 194 |
ns.init_tabwidget = function(element) { |
197 | 195 |
var $element = $(element); |
... | ... | |
228 | 226 |
title: false |
229 | 227 |
}; |
230 | 228 |
|
231 |
config.height = $e.height(); |
|
232 |
config.width = $e.width(); |
|
229 |
config.height = $e.height();
|
|
230 |
config.width = $e.width();
|
|
233 | 231 |
|
234 | 232 |
var editor = CKEDITOR.inline($e.get(0), config); |
235 |
$e.data('editor', editor);
|
|
233 |
$e.data('ckeditorInstance', editor);
|
|
236 | 234 |
|
237 | 235 |
if ($e.hasClass('texteditor-autofocus')) |
238 |
$e.ckeditor(function() { ns.focus_ckeditor($e); });
|
|
236 |
editor.on('instanceReady', function() { ns.focus_ckeditor($e); });
|
|
239 | 237 |
}; |
240 | 238 |
|
241 | 239 |
ns.reinit_widgets = function() { |
Auch abrufbar als: Unified diff
CKEditor: Fixes für texteditor in popup_dialog
- data field kanonisch auf data('ckeditorInstance') geändert
- jQuery style $.ckeditor hooks auf editor.on('loaded') geändert, der
Adapter unterstützt kein inline
- mehrfachinitialisierung unterbunden
- selectall und focus Funktionalität in zwei Funktionen getrennt
- focus auf die API Methode .focus() umgestellt