Code Monkey home page Code Monkey logo

draftjs-comment-text's Introduction

Overview

Getting started

  1. Make sure you are using node 7, install packages and start the development server

    nvm use
    npm i
    npm run start

usage

Open localhost:3000 to see the demo.

  • Edit the text in the first box. By copy & pasting or by writing on the keyboard. You can use short-commands for bold and cursive if you like.
  • To add a comment, select some text: with the keyboard, by double clicking a word or selecting a line or paragraph. A toolbar with a single icon will appear above the selected text, click it to add a comment.
  • Enter text and hit enter or press Save comment.
  • Comments will appear in a list below the text.
  • Click Select in document to show where the comment is added. The toolbar will appear and give you the option to delete or edit comment.

Building & Deploying

From react bolierplate:

  1. Run npm run build, which will compile all the necessary files to the build folder.

  2. Upload the contents of the build folder to your web server's root folder.

Structure

The app structure is based on React Bolierplate

CSS

TypeStyle is used for styling components. It is pretty nice, but i will be using regualr stylus for my next project.

Editor

The editor uses draft-js as the main framework. Comment functionality and the toolbar is not part of the framework.

Browser support

Tested on:

  • OS X

    • Chrome
    • Safari
    • FireFox.
  • Windows 10

    • Edge

Will not work in IE11 but there are polyfills to fix this issue. Can´t test due to lack of old windows computers in the archipelago.

Assumptions and bugs hiding as features

Browser support

Developed on Chrome and only tested on desktop browsers. Interacting with text selection in mobile devices is very different and might not work as expected.

Selecting text

  • Best way to edit or deleting a comment is to use the Select in document button in the comment list.

  • Selecting text that contains some commented parts will replace the old comment with a new one so nested comments are not possible.

  • Selecting a comment but including for example a blank before will not bring up the delete option. The first letter in the selected text must be part of a comment to be able to edit it.

  • Comments are not escaped and html and js code can be injected directly to the DOM.

draftjs-comment-text's People

Contributors

maxxafari avatar

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.