|
@@ -44,3 +44,25 @@ export async function audioHandle(event) {
|
|
|
document.execCommand("insertHTML", false, imageNode.outerHTML);
|
|
|
this.$emit("audio-added");
|
|
|
}
|
|
|
+
|
|
|
+export async function uploadAudioHandle(file) {
|
|
|
+ this.$refs.editor.focus();
|
|
|
+
|
|
|
+ // if (file.size > this.maxAudioSize) {
|
|
|
+ // this.$message(
|
|
|
+ // `音频大小超过限制!最大不超过 ${this.maxAudioSize / 1024 / 1024} MB.`
|
|
|
+ // );
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // 上传音频文件
|
|
|
+ const res = await saveAudioApi({ file });
|
|
|
+ console.log(res.data);
|
|
|
+
|
|
|
+ const imageNode = await audioToImageNode(res.data);
|
|
|
+ console.log(imageNode);
|
|
|
+ // console.log({ relativeFilePath, imageNode });
|
|
|
+ // console.log(imageNode.outerHTML);
|
|
|
+ document.execCommand("insertHTML", false, imageNode.outerHTML);
|
|
|
+ this.$emit("audio-added");
|
|
|
+}
|