diff --git a/build/changelog/entries/2015/04/10220.SUP-845.bugfix b/build/changelog/entries/2015/04/10220.SUP-845.bugfix new file mode 100644 index 0000000000..af29e74383 --- /dev/null +++ b/build/changelog/entries/2015/04/10220.SUP-845.bugfix @@ -0,0 +1,4 @@ +The Word content handler now replaces unnecessary new line characters +added by Word with spaces. This fixes bug SUP-845, in which spaces got +lost, because new line characters are automatically stripped when using +the Text/HTML GCN tag part type. diff --git a/build/changelog/entries/2015/04/10221.SUP-827.bugfix b/build/changelog/entries/2015/04/10221.SUP-827.bugfix new file mode 100644 index 0000000000..3879d3a31e --- /dev/null +++ b/build/changelog/entries/2015/04/10221.SUP-827.bugfix @@ -0,0 +1,4 @@ +When a URL was pasted into the input field of the toolbar +using the context menu, the URL was not stored into the link, unless +a key was also pressed. +This has been fixed now. diff --git a/build/changelog/mappings/1.0.15.json b/build/changelog/mappings/1.0.15.json new file mode 100644 index 0000000000..0f8510b695 --- /dev/null +++ b/build/changelog/mappings/1.0.15.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.15", + "date": "15.04.2015", + "changeLogEntryFileNames": [ + "10217.SUP-763.bugfix", + "10216.SUP-749.bugfix", + "10210.SUP-158.bugfix", + "10214.SUP-744.enhancement", + "10211.SUP-158.bugfix", + "10218.SUP-763.bugfix", + "10213.SUP-143.bugfix", + "10212.SUP-740.bugfix" + ], + "genericProperties": {} +} \ No newline at end of file diff --git a/src/plugins/common/contenthandler/lib/wordcontenthandler.js b/src/plugins/common/contenthandler/lib/wordcontenthandler.js index 8314e505b0..255bbf279c 100755 --- a/src/plugins/common/contenthandler/lib/wordcontenthandler.js +++ b/src/plugins/common/contenthandler/lib/wordcontenthandler.js @@ -159,6 +159,29 @@ define([ } } + /** + * Replaces unnecessary new line characters within text nodes in Word HTML + * with a space. + * + * @param {jQuery.} $content + */ + function replaceWordNewLines($content) { + var i; + var $nodes = $content.contents(); + var node; + + for (i = 0; i < $nodes.length; i++) { + node = $nodes[i]; + + if (Node.TEXT_NODE === node.nodeType) { + var text = node.nodeValue; + node.nodeValue = text.replace(/[\r\n]+/gm, ' '); + } else { + replaceWordNewLines($nodes.eq(i)); + } + } + } + /** * Cleanup MS Word HTML. * @@ -198,6 +221,7 @@ define([ } removeUnrenderedChildNodes($content); + replaceWordNewLines($content); } /** diff --git a/src/plugins/common/ui/lib/port-helper-attribute-field.js b/src/plugins/common/ui/lib/port-helper-attribute-field.js index ccc67da2c7..3bca6925e2 100644 --- a/src/plugins/common/ui/lib/port-helper-attribute-field.js +++ b/src/plugins/common/ui/lib/port-helper-attribute-field.js @@ -131,7 +131,8 @@ define([ .bind("focus", onFocus) .bind("blur", onBlur) .bind("keydown", onKeyDown) - .bind("keyup", onKeyup); + .bind("keyup", onKeyup) + .bind("change", onChange); setPlaceholder(); @@ -140,6 +141,25 @@ define([ // TODO unbind, otherwise mermory leak Aloha.bind('aloha-editable-deactivated', onBlur); + /** + * Update the attribute in the target element + */ + function updateTarget() { + // If this attribute field currently refers to a repository + // item, and the user edits the contents of the input field, + // this attribute field seizes to refer to the repository item. + if (resourceItem && resourceValue !== getValue()) { + resourceItem = null; + resourceValue = null; + } + + // This handles attribute updates for non-repository, literal urls typed into the input field. + // Input values that refer to a repository item are handled via setItem(). + if ( ! resourceItem ) { + setAttribute(targetAttribute, getValue()); + } + } + function onSelect(event, ui) { if (ui.item) { setItem(ui.item.obj); @@ -180,19 +200,7 @@ define([ } function onKeyup(event) { - // If this attribute field currently refers to a repository - // item, and the user edits the contents of the input field, - // this attribute field seizes to refer to the repository item. - if (resourceItem && resourceValue !== getValue()) { - resourceItem = null; - resourceValue = null; - } - - // This handles attribute updates for non-repository, literal urls typed into the input field. - // Input values that refer to a repository item are handled via setItem(). - if ( ! resourceItem ) { - setAttribute(targetAttribute, getValue()); - } + updateTarget(); if ( ( event.keyCode == 13 || event.keyCode == 27 ) ) { // Set focus to link element and select the object @@ -201,6 +209,10 @@ define([ } } + function onChange(event) { + updateTarget(); + } + function finishEditing() { restoreTargetBackground();