Git Product home page Git Product logo

last-draft-js-plugins's People

Contributors

mxstbr avatar ponjimon avatar svnm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

last-draft-js-plugins's Issues

Link plugin (anchor) decorators not working

Hi,

I'm using custom decorators with draft.js and now my links don't have any styles on them. Is there some way of setting them manually?

 const linkPlugin = createLinkPlugin({
      placeholder: "",
      theme: {
        link: {
          color: 'red'
        }
      }
    })

This doesn't work. In fact any option I try setting through there doesn't seem to appear.

React v16

Currently, all last-draft-js-plugins depend on [email protected]. Now that react@16 has been out for a while it'd be great to add that version number to the peerDependencies!

Link modal not closing after changing seleciton or focus.

In my opinion link modal should be closed after editor looses focus or after changing selection on editor.

To reproduce: just select some text, click "link" then just select another part of text or click outside of editor and back. Every time u open toolbar there would be link modal.

Could be fixed by subscribing on "onEditorChange" and close modal window each time editor changed. This event would be raised by any kind of selection, focus loosing or editing.

P.S. same behaviour comes with any other pickers and kinda frustrating based on UX.

React 16 'last-draft-js-sidebar-plugin'

After react 16 update, SideToolbarPlugin>Emoji and GIF are not work
Picker.js:197 Uncaught TypeError: Cannot read property 'func' of undefined
at Function.get (Picker.js:197)
at validatePropTypes (react.development.js:1638)
at Object.createElementWithValidation [as createElement] (react.development.js:1738)
at _default.render (index.js:61)
at finishClassComponent (react-dom.development.js:14301)
at updateClassComponent (react-dom.development.js:14264)
at beginWork (react-dom.development.js:15082)
at performUnitOfWork (react-dom.development.js:17820)
at workLoop (react-dom.development.js:17860)
at renderRoot (react-dom.development.js:17946)

[question] how to use emojiPickerPlugin in a Toolbar

Hi,

I am not able to make draft-js-emoji-picker-plugin work:

import React, { Component } from 'react'
import { render } from 'react-dom' // eslint-disable-line no-unused-vars
import Editor, { composeDecorators } from 'draft-js-plugins-editor'
import { EditorState, convertFromRaw, convertToRaw } from 'draft-js'
import { fromJS } from 'immutable';

/* Emoji plugin */
import createEmojiPlugin from 'draft-js-emoji-plugin'
import emojiPickerPlugin from 'draft-js-emoji-picker-plugin'
import 'draft-js-emoji-plugin/lib/plugin.css'
const emojiPlugin = createEmojiPlugin()
// const { EmojiSuggestions } = emojiPlugin

const decorator = composeDecorators(
  // resizeablePlugin.decorator,
)

/* Toolbar */
import createToolbarPlugin from 'last-draft-js-toolbar-plugin'
import 'last-draft-js-toolbar-plugin/lib/plugin.css'
const toolbarPlugin = createToolbarPlugin()
const { Toolbar } = toolbarPlugin

/* Side Toolbar */
import createSidebarPlugin from 'last-draft-js-sidebar-plugin'
import 'last-draft-js-sidebar-plugin/lib/plugin.css'
const sidebarPlugin = createSidebarPlugin()
const { Sidebar } = sidebarPlugin

/* init the plugins */
const plugins = [
  emojiPlugin,
  emojiPickerPlugin,
  toolbarPlugin,
  sidebarPlugin,
]

/* init the state, either from raw, html or text */
import { raw } from './initialState/raw'

/* from raw */
const content = convertFromRaw(raw)
let STATE = EditorState.createWithContent(content)

export default class Example extends Component {
  state = {
    editorState: STATE
  }

  onChange = (editorState) => {
    this.setState({ editorState })

    let raw = convertToRaw(editorState.getCurrentContent())
    this.logState('raw state:', raw)
  }

  logState (type, raw) {
    // console.log(type)
    console.log(JSON.stringify(raw))
  }

  focus = () => {
    this.editor.focus()
  }


  render () {
    return (
      <div>
        <div className='editor'>
          <Editor
            editorState={this.state.editorState}
            onChange={this.onChange}
            plugins={plugins}
            ref={(element) => { this.editor = element }}
          />
          <Sidebar />
        </div>
      </div>
    )
  }
}

Any thoughts or help is welcome!

LinkPlugin links wrong behaviour

Hello, found a bug that adding a link to inline text would result updating entity, but href on link would be same as text.
For example decorating text "github.com" with "google.com" link would result link to github.com, which seems like a wrong behaviour.

yarn.lock

npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:

Missing dependencies

After running yarn add last-draft-js-toolbar-plugin and serving the app I'm seeing the following errors. Looks like the packages linkify-it and tlds aren't specified in package.json. Adding them to my own package.json fixes the problem.

Module not found: Error: Can't resolve 'linkify-it' in '.../node_modules/draft-js-modal-plugin/lib/components/LinkModal'
 @ ./~/draft-js-modal-plugin/lib/components/LinkModal/index.js 22:17-38
 @ ./~/draft-js-modal-plugin/lib/index.js
Module not found: Error: Can't resolve 'tlds' in '.../node_modules/draft-js-modal-plugin/lib/components/LinkModal'
 @ ./~/draft-js-modal-plugin/lib/components/LinkModal/index.js 26:12-27
 @ ./~/draft-js-modal-plugin/lib/index.js
 @ ./~/last-draft-js-toolbar-plugin/lib/components/getModalByType/index.js
 @ ./~/last-draft-js-toolbar-plugin/lib/index.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.