Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
STUDIP.domReady(() => {
if (STUDIP.editor_enabled) {
// replace areas visible on page load
replaceVisibleTextareas();
// replace areas that are created or shown after page load
// remove editors that become hidden after page load
// show, hide and create do not raise an event, use interval timer
setInterval(replaceVisibleTextareas, 300);
}
// when attaching to hidden textareas, or textareas who's parents are
// hidden, the editor does not function properly; therefore attach to
// visible textareas only
function replaceVisibleTextareas() {
$('textarea.wysiwyg').each(function() {
var editor = CKEDITOR.dom.element.get(this).getEditor();
if (!editor && $(this).is(':visible')) {
STUDIP.wysiwyg.replace(this);
} else if (editor && editor.container && $(editor.container.$).is(':hidden')) {
editor.destroy(true);
}
});
}
// customize existing dialog windows
CKEDITOR.on('dialogDefinition', function(ev) {
var dialogName = ev.data.name,
dialogDefinition = ev.data.definition;
if (dialogName == 'table') {
var infoTab = dialogDefinition.getContents('info');
infoTab.get('txtBorder')['default'] = '';
infoTab.get('txtWidth')['default'] = '';
infoTab.get('txtCellSpace')['default'] = '';
infoTab.get('txtCellPad')['default'] = '';
var advancedTab = dialogDefinition.getContents('advanced');
advancedTab.get('advCSSClasses')['default'] = 'content';
}
});
});
// Hotfix for Dialogs
$.widget( "ui.dialog", $.ui.dialog, {
// jQuery UI v1.11+ fix to accommodate CKEditor (and other iframed content) inside a dialog
// @see http://bugs.jqueryui.com/ticket/9087
// @see http://dev.ckeditor.com/ticket/10269
_allowInteraction: function( event ) {
return this._super( event ) ||
// addresses general interaction issues with iframes inside a dialog
event.target.ownerDocument !== this.document[ 0 ] ||
// addresses interaction issues with CKEditor's dialog windows and iframe-based dropdowns in IE
!!$( event.target ).closest( ".cke_dialog, .cke_dialog_background_cover, .cke" ).length;
}
});