Revision 5532b7c8
Von Bernd Bleßmann vor fast 3 Jahren hinzugefügt
js/ckeditor/plugins/inline_resize/plugin.js | ||
---|---|---|
23 | 23 |
}); |
24 | 24 |
}; |
25 | 25 |
|
26 |
function parentDialog(e) { |
|
27 |
return e.getParents().filter( function(parent) { |
|
28 |
return parent.$.classList.contains("ui-dialog-content") |
|
29 |
})[0]; |
|
30 |
}; |
|
31 |
|
|
26 | 32 |
function attach( editor ) { |
27 | 33 |
var config = editor.config, |
28 |
parent = parentScroll(editor.element); |
|
34 |
parent = parentScroll(editor.element), |
|
35 |
divelt = editor.element.getNext(function(elt){return elt.getAttribute("class") === "cke_textarea_inline"}), |
|
36 |
inline = editor.element.$.classList.contains("texteditor-in-dialog"); |
|
37 |
|
|
38 |
var dialog; |
|
39 |
|
|
40 |
if (inline) { |
|
41 |
dialog = parentDialog(divelt); |
|
42 |
} |
|
29 | 43 |
|
30 | 44 |
var resize = function (width, height) { |
31 | 45 |
var editable; |
... | ... | |
51 | 65 |
var viewRect = win.getViewPaneSize(); |
52 | 66 |
|
53 | 67 |
float_space.setStyle( 'position', 'absolute' ); |
54 |
float_space.setStyle( 'top', pixelate( editorPos.y + editorRect.height - floatRect.height + 1) ); |
|
55 |
float_space.setStyle( 'right', pixelate( viewRect.width - editorRect.right ) ); |
|
68 |
if (inline) { |
|
69 |
var dialogPos = dialog.getDocumentPosition(); |
|
70 |
float_space.setStyle( 'top', pixelate( editorPos.y - dialogPos.y + editorRect.height - floatRect.height + 1 ) ); |
|
71 |
|
|
72 |
//float_space.setStyle( 'left', pixelate( editorPos.x - dialogPos.x + editorRect.width - floatRect.width ) ); |
|
73 |
// floatRect.width seems to be far to high on first dialog popup |
|
74 |
float_space.setStyle( 'left', pixelate( editorPos.x - dialogPos.x + editorRect.width - 11 ) ); |
|
75 |
} else { |
|
76 |
float_space.setStyle( 'top', pixelate( editorPos.y + editorRect.height - floatRect.height + 1) ); |
|
77 |
float_space.setStyle( 'right', pixelate( viewRect.width - editorRect.right ) ); |
|
78 |
} |
|
56 | 79 |
}; |
57 | 80 |
|
58 | 81 |
var float_html = '<div class="cke_editor_inline_resize_button">\u25E2</div>'; // class so that csss can overrise content and style |
59 |
var float_space = CKEDITOR.document.getBody().append( CKEDITOR.dom.element.createFromHtml( float_html )); |
|
82 |
var float_space = inline ? divelt.getParent().append( CKEDITOR.dom.element.createFromHtml( float_html )) |
|
83 |
: CKEDITOR.document.getBody().append( CKEDITOR.dom.element.createFromHtml( float_html )); |
|
60 | 84 |
|
61 | 85 |
var drag_handler = function( evt ) { |
62 | 86 |
var width = startSize.width + evt.data.$.screenX - origin.x, |
... | ... | |
137 | 161 |
* ltr support |
138 | 162 |
* textarea/div mode safe, currently simply assumes that textarea inline is used |
139 | 163 |
* positioning of resize handle is not browser zomm safe |
164 |
* positioning of resize handle in dialog with scroll bars is broken |
|
140 | 165 |
*/ |
Auch abrufbar als: Unified diff
CKEditor inline_resize: Hack für Editor im Dialog