Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balloon panel support for divarea editor #1239

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/balloonpanel/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
bottom: Math.min( editorRect.bottom, viewPaneSize.height + winGlobalScroll.y )
};

if ( isInline ) {
if ( isInline && !this.editor.plugins.divarea ) {
// In inline we want to limit position within the window.
allowedRect = this._getViewPaneRect( winGlobal );

Expand Down
45 changes: 45 additions & 0 deletions tests/plugins/balloonpanel/manual/divarea.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<style>
body {
margin-left: 0px;
padding-left: 400px;
}
</style>

<div id="editor1" contenteditable="true">
<p>Apollo 11</p>
<p><strong>Apollo 11</strong></p>
<p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p>
<p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p>
<p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p>
<p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p><p>Sample text </p>
</div>
<button id="attach">Attach balloon panel</button>
<script>
CKEDITOR.disableAutoInline = true;

function instanceReadyListener( evt ) {
var strong = this.editable().findOne( 'strong' ),
panel = new CKEDITOR.ui.balloonPanel( this, {
width: 'auto',
height: 200,
content: 'Editor test'
} );

panel.setTitle( 'Title' );
document.getElementById('attach').addEventListener( 'click', function() {
panel.attach( strong );
panel.parts.content.setHtml( '<p style="padding: 10px">Clicked element: ' + strong.getName() + ' ("' + strong.getText() + '")</p>' );
} );
strong.setStyle( 'background', 'pink' );
strong.setStyle( 'outline', '4px solid red' );
}

CKEDITOR.replace( 'editor1', {
extraPlugins: 'balloonpanel',
height: 300,
width: 600,
on: {
instanceReady: instanceReadyListener
}
} );
</script>
13 changes: 13 additions & 0 deletions tests/plugins/balloonpanel/manual/divarea.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@bender-ui: collapsed
@bender-tags: 4.8.0, bug, balloonpanel
@bender-ckeditor-plugins: wysiwygarea,toolbar,divarea,basicstyles,floatingspace,balloonpanel

1. Scroll editor to move selected text outside the editor view.
1. Click `Attach balloon panel button`.

Ballon panel should be attached with arrow facing upwords.
Arrow should be next to top edge and inside editable.

## Unexpected behaviour

Ballon panel arrow is attached outside editable.