Paste image inside RichTextEditor
Please ignore the sample shared with the previous update for reference, refer the below sample.
Sample: https://codesandbox.io/s/vue-template-7o1uk
Hi
I just updated your npm package and I get this error
ERROR Failed to compile with 1 errors 12:44:25 PM
error in ./node_modules/@syncfusion/ej2-richtexteditor/src/rich-text-editor/base/interface.js
Module parse failed: Unterminated comment (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> /**export var executeGroup = {
| 'bold': {
| command: 'Style',
@ ./node_modules/@syncfusion/ej2-richtexteditor/src/rich-text-editor/base.js 6:0-33 6:0-33
@ ./node_modules/@syncfusion/ej2-richtexteditor/src/rich-text-editor/index.js
@ ./node_modules/@syncfusion/ej2-richtexteditor/src/index.js
@ ./node_modules/@syncfusion/ej2-richtexteditor/index.js
@ ./node_modules/@syncfusion/ej2-vue-richtexteditor/src/index.js
@ ./node_modules/@syncfusion/ej2-vue-richtexteditor/index.js
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Pruebas/pruebas1.vue?vue&type=script&lang=js&
@ ./src/components/Pruebas/pruebas1.vue?vue&type=script&lang=js&
@ ./src/components/Pruebas/pruebas1.vue
@ ./src/components/Drawer/Content.js
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Drawer/DrawerPanel.vue?vue&type=script&lang=js&
@ ./src/components/Drawer/DrawerPanel.vue?vue&type=script&lang=js&
@ ./src/components/Drawer/DrawerPanel.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Drawer/Drawer.vue?vue&type=script&lang=js&
@ ./src/components/Drawer/Drawer.vue?vue&type=script&lang=js&
@ ./src/components/Drawer/Drawer.vue
@ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/layout/Layout1.vue?vue&type=script&lang=js&
@ ./src/layout/Layout1.vue?vue&type=script&lang=js&
@ ./src/layout/Layout1.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.1.97:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
<div class="row">
<div class="col-md-12">
<label class="control-label" for="subject">Detalle {{ date }}</label>
<ejs-richtexteditor
:change="onRTEChange"
:created="onCreate"
:inlineMode="inlineModeData"
:insertImageSettings="insertImageSettings"
:toolbarSettings="toolbarSettings"
height="auto"
ref="rteObj"
v-bind:disabled="extraData.ACTION === 'DELETE'"
></ejs-richtexteditor>
</div>
</div>
import { RichTextEditorPlugin, Toolbar, Link, Image, HtmlEditor, Table, QuickToolbar, PasteCleanup } from '@syncfusion/ej2-vue-richtexteditor';
insertImageSettings: {
path: process.env.VUE_APP_PATH_UPLOAD_IMAGES,
saveUrl: process.env.VUE_APP_SAVEURL_UPLOAD_IMAGES,
display: 'inline'
},
// SUBE IMAGENES DESDE EL EDITOR RTE VIA DRAG AND DROP O UPLODING FILES
[HttpPost]
[Route("Work/SaveImages")]
[AllowAnonymous]
public void Save(IList<IFormFile> UploadFiles)
{
string HtmlString = string.Empty;
if (UploadFiles != null)
{
foreach (var file in UploadFiles)
{
string filename = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
string path1 = System.IO.Directory.GetCurrentDirectory();
filename = path1 + "\\rte_files" + $@"\{filename}";
if (!System.IO.File.Exists(filename))
{
using (FileStream fs = System.IO.File.Create(filename))
{
file.CopyTo(fs);
fs.Flush();
}
}
else
{
Response.Clear();
Response.StatusCode = 204;
}
}
}
}
Attachment: ComponentWithRTE_d1de4a3.rar
Thanks for your update,
As requested already, let us know from where the image is copied and pasted to RichTextEditor. Meanwhile, we will validate the reported query with the path property in InsertImageSettings and will update you with further details shortly.
Regards,
- Host the shared server side service which is in ASP.NET core.
- Paste the image in RichTextEditor the save endpoints will be triggered and the image will be saved in the path wwwroot/Images.
https://www.syncfusion.com/downloads/support/forum/150655/ze/RTEIMA~12001332757
if (!System.IO.File.Exists(fileSavePath))
{
httpPostedFile.SaveAs(fileSavePath);
HttpResponse Response = System.Web.HttpContext.Current.Response; // THIS LINE NOT WORKS
Response.Clear();
Response.Headers.Add("name", imageFile);
Response.ContentType = "application/json; charset=utf-8";
Response.StatusDescription = "File uploaded succesfully"; // THIS LINE NOT WORKS
Response.End(); // THIS LINE NOT WORKS
}Thanks in advance!
https://www.syncfusion.com/downloads/support/directtrac/150655/ze/Rename_RTE1737757220
I can upload pictures by dragging and dropping, but why can't I automatically upload pictures after pasting?
| <ejs-richtexteditor :toolbarSettings="toolbarSettings" :insertImageSettings="insertImageSettings"> export default { name: "App", components: { "ejs-richtexteditor": RichTextEditorComponent, }, data() { return { toolbarSettings: { items: ['Image'] }, insertImageSettings: { path: "https://localhost:44329/Uploads/", saveUrl: "https://localhost:44329/Home/SaveImage", } }; }, provide:{ richtexteditor:[Toolbar, Link, Image, HtmlEditor, PasteCleanup] } }; |
- 19 Replies
- 4 Participants
-
JL jose luis barajas
- Jan 15, 2020 01:40 AM UTC
- Dec 16, 2022 06:39 AM UTC