Skip to content

Commit

Permalink
Merge branch 't/14573'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tade0 committed May 9, 2016
2 parents 8c6c99a + 3c68743 commit d8486d5
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -5,6 +5,7 @@ CKEditor 4 Changelog

Fixed Issues:

* [#14573](https://dev.ckeditor.com/ticket/14573): Fixed: Missing [Widget](http://ckeditor.com/addon/widget) drag handler CSS when there are multiple editor instances.
* [#14620](https://dev.ckeditor.com/ticket/14620): Fixed: Setting both the `min-height` style for the `<body>` element and the `height` style for the `<html>` element breaks [Auto Grow](http://ckeditor.com/addon/autogrow) plugin.
* [#14538](http://dev.ckeditor.com/ticket/14538): Fixed: Keyboard focus goes into embedded iframe element.
* [#14602](http://dev.ckeditor.com/ticket/14602): Fixed: [dom.element.removeAttribute()](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-removeAttribute) method does not remove all attributes if no parameter is given.
Expand Down
31 changes: 19 additions & 12 deletions core/editable.js
Expand Up @@ -4,6 +4,9 @@
*/

( function() {
var isNotWhitespace, isNotBookmark, isEmpty, isBogus, emptyParagraphRegexp,
insert, fixTableAfterContentsDeletion, getHtmlFromRangeHelpers, extractHtmlFromRangeHelpers;

/**
* Editable class which provides all editing related activities by
* the `contenteditable` element, dynamically get attached to editor instance.
Expand Down Expand Up @@ -902,12 +905,16 @@
// Create the content stylesheet for this document.
var styles = CKEDITOR.getCss();
if ( styles ) {
var head = doc.getHead();
if ( !head.getCustomData( 'stylesheet' ) ) {
var head = doc.getHead(),
stylesElement = head.getCustomData( 'stylesheet' );

if ( !stylesElement ) {
var sheet = doc.appendStyleText( styles );
sheet = new CKEDITOR.dom.element( sheet.ownerNode || sheet.owningElement );
head.setCustomData( 'stylesheet', sheet );
sheet.data( 'cke-temp', 1 );
} else if ( styles != stylesElement.getText() ) {
CKEDITOR.env.ie && CKEDITOR.env.version < 9 ? stylesElement.$.styleSheet.cssText = styles : stylesElement.setText( styles );
}
}

Expand Down Expand Up @@ -1291,12 +1298,12 @@
//
//

var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ),
isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ),
isEmpty = CKEDITOR.dom.walker.empty(),
isBogus = CKEDITOR.dom.walker.bogus(),
// Matching an empty paragraph at the end of document.
emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;
isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ),
isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ),
isEmpty = CKEDITOR.dom.walker.empty(),
isBogus = CKEDITOR.dom.walker.bogus(),
// Matching an empty paragraph at the end of document.
emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;

// Auto-fixing block-less content by wrapping paragraph (#3190), prevent
// non-exitable-block by padding extra br.(#3189)
Expand Down Expand Up @@ -1523,7 +1530,7 @@
//
// Functions related to insertXXX methods
//
var insert = ( function() {
insert = ( function() {
'use strict';

var DTD = CKEDITOR.dtd;
Expand Down Expand Up @@ -2232,7 +2239,7 @@
// 1. Fixes a range which is a result of deleteContents() and is placed in an intermediate element (see dtd.$intermediate),
// inside a table. A goal is to find a closest <td> or <th> element and when this fails, recreate the structure of the table.
// 2. Fixes empty cells by appending bogus <br>s or deleting empty text nodes in IE<=8 case.
var fixTableAfterContentsDeletion = ( function() {
fixTableAfterContentsDeletion = ( function() {
// Creates an element walker which can only "go deeper". It won't
// move out from any element. Therefore it can be used to find <td>x</td> in cases like:
// <table><tbody><tr><td>x</td></tr></tbody>^<tfoot>...
Expand Down Expand Up @@ -2473,7 +2480,7 @@
//
// Helpers for editable.getHtmlFromRange.
//
var getHtmlFromRangeHelpers = {
getHtmlFromRangeHelpers = {
eol: {
detect: function( that, editable ) {
var range = that.range,
Expand Down Expand Up @@ -2638,7 +2645,7 @@
//
// Helpers for editable.extractHtmlFromRange.
//
var extractHtmlFromRangeHelpers = ( function() {
extractHtmlFromRangeHelpers = ( function() {
function optimizeBookmarkNode( node, toStart ) {
var parent = node.getParent();

Expand Down
16 changes: 16 additions & 0 deletions tests/tickets/14573/manual/widgetdraghandler.html
@@ -0,0 +1,16 @@
<textarea name="editor1">Editor 1</textarea>
<hr />
<textarea name="editor2">
Editor 2
<p><img alt="" src="%BASE_PATH%_assets/logo.png" /></p>
</textarea>
<script type="text/javascript">
CKEDITOR.replace( 'editor1' , {
extraPlugins: 'divarea',
allowedContent: true
});
CKEDITOR.replace( 'editor2' , {
extraPlugins: 'divarea,image2',
allowedContent: true
});
</script>
6 changes: 6 additions & 0 deletions tests/tickets/14573/manual/widgetdraghandler.md
@@ -0,0 +1,6 @@
@bender-tags: 4.5.9, tc, 14573
@bender-ui: collapsed

1. Hover over CKEditor logo inside Editor 2.

**Expected**: Drag handler should appear over the top left corner of the image.

0 comments on commit d8486d5

Please sign in to comment.