Giter Club home page Giter Club logo

Comments (7)

yairEO avatar yairEO commented on June 21, 2024

For now you can use tagify.setContentEditable(false) to disallow editing

from tagify.

khaziq-sfy034 avatar khaziq-sfy034 commented on June 21, 2024

If this is set to false the user cannot edit or update the text. There should be a way that user can remove the text and type until the limit reaches.

from tagify.

khaziq-sfy034 avatar khaziq-sfy034 commented on June 21, 2024

isn't there a way that we can simply remove the characters those exceeded the max length ?

from tagify.

yairEO avatar yairEO commented on June 21, 2024

you can tap into the input event and then count the number or characters and disallow submitting the form/field until your max count is satisfied.

const MAX_CHARS = 100;

const tagify = new Tagify(...)

tagify.on('input', e => {
  console.log(e.detail)
  
  // count the number of characters 
  
  // you can also call this with either `true` or an error string to mark the field as invalid:
  tagify.toggleScopeValidation(true || 'maximum characters reached')
})

from tagify.

khaziq-sfy034 avatar khaziq-sfy034 commented on June 21, 2024

So I managed to disable the button by getting the total. But I am facing weird behavior in non react input, it clears the input if state is called inside the INPUT callback, but works fine in the react version.

Issues facing with react and non react version:

  1. When added tag from the selected it always takes the cursor to the first position in the textearea, in react input comp.
  2. Slice the text only works for the first time using the change callback, if input callback used in the react comp it slices the text if there are spaces and takes the cursor to the first position. In non react working there's a weird behaviour cannot call react hooks inside the input call back.
  3. In non react comp it only updates the state if you click away from the textarea.

Expected:
The react component can somehow slice down the text to the max length and allows the tags to be entered accurately using the select.

Sharing the sandbox link below
https://codesandbox.io/p/sandbox/tagify-test-5ftnvt

from tagify.

khaziq-sfy034 avatar khaziq-sfy034 commented on June 21, 2024

Also I just noticed tha in react version if you add the tag by clicking on it from the dropdown it moves the cursor to the start of sentence, if you use keyboard to add it then works fine.
But in the normal version it works perfect the cursor moves to the end position of added tag using click.

from tagify.

yairEO avatar yairEO commented on June 21, 2024

you should open a new issue and please be clearer. You mean caret, not cursor which is the mouse pointer. I can barely understand the issue.

from tagify.

Related Issues (20)

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.