Follow latest Web Share Target specification
This commit is contained in:
parent
f19ac5320e
commit
c473b62aed
@ -3,7 +3,7 @@
|
|||||||
<h1>{{ this.$t('share-with', { name }) }}</h1>
|
<h1>{{ this.$t('share-with', { name }) }}</h1>
|
||||||
<div>
|
<div>
|
||||||
<mk-signin v-if="!$store.getters.isSignedIn"/>
|
<mk-signin v-if="!$store.getters.isSignedIn"/>
|
||||||
<mk-post-form v-else-if="!posted" :initial-text="text" :instant="true" @posted="posted = true"/>
|
<mk-post-form v-else-if="!posted" :initial-text="template" :instant="true" @posted="posted = true"/>
|
||||||
<p v-if="posted" class="posted"><fa icon="check"/></p>
|
<p v-if="posted" class="posted"><fa icon="check"/></p>
|
||||||
</div>
|
</div>
|
||||||
<button v-if="posted" class="ui button" @click="close">{{ $t('@.close') }}</button>
|
<button v-if="posted" class="ui button" @click="close">{{ $t('@.close') }}</button>
|
||||||
@ -20,9 +20,20 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
name: null,
|
name: null,
|
||||||
posted: false,
|
posted: false,
|
||||||
text: new URLSearchParams(location.search).get('text')
|
text: new URLSearchParams(location.search).get('text'),
|
||||||
|
url: new URLSearchParams(location.search).get('url'),
|
||||||
|
title: new URLSearchParams(location.search).get('title'),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
template(): string {
|
||||||
|
let t = '';
|
||||||
|
if (this.title) t += `【${title}】\n`;
|
||||||
|
if (this.text) t += `${text}\n`;
|
||||||
|
if (this.url) t += `${url}`;
|
||||||
|
return t.trim();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close() {
|
close() {
|
||||||
window.close();
|
window.close();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<h1>{{ $t('share-with', { name }) }}</h1>
|
<h1>{{ $t('share-with', { name }) }}</h1>
|
||||||
<div>
|
<div>
|
||||||
<mk-signin v-if="!$store.getters.isSignedIn"/>
|
<mk-signin v-if="!$store.getters.isSignedIn"/>
|
||||||
<mk-post-form v-else-if="!posted" :initial-text="text" :instant="true" @posted="posted = true"/>
|
<mk-post-form v-else-if="!posted" :initial-text="template" :instant="true" @posted="posted = true"/>
|
||||||
<p v-if="posted" class="posted"><fa icon="check"/></p>
|
<p v-if="posted" class="posted"><fa icon="check"/></p>
|
||||||
</div>
|
</div>
|
||||||
<ui-button class="close" v-if="posted" @click="close">{{ $t('@.close') }}</ui-button>
|
<ui-button class="close" v-if="posted" @click="close">{{ $t('@.close') }}</ui-button>
|
||||||
@ -20,9 +20,20 @@ export default Vue.extend({
|
|||||||
return {
|
return {
|
||||||
name: null,
|
name: null,
|
||||||
posted: false,
|
posted: false,
|
||||||
text: new URLSearchParams(location.search).get('text')
|
text: new URLSearchParams(location.search).get('text'),
|
||||||
|
url: new URLSearchParams(location.search).get('url'),
|
||||||
|
title: new URLSearchParams(location.search).get('title'),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
template(): string {
|
||||||
|
let t = '';
|
||||||
|
if (this.title) t += `【${title}】\n`;
|
||||||
|
if (this.text) t += `${text}\n`;
|
||||||
|
if (this.url) t += `${url}`;
|
||||||
|
return t.trim();
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close() {
|
close() {
|
||||||
window.close();
|
window.close();
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"share_target": {
|
"share_target": {
|
||||||
"url_template": "share?text=【{title}】%0A{text}%0A{url}"
|
"action": "/share/",
|
||||||
|
"params": {
|
||||||
|
"title": "title",
|
||||||
|
"text": "text",
|
||||||
|
"url": "url"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user