This commit is contained in:
syuilo 2020-09-21 01:47:36 +09:00
parent 73bcd84173
commit 5e0a8c3d8b
10 changed files with 27 additions and 21 deletions

View File

@ -3,6 +3,8 @@
"_DEV_": false,
"_LANGS_": false,
"_VERSION_": false,
"_ENV_": false
"_ENV_": false,
"_DATA_TRANSFER_DRIVE_FILE_": false,
"_DATA_TRANSFER_DRIVE_FOLDER_": false
}
}

View File

@ -2,3 +2,5 @@ declare const _LANGS_: string[];
declare const _VERSION_: string;
declare const _ENV_: string;
declare const _DEV_: boolean;
declare const _DATA_TRANSFER_DRIVE_FILE_: string;
declare const _DATA_TRANSFER_DRIVE_FOLDER_: string;

View File

@ -116,7 +116,7 @@ export default defineComponent({
onDragstart(e) {
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('mk_drive_file', JSON.stringify(this.file));
e.dataTransfer.setData(_DATA_TRANSFER_DRIVE_FILE_, JSON.stringify(this.file));
this.isDragging = true;
//

View File

@ -92,8 +92,8 @@ export default defineComponent({
}
const isFile = e.dataTransfer.items[0].kind == 'file';
const isDriveFile = e.dataTransfer.types[0] == 'mk_drive_file';
const isDriveFolder = e.dataTransfer.types[0] == 'mk_drive_folder';
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
const isDriveFolder = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FOLDER_;
if (isFile || isDriveFile || isDriveFolder) {
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
@ -122,7 +122,7 @@ export default defineComponent({
}
//#region
const driveFile = e.dataTransfer.getData('mk_drive_file');
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile);
this.browser.removeFile(file.id);
@ -134,7 +134,7 @@ export default defineComponent({
//#endregion
//#region
const driveFolder = e.dataTransfer.getData('mk_drive_folder');
const driveFolder = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FOLDER_);
if (driveFolder != null && driveFolder != '') {
const folder = JSON.parse(driveFolder);
@ -168,7 +168,7 @@ export default defineComponent({
onDragstart(e) {
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('mk_drive_folder', JSON.stringify(this.folder));
e.dataTransfer.setData(_DATA_TRANSFER_DRIVE_FOLDER_, JSON.stringify(this.folder));
this.isDragging = true;
//

View File

@ -59,8 +59,8 @@ export default defineComponent({
}
const isFile = e.dataTransfer.items[0].kind == 'file';
const isDriveFile = e.dataTransfer.types[0] == 'mk_drive_file';
const isDriveFolder = e.dataTransfer.types[0] == 'mk_drive_folder';
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
const isDriveFolder = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FOLDER_;
if (isFile || isDriveFile || isDriveFolder) {
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
@ -91,7 +91,7 @@ export default defineComponent({
}
//#region
const driveFile = e.dataTransfer.getData('mk_drive_file');
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile);
this.browser.removeFile(file.id);
@ -103,7 +103,7 @@ export default defineComponent({
//#endregion
//#region
const driveFolder = e.dataTransfer.getData('mk_drive_folder');
const driveFolder = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FOLDER_);
if (driveFolder != null && driveFolder != '') {
const folder = JSON.parse(driveFolder);
// reject

View File

@ -222,8 +222,8 @@ export default defineComponent({
}
const isFile = e.dataTransfer.items[0].kind == 'file';
const isDriveFile = e.dataTransfer.types[0] == 'mk_drive_file';
const isDriveFolder = e.dataTransfer.types[0] == 'mk_drive_folder';
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
const isDriveFolder = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FOLDER_;
if (isFile || isDriveFile || isDriveFolder) {
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
@ -254,7 +254,7 @@ export default defineComponent({
}
//#region
const driveFile = e.dataTransfer.getData('mk_drive_file');
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile);
if (this.files.some(f => f.id == file.id)) return;
@ -267,7 +267,7 @@ export default defineComponent({
//#endregion
//#region
const driveFolder = e.dataTransfer.getData('mk_drive_folder');
const driveFolder = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FOLDER_);
if (driveFolder != null && driveFolder != '') {
const folder = JSON.parse(driveFolder);

View File

@ -496,7 +496,7 @@ export default defineComponent({
onDragover(e) {
if (!e.dataTransfer.items[0]) return;
const isFile = e.dataTransfer.items[0].kind == 'file';
const isDriveFile = e.dataTransfer.types[0] == 'mk_drive_file';
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
if (isFile || isDriveFile) {
e.preventDefault();
this.draghover = true;
@ -523,7 +523,7 @@ export default defineComponent({
}
//#region
const driveFile = e.dataTransfer.getData('mk_drive_file');
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile);
this.files.push(file);

View File

@ -122,7 +122,7 @@ export default defineComponent({
onDragover(e) {
const isFile = e.dataTransfer.items[0].kind == 'file';
const isDriveFile = e.dataTransfer.types[0] == 'mk_drive_file';
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
if (isFile || isDriveFile) {
e.preventDefault();
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
@ -145,7 +145,7 @@ export default defineComponent({
}
//#region
const driveFile = e.dataTransfer.getData('mk_drive_file');
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
if (driveFile != null && driveFile != '') {
this.file = JSON.parse(driveFile);
e.preventDefault();

View File

@ -130,7 +130,7 @@ export default defineComponent({
onDragover(e) {
const isFile = e.dataTransfer.items[0].kind == 'file';
const isDriveFile = e.dataTransfer.types[0] == 'mk_drive_file';
const isDriveFile = e.dataTransfer.types[0] == _DATA_TRANSFER_DRIVE_FILE_;
if (isFile || isDriveFile) {
e.dataTransfer.dropEffect = e.dataTransfer.effectAllowed == 'all' ? 'copy' : 'move';
@ -153,7 +153,7 @@ export default defineComponent({
}
//#region
const driveFile = e.dataTransfer.getData('mk_drive_file');
const driveFile = e.dataTransfer.getData(_DATA_TRANSFER_DRIVE_FILE_);
if (driveFile != null && driveFile != '') {
const file = JSON.parse(driveFile);
this.form.file = file;

View File

@ -134,6 +134,8 @@ module.exports = {
_LANGS_: JSON.stringify(Object.entries(locales).map(([k, v]: [string, any]) => [k, v._lang_])),
_ENV_: JSON.stringify(process.env.NODE_ENV),
_DEV_: JSON.stringify(process.env.NODE_ENV) !== 'production',
_DATA_TRANSFER_DRIVE_FILE_: JSON.stringify('mk_drive_file'),
_DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify('mk_drive_folder'),
}),
new VueLoaderPlugin(),
new WebpackOnBuildPlugin((stats: any) => {