World links.

This commit is contained in:
armored-dragon 2024-11-30 09:29:08 -06:00
parent 01542d7ea6
commit e340741dce
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 61 additions and 14 deletions

View file

@ -118,7 +118,7 @@
let formattedMessagePacket = { ...message };
formattedMessagePacket.message = formattedMessage
_emitEvent({ type: "show_message", ...formattedMessagePacket }); // Update qml view of to new message.
_emitEvent({ type: "show_message", ...formattedMessagePacket }); // Update qml view of to new message.
_notificationCoreMessage(message.displayName, message.message) // Show a new message on screen.
// Create a new variable based on the message that will be saved.
@ -291,7 +291,7 @@
function _parseMessage(message){
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
const mentionRegex = /@(\w+)/; // FIXME: Remove - devcode
const overteLocationRegex = null;
const overteLocationRegex = /hifi:\/\/[a-zA-Z0-9_-]+\/[-+]?\d*\.?\d+,[+-]?\d*\.?\d+,[+-]?\d*\.?\d+\/[-+]?\d*\.?\d+,[+-]?\d*\.?\d+,[+-]?\d*\.?\d+,[+-]?\d*\.?\d+/;
let runningMessage = message;
let messageArray = [];

View file

@ -414,6 +414,7 @@ Rectangle {
anchors.top: parent.children[0].bottom;
width: parent.width * 0.8
x: 5
id: messageBoxFlow
Repeater {
model: texttest;
@ -432,7 +433,7 @@ Rectangle {
text: model.value || ""
font.pointSize: 12
wrapMode: Text.Wrap
width: Math.min(parent.parent.parent.width, contentWidth);
width: Math.min(messageBoxFlow.width, contentWidth);
visible: model.type === 'text' || model.type === 'mention';
@ -447,41 +448,87 @@ Rectangle {
}
RowLayout {
width: Math.min(parent.parent.parent.width, children[0].contentWidth);
width: Math.min(messageBoxFlow.width, children[0].contentWidth);
visible: model.type === 'url';
Text {
text: model.value || ""
font.pointSize: 12
wrapMode: Text.Wrap
text: model.value || "";
font.pointSize: 12;
wrapMode: Text.Wrap;
color: "#4EBAFD";
font.underline: true
font.underline: true;
width: parent.width;
MouseArea {
anchors.fill: parent;
onClicked: {
Window.openWebBrowser(model.value)
Window.openWebBrowser(model.value);
}
}
}
Text {
text: "🗗"
font.pointSize: 10
wrapMode: Text.Wrap
color: "white"
text: "🗗";
font.pointSize: 10;
wrapMode: Text.Wrap;
color: "white";
MouseArea {
anchors.fill: parent;
onClicked: {
Qt.openUrlExternally(model.value)
Qt.openUrlExternally(model.value);
}
}
}
}
RowLayout {
visible: model.type === 'overteLocation';
width: Math.min(messageBoxFlow.width, children[0].children[1].contentWidth + 35);
height: 20;
Layout.leftMargin: 5
Layout.rightMargin: 5
Rectangle {
width: parent.width;
height: 20;
color: "lightgray"
radius: 2;
Image {
source: "./img/ui/world_black.png"
width: 18;
height: 18;
sourceSize.width: 18
sourceSize.height: 18
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 2
anchors.rightMargin: 10
}
Text {
text: model.value.split('hifi://')[1].split('/')[0];
color: "black"
font.pointSize: 12
x: parent.children[0].width + 5;
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent;
onClicked: {
Window.openUrl(model.value);
}
}
}
}
Item {
Layout.fillWidth: true
visible: model.type === 'messageEnd'