Skip to content

Commit

Permalink
Merge branch 'hotfix-1.3.x' into hotfix
Browse files Browse the repository at this point in the history
Conflicts:
	src/plugins/common/link/lib/link-plugin.js
  • Loading branch information
Bernhard Kaszt committed Nov 18, 2015
2 parents 48d0da8 + e319351 commit 1a763b5
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 12 deletions.
6 changes: 6 additions & 0 deletions build/changelog/entries/2015/11/10403.SUP-2110.bugfix
@@ -0,0 +1,6 @@
When using the targetregex, cssclassregex and titleregex settings of the link plugin,
the corresponding attribute was not removed, when the current href did not match the
pattern. This has been fixed, and the behavior of this settings has been changed so
that the automatically set values will only be set, when the href of the currently
selected link changes, but not if another link is selected, which means that manual
changes to these attributes will be preserved, so long as the link href does not change.
2 changes: 2 additions & 0 deletions build/changelog/entries/2015/11/10405.SUP-1041.bugfix
@@ -0,0 +1,2 @@
The handling of @<br>@ tags in empty paragraphs was consistent
across browsers. This has been fixed.
9 changes: 9 additions & 0 deletions build/changelog/mappings/1.2.40.json
@@ -0,0 +1,9 @@
{
"version": "1.2.40",
"date": "18.11.2015",
"changeLogEntryFileNames": [
"10405.SUP-1041.bugfix",
"10403.SUP-2110.bugfix"
],
"genericProperties": {}
}
9 changes: 9 additions & 0 deletions build/changelog/mappings/1.3.20.json
@@ -0,0 +1,9 @@
{
"version": "1.3.20",
"date": "18.11.2015",
"changeLogEntryFileNames": [
"10405.SUP-1041.bugfix",
"10403.SUP-2110.bugfix"
],
"genericProperties": {}
}
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>com.gentics</groupId>
<artifactId>junit-selenium-qunit-runner</artifactId>
<version>0.9.3</version>
<version>0.9.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -509,4 +509,4 @@
<url>http://artifactory.office/repository/lan.snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
</project>
20 changes: 12 additions & 8 deletions src/lib/aloha/editable.js
Expand Up @@ -968,20 +968,14 @@ define([
*/
smartContentChange: function (event) {
var me = this,
uniChar = null,
re,
match;
uniChar = null;

// ignore meta keys like crtl+v or crtl+l and so on
if (event && (event.metaKey || event.crtlKey || event.altKey)) {
return false;
}

if (event && event.originalEvent) {
// regex to strip unicode
re = new RegExp("U\\+(\\w{4})");
match = re.exec(event.originalEvent.keyIdentifier);

if (event) {
// Use among browsers reliable which http://api.jquery.com/keypress
uniChar = (this.keyCodeMap[this.keyCode] || String.fromCharCode(event.which) || 'unknown');
}
Expand Down Expand Up @@ -1056,6 +1050,16 @@ define([
}, this.sccDelay);

} else if (uniChar !== null) {
var range = Aloha.Selection.getRangeObject();

if (range.startContainer == range.endContainer) {
var $children = $(range.startContainer).children();

if ($children.length == 1 && $children.is('br')) {
$children.remove();
}
}

// in the rare case idle time is lower then delay time
clearTimeout(this.sccTimerDelay);
clearTimeout(this.sccTimerIdle);
Expand Down
10 changes: 8 additions & 2 deletions src/plugins/common/link/lib/link-plugin.js
Expand Up @@ -1215,8 +1215,12 @@ define([
* Updates the link object depending on the src field
*/
hrefChange: function () {
var hrefTargetObject = this.hrefField.getTargetObject();
var setAutoValues = hrefTargetObject && !hrefTargetObject.getAttribute('data-ignore-auto-values');
var that = this;

// No need to check setAutoValues here, since the title will not be
// changed anyway once a custom title has been set.
this.automaticallySetTitle(
this.hrefField,
this.title,
Expand All @@ -1226,7 +1230,7 @@ define([
// For now hard coded attribute handling with regex.
// Avoid creating the target attribute, if it's unnecessary, so
// that XSS scanners (AntiSamy) don't complain.
if ( this.target != '' ) {
if (setAutoValues && this.target) {
this.hrefField.setAttribute(
'target',
this.target,
Expand All @@ -1235,7 +1239,7 @@ define([
);
}

if (null != this.cssclassregex) {
if (setAutoValues && null != this.cssclassregex) {
this.hrefField.setAttribute(
'class',
this.cssclass,
Expand Down Expand Up @@ -1352,7 +1356,9 @@ define([
that.prepareAnchor(foundMarkup.href);

// now we are ready to set the target object
foundMarkup.setAttribute('data-ignore-auto-values', 'true');
that.hrefField.setTargetObject(foundMarkup, 'href');
foundMarkup.removeAttribute('data-ignore-auto-values');
addAdditionalTargetObject(rangeObject, that.hrefField);
that.stripAnchor();
if (that.hrefField.getItem()) {
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/common/ui/lib/port-helper-attribute-field.js
Expand Up @@ -385,6 +385,8 @@ define([
executeForTargets(function (target) {
target.attr(attr, value);
});
} else {
$(targetObject).removeAttr(attr);
}
}
}
Expand Down Expand Up @@ -413,10 +415,20 @@ define([
return;
}

var ignoreAutoValues = targetObject.getAttribute('data-ignore-auto-values');

// check whether a repository item is linked to the object
RepositoryManager.getObject( obj, function ( items ) {
if (items && items.length > 0) {
if (ignoreAutoValues) {
targetObject.setAttribute('data-ignore-auto-values', ignoreAutoValues);
}

setItem(items[0]);

if (ignoreAutoValues) {
targetObject.removeAttribute('data-ignore-auto-values');
}
}
} );
}
Expand Down

0 comments on commit 1a763b5

Please sign in to comment.