1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Drag & Drop: set a link as external

Summary:
Rest assured: external links remain evil, by default.

Don't adopt them randomly by induction.

Whether you believe it or not, this specific external
link merited some deep thoughts on Phorge:

- https://we.phorge.it/T15172

So, whenever you use a mouse, a finger, or whenever we have
a confirmation dialog or not to prevent onblur disasters,
this change is probably consistent with common expectations.

Having said, external links remain evil - by default.

Closes T15172

Test Plan:
- Drag & Drop a File on a Remarkup text
- click on the link inside the popup
- it opens in a new tab (without risk of form loss)

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15172

Differential Revision: https://we.phorge.it/D25077
This commit is contained in:
Valerio Bozzolan 2023-03-17 13:13:13 +01:00
parent 4f356838be
commit b33e373503

View file

@ -115,7 +115,19 @@ JX.install('PhabricatorFileUpload', {
switch (this.getStatus()) { switch (this.getStatus()) {
case 'done': case 'done':
var link = JX.$N('a', {href: this.getPageURI()}, this.getMonogram());
// In this case the File upload was successful
var linkAttr = {};
linkAttr.href = this.getPageURI();
// External links are evil as default.
// Believe it or not, but some Phorge users brainstormed
// for one hour for this specific target="_blank".
// https://we.phorge.it/T15172
linkAttr.target = '_blank';
var link = JX.$N('a', linkAttr, this.getMonogram());
content = [ content = [
JX.$N('strong', {}, ['Upload Complete (', link, ')']), JX.$N('strong', {}, ['Upload Complete (', link, ')']),