wip
This commit is contained in:
parent
e1d379aa55
commit
5fa695830d
|
@ -66,7 +66,6 @@ import { erase, unique } from '../../prelude/array';
|
|||
import extractMentions from '../../misc/extract-mentions';
|
||||
import getAcct from '../../misc/acct/render';
|
||||
import { formatTimeString } from '../../misc/format-time-string';
|
||||
import { selectDriveFile } from '@/scripts/select-drive-file';
|
||||
import { Autocomplete } from '@/scripts/autocomplete';
|
||||
import { noteVisibilities } from '../../types';
|
||||
import { utils } from '@syuilo/aiscript';
|
||||
|
@ -379,7 +378,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
chooseFileFromDrive() {
|
||||
selectDriveFile(true).then(files => {
|
||||
os.selectDriveFile(true).then(files => {
|
||||
for (const file of files) {
|
||||
this.attachMedia(file);
|
||||
}
|
||||
|
|
|
@ -143,6 +143,31 @@ export function dialog(props: Record<string, any>, opts?: { cancelableByBgClick:
|
|||
});
|
||||
}
|
||||
|
||||
export function selectDriveFile(multiple) {
|
||||
return new Promise(async (res, rej) => {
|
||||
modal(await import('@/components/drive-window.vue'), {
|
||||
type: 'file',
|
||||
multiple
|
||||
}).then(files => {
|
||||
res(multiple ? files : files[0]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function selectDriveFolder(multiple) {
|
||||
return new Promise((res, rej) => {
|
||||
import('@/components/drive-window.vue').then(dialog => {
|
||||
const w = $root.new(dialog, {
|
||||
type: 'folder',
|
||||
multiple
|
||||
});
|
||||
w.$once('selected', folders => {
|
||||
res(multiple ? folders : (folders.length === 0 ? null : folders[0]));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function menu(props: Record<string, any>, opts?: { source: any; }) {
|
||||
return modal(defineAsyncComponent(() => import('@/components/menu.vue')), props, {}, {
|
||||
position: 'source',
|
||||
|
|
|
@ -13,7 +13,6 @@ import { defineComponent } from 'vue';
|
|||
import { faCloud, faFolderOpen } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faClock, faEyeSlash, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
|
||||
import MkButton from '@/components/ui/button.vue';
|
||||
import { selectDriveFolder } from '@/scripts/select-drive-folder';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -38,7 +37,7 @@ export default defineComponent({
|
|||
|
||||
methods: {
|
||||
chooseUploadFolder() {
|
||||
selectDriveFolder(false).then(async folder => {
|
||||
os.selectDriveFolder(false).then(async folder => {
|
||||
await this.$store.dispatch('settings/set', { key: 'uploadFolder', value: folder ? folder.id : null });
|
||||
os.dialog({
|
||||
type: 'success',
|
||||
|
|
|
@ -19,7 +19,6 @@ import { faPencilAlt } from '@fortawesome/free-solid-svg-icons';
|
|||
import { faImage, faFolderOpen } from '@fortawesome/free-regular-svg-icons';
|
||||
import XContainer from '../page-editor.container.vue';
|
||||
import MkFileThumbnail from '@/components/drive-file-thumbnail.vue';
|
||||
import { selectDriveFile } from '@/scripts/select-drive-file';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -58,7 +57,7 @@ export default defineComponent({
|
|||
|
||||
methods: {
|
||||
async choose() {
|
||||
selectDriveFile(false).then(file => {
|
||||
os.selectDriveFile(false).then(file => {
|
||||
this.file = file;
|
||||
this.value.fileId = file.id;
|
||||
});
|
||||
|
|
|
@ -106,7 +106,6 @@ import { blockDefs } from '@/scripts/hpml/index';
|
|||
import { HpmlTypeChecker } from '@/scripts/hpml/type-checker';
|
||||
import { url } from '@/config';
|
||||
import { collectPageVars } from '@/scripts/collect-page-vars';
|
||||
import { selectDriveFile } from '@/scripts/select-drive-file';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -414,7 +413,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
setEyeCatchingImage() {
|
||||
selectDriveFile(false).then(file => {
|
||||
os.selectDriveFile(false).then(file => {
|
||||
this.eyeCatchingImageId = file.id;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -58,7 +58,6 @@ import MkButton from '@/components/ui/button.vue';
|
|||
import MkInput from '@/components/ui/input.vue';
|
||||
import MkSwitch from '@/components/ui/switch.vue';
|
||||
import MkTextarea from '@/components/ui/textarea.vue';
|
||||
import { selectDriveFile } from '@/scripts/select-drive-file';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
|
@ -101,7 +100,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
async selectDriveFile() {
|
||||
const files = await selectDriveFile();
|
||||
const files = await os.selectDriveFile();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
<script lang="ts">
|
||||
import { defineAsyncComponent, defineComponent } from 'vue';
|
||||
import DefaultUI from './default.vue';
|
||||
import DeckUI from './deck.vue';
|
||||
import DefaultUI from '@/ui/default.vue';
|
||||
import DeckUI from '@/ui/deck.vue';
|
||||
import { instanceName, deckmode } from '@/config';
|
||||
|
||||
export default defineComponent({
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import * as os from '@/os';
|
||||
|
||||
export function selectDriveFile(multiple) {
|
||||
return new Promise(async (res, rej) => {
|
||||
os.modal(await import('@/components/drive-window.vue'), {
|
||||
type: 'file',
|
||||
multiple
|
||||
}).then(files => {
|
||||
res(multiple ? files : files[0]);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
export function selectDriveFolder(multiple) {
|
||||
return new Promise((res, rej) => {
|
||||
import('@/components/drive-window.vue').then(dialog => {
|
||||
const w = $root.new(dialog, {
|
||||
type: 'folder',
|
||||
multiple
|
||||
});
|
||||
w.$once('selected', folders => {
|
||||
res(multiple ? folders : (folders.length === 0 ? null : folders[0]));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import { faUpload, faCloud } from '@fortawesome/free-solid-svg-icons';
|
||||
import { selectDriveFile } from './select-drive-file';
|
||||
import { apiUrl } from '@/config';
|
||||
import { store } from '@/store';
|
||||
import * as os from '@/os';
|
||||
|
@ -57,7 +56,7 @@ export function selectFile(src: any, label: string | null, multiple = false) {
|
|||
};
|
||||
|
||||
const chooseFileFromDrive = () => {
|
||||
selectDriveFile(multiple).then(files => {
|
||||
os.selectDriveFile(multiple).then(files => {
|
||||
res(files);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -44,7 +44,7 @@ import DeckColumnCore from '@/components/deck/column-core.vue';
|
|||
import DeckColumn from '@/components/deck/column.vue';
|
||||
import XSidebar from '@/components/sidebar.vue';
|
||||
import { getScrollContainer } from '@/scripts/scroll';
|
||||
import * as os from './os';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
|
@ -93,10 +93,10 @@ import { v4 as uuid } from 'uuid';
|
|||
import { host } from '@/config';
|
||||
import { search } from '@/scripts/search';
|
||||
import { StickySidebar } from '@/scripts/sticky-sidebar';
|
||||
import { widgets } from './widgets';
|
||||
import { widgets } from '@/widgets';
|
||||
import XSidebar from '@/components/sidebar.vue';
|
||||
import { Autocomplete } from '@/scripts/autocomplete';
|
||||
import * as os from './os';
|
||||
import * as os from '@/os';
|
||||
|
||||
const DESKTOP_THRESHOLD = 1100;
|
||||
|
Loading…
Reference in New Issue