I see. Thank you
T
Ted Chou
@Ted Chou
Posts
-
Syntax error . const function -
Syntax error . const functionHi, sorry, I am not very experienced with nodejs.
I see the following error below.ERROR in ./src/ui/EditorToolbarConfig.js Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: /Applications/MAMP/htdocs/prosemirror12/src/ui/EditorToolbarConfig.js: Unexpected token (166:13) 164 | '[image] Insert image': [ 165 | { > 166 | lang('Insert image by URL'): IMAGE_FROM_URL,
I have written a separate js file i18.js:
let lang_list = {} lang_list['en'] = {'Insert Table...': 'Insert Table...', 'Fill Color...': 'Fill Color...',} lang_list['zh'] = {'Insert Table...': 'Insert Table...', 'Fill Color...': 'Fill Color...', 'Border Color....': 'Border Color....'} export default function Lang(text) { if (text in lang_list['zh']) { return lang_list['zh'][text] } return text }
and I wish to load this file in here EditorToolbarConfig.js:
import Lang from './i18n'; export const COMMAND_GROUPS = [ { Lang( 'Insert image by URL'): FontTypeCommandMenuButton, }, { Lang( '[format_size] Text Size'): FontSizeCommandMenuButton, }]
For some reason, I see the error above.
Thanks!