GithubHelp home page GithubHelp logo

jkhaui / predictable Goto Github PK

View Code? Open in Web Editor NEW
81.0 3.0 19.0 5.41 MB

A contenteditable text editor with predictive typeahead, similar to Gmail's Smart Compose feature.

HTML 5.73% JavaScript 92.39% CSS 1.89%
gmail autocomplete lookahead typeahead smart-compose predictive-text contenteditable

predictable's Introduction

Predictable

Predictable is a basic PoC web app to demonstrate how predictive text/autocomplete/lookahead/typeahead can be applied to a contenteditable element. This functionality is seen in real-world apps, with the seminal example being Gmail's "Smart Compose feature". Pressing the Tab key will autocomplete a suggested phrase.

Quick Start

> `git clone https://github.com/jkhaui/predictable`
> `npm install`
> `npm start`
This project is bootstrapped with create-react-app. It also uses Medium-Editor as a solid base for contenteditable. However, neither React nor Medium-Editor are tightly coupled to Predictable's functionality, which is written in vanilla JS and can easily be modified to work with any contenteditable container.

N.b. Being a simple PoC, there are some obvious bugs. E.g. The first word of the text editor in Chrome is, for some strange reason, positioned differently to the rest of the text. This causes the autocomplete placeholder to appear misaligned if applied at the very beginning of a document.

This example uses a large corpus of phrases related to the legal domain, but they can be easily swapped out for another data source. Improvements and PRs are highly welcomed.
Demo:

predictable's People

Contributors

dependabot[bot] avatar jkhaui 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

Watchers

 avatar  avatar  avatar

predictable's Issues

Does predictable work with draft-js?

Hi! Thank you for creating this great PoC. I read that you work with draft-js as well. Do you have a PoC for predictable which works with draft-js?

Dynamic source for data

Is there a way where we can use a get API's result as suggestion? As of now the static array is used as the static data source. Any way to make it dynamic ?

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.