Skip to content
This repository has been archived by the owner on May 3, 2020. It is now read-only.

Not working, no documentation #24

Closed
mokhosh opened this issue Jun 9, 2018 · 25 comments
Closed

Not working, no documentation #24

mokhosh opened this issue Jun 9, 2018 · 25 comments

Comments

@mokhosh
Copy link

mokhosh commented Jun 9, 2018

I installed tagsinput, imported js and scss and added a type=tags input, but it's just a simple text input:

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

@import "~bulma-tagsinput";

<input class="input" type="tags" placeholder="Add Tag" value="Tag1,Tag2,Tag3">
@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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.

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

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?

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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>

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

you should have bulmaTagsinput defined, not Tagify

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

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

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

Console:

ReferenceError: bulmaTagsinput is not defined

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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 ?

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

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?

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018 via email

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

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.

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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.

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

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.

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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 ?

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

Thanks. I'll keep you in touch

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

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?

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

Thanks anyway.
Maybe we can fix this later.

@Wikiki
Copy link
Owner

Wikiki commented Jun 9, 2018

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

@mokhosh
Copy link
Author

mokhosh commented Jun 9, 2018

Tried both. No luck.

@Wikiki
Copy link
Owner

Wikiki commented Jun 14, 2018

please try last release

1 similar comment
@Wikiki
Copy link
Owner

Wikiki commented Jun 14, 2018

please try last release

@mohamdio
Copy link

mohamdio commented Nov 3, 2018

Just do that:

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

@Wikiki Wikiki closed this as completed Nov 7, 2018
@pdiveris
Copy link

Thank you mohamdio!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants