Giter VIP home page Giter VIP logo

Comments (25)

mohamdio avatar mohamdio commented on August 26, 2024 2

Just do that:

// Initialize all input of tags type.
var tagsinput = bulmaTagsinput.attach('[type="tags"]');

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024 1

Thanks. I'll keep you in touch

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024 1

no that's the right way.
I don't understand why it's not working with "import" :-(

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

Hi, the documentation is outdated. Please call the .attach() static method to init the plugin on the input.

I'm currently working on the big issue with the integration into Laravel then I'll update all extensions and documentation.
Sorry for the inconvenience.

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

I tried this:

import Tagify from 'bulma-tagsinput/dist/bulma-tagsinput.min'

document.addEventListener('DOMContentLoaded', function () {
    Tagify.attach()
})

but i get Tagify is not defined in the console.

also, i'm currently using this in a Laravel project, can you tell me what exactly you're working on?

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

I'm currently working with another user on is issue with laravel integration and I found the following process to follow to get it work (for carousel extension):

  1. add "laravelcollective/html": "5.*" to composer.json then run "composer update"

  2. in app.php: add this provider: Collective\Html\HtmlServiceProvider::class,

  3. then these aliases:
    'HTML' => Collective\Html\HtmlFacade::class,
    'Form' => Collective\Html\FormFacade::class

  4. in webpack.mix.js update the mix command to:
    mix.js('resources/assets/js/app.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .copy('node_modules/bulma-carousel/dist/bulma-carousel.js', 'public/js');

  5. in your view (welcome.blade.php) add the following at the end:
    {!! HTML::script('js/bulma-carousel.js') !!}
    <script>
    var carousels = bulmaCarousel.attach();
    </script>

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

you should have bulmaTagsinput defined, not Tagify

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024
import bulmaTagsinput from 'bulma-tagsinput/dist/bulma-tagsinput.min'

document.addEventListener('DOMContentLoaded', function () {
    bulmaTagsinput.attach()
})

Console:

ReferenceError: bulmaTagsinput is not defined

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

Where (which file) do you put the import ?
Why not just including js file directly into your view and then just call bulmaTasgInput.attach() as I show 2 posts above ?

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

i import bulma-tagsinput.min.js in my app.js file. because it's better to have a single js file and a single request. it shouldn't be any different, right?

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

You issue is related to Laravel integration so I only know 2 ways for it to work:

  1. Use the flow I gave you
  2. Recompil sources by yourself with your own webpack configuration

Regards

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

Thank you

The first option is not an option for me because I have to keep my requests minimal.
I don't know how to do the second option.

Here's how I made it work for now. I moved my attach() call to app.js instead of the page where I need it. The downside is it will be called in every page.

Looking forward to the Laravel integration.

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

If bulmaTagsInput is defined within your app.js. Why don't just reference it into window global variable then you should be able to call the .attach() only on the page you want.

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

Isn't that what import should do?
I'm also using sweetalert and it works in all files just fine without making a new global variable.

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

I'll try to have a look at sweetalert to check what's different.
Can you please give me the sweetalert repo url to be sure to look at the right one ?

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

Sure:

https://github.com/t4t5/sweetalert
https://sweetalert.js.org/docs/

Thank you

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

Can you please try with the last commit ?
https://github.com/Wikiki/bulma-tagsinput/blob/master/dist/js/bulma-tagsinput.js

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

I get bulmaTagsinput is not defined.
To be fair I copied the code to my final compiled file since I didn't know how to use the latest commit without upgrading the npm package. Could that be the problem?

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

Thanks anyway.
Maybe we can fix this later.

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

I think this is a case issue: try both: bulmaTagsinput and bulmaTagsInput (i of input in lower and upper case)

from bulma-tagsinput.

mokhosh avatar mokhosh commented on August 26, 2024

Tried both. No luck.

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

please try last release

from bulma-tagsinput.

Wikiki avatar Wikiki commented on August 26, 2024

please try last release

from bulma-tagsinput.

pdiveris avatar pdiveris commented on August 26, 2024

Thank you mohamdio!

from bulma-tagsinput.

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.