summernote

How to write Definition File for React JSX

六月ゝ 毕业季﹏ 提交于 2019-12-01 10:58:24
问题 I want to write a custom definition file for Summernote.jsx so that i dont get react-summernote module not found i have written declare var ReactSummernote: JSX.ElementClass; declare module "react-summernote" { export default ReactSummernote; } and imported this as import ReactSummernote from 'react-summernote'; but got an error saying "JSX element type 'ReactSummernote' does not have any construct or call signatures" on <ReactSummernote /> following is the link Summernote.JSX 回答1: You can

Summernote Show Images that have been uploaded to a folder

左心房为你撑大大i 提交于 2019-12-01 09:06:59
问题 I am using the really nice Summernote Editor for a little webapp. Instead of using the default inline base64 code for images I am storing the images in a folder. I have that part working as intended. I am able to click the "image" icon and select an image and it will upload it to a folder on my server in its original type (jpg, png, gif). The problem is that even though the image gets uploaded properly, Summernote does not add it to the editor ... so it doesn't show. Here is the relevant code

Paste content as plain text in summernote editor

江枫思渺然 提交于 2019-11-28 20:58:35
问题 I need to copy paste some content in my summernote editor .But when I paste, it takes the style of the page from where I have copied it.I need to paste it as plain text. Is there any solution? 回答1: Use the onPaste Callback Use the onPaste option to define a callback that will strip the tags and manually insert the text. $editor.summernote({ onPaste: function (e) { var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); e.preventDefault(); document

Paste content as plain text in summernote editor

纵然是瞬间 提交于 2019-11-28 19:12:11
I need to copy paste some content in my summernote editor .But when I paste, it takes the style of the page from where I have copied it.I need to paste it as plain text. Is there any solution? Use the onPaste Callback Use the onPaste option to define a callback that will strip the tags and manually insert the text. $editor.summernote({ onPaste: function (e) { var bufferText = ((e.originalEvent || e).clipboardData || window.clipboardData).getData('Text'); e.preventDefault(); document.execCommand('insertText', false, bufferText); } }); Credit: https://github.com/summernote/summernote/issues/303

Summernote image upload

纵然是瞬间 提交于 2019-11-26 19:20:05
I have a problem with editor Summernote. I want to upload images into a catalog on the server. I have some script: <script type="text/javascript"> $(function () { $(\'.summernote\').summernote({ height: 200 }); $(\'.summernote\').summernote({ height:300, onImageUpload: function(files, editor, welEditable) { sendFile(files[0],editor,welEditable); } }); }); </script> <script type="text/javascript"> function sendFile(file, editor, welEditable) { data = new FormData(); data.append("file", file); url = "http://localhost/spichlerz/uploads"; $.ajax({ data: data, type: "POST", url: url, cache: false,