{"version":3,"file":"editorConfig.cjs","sources":["../../../../packages/utils/editorConfig.js"],"sourcesContent":["\r\n// 初始化 MENU_CONF 属性\r\nconst editorConfig = {                       // JS 语法\r\n    MENU_CONF: {}\r\n\r\n    // 其他属性...\r\n};\r\n// 上传图片\r\n// 修改 uploadImage 菜单配置\r\neditorConfig.MENU_CONF['uploadImage'] = {\r\n    server: '/api/upload-img',\r\n    // server: '/api/upload-img-10s', // test timeout\r\n    // server: '/api/upload-img-failed', // test failed\r\n    // server: '/api/xxx', // test 404\r\n\r\n    timeout: 5 * 1000, // 5s\r\n\r\n    fieldName: 'custom-fileName',\r\n    meta: { token: 'xxx', a: 100 },\r\n    metaWithUrl: true, // join params to url\r\n    headers: { Accept: 'text/x-json' },\r\n\r\n    maxFileSize: 10 * 1024 * 1024, // 10M\r\n\r\n    base64LimitSize: 5 * 1024, // insert base64 format, if file's size less than 5kb\r\n    // 继续写其他配置...\r\n    \r\n    //【注意】不需要修改的不用写，wangEditor 会去 merge 当前其他配置\r\n    // 上传之前触发\r\n        onBeforeUpload(file) {    // JS 语法\r\n            // file 选中的文件，格式如 { key: file }\r\n            return file\r\n    \r\n            // 可以 return\r\n            // 1. return file 或者 new 一个 file ，接下来将上传\r\n            // 2. return false ，不上传这个 file\r\n        },\r\n    \r\n        // 上传进度的回调函数\r\n       onProgress(progress) {       // JS 语法\r\n            // progress 是 0-100 的数字\r\n            console.log('progress', progress)\r\n        },\r\n    \r\n        // 单个文件上传成功之后\r\n        onSuccess(file, res) {          // JS 语法\r\n            console.log(`${file.name} 上传成功`, res)\r\n        },\r\n    \r\n        // 单个文件上传失败\r\n        onFailed(file, res) {           // JS 语法\r\n            console.log(`${file.name} 上传失败`, res)\r\n        },\r\n    \r\n        // 上传错误，或者触发 timeout 超时\r\n        onError(file, err, res) {               // JS 语法\r\n            console.log(`${file.name} 上传出错`, err, res)\r\n        },\r\n        \r\n}\r\n\r\n// 上传视频\r\neditorConfig.MENU_CONF['insertVideo'] = {\r\n    onInsertedVideo(videoNode) {\r\n      console.log('inserted video', videoNode)\r\n    },\r\n};\r\neditorConfig.MENU_CONF['uploadVideo'] = {\r\n    server: '/api/upload-video',\r\n    // server: '/api/upload-img-failed', // test failed\r\n    // server: '/api/xxx', // test 404\r\n\r\n    timeout: 5 * 1000, // 5s\r\n\r\n    fieldName: 'custom-fileName',\r\n    meta: { token: 'xxx', a: 100 },\r\n    metaWithUrl: true, // join params to url\r\n    headers: { Accept: 'text/x-json' },\r\n\r\n    maxFileSize: 10 * 1024 * 1024, // 10M\r\n\r\n    onBeforeUpload(file) {\r\n      console.log('onBeforeUpload', file)\r\n\r\n      return file // will upload this file\r\n      // return false // prevent upload\r\n    },\r\n    onProgress(progress) {\r\n      console.log('onProgress', progress)\r\n    },\r\n    onSuccess(file, res) {\r\n      console.log('onSuccess', file, res)\r\n    },\r\n    onFailed(file, res) {\r\n      alert(res.message)\r\n      console.log('onFailed', file, res)\r\n    },\r\n    onError(file, err, res) {\r\n      alert(err.message)\r\n      console.error('onError', file, err, res)\r\n    },\r\n\r\n    // customInsert(res, insertFn) {\r\n    //   console.log('customInsert', res)\r\n    //   const videoInfo = res.data || {}\r\n    //   const { url, poster } = videoInfo\r\n    //   if (!url) throw new Error(`Video url is empty`)\r\n\r\n    //   console.log('Your video url ', url)\r\n    //   insertFn(url, poster)\r\n    // },\r\n\r\n    // customUpload(file, insertFn) {\r\n    //   console.log('customUpload', file)\r\n\r\n    //   return new Promise((resolve) => {\r\n    //     // Simulate async insert video\r\n    //     setTimeout(() => {\r\n    //       const src = `https://www.w3school.com.cn/i/movie.ogg`\r\n    //       const poster = 'https://www.baidu.com/img/flexible/logo/pc/result@2.png'\r\n    //       insertFn(src, poster)\r\n    //       resolve('ok')\r\n    //     }, 500)\r\n    //   })\r\n    // },\r\n\r\n    // customBrowseAndUpload(insertFn) {\r\n    //   alert('Custom browse and upload')\r\n\r\n    //   // Simulate async insert video\r\n    //   setTimeout(() => {\r\n    //     const src = '<iframe src=\"//player.bilibili.com/player.html?aid=250348909&bvid=BV1Pv411w7Xr&cid=401518678&page=1\" scrolling=\"no\" border=\"0\" frameborder=\"no\" framespacing=\"0\" allowfullscreen=\"true\"> </iframe>'\r\n    //     insertFn(src, '')\r\n    //   }, 500)\r\n    // },\r\n  };\r\n// 修改 otherMenuKey 菜单配置\r\neditorConfig.MENU_CONF['otherMenuKey'] = {\r\n    // 配置\r\n}\r\nexport {\r\n    editorConfig\r\n}\r\n"],"names":["editorConfig","file","progress","res","err","videoNode"],"mappings":"gFAEK,MAACA,EAAe,CACjB,UAAW,CAAE,CAGjB,EAGAA,EAAa,UAAU,YAAiB,CACpC,OAAQ,kBAKR,QAAS,EAAI,IAEb,UAAW,kBACX,KAAM,CAAE,MAAO,MAAO,EAAG,GAAK,EAC9B,YAAa,GACb,QAAS,CAAE,OAAQ,aAAe,EAElC,YAAa,GAAK,KAAO,KAEzB,gBAAiB,EAAI,KAKjB,eAAeC,EAAM,CAEjB,OAAOA,CAKV,EAGF,WAAWC,EAAU,CAEhB,QAAQ,IAAI,WAAYA,CAAQ,CACnC,EAGD,UAAUD,EAAME,EAAK,CACjB,QAAQ,IAAI,GAAGF,EAAK,YAAaE,CAAG,CACvC,EAGD,SAASF,EAAME,EAAK,CAChB,QAAQ,IAAI,GAAGF,EAAK,YAAaE,CAAG,CACvC,EAGD,QAAQF,EAAMG,EAAKD,EAAK,CACpB,QAAQ,IAAI,GAAGF,EAAK,YAAaG,EAAKD,CAAG,CAC5C,CAET,EAGAH,EAAa,UAAU,YAAiB,CACpC,gBAAgBK,EAAW,CACzB,QAAQ,IAAI,iBAAkBA,CAAS,CACxC,CACL,EACAL,EAAa,UAAU,YAAiB,CACpC,OAAQ,oBAIR,QAAS,EAAI,IAEb,UAAW,kBACX,KAAM,CAAE,MAAO,MAAO,EAAG,GAAK,EAC9B,YAAa,GACb,QAAS,CAAE,OAAQ,aAAe,EAElC,YAAa,GAAK,KAAO,KAEzB,eAAeC,EAAM,CACnB,eAAQ,IAAI,iBAAkBA,CAAI,EAE3BA,CAER,EACD,WAAWC,EAAU,CACnB,QAAQ,IAAI,aAAcA,CAAQ,CACnC,EACD,UAAUD,EAAME,EAAK,CACnB,QAAQ,IAAI,YAAaF,EAAME,CAAG,CACnC,EACD,SAASF,EAAME,EAAK,CAClB,MAAMA,EAAI,OAAO,EACjB,QAAQ,IAAI,WAAYF,EAAME,CAAG,CAClC,EACD,QAAQF,EAAMG,EAAKD,EAAK,CACtB,MAAMC,EAAI,OAAO,EACjB,QAAQ,MAAM,UAAWH,EAAMG,EAAKD,CAAG,CACxC,CAmCL,EAEAH,EAAa,UAAU,aAAkB,CAEzC"}