Skip to content

Commit

Permalink
Merge branch 'MDL-50079-master' of git://github.com/danpoltawski/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 13, 2015
2 parents 29caaef + cc75779 commit 8775bc4
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
*/
_setLink: function(e) {
var input,
target,
selectednode,
anchornodes,
value;

e.preventDefault();
Expand All @@ -221,22 +218,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
}

// Add the link.
selectednode = this._setLinkOnSelection(value);

// Note this is a document fragment and YUI doesn't like them.
if (!selectednode) {
return;
}

anchornodes = this._findSelectedAnchors(Y.one(selectednode));
Y.Array.each(anchornodes, function(anchornode) {
target = this._content.one('.newwindow');
if (target.get('checked')) {
anchornode.setAttribute('target', '_blank');
} else {
anchornode.removeAttribute('target');
}
}, this);
this._setLinkOnSelection(value);

this.markUpdated();
}
Expand All @@ -253,7 +235,9 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
_setLinkOnSelection: function(url) {
var host = this.get('host'),
link,
selectednode;
selectednode,
target,
anchornodes;

this.editor.focus();
host.setSelection(this._currentSelection);
Expand All @@ -274,6 +258,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
selectednode = host.getSelectionParentNode();
}

// Note this is a document fragment and YUI doesn't like them.
if (!selectednode) {
return;
}

anchornodes = this._findSelectedAnchors(Y.one(selectednode));
// Add new window attributes if requested.
Y.Array.each(anchornodes, function(anchornode) {
target = this._content.one('.newwindow');
if (target.get('checked')) {
anchornode.setAttribute('target', '_blank');
} else {
anchornode.removeAttribute('target');
}
}, this);

return selectednode;
},

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
*/
_setLink: function(e) {
var input,
target,
selectednode,
anchornodes,
value;

e.preventDefault();
Expand All @@ -221,22 +218,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
}

// Add the link.
selectednode = this._setLinkOnSelection(value);

// Note this is a document fragment and YUI doesn't like them.
if (!selectednode) {
return;
}

anchornodes = this._findSelectedAnchors(Y.one(selectednode));
Y.Array.each(anchornodes, function(anchornode) {
target = this._content.one('.newwindow');
if (target.get('checked')) {
anchornode.setAttribute('target', '_blank');
} else {
anchornode.removeAttribute('target');
}
}, this);
this._setLinkOnSelection(value);

this.markUpdated();
}
Expand All @@ -253,7 +235,9 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
_setLinkOnSelection: function(url) {
var host = this.get('host'),
link,
selectednode;
selectednode,
target,
anchornodes;

this.editor.focus();
host.setSelection(this._currentSelection);
Expand All @@ -274,6 +258,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
selectednode = host.getSelectionParentNode();
}

// Note this is a document fragment and YUI doesn't like them.
if (!selectednode) {
return;
}

anchornodes = this._findSelectedAnchors(Y.one(selectednode));
// Add new window attributes if requested.
Y.Array.each(anchornodes, function(anchornode) {
target = this._content.one('.newwindow');
if (target.get('checked')) {
anchornode.setAttribute('target', '_blank');
} else {
anchornode.removeAttribute('target');
}
}, this);

return selectednode;
},

Expand Down
40 changes: 20 additions & 20 deletions lib/editor/atto/plugins/link/yui/src/button/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,6 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
*/
_setLink: function(e) {
var input,
target,
selectednode,
anchornodes,
value;

e.preventDefault();
Expand All @@ -219,22 +216,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
}

// Add the link.
selectednode = this._setLinkOnSelection(value);

// Note this is a document fragment and YUI doesn't like them.
if (!selectednode) {
return;
}

anchornodes = this._findSelectedAnchors(Y.one(selectednode));
Y.Array.each(anchornodes, function(anchornode) {
target = this._content.one('.newwindow');
if (target.get('checked')) {
anchornode.setAttribute('target', '_blank');
} else {
anchornode.removeAttribute('target');
}
}, this);
this._setLinkOnSelection(value);

this.markUpdated();
}
Expand All @@ -251,7 +233,9 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
_setLinkOnSelection: function(url) {
var host = this.get('host'),
link,
selectednode;
selectednode,
target,
anchornodes;

this.editor.focus();
host.setSelection(this._currentSelection);
Expand All @@ -272,6 +256,22 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
selectednode = host.getSelectionParentNode();
}

// Note this is a document fragment and YUI doesn't like them.
if (!selectednode) {
return;
}

anchornodes = this._findSelectedAnchors(Y.one(selectednode));
// Add new window attributes if requested.
Y.Array.each(anchornodes, function(anchornode) {
target = this._content.one('.newwindow');
if (target.get('checked')) {
anchornode.setAttribute('target', '_blank');
} else {
anchornode.removeAttribute('target');
}
}, this);

return selectednode;
},

Expand Down

0 comments on commit 8775bc4

Please sign in to comment.