bkniffler / draft-wysiwyg Goto Github PK
View Code? Open in Web Editor NEWDraft-JS experiments with drag&drop, resizing, tooltips, WIP
Home Page: https://draft-wysiwyg.herokuapp.com/
License: MIT License
Draft-JS experiments with drag&drop, resizing, tooltips, WIP
Home Page: https://draft-wysiwyg.herokuapp.com/
License: MIT License
I'm trying to call AddBlock with asJson = true, but I'm getting an error:
Uncaugh ReferenceError: decorator is not defined
This is my code (relevant lines):
import {AddBlock, RemoveBlock} from 'draft-wysiwyg/lib/draft-utils';
this.change(AddBlock(editorState,this.refs.draft.state.value.getSelection(), 'image', {url:imagePath}, true));
It looks to me like the following lines in add-block.js are to blame.
if (!editorState) {
editorState = _draftJs.EditorState.createEmpty(decorator);
}
// If json -> convert to editorstate
else if (asJson) {
editorState = _draftJs.EditorState.push(_draftJs.EditorState.createEmpty(decorator), _draftJs.ContentState.createFromBlockArray(convertFromRaw(editorState)));
}
Maybe this is not a fully developed feature...or maybe I'm doing something wrong. Let me know if thoughts.
By the way, I used to do the conversion to JSON myself, but I started getting errors following a recent upgrade. I will see if I can get that fixed as well so that I don't have to rely on asJson.
Hello!
First, congrats for this awesome job. It is the best editor I've seen, and it is exactly what I'm looking for (:
I installed, imported and tried to use without success. What are the required props?
Here is my code:
import RichEditor from 'draft-wysiwyg'
import {RichUtils} from 'draft-js';
constructor(props){
super(props);
this.state = {
textoState: '',
}
}
handleChangeTexto = (text) => {
this.setState({textoState: text});
}
render(){
return(
<RichEditor
onChange={data=>this.handleChangeTexto(data)}
value={''}
cleanupTypes="*"
sidebar={0}/>
)
}
What am I missing? =(
Hey,
Is there an easy way to get spellcheck to work? I can't seem to do it and it is not working in the example.
Thanks,
Tim
Hello,
Was playing with this demo: https://draft-wysiwyg.herokuapp.com/
After I drag and drop an existing image and then undo, it leaves two copies of the image inside the editor.
Hello when I drop an image over the editor, this pass twice in dnd plugin creator, the second time without file and crash, I looking why now.
Here is a gif for it, the key press sequence is: down, down, up, up.
I think part of the reason is draft-js-focus-plugin:L43..L45, in which the activeBlock
is undefined
and the condition in if
will always be false
.
But I suspect by setting the selectionState
focus to the block-focus
still won't make it focused, because the block-focus
doesn't handle the update of the selectionState
. Meanwhile I think neither handling the update of selectionState
nor setting focus directly from another block-focus
would be an easy solution here, what's your idea?
Thanks, and also thanks for your project!
Is the table plugin source link available?
Excuse me , how can i use this awesome plugin in my project,thank you
C:\dev\projects\draft.js\node_modules\draft-wysiwyg>npm run build:example
> [email protected] build:example C:\dev\projects\draft.js\node_modules\draft-wysiwyg
> gulp build
(node:20008) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[13:03:30] Using gulpfile C:\dev\projects\draft.js\node_modules\draft-wysiwyg\gulpfile.js
[13:03:30] Starting 'build'...
[13:03:31] [webpack:build-dev] Hash: 4bed3731292b2b3ad3d5
Version: webpack 1.13.2
Time: 158ms
Asset Size Chunks Chunk Names
app.js 632 bytes 0 [emitted] app
app.js.map 95 bytes 0 [emitted] app
chunk {0} app.js, app.js.map (app) 28 bytes [rendered]
[0] multi app 28 bytes {0} [built] [1 error]
ERROR in ./example/browser.js
Module parse failed: C:\dev\projects\draft.js\node_modules\draft-wysiwyg\example\browser.js Unexpected token (7:2)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (7:2)
at Parser.pp$4.raise (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:2221:15)
at Parser.pp.unexpected (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:603:10)
at Parser.pp$3.parseExprAtom (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1822:12)
at Parser.pp$3.parseExprSubscripts (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1715:21)
at Parser.pp$3.parseMaybeUnary (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1692:19)
at Parser.pp$3.parseExprOps (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1637:21)
at Parser.pp$3.parseMaybeConditional (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1620:21)
at Parser.pp$3.parseMaybeAssign (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1597:21)
at Parser.pp$3.parseExprList (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:2165:22)
at Parser.pp$3.parseSubscripts (C:\dev\projects\draft.js\node_modules\draft-wysiwyg\node_modules\webpack\node_modules\acorn\dist\acorn.js:1741:35)
@ multi app
[13:03:33] Finished 'build' after 2.41 s
C:\dev\projects\draft.js\node_modules\draft-wysiwyg>npm -v
3.10.3
C:\dev\projects\draft.js\node_modules\draft-wysiwyg>node -v
v6.4.0
Node updated to 7.* and as I updated today I find that I can no longer install this library because of an exception related to my node version, can you fix that?
Hello? Can I provide table plugin source code? Need your help, thank you very much @
I need to add a feature, but I could not find the source code.
The package.json
writes:
"repository": {
"type": "git",
"url": "https://github.com/draft-js-plugins/draft-js-plugins.git"
}
But not found draft-js-plugins-editor-wysiwyg
.
Hi guys,
can you tell me how to fix this, i have this issue in my own project. But the problem also affects images etc.. don't really know what is causing it. Some guidance would be nice
Hi,
Could you please include copyright holders and license?
Hi, I'm wondering if draft-wysiwyg is compatible with draft-js-mention-plugin and draft-js-emoji-plugin. With draft-js-emoji-plugin and draft-js-mention-plugin, we have to import the component for displaying suggestions using the instances of those plugin:
const emojiPlugin = createEmojiPlugin();
const { EmojiSuggestions } = emojiPlugin;
const mentionPlugin = createMentionPlugin();
const { MentionSuggestions } = mentionPlugin;
Can anyone point me to the right direction of how insert it properly to the createPlugins() function? Thanks.
Hi, I used your editor back when version was 0.0.26. Now, using the same code I used back then does not work. Would it be possible for you to post the example source code (if it's up to date with the current version of the editor) to check out what exactly changed?
This is a cool editor if the heroku app example is to be believed.
However, it doesn't work. I can't get it to render document contents from my store. I've tried replicating what you have in your example, and I've tried using other people's examples. After a couple of days, I think what I really need is for someone to update the documentation and clearly indicate
I cannot adequately express how disheartening it is to run across an impressive library like this only to run into an inability to use it because of documentation problems.
Please address this or give me some help.
Thanks very much for your time.
Can you please commit the demo code so that others can use this project?
I'm sure you came here because it was the first thing on google you saw when searching for a draft.js wysiwyg editor.
What you will soon discover is that this project is abandoned, with no documentation, and the author also did not commit the source code used in the demo you also likely saw (running on a free tier heroku server).
Go here instead for a draft.js wysiwyg editior
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.