mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
don't change URL bar when clicking on linkified rooms or users.
be aware of /user paths.
This commit is contained in:
parent
ad873c2b60
commit
de82ac3bc0
3 changed files with 33 additions and 34 deletions
|
@ -100,9 +100,9 @@ var sanitizeHtmlParams = {
|
|||
if (m) {
|
||||
var entity = m[1];
|
||||
if (entity[0] === '@') {
|
||||
attribs.href = '#'; // TODO
|
||||
attribs.href = '#/user/' + entity;
|
||||
}
|
||||
else if (entity[0] === '#') {
|
||||
else if (entity[0] === '#' || entity[0] === '!') {
|
||||
attribs.href = '#/room/' + entity;
|
||||
}
|
||||
delete attribs.target;
|
||||
|
|
|
@ -176,12 +176,12 @@ module.exports = React.createClass({
|
|||
|
||||
// this can technically be done anywhere but doing this here keeps all
|
||||
// the routing url path logic together.
|
||||
// if (this.onAliasClick) {
|
||||
// linkifyMatrix.onAliasClick = this.onAliasClick;
|
||||
// }
|
||||
// if (this.onUserClick) {
|
||||
// linkifyMatrix.onUserClick = this.onUserClick;
|
||||
// }
|
||||
if (this.onAliasClick) {
|
||||
linkifyMatrix.onAliasClick = this.onAliasClick;
|
||||
}
|
||||
if (this.onUserClick) {
|
||||
linkifyMatrix.onUserClick = this.onUserClick;
|
||||
}
|
||||
|
||||
window.addEventListener('resize', this.handleResize);
|
||||
this.handleResize();
|
||||
|
@ -761,29 +761,29 @@ module.exports = React.createClass({
|
|||
}
|
||||
},
|
||||
|
||||
// onAliasClick: function(event, alias) {
|
||||
// event.preventDefault();
|
||||
// dis.dispatch({action: 'view_room', room_alias: alias});
|
||||
// },
|
||||
onAliasClick: function(event, alias) {
|
||||
event.preventDefault();
|
||||
dis.dispatch({action: 'view_room', room_alias: alias});
|
||||
},
|
||||
|
||||
// onUserClick: function(event, userId) {
|
||||
// event.preventDefault();
|
||||
onUserClick: function(event, userId) {
|
||||
event.preventDefault();
|
||||
|
||||
// // var MemberInfo = sdk.getComponent('rooms.MemberInfo');
|
||||
// // var member = new Matrix.RoomMember(null, userId);
|
||||
// // ContextualMenu.createMenu(MemberInfo, {
|
||||
// // member: member,
|
||||
// // right: window.innerWidth - event.pageX,
|
||||
// // top: event.pageY
|
||||
// // });
|
||||
// var MemberInfo = sdk.getComponent('rooms.MemberInfo');
|
||||
// var member = new Matrix.RoomMember(null, userId);
|
||||
// ContextualMenu.createMenu(MemberInfo, {
|
||||
// member: member,
|
||||
// right: window.innerWidth - event.pageX,
|
||||
// top: event.pageY
|
||||
// });
|
||||
|
||||
// var member = new Matrix.RoomMember(null, userId);
|
||||
// if (!member) { return; }
|
||||
// dis.dispatch({
|
||||
// action: 'view_user',
|
||||
// member: member,
|
||||
// });
|
||||
// },
|
||||
var member = new Matrix.RoomMember(null, userId);
|
||||
if (!member) { return; }
|
||||
dis.dispatch({
|
||||
action: 'view_user',
|
||||
member: member,
|
||||
});
|
||||
},
|
||||
|
||||
onLogoutClick: function(event) {
|
||||
dis.dispatch({
|
||||
|
|
|
@ -96,8 +96,8 @@ function matrixLinkify(linkify) {
|
|||
}
|
||||
|
||||
// stubs, overwritten in MatrixChat's componentDidMount
|
||||
// matrixLinkify.onUserClick = function(e, userId) { e.preventDefault(); };
|
||||
// matrixLinkify.onAliasClick = function(e, roomAlias) { e.preventDefault(); };
|
||||
matrixLinkify.onUserClick = function(e, userId) { e.preventDefault(); };
|
||||
matrixLinkify.onAliasClick = function(e, roomAlias) { e.preventDefault(); };
|
||||
|
||||
var escapeRegExp = function(string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
|
@ -113,7 +113,6 @@ matrixLinkify.VECTOR_URL_PATTERN = "^(?:https?:\/\/)?(?:"
|
|||
matrixLinkify.MATRIXTO_URL_PATTERN = "^(?:https?:\/\/)?(?:www\\.)?matrix\\.to/#/((#|@).*)";
|
||||
|
||||
matrixLinkify.options = {
|
||||
/*
|
||||
events: function (href, type) {
|
||||
switch (type) {
|
||||
case "userid":
|
||||
|
@ -130,7 +129,7 @@ matrixLinkify.options = {
|
|||
};
|
||||
}
|
||||
},
|
||||
*/
|
||||
|
||||
formatHref: function (href, type) {
|
||||
switch (type) {
|
||||
case 'roomalias':
|
||||
|
@ -148,9 +147,9 @@ matrixLinkify.options = {
|
|||
if (m) {
|
||||
var entity = m[1];
|
||||
if (entity[0] === '@') {
|
||||
return '#'; // TODO
|
||||
return '#/user/' + entity;
|
||||
}
|
||||
else if (entity[0] === '#') {
|
||||
else if (entity[0] === '#' || entity[0] === '!') {
|
||||
return '#/room/' + entity;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue