summaryrefslogtreecommitdiff
path: root/src/client/components
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2020-11-15 12:04:54 +0900
committersyuilo <syuilotan@yahoo.co.jp>2020-11-15 12:04:54 +0900
commitd53c55ecb512be114b394955da22e2450d01e379 (patch)
tree10fd5da883c1617233670a771c453d9561dd2401 /src/client/components
parentAdd description (diff)
downloadmisskey-d53c55ecb512be114b394955da22e2450d01e379.tar.gz
misskey-d53c55ecb512be114b394955da22e2450d01e379.tar.bz2
misskey-d53c55ecb512be114b394955da22e2450d01e379.zip
wip: clip
Diffstat (limited to 'src/client/components')
-rw-r--r--src/client/components/form-dialog.vue10
-rw-r--r--src/client/components/note.vue44
2 files changed, 48 insertions, 6 deletions
diff --git a/src/client/components/form-dialog.vue b/src/client/components/form-dialog.vue
index 2a067b67fa..0dc02258af 100644
--- a/src/client/components/form-dialog.vue
+++ b/src/client/components/form-dialog.vue
@@ -15,15 +15,15 @@
<div class="xkpnjxcv _section">
<label v-for="item in Object.keys(form).filter(item => !form[item].hidden)" :key="item">
<MkInput v-if="form[item].type === 'number'" v-model:value="values[item]" type="number" :step="form[item].step || 1">
- <span v-text="form[item].label || item"></span>
+ <span v-text="form[item].label || item"></span><span v-if="form[item].required === false"> ({{ $t('optional') }})</span>
<template v-if="form[item].description" #desc>{{ form[item].description }}</template>
</MkInput>
- <MkInput v-else-if="form[item].type === 'string' && !item.multiline" v-model:value="values[item]" type="text">
- <span v-text="form[item].label || item"></span>
+ <MkInput v-else-if="form[item].type === 'string' && !form[item].multiline" v-model:value="values[item]" type="text">
+ <span v-text="form[item].label || item"></span><span v-if="form[item].required === false"> ({{ $t('optional') }})</span>
<template v-if="form[item].description" #desc>{{ form[item].description }}</template>
</MkInput>
- <MkTextarea v-else-if="form[item].type === 'string' && item.multiline" v-model:value="values[item]">
- <span v-text="form[item].label || item"></span>
+ <MkTextarea v-else-if="form[item].type === 'string' && form[item].multiline" v-model:value="values[item]">
+ <span v-text="form[item].label || item"></span><span v-if="form[item].required === false"> ({{ $t('optional') }})</span>
<template v-if="form[item].description" #desc>{{ form[item].description }}</template>
</MkTextarea>
<MkSwitch v-else-if="form[item].type === 'boolean'" v-model:value="values[item]">
diff --git a/src/client/components/note.vue b/src/client/components/note.vue
index bf89cbf568..8aa205bdec 100644
--- a/src/client/components/note.vue
+++ b/src/client/components/note.vue
@@ -102,7 +102,7 @@
<script lang="ts">
import { computed, defineAsyncComponent, defineComponent, markRaw, ref } from 'vue';
-import { faSatelliteDish, faBolt, faTimes, faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight, faInfoCircle, faBiohazard, faPlug, faExclamationCircle } from '@fortawesome/free-solid-svg-icons';
+import { faSatelliteDish, faBolt, faTimes, faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight, faInfoCircle, faBiohazard, faPlug, faExclamationCircle, faPaperclip } from '@fortawesome/free-solid-svg-icons';
import { faCopy, faTrashAlt, faEdit, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons';
import { parse } from '../../mfm/parse';
import { sum, unique } from '../../prelude/array';
@@ -610,6 +610,11 @@ export default defineComponent({
text: this.$t('favorite'),
action: () => this.toggleFavorite(true)
}),
+ {
+ icon: faPaperclip,
+ text: this.$t('clip'),
+ action: () => this.clip()
+ },
(this.appearNote.userId != this.$store.state.i.id) ? statePromise.then(state => state.isWatching ? {
icon: faEyeSlash,
text: this.$t('unwatch'),
@@ -762,6 +767,43 @@ export default defineComponent({
});
},
+ async clip() {
+ const clips = await os.api('clips/list');
+ os.modalMenu([{
+ icon: faPlus,
+ text: this.$t('createNew'),
+ action: async () => {
+ const { canceled, result } = await os.form(this.$t('createNewClip'), {
+ name: {
+ type: 'string',
+ label: this.$t('name')
+ },
+ description: {
+ type: 'string',
+ required: false,
+ multiline: true,
+ label: this.$t('description')
+ },
+ isPublic: {
+ type: 'boolean',
+ label: this.$t('public')
+ }
+ });
+ if (canceled) return;
+
+ const clip = await os.apiWithDialog('clips/create', result);
+
+ os.apiWithDialog('clips/add-note', { clipId: clip.id, noteId: this.appearNote.id });
+ }
+ }, null, ...clips.map(clip => ({
+ text: clip.name,
+ action: () => {
+ os.apiWithDialog('clips/add-note', { clipId: clip.id, noteId: this.appearNote.id });
+ }
+ }))], this.$refs.menuButton, {
+ }).then(this.focus);
+ },
+
async promote() {
const { canceled, result: days } = await os.dialog({
title: this.$t('numberOfDays'),