diff --git a/.webpack/js.mjs b/.webpack/js.mjs index a6936636..ac70fc6f 100644 --- a/.webpack/js.mjs +++ b/.webpack/js.mjs @@ -120,7 +120,7 @@ export default { 'sw': `${dir}/sw/sw.mjs`, 'cloudcmd': `${dir}/cloudcmd.mjs`, [`${modules}/edit`]: `${dirModules}/edit.mjs`, - [`${modules}/edit-file`]: `${dirModules}/edit-file.js`, + [`${modules}/edit-file`]: `${dirModules}/edit-file.mjs`, [`${modules}/edit-file-vim`]: `${dirModules}/edit-file-vim.mjs`, [`${modules}/edit-names`]: `${dirModules}/edit-names.js`, [`${modules}/edit-names-vim`]: `${dirModules}/edit-names-vim.mjs`, diff --git a/client/cloudcmd.mjs b/client/cloudcmd.mjs index 746f7e74..d72d7bff 100644 --- a/client/cloudcmd.mjs +++ b/client/cloudcmd.mjs @@ -4,9 +4,9 @@ import wraptile from 'wraptile'; import load from 'load.js'; import * as Util from '#common/util'; import * as CloudFunc from '#common/cloudfunc'; +import DOM from '#dom'; import {registerSW, listenSW} from './sw/register.mjs'; import {initSortPanel, sortPanel} from './sort.mjs'; -import DOM from '#dom'; import {createCloudCmd} from './client.mjs'; import * as Listeners from './listeners/index.mjs'; diff --git a/client/modules/edit-file.js b/client/modules/edit-file.mjs similarity index 89% rename from client/modules/edit-file.js rename to client/modules/edit-file.mjs index 59050a3c..f8cd21c5 100644 --- a/client/modules/edit-file.js +++ b/client/modules/edit-file.mjs @@ -1,12 +1,15 @@ -'use strict'; - /* global CloudCmd, DOM*/ -CloudCmd.EditFile = exports; +import Format from 'format-io'; +import {fullstore} from 'fullstore'; +import exec from 'execon'; +import supermenu from 'supermenu'; -const Format = require('format-io'); -const {fullstore} = require('fullstore'); -const exec = require('execon'); -const supermenu = require('supermenu'); +CloudCmd.EditFile = { + init, + show, + hide, + isChanged, +}; const Info = DOM.CurrentInfo; @@ -26,7 +29,7 @@ const ConfigView = { }, }; -module.exports.init = async () => { +export async function init() { isLoading(true); await CloudCmd.Edit(); @@ -36,7 +39,7 @@ module.exports.init = async () => { setListeners(editor); isLoading(false); -}; +} function getName() { const {name, isDir} = Info; @@ -47,7 +50,7 @@ function getName() { return name; } -module.exports.show = async (options) => { +export async function show(options) { if (isLoading()) return; @@ -86,11 +89,9 @@ module.exports.show = async (options) => { CloudCmd.Edit.show(optionsEdit); return CloudCmd.Edit; -}; +} -module.exports.hide = hide; - -function hide() { +export function hide() { CloudCmd.Edit.hide(); } @@ -176,9 +177,7 @@ function setMsgChanged(name) { MSG_CHANGED = `Do you want to save changes to ${name}?`; } -module.exports.isChanged = isChanged; - -async function isChanged() { +export async function isChanged() { const editor = CloudCmd.Edit.getEditor(); const is = editor.isChanged();