diff --git a/src/client/.eslintrc b/src/client/.eslintrc index baff352604..5ea3dc45d6 100644 --- a/src/client/.eslintrc +++ b/src/client/.eslintrc @@ -3,6 +3,8 @@ "_DEV_": false, "_LANGS_": false, "_VERSION_": false, - "_ENV_": false + "_ENV_": false, + "_DATA_TRANSFER_DRIVE_FILE_": false, + "_DATA_TRANSFER_DRIVE_FOLDER_": false } } diff --git a/src/client/@types/global.d.ts b/src/client/@types/global.d.ts index 9f600268c8..8b7c4356d6 100644 --- a/src/client/@types/global.d.ts +++ b/src/client/@types/global.d.ts @@ -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; diff --git a/src/client/components/drive.file.vue b/src/client/components/drive.file.vue index 56dce1f3b0..1a55bb6e7f 100644 --- a/src/client/components/drive.file.vue +++ b/src/client/components/drive.file.vue @@ -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; // 親ブラウザに対して、ドラッグが開始されたフラグを立てる diff --git a/src/client/components/drive.folder.vue b/src/client/components/drive.folder.vue index c02d6df6b2..291e813288 100644 --- a/src/client/components/drive.folder.vue +++ b/src/client/components/drive.folder.vue @@ -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; // 親ブラウザに対して、ドラッグが開始されたフラグを立てる diff --git a/src/client/components/drive.nav-folder.vue b/src/client/components/drive.nav-folder.vue index 145e8b9aae..e5e2ee15a2 100644 --- a/src/client/components/drive.nav-folder.vue +++ b/src/client/components/drive.nav-folder.vue @@ -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 diff --git a/src/client/components/drive.vue b/src/client/components/drive.vue index 05ab302c91..4e74cddd3a 100644 --- a/src/client/components/drive.vue +++ b/src/client/components/drive.vue @@ -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); diff --git a/src/client/components/post-form.vue b/src/client/components/post-form.vue index 073a31aa82..88bf552612 100644 --- a/src/client/components/post-form.vue +++ b/src/client/components/post-form.vue @@ -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); diff --git a/src/client/pages/messaging/messaging-room.form.vue b/src/client/pages/messaging/messaging-room.form.vue index fd4119a727..90783dab8c 100644 --- a/src/client/pages/messaging/messaging-room.form.vue +++ b/src/client/pages/messaging/messaging-room.form.vue @@ -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(); diff --git a/src/client/pages/messaging/messaging-room.vue b/src/client/pages/messaging/messaging-room.vue index c6bfdb5afd..ac00554797 100644 --- a/src/client/pages/messaging/messaging-room.vue +++ b/src/client/pages/messaging/messaging-room.vue @@ -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; diff --git a/webpack.config.ts b/webpack.config.ts index 2674203b4b..23c193c6b3 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -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) => {