From 2162ef20b0d00a098c9968ca6c141bccd5efb29f Mon Sep 17 00:00:00 2001 From: eal Date: Tue, 19 Sep 2017 22:43:20 +0300 Subject: Add emoji completion. --- src/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index d1f99fa5..a13569d6 100644 --- a/src/main.js +++ b/src/main.js @@ -102,3 +102,13 @@ window.fetch('/static/terms-of-service.html') .then((html) => { store.dispatch('setOption', { name: 'tos', value: html }) }) + +window.fetch('/static/emoji.txt') + .then((res) => res.text()) + .then((csv) => { + const emoji = csv.split('\n').map((row) => { + const values = row.split(', ') + return { shortcode: values[0], url: values[1] } + }) + store.dispatch('setOption', { name: 'emoji', value: emoji }) + }) -- cgit v1.2.3-70-g09d2 From f4b1319eff7562ff71181a75f967de6ec52337c2 Mon Sep 17 00:00:00 2001 From: eal Date: Tue, 19 Sep 2017 22:54:54 +0300 Subject: Actually fix image url. --- src/components/post_status_form/post_status_form.js | 2 +- src/main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.js') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 6d89b051..2e0aafd0 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -72,7 +72,7 @@ const PostStatusForm = { // eslint-disable-next-line camelcase screen_name: `:${shortcode}:`, name: '', - img: url + img: image-url })) } else { return false diff --git a/src/main.js b/src/main.js index a13569d6..2ab548a6 100644 --- a/src/main.js +++ b/src/main.js @@ -108,7 +108,7 @@ window.fetch('/static/emoji.txt') .then((csv) => { const emoji = csv.split('\n').map((row) => { const values = row.split(', ') - return { shortcode: values[0], url: values[1] } + return { shortcode: values[0], image-url: values[1] } }) store.dispatch('setOption', { name: 'emoji', value: emoji }) }) -- cgit v1.2.3-70-g09d2 From 447ec911766a9c5b6d5512a9e054fdbbe39df92a Mon Sep 17 00:00:00 2001 From: eal Date: Tue, 19 Sep 2017 22:58:15 +0300 Subject: Actually actually fix image url. --- src/components/post_status_form/post_status_form.js | 2 +- src/main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.js') diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 2e0aafd0..6fc84407 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -72,7 +72,7 @@ const PostStatusForm = { // eslint-disable-next-line camelcase screen_name: `:${shortcode}:`, name: '', - img: image-url + img: image_url })) } else { return false diff --git a/src/main.js b/src/main.js index 2ab548a6..bac4d0f7 100644 --- a/src/main.js +++ b/src/main.js @@ -108,7 +108,7 @@ window.fetch('/static/emoji.txt') .then((csv) => { const emoji = csv.split('\n').map((row) => { const values = row.split(', ') - return { shortcode: values[0], image-url: values[1] } + return { shortcode: values[0], image_url: values[1] } }) store.dispatch('setOption', { name: 'emoji', value: emoji }) }) -- cgit v1.2.3-70-g09d2 From ba9b04a8bacc62be0264c4fdd3dbcf34f12f7e4b Mon Sep 17 00:00:00 2001 From: eal Date: Thu, 19 Oct 2017 23:39:21 +0300 Subject: Use the API endpoint for emoji completion. --- src/main.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index bac4d0f7..b994e154 100644 --- a/src/main.js +++ b/src/main.js @@ -103,12 +103,11 @@ window.fetch('/static/terms-of-service.html') store.dispatch('setOption', { name: 'tos', value: html }) }) -window.fetch('/static/emoji.txt') - .then((res) => res.text()) - .then((csv) => { - const emoji = csv.split('\n').map((row) => { - const values = row.split(', ') - return { shortcode: values[0], image_url: values[1] } +window.fetch('/api/pleroma/emoji.json') + .then((res) => res.json()) + .then((values) => { + const emoji = Object.keys(values).map((key) => { + return { shortcode: key, image_url: values[key] } }) store.dispatch('setOption', { name: 'emoji', value: emoji }) }) -- cgit v1.2.3-70-g09d2