{{scopedProps.message.data.meta}}
@@ -204,6 +205,7 @@ export default {
m.type = 'system';
m.data.text = 'This message has been removed';
},
+ downloadMessage(message){},
like(id){
const m = this.messageList.findIndex(m => m.id === id);
var msg = this.messageList[m];
diff --git a/demo/src/messageHistory.js b/demo/src/messageHistory.js
index cbdabb16..f59ad508 100644
--- a/demo/src/messageHistory.js
+++ b/demo/src/messageHistory.js
@@ -21,5 +21,15 @@ export default [
{ type: 'text', author: `me`, id: 18, data: { text: `Do you read me...`, meta: '✓✓ Read' } },
{ type: 'text', author: `me`, id: 19, data: { text: `...or not?`, meta: '✓ Delivered' } },
{ type: 'system', id: 20, data: { text: 'User changed security key', meta: '04-08-2018 15:57' } },
- { type: 'text', author: `support`, id: 21, data: { text: `What about suggestions?` }, suggestions: ["Looks good!", "It's OK.", "Uhh.. Do I really have to say something?", "This suggestion is way too long for css purpose. Let's make it long... Longer, and more and more.. Never ending."] }
+ { type: 'text', author: `support`, id: 21, data: { text: `What about suggestions?` }, suggestions: ["Looks good!", "It's OK.", "Uhh.. Do I really have to say something?", "This suggestion is way too long for css purpose. Let's make it long... Longer, and more and more.. Never ending."] },
+ { type: 'file', author: `me`, id: 22, data: { meta: '12-11-2020 15:57', file: {id:"122134", mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.docx"} } },
+ { type: 'file', author: `me`, id: 23, data: { meta: '12-11-2020 15:57', file: {id:"122135", mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.xlsx"} } },
+ { type: 'file', author: `me`, id: 24, data: { meta: '12-11-2020 15:57', file: {id:"122136", mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.pptx"} } },
+ { type: 'file', author: `me`, id: 25, data: { meta: '12-11-2020 15:57', file: {id:"122137", mime:"application/zip", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.zip"} } },
+ { type: 'file', author: `me`, id: 26, data: { meta: '12-11-2020 15:57', file: {id:"122138", mime:"image/jpeg", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.jpg"} } },
+ { type: 'file', author: `me`, id: 27, data: { meta: '12-11-2020 15:57', file: {id:"122139", mime:"image/svg+xml", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.svg"} } },
+ { type: 'file', author: `me`, id: 28, data: { meta: '12-11-2020 15:57', file: {id:"1221310", mime:"text/csv", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.csv"} } },
+ { type: 'file', author: `me`, id: 29, data: { meta: '12-11-2020 15:57', file: {id:"1221311", mime:"image/png", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.png"} } },
+ { type: 'file', author: `me`, id: 30, data: { meta: '12-11-2020 15:57', file: {id:"1221312", mime:"application/pdf", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.pdf"} } },
+ { type: 'file', author: `me`, id: 30, data: { meta: '12-11-2020 15:57', file: {id:"1221312", mime:"text/html", size:"108604", name: "ScreenShot 2020-10-21 à 21.38.52.html"} } }
]
diff --git a/package.json b/package.json
index 71b352f9..cc56344e 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,8 @@
"kind-of": "6.0.3",
"minimist": "1.2.3",
"msgdown": "^1.0.2",
+ "pretty-bytes": "^5.4.1",
+ "smart-truncate": "^1.0.1",
"v-tooltip": "^2.0.1"
},
"devDependencies": {
diff --git a/src/ChatWindow.vue b/src/ChatWindow.vue
index 72e92f43..91adf570 100644
--- a/src/ChatWindow.vue
+++ b/src/ChatWindow.vue
@@ -26,6 +26,7 @@
:message-styling="messageStyling"
@scrollToTop="$emit('scrollToTop')"
@remove="$emit('remove', $event)"
+ @download="$emit('download', $event)"
>
diff --git a/src/Launcher.vue b/src/Launcher.vue
index 89411a4d..d1df6772 100644
--- a/src/Launcher.vue
+++ b/src/Launcher.vue
@@ -36,6 +36,7 @@
@onType="$emit('onType')"
@edit="$emit('edit', $event)"
@remove="$emit('remove', $event)"
+ @download="$emit('download', $event)"
>
diff --git a/src/Message.vue b/src/Message.vue
index 652452d5..906887a4 100644
--- a/src/Message.vue
+++ b/src/Message.vue
@@ -1,5 +1,5 @@
-
@@ -67,6 +77,7 @@
@@ -40,25 +92,23 @@ export default {
-webkit-font-smoothing: subpixel-antialiased;
}
-.sc-message--content.sent .sc-message--file {
+.sc-message--content .sc-message--file {
word-wrap: break-word;
+ padding: 5px;
+ width: 223px;
}
-.sc-message--file-icon {
- text-align: center;
- margin-left: auto;
- margin-right: auto;
- margin-top: 15px;
- margin-bottom: 0px;
-}
+.sc-message--file-content {
+ font-size: small;
+ float: right;
-.sc-image {
- max-width: 100%;
- min-width: 100%;
+ .sc-message--file-download-icon {
+ float: right;
+ cursor: pointer;
+ }
}
.sc-message--file-text {
- padding: 17px 20px;
border-radius: 6px;
font-weight: 300;
font-size: 14px;
@@ -69,11 +119,9 @@ export default {
.sc-message--file-name {
color: white;
- padding-left: 15px;
- padding-right: 15px;
- padding-top: 0;
- font-size: x-small;
- text-align: center;
+ margin-top: 7px;
+ text-align: left;
+ width: 148px;
}
.sc-message--file-name a {
@@ -94,7 +142,6 @@ export default {
.sc-message--content.received .sc-message--file {
color: #263238;
background-color: #f4f7f9;
- margin-right: 40px;
}
.sc-message--content.received .sc-message--file-name {
@@ -108,4 +155,24 @@ export default {
.sc-message--content.received .sc-message--file a:hover {
color: #0c0c0c;
}
+
+.sc-message--file-icon {
+ float: left;
+}
+
+.sc-message--file-icon svg {
+ fill: #000000;
+ height: 60px;
+ width: 60px;
+}
+
+.sc-message--file-download-icon svg {
+ fill: #000000;
+ stroke: #000000;
+}
+
+.sc-message--content.sent svg {
+ fill: #ffffff;
+ stroke: #ffffff;
+}
diff --git a/src/messages/ImageMessage.vue b/src/messages/ImageMessage.vue
new file mode 100644
index 00000000..56dbdc43
--- /dev/null
+++ b/src/messages/ImageMessage.vue
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
{{data.text}}
{{data.meta}}
+
+
+
+
+
+
diff --git a/yarn.lock b/yarn.lock
index 02a5425c..c91a9132 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7063,6 +7063,11 @@ prettier@^2.0.2:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==
+pretty-bytes@^5.4.1:
+ version "5.4.1"
+ resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.4.1.tgz#cd89f79bbcef21e3d21eb0da68ffe93f803e884b"
+ integrity sha512-s1Iam6Gwz3JI5Hweaz4GoCD1WUNUIyzePFy5+Js2hjwGVt2Z79wNN+ZKOZ2vB6C+Xs6njyB84Z1IthQg8d9LxA==
+
pretty-error@^2.0.2:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
@@ -7898,6 +7903,11 @@ slice-ansi@^4.0.0:
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"
+smart-truncate@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/smart-truncate/-/smart-truncate-1.0.1.tgz#a2173d7abc724a5a30e1b63af88616228b14a475"
+ integrity sha512-f+kSLMDWKSCpYhwOZM+Da4d8klk5nY4gH57HOEOaaotsZEsTIm/51/9vKDNE26WjU72eBM1zEYdQl6uDwvZfLg==
+
snapdragon-node@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"