Giter Site home page Giter Site logo

trumbowyg-counter's Introduction

Trumbowyg counter plugin

Simple plugin for Trumbowyg WYSIWYG Editor that shows number of characters in the editor.

Plugin works out of the box, no configuration required.

Example

Example is available here

Parameters

class <string>

Counter div class name Default: trumbowyg-counter

align <string> (default: left)

Text alignment in div. Available options: left, right, center Default: left

showWordsCounter <boolean>

Shows words counter Default: true

showCharsCounter <boolean>

Shows characters counter Default: true

trumbowyg-counter's People

Contributors

paweljanicki avatar konradkraska avatar

Watchers

 avatar  avatar  avatar

trumbowyg-counter's Issues

Word count can be inaccurate

I've spotted an issue with the word counter, and I'm not sure how to solve it (easily). The issue is that any code to strip HTML ends up concatenating words that are only separated by HTML tags.

For example:

<p>One</p><p>Two</p><p>Three</p>

This should result in a word count of 3, but because the text being returned from the element is OneTwoThree the word count is calculated as 1.

Any code that strips HTML will return the same result.

This is clearly a bug, but how does one fix it when it's so prevalent? Putting a space before each closing paragraph tag seems like a smelly hack.

https://stackoverflow.com/questions/73225259/calculating-word-count-after-stripping-html

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.