Skip to content

Commit

Permalink
Merge branch 'hotfix' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Kaszt committed Apr 9, 2015
2 parents 3e33dcc + b89707c commit 0d78b7f
Show file tree
Hide file tree
Showing 26 changed files with 225 additions and 20 deletions.
2 changes: 2 additions & 0 deletions build/changelog/entries/2015/03/10202.SUP-619.bugfix
@@ -0,0 +1,2 @@
When using internet explorer, it sometimes was possible to drag a block
into another block (instead of right after it). This has been fixed now.
5 changes: 5 additions & 0 deletions build/changelog/entries/2015/03/10203.SUP-619.bugfix
@@ -0,0 +1,5 @@
When using Internet Explorer, it was possible to navigate the cursor
into non-editable areas (blocks), because the contenteditable implementation
of IE is broken. This fix will move the cursor out of the non-editable area in
such cases. Additionally, it prevents inserting text into non-editable areas with
the keyboard, in cases where moving the cursor out did not work for some reasons.
4 changes: 4 additions & 0 deletions build/changelog/entries/2015/03/10204.SUP-622.bugfix
@@ -0,0 +1,4 @@
Errors in table-plugin:
* When pressing delete in a paragraph right before a link with a table after the paragraph, the cursor will jump into the first table cell.
* When pressing delete in a link in the last position before a table, the cursor will not jump into the first table cell but the table gets deleted.
Both errors have been fixed.
3 changes: 3 additions & 0 deletions build/changelog/entries/2015/03/10205.SUP-675.bugfix
@@ -0,0 +1,3 @@
Improve text of tooltips for the buttons which increase/decrease indentation
in lists. Escpecially the German tooltips where unclear in regard to the
expected action of the buttons.
5 changes: 5 additions & 0 deletions build/changelog/entries/2015/03/10206.SUP-503.bugfix
@@ -0,0 +1,5 @@
Selecting cells in tables has been improved:
When dragging the mouse over table cells, it is no
longer necessary to drag over the editable element in the cell.
Also selecting a cell range by clicking with the mouse (while holding
the SHIFT-key) has been improved when using Internet Explorer.
2 changes: 2 additions & 0 deletions build/changelog/entries/2015/03/10209.SUP-645.bugfix
@@ -0,0 +1,2 @@
After forward-deleting the last letter of a link, the cursor disappeared from the editable.
This has been fixed.
3 changes: 3 additions & 0 deletions build/changelog/entries/2015/04/10212.SUP-740.bugfix
@@ -0,0 +1,3 @@
When having the cursor on a link (in an editable that allows links) and
then clicking into an editable, that does not allow links, the "Insert Link"
button was shown in the "Insert" tab of the toolbar. This has been fixed now.
10 changes: 10 additions & 0 deletions build/changelog/mappings/0.25.28.json
@@ -0,0 +1,10 @@
{
"version": "0.25.28",
"date": "24.03.2015",
"changeLogEntryFileNames": [
"10204.SUP-622.bugfix",
"10202.SUP-619.bugfix",
"10203.SUP-619.bugfix"
],
"genericProperties": {}
}
10 changes: 10 additions & 0 deletions build/changelog/mappings/1.0.13.json
@@ -0,0 +1,10 @@
{
"version": "1.0.13",
"date": "24.03.2015",
"changeLogEntryFileNames": [
"10204.SUP-622.bugfix",
"10202.SUP-619.bugfix",
"10203.SUP-619.bugfix"
],
"genericProperties": {}
}
10 changes: 10 additions & 0 deletions build/changelog/mappings/1.0.14.json
@@ -0,0 +1,10 @@
{
"version": "1.0.14",
"date": "01.04.2015",
"changeLogEntryFileNames": [
"10205.SUP-675.bugfix",
"10206.SUP-503.bugfix",
"10209.SUP-645.bugfix"
],
"genericProperties": {}
}
10 changes: 10 additions & 0 deletions build/changelog/mappings/1.1.13.json
@@ -0,0 +1,10 @@
{
"version": "1.1.13",
"date": "25.03.2015",
"changeLogEntryFileNames": [
"10204.SUP-622.bugfix",
"10202.SUP-619.bugfix",
"10203.SUP-619.bugfix"
],
"genericProperties": {}
}
10 changes: 10 additions & 0 deletions build/changelog/mappings/1.1.14.json
@@ -0,0 +1,10 @@
{
"version": "1.1.14",
"date": "01.04.2015",
"changeLogEntryFileNames": [
"10205.SUP-675.bugfix",
"10206.SUP-503.bugfix",
"10209.SUP-645.bugfix"
],
"genericProperties": {}
}
8 changes: 8 additions & 0 deletions build/changelog/mappings/1.2.10.json
@@ -0,0 +1,8 @@
{
"version": "1.2.10",
"date": "09.04.2015",
"changeLogEntryFileNames": [
"10212.SUP-740.bugfix"
],
"genericProperties": {}
}
10 changes: 10 additions & 0 deletions build/changelog/mappings/1.2.8.json
@@ -0,0 +1,10 @@
{
"version": "1.2.8",
"date": "25.03.2015",
"changeLogEntryFileNames": [
"10204.SUP-622.bugfix",
"10202.SUP-619.bugfix",
"10203.SUP-619.bugfix"
],
"genericProperties": {}
}
10 changes: 10 additions & 0 deletions build/changelog/mappings/1.2.9.json
@@ -0,0 +1,10 @@
{
"version": "1.2.9",
"date": "01.04.2015",
"changeLogEntryFileNames": [
"10205.SUP-675.bugfix",
"10206.SUP-503.bugfix",
"10209.SUP-645.bugfix"
],
"genericProperties": {}
}
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -509,4 +509,4 @@
<url>http://artifactory.office/repository/lan.snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
</project>
9 changes: 8 additions & 1 deletion src/lib/aloha/engine.js
Expand Up @@ -7284,6 +7284,7 @@ define([
//@{
commands.forwarddelete = {
action: function (value, range) {
var deleteContentsRange;
// special behaviour for skipping zero-width whitespaces in IE7
if (Aloha.browser.msie && Aloha.browser.version <= 7) {
moveOverZWSP(range, true);
Expand Down Expand Up @@ -7402,8 +7403,14 @@ define([

// "Delete the contents of the range with start (node, offset) and
// end (node, end offset)."
deleteContents(node, offset, node, endOffset);
deleteContentsRange = deleteContents(node, offset, node, endOffset);

if (deleteContentsRange) {
// The new range position can only be determined inside deleteContents,
// that's why it's necessary to take over the range if one was returned.
range.setStart(deleteContentsRange.startContainer, deleteContentsRange.startOffset);
range.setEnd(deleteContentsRange.endContainer, deleteContentsRange.endOffset);
}
// "Abort these steps."
return;
}
Expand Down
8 changes: 8 additions & 0 deletions src/lib/aloha/markup.js
Expand Up @@ -495,6 +495,14 @@ define([
return true;
}

// Internet Explorer hack: IE would allow to move the cursor into non-editable areas.
// we cannot prevent this, without breaking the selection & copy/paste functionality.
// so we simply prevent any keypress events that would insert text into non-editable areas
// keypresses with the ctrl-key are allowed, because they trigger functionality like copying
if (Aloha.browser.msie && !Aloha.Selection.isSelectionEditable() && !event.ctrlKey) {
return false;
}

// BACKSPACE
if (event.keyCode === 8) {
event.preventDefault(); // prevent history.back() even on exception
Expand Down
4 changes: 3 additions & 1 deletion src/lib/aloha/selection.js
Expand Up @@ -732,7 +732,9 @@ define([
jQuery(range.commonAncestorContainer)
.closest('.aloha-editable').length > 0;

if (inEditable && !rangeStartInBlock(range)) {
// we only will move the selection out of the non-editable area (in an editable)
// if the range is collapsed (blinking cursor)
if (inEditable && range.isCollapsed()) {
var validStartPosition = this._validEditablePosition(range.startContainer);
var validEndPosition = this._validEditablePosition(range.endContainer);
var newPos;
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/common/block/lib/dragbehavior.js
Expand Up @@ -464,6 +464,11 @@ define([
if (this.$overElement &&
!this._isAllowedOverElement(this.$overElement[0])) {
this.enableInsertBeforeOrAfter(this.$overElement[0]);
// prevent dragging the block into a position, where it should not be
// when _isAllowedOverElement() return false, insertBeforeOrAfterMode must not be false
if (this.insertBeforeOrAfterMode === false) {
this.insertBeforeOrAfterMode = 'AFTER';
}
}

if (this.insertBeforeOrAfterMode !== false) {
Expand Down
14 changes: 13 additions & 1 deletion src/plugins/common/link/lib/link-plugin.js
Expand Up @@ -590,7 +590,19 @@ define([
}
this._isScopeActive = show;
this._isScopeActive_editableId = Aloha.activeEditable && Aloha.activeEditable.getId();
if ( show ) {
if (!configurations[this._isScopeActive_editableId]) {
this.hrefField.hide();
this._insertLinkButton.hide();
this._removeLinkButton.hide();
this._formatLinkButton.setState(false);
// The calls to enterScope and leaveScope by the link
// plugin are not balanced.
// When the selection is changed from one link to
// another, the link scope is incremented more than
// decremented, which necessitates the force=true
// argument to leaveScope.
Scopes.leaveScope(this.name, 'link', true);
} else if ( show ) {
this.hrefField.show();
this._insertLinkButton.hide();
// Never show the removeLinkButton when the link itself
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/common/list/nls/de/i18n.js
@@ -1,7 +1,7 @@
define({
"button.createulist.tooltip": "Unsortierte Liste einfügen",
"button.createolist.tooltip": "Sortierte Liste einfügen",
"button.indentlist.tooltip": "Liste einrücken",
"button.outdentlist.tooltip": "Liste ausrücken",
"button.indentlist.tooltip": "Einzug vergrößern",
"button.outdentlist.tooltip": "Einzug verkleinern",
"floatingmenu.tab.list": "Listen"
});
4 changes: 2 additions & 2 deletions src/plugins/common/list/nls/i18n.js
Expand Up @@ -2,8 +2,8 @@ define({
"root": {
"button.createulist.tooltip": "Insert Unordered List",
"button.createolist.tooltip": "Insert Ordered List",
"button.indentlist.tooltip": "Indent List",
"button.outdentlist.tooltip": "Outdent List",
"button.indentlist.tooltip": "Increase Indent",
"button.outdentlist.tooltip": "Decrease Indent",
"floatingmenu.tab.list": "Lists"
},
"ca": true,
Expand Down
56 changes: 54 additions & 2 deletions src/plugins/common/table/lib/table-cell.js
Expand Up @@ -165,6 +165,9 @@ define([
$wrapper.bind('mouseover', function ($event) {
cell._selectCellRange();
});
$elem.bind('mouseover', function ($event) {
cell._selectCellRange();
});

// we will treat the wrapper just like an editable
$wrapper.contentEditableSelectionChange(function ($event) {
Expand All @@ -178,8 +181,57 @@ define([
cell.wrapper.trigger('focus');
cell._selectAll($wrapper);
}, 1);
if (!$event.shiftKey) {
cell.tableObj.selection.unselectCells();
cell.tableObj.selection.baseCellPosition = [cell._virtualY(), cell._virtualX()];

if (!cell.tableObj.selection.lastBaseCellPosition) {
cell.tableObj.selection.lastBaseCellPosition = cell.tableObj.selection.baseCellPosition;
}

if ($event.shiftKey) {
// shift-click to select a coherent cell range
//
// in IE it's not possible to select multiple cells when you "select+drag" over other cells
// click into the first cell and then "shift-click" into the last cell of the coherent cell range you want to select
var right = cell.tableObj.selection.lastBaseCellPosition[1];
var bottom = cell.tableObj.selection.lastBaseCellPosition[0];
var topLeft = cell.tableObj.selection.baseCellPosition;
var left = topLeft[1];
if (left > right) {
left = right;
right = topLeft[1];
}
var top = topLeft[0];
if (top > bottom) {
top = bottom;
bottom = topLeft[0];
}
var rect = {
"top": top,
"right": right,
"bottom": bottom,
"left": left
};

var table = cell.tableObj;
var $rows = table.obj.children().children('tr');
var grid = Utils.makeGrid($rows);

table.selection.selectedCells = [];
var selectClass = table.get('classCellSelected');
Utils.walkGrid(grid, function (cellInfo, j, i) {
if (Utils.containsDomCell(cellInfo)) {
if (i >= rect.top && i <= rect.bottom && j >= rect.left && j <= rect.right) {
jQuery(cellInfo.cell).addClass(selectClass);
table.selection.selectedCells.push(cellInfo.cell);
} else {
jQuery(cellInfo.cell).removeClass(selectClass);
}
}
});

table.selection.notifyCellsSelected();
} else {
cell.tableObj.selection.lastBaseCellPosition = cell.tableObj.selection.baseCellPosition;
cell._startCellSelection();
}
$event.stopPropagation();
Expand Down
31 changes: 24 additions & 7 deletions src/plugins/common/table/lib/table.js
Expand Up @@ -474,20 +474,38 @@ define([
return false;
}

/**
* Get the next sibling of the parent that is not null.
* If the parent has no sibling, get the next sibling of it's parent.
* Repeat until a sibling is found or the parent is null
* @param {Node} node
* @return {Node}
*/
function getNextParentSiblingRecur(node) {
if (node.parentNode) {
return node.parentNode.nextSibling || getNextParentSiblingRecur(node.parentNode);
} else {
return null;
}
}

Aloha.bind('aloha-command-will-execute', function (_, event){
var range = Aloha.getSelection().getRangeAt(0);
var adjacent;
var adjacent = null;
//if forwarddelete is invoked before the table, jump into first table cell instead of deleting the table
if ('forwarddelete' === event.commandId) {
if (!range.collapsed || !isRangeVisiblyAtRightBoundary(range)) {
return;
}
var node = range.commonAncestorContainer;
if (3 === node.nodeType) {
adjacent = node.parentNode
&& Html.findNodeLeft(
node.parentNode.nextSibling,
isNotUnrenderedNode
);
if(node.nextSibling === null) {
adjacent = node.parentNode
&& Html.findNodeLeft(
getNextParentSiblingRecur(node),
isNotUnrenderedNode
);
}
} else if (1 === node.nodeType) {
adjacent = Html.findNodeLeft(
node.nextSibling,
Expand Down Expand Up @@ -747,7 +765,6 @@ define([
thisWai.removeClass(waiGreen + ' ' + waiRed);

// Y U NO explain why we must check that summary is longer than 5 characters?
// http://cdn3.knowyourmeme.com/i/000/089/665/original/tumblr_l96b01l36p1qdhmifo1_500.jpg

if (jQuery.trim(this.obj[0].summary) !== '') {
thisWai.addClass(waiGreen);
Expand Down
6 changes: 3 additions & 3 deletions src/test/unit/bold.html
Expand Up @@ -147,16 +147,16 @@
execResult: 'foo[<b>bar</b><i><b>bam]</b>baz</i>'
},
{ start: 'foo<span contenteditable=false>[bar]</span>baz',
execResult: '<b>[foo<span contenteditable=false>bar</span>baz]</b>'
execResult: 'foo<span contenteditable=false><b>[bar]</b></span>baz'
},
{ start: 'fo[o<span contenteditable=false>bar</span>b]az',
execResult: 'fo[<b>o<span contenteditable=false>bar</span>b]</b>az'
},
{ start: 'foo<span contenteditable=false>ba[r]</span>baz',
execResult: '<b>[foo<span contenteditable=false>bar</span>baz]</b>'
execResult: 'foo<span contenteditable=false>ba[<b>r]</b></span>baz'
},
{ start: 'fo[o<span contenteditable=false>b]ar</span>baz',
execResult: 'fo[<b>o]</b><span contenteditable=false>bar</span>baz'
execResult: 'fo[<b>o</b><span contenteditable=false><b>b]</b>ar</span>baz'
},
{ start: 'fo[<b>o</b><span contenteditable=false>bar</span><b>b</b>]az',
execResult: 'fo[o<span contenteditable=false>bar</span>b]az'
Expand Down

0 comments on commit 0d78b7f

Please sign in to comment.