1- 'use strict' ;
2-
3- const { tryToCatch} = require ( 'try-to-catch' ) ;
4-
5- /* global CloudCmd, DOM */
6- CloudCmd . EditNames = exports ;
7-
8- const exec = require ( 'execon' ) ;
9- const supermenu = require ( 'supermenu' ) ;
10- const { multiRename} = require ( 'multi-rename' ) ;
1+ import { tryToCatch } from 'try-to-catch' ;
2+ import exec from 'execon' ;
3+ import supermenu from 'supermenu' ;
4+ import { multiRename } from 'multi-rename' ;
5+
6+ const { CloudCmd, DOM } = globalThis ;
7+
8+ CloudCmd . EditNames = {
9+ init,
10+ show,
11+ hide,
12+ isChanged,
13+ } ;
1114
1215const Info = DOM . CurrentInfo ;
1316const { Dialog} = DOM ;
@@ -22,13 +25,13 @@ const ConfigView = {
2225 } ,
2326} ;
2427
25- module . exports . init = async ( ) => {
28+ export async function init ( ) {
2629 await CloudCmd . Edit ( ) ;
2730
2831 setListeners ( ) ;
29- } ;
32+ }
3033
31- module . exports . show = ( options ) => {
34+ export function show ( options ) {
3235 const names = getActiveNames ( ) . join ( '\n' ) ;
3336 const config = {
3437 ...ConfigView ,
@@ -50,7 +53,7 @@ module.exports.show = (options) => {
5053 CloudCmd . Edit . show ( config ) ;
5154
5255 return CloudCmd . Edit ;
53- } ;
56+ }
5457
5558async function keyListener ( event ) {
5659 const ctrl = event . ctrlKey ;
@@ -77,9 +80,7 @@ function getActiveNames() {
7780 return DOM . getFilenames ( DOM . getActiveFiles ( ) ) ;
7881}
7982
80- module . exports . hide = hide ;
81-
82- function hide ( ) {
83+ export function hide ( ) {
8384 CloudCmd . Edit . hide ( ) ;
8485}
8586
@@ -201,9 +202,7 @@ function setMenu(event) {
201202 Menu . show ( position . x , position . y ) ;
202203}
203204
204- module . exports . isChanged = isChanged ;
205-
206- async function isChanged ( ) {
205+ export async function isChanged ( ) {
207206 const editor = CloudCmd . Edit . getEditor ( ) ;
208207 const msg = 'Apply new names?' ;
209208
@@ -214,3 +213,4 @@ async function isChanged() {
214213
215214 ! cancel && await applyNames ( ) ;
216215}
216+
0 commit comments