4 Commits

Author SHA1 Message Date
mashuo
f7dea91190 Pre Merge pull request !402 from mashuo/springboot3 2025-04-24 10:20:16 +00:00
RuoYi
e22323971e 富文本复制粘贴图片上传至url 2025-04-24 18:20:01 +08:00
RuoYi
f593d36745 update package.json 2025-04-24 18:19:44 +08:00
mashuo
245e0b76f9 fix: 代码生成javax替换为jakarta 2025-03-31 01:17:21 +00:00
3 changed files with 29 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ package ${packageName}.controller;
import java.util.List; import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -5,9 +5,9 @@
"author": "若依", "author": "若依",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve", "dev": "vue-cli-service serve",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build", "build:prod": "vue-cli-service build",
"build:stage": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode staging", "build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview", "preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src" "lint": "eslint --ext .js,.vue src"
}, },

View File

@@ -18,6 +18,7 @@
</template> </template>
<script> <script>
import axios from "axios";
import Quill from "quill"; import Quill from "quill";
import "quill/dist/quill.core.css"; import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css"; import "quill/dist/quill.snow.css";
@@ -135,6 +136,7 @@ export default {
this.quill.format("image", false); this.quill.format("image", false);
} }
}); });
this.Quill.root.addEventListener('paste', this.handlePasteCapture, true);
} }
this.Quill.clipboard.dangerouslyPasteHTML(this.currentValue); this.Quill.clipboard.dangerouslyPasteHTML(this.currentValue);
this.Quill.on("text-change", (delta, oldDelta, source) => { this.Quill.on("text-change", (delta, oldDelta, source) => {
@@ -192,8 +194,29 @@ export default {
handleUploadError() { handleUploadError() {
this.$message.error("图片插入失败"); this.$message.error("图片插入失败");
}, },
}, // 复制粘贴图片处理
}; handlePasteCapture(e) {
const clipboard = e.clipboardData || window.clipboardData;
if (clipboard && clipboard.items) {
for (let i = 0; i < clipboard.items.length; i++) {
const item = clipboard.items[i];
if (item.type.indexOf('image') !== -1) {
e.preventDefault();
const file = item.getAsFile();
this.insertImage(file);
}
}
}
},
insertImage(file) {
const formData = new FormData();
formData.append("file", file);
axios.post(this.uploadUrl, formData, { headers: { "Content-Type": "multipart/form-data", Authorization: this.headers.Authorization } }).then(res => {
this.handleUploadSuccess(res.data);
})
}
}
}
</script> </script>
<style> <style>