How to use draftjs-conductor - 5 common examples

To help you get started, we’ve selected a few draftjs-conductor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github springload / draftail / lib / components / DraftailEditor.js View on Github external
this.renderSource = this.renderSource.bind(this);

    const { editorState, rawContentState } = props;

    this.state = {
      readOnlyState: false,
      hasFocus: false,
      sourceOptions: null,
    };

    if (editorState !== null) {
      this.getEditorState = this.getEditorStateProp.bind(this);
    } else {
      // If editorState is not used as a prop, create it in local state from rawContentState.
      this.state.editorState = createEditorStateFromRaw(rawContentState);
      this.getEditorState = this.getEditorStateState.bind(this);
    }
  }
github springload / draftail / lib / components / DraftailEditor.js View on Github external
handlePastedText(text: string, html: ?string, editorState: EditorState) {
    const { stripPastedStyles } = this.props;

    // Leave paste handling to Draft.js when stripping styles is desirable.
    if (stripPastedStyles) {
      return NOT_HANDLED;
    }

    const pastedState = handleDraftEditorPastedText(html, editorState);

    if (pastedState) {
      this.onChange(pastedState);
      return HANDLED;
    }

    return NOT_HANDLED;
  }
github springload / draftail / lib / api / behavior.js View on Github external
blockStyleFn(block: ContentBlock) {
    const type = block.getType();

    return `Draftail-block--${type} ${blockDepthStyleFn(block)}`;
  },
github springload / draftail / lib / components / DraftailEditor.js View on Github external
componentDidMount() {
    this.copySource = registerCopySource(this.editorRef.editor);
  }
github springload / draftail / lib / components / DraftailEditor.js View on Github external
saveState() {
    const { onSave } = this.props;
    const editorState = this.getEditorState();

    if (onSave) {
      onSave(serialiseEditorStateToRaw(editorState));
    }
  }

draftjs-conductor

📝✨ Little Draft.js helpers to make rich text editors “just work”

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis