Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

textchecker-element

textlint105MIT0.18.0TypeScript support: included

Overlay text checker web compoentns.

webcomponent, customelement, spellchecker

readme

@textlint/editor

textlint editor is privacy first linting tool on your browser.

Usage

  1. Install Web Extensions
  2. Install your favorites textlint worker scripts
  3. Finally, you can linting any supported textarea with your textlint worker script

:memo: @textlint/editor web extension hook the access of https://*/*/textlint-worker.js. If you navigate to https://*/*/textlint-worker.js, the web extension open installation dialog like Greasemonkey Extension.

:memo: You want to use your customized rule, please use https://github.com/textlint/editor-script-template.

Supports textarea

  • <input checked="" disabled="" type="checkbox"> textarea
  • <input disabled="" type="checkbox"> contenteditable
  • <input disabled="" type="checkbox"> Google Docs
  • <input disabled="" type="checkbox"> Twitter
  • <input disabled="" type="checkbox"> Medium
  • <input disabled="" type="checkbox"> Wordpress
  • <input disabled="" type="checkbox"> CodeMirror
  • <input disabled="" type="checkbox"> ACE

If you want to support new textarea, please create an issues or pull request to textchecker-element.

Purpose

  • Privacy first
    • Offline works
  • Create own textlint that is bundled with own configuration

Grammarly and Microsoft Editor is useful and high-quality linting tools, but these require network access, and you must pass your text to their server.

textlint can be works at offline. Because, textlint is written by JavaScript, textlint rules are also written by JavaScript.

However, textlint is pluggable linting tools and textlint can not provide recommended/default ruleset.

@textlint/editor project resolve this issue using @textlint/script-compiler that generate optimized code from your textlint configuration.

Architecture

For example, WebExtension download own optimized textlint that is generated code @textlint/script-compiler, and use it for linting.

So, we can focus on the compiler and frontend of editor.

Develop

Install with yarn and build before editing files.

yarn install
yarn run build
cd packages/you want to edit

Develop web extension

yarn install
yarn run build
cd packages/webextension
yarn dev chrome # yarn dev firefox

Architecture

  • FrontEnd
    • textchecker-element is general web component implementation.
    • Injectable code
    • View
    • multiple implementations
    • For VSCode, TextArea, Google Docs
  • BackEnd
    • Web Extension: background.js
    • Server: API server
    • Web Worker: thread
    • spellchecker backend api

FrontEnd and BackEnd is separated.

WebComponent

Avoid side-effect on website.

  • TextChecker
  • Controller
  • Portal Overlay

Compiler target

@textlint/script-compiler generate bundled JavaScript code.

Compiler compilertextlint + rule + textlintrc into a single library code.

  • Chrome Extension code
    • chrome.storage.local for cache
    • libraryTarget:
  • Web Worker code
    • kvstorage cache
    • libraryTarget: self
  • Main Thread code(just web)
    • kvstorage cache
    • libraryTarget: web

Also, We can provide @textlint/script-compiler as a service using codesandbox

API

The library has some API

  • update(config): Promise<void>
    • dynamic update textlintrc config
  • lint({text:string}): { range: [number, number], message: string, suggestions: suggesionItem[] };
  • fix({ range: [number,number] }): string;
  • suggest({ range: [number, numbe })`
    • missing parts of textlint
  • ignore({ word:string }): Promise<void>

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.12.6 (2021-06-25)

Bug Fixes

  • webextension: prevent to send/receive message from other origin (#56) (9a740b2)

0.12.5 (2021-06-23)

Bug Fixes

  • webextension: force release reference (a14c018)

0.12.4 (2021-06-21)

Bug Fixes

  • webextension: remove existing worker when override map (dffe8c8)

0.12.3 (2021-06-20)

Bug Fixes

  • webextension: correct to terminate worker (8a01e6b), closes #52
  • webextension: use LRU for storing TextlintWorker (#53) (0ee9089)
  • webextension: when tab is closed, shutdown related workers (#54) (ab033a9)

0.12.2 (2021-06-19)

Bug Fixes

  • webextension: use LRU for storing TextlintWorker (#53) (0ee9089)
  • webextension: when tab is closed, shutdown related workers (ecf27fd)

0.12.1 (2021-05-27)

Bug Fixes

  • script-compiler: add deps for script-comppiler (#51) (85cca5f)

0.12.0 (2021-05-24)

Features

0.11.3 (2021-05-15)

Bug Fixes

Features

  • support @textlint/config-inliner in compiler (630fd1e)
  • compiler: support to inline prh.yml (#47) (b06e3b2)

0.11.2 (2021-05-02)

Bug Fixes

0.11.1 (2021-05-02)

Note: Version bump only for package @textlint/editor

0.11.0 (2021-05-02)

Bug Fixes

  • fix web url (90248dd)
  • webextension: use tabs instead of webRequest (#45) (0a710fa)
  • improve stability (#44) (270b400)
  • webextension: add worker-src: self blob to CSP (#39) (adccedd)
  • webextension: do not expose background object to website (#43) (3ee2a87), closes #40
  • webextension: remove tabs permission (8fd47b4)
  • use website (37523f2)

Features

  • webextension: support to update Script (339cf6f)

0.10.5 (2021-04-19)

Bug Fixes

  • website-generator: prefer command line flag than package.json (bd59e3f)

0.10.4 (2021-04-19)

Note: Version bump only for package @textlint/editor

0.10.3 (2021-04-19)

Bug Fixes

  • textchecker-element: remove dot (371d4cf)
  • webextension: fix to install (61b92fe)
  • webextension: remove activeTab (c89a759)
  • uuid (6376a7f)
  • webextension: use react in install-dialog (09befb6)

0.10.2 (2021-04-18)

Note: Version bump only for package @textlint/editor

0.10.1 (2021-04-18)

Bug Fixes

  • add build:public before publish (7c5413f)

0.10.0 (2021-04-18)

Bug Fixes

  • script-parser: fix script banner format (166694c)

Features

  • add data-textlint-editor-embedded (252b594)

0.9.3 (2021-04-18)

Bug Fixes

  • rename textlint.js to textlint-worker.js (5e9e677), closes #27
  • rename textlint.js to textlint-worker.js (3a82df9), closes #27
  • rename textlint.js to textlint-worker.js (d9d2f3f), closes #27

0.9.2 (2021-04-17)

Bug Fixes

0.9.1 (2021-04-17)

Note: Version bump only for package @textlint/editor

0.9.0 (2021-04-17)

Bug Fixes

  • textchecker-element: fix to click fix (1fb2b47)
  • webextension: cache worker x script (8ea8ea5)
  • webextension: support ext (a3e86dc)
  • webextension: support ext (f4c2284)
  • dot not attach readonly textarea (236c050), closes #26
  • fix Cannot read property 'targetElement' of undefined (247b236), closes #25
  • fix hide popup when no hovering item (d4cbea6)
  • mouse handling (4238396)
  • page → browser action (fc754da)
  • pin "@adobe/react-spectrum" reg (337c340)
  • use @kvs/env (a72c5b5)

Features

  • support "ignore" feature (ef14d33)
  • textchecker-element: hide after 500ms delay (18927bc)

0.8.2 (2021-01-21)

Note: Version bump only for package @textlint/editor

0.8.1 (2021-01-21)

Bug Fixes

  • fix textlint worker management (83ccaa6)
  • support Mutation Observer (dfdc815)

0.8.0 (2020-10-27)

Bug Fixes

Features

0.7.1 (2020-08-09)

Bug Fixes

  • website-generator: copy index.js (307ae9a)

0.7.0 (2020-08-05)

Bug Fixes

  • text-checker-element: remove console.log (6625de3)
  • textchecker-element: add style to rule name (a86ebd2)
  • textchecker-element: add style to rule name (e885db5)
  • textchecker-element: fix popup bug (650b1d0)
  • textchecker-element: remove unused code (040724d)
  • textchecker-element: use id for search element (7d4b9b8)
  • textchecker-element: when scroll and resize, update annotations (b49c608)
  • webextension: add boot event (34babc9)
  • webextension: fix fixAll and fixRule (291ac1d)
  • webextension: support Firefox (ddfc020)

Features

  • add textlint-script-parser (6a746fb)
  • script-editor: add metadata to script (569ef53)

Performance Improvements

  • textchecker-element: drop non-visible annotation (8590b90)

0.6.0 (2020-08-02)

Bug Fixes

  • compiler: addd @babel/core deps (37076d9)

Features

  • compiler: process.env.TEXLINT_COMPILER_INLINING as flag (410ccb0)

0.5.0 (2020-08-02)

Features

  • @textlint/script-compiler: add babel-plugin-static-fs (3e85945)

0.4.2 (2020-08-02)

Bug Fixes

  • website-generator: update template (498ab81)

0.4.1 (2020-08-02)

Bug Fixes

  • add --create-release=github (13078ae)

0.4.0 (2020-08-02)

Bug Fixes

  • compiler: change way that is applying patch for kuromoji (de26db2)

Features

  • textchecker-element: implement LintEngine API (8cd5b1a)
  • webextension: support multiple workers (79f8a0a)

0.3.0 (2020-07-31)

Features

  • @textlint/website-generator: add template (4063008)
  • @textlint/website-generator: add website generator (4c500a5)

0.2.2 (2020-07-31)

Bug Fixes

  • compiler: add mode option (7d02092)

0.2.1 (2020-07-30)

Bug Fixes

  • textchecker-element: use import (99bbaec)

0.2.0 (2020-07-30)

Features

  • fixText command should respect ruleId (#10) (69e68f1)
  • stop lint on composition event (036f1c1)

0.1.2 (2020-07-29)

Bug Fixes

0.1.1 (2020-07-29)

Bug Fixes

  • compiler: add workaround for kuromoji.js bug (a64bb7a)
  • compiler: add workaround for kuromoji.js bug (41e63b0)
  • textchecker-element: add status (9a49605)
  • textchecker-element: fix design (4eeb1fc)
  • textchecker-element: fix position issue (e53d031)
  • webextension: support fix it (386b994)
  • add multiple request handler (0ed4a4a)
  • use fs.promises (24d13fa)
  • use lerna (faccd99)

Features

  • textchecker-element: implement design (d8a1529), closes #1
  • textchecker-element: support "Fix it!" (c516c19)
  • webextension: add webextension (24737b4)
  • implement @textlint/config-loader (2885865)
  • implement config loader (ed9ca27)
  • support popup position (42aa2f8)
  • support textlint rough (b99bd82)
  • text-checker: add text-checker-popup-element.ts (48f0f8f)