-
Notifications
You must be signed in to change notification settings - Fork 437
/
index.html
3798 lines (3251 loc) · 176 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tagify - Tags input Component</title>
<meta name="description" content="Converts HTML input/textarea into Tags component">
<meta name="author" content="Yair Even-Or">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="tag, tags, tagging, tagify, javascript, component, web">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔖</text></svg>">
<link rel="stylesheet" href="dist/tagify.css">
<link rel="stylesheet" href="https://unpkg.com/@yaireo/dragsort/dist/dragsort.css" media="print" onload="this.media='all'">
<style>
html, body{ min-height:100%; scroll-behavior: smooth; }
body{
font:14px Arial;
margin:0;
overflow-x:hidden;
} /* display:flex; flex-flow: column nowrap; align-items:center; justify-content:center; */
.forkLink{ position:fixed; z-index:100; border:0; top:0; width:70px; right:0; opacity:.8; transition:.15s ease-out; }
.forkLink:hover{ opacity:1; }
.forkLink img{ width:100%; }
section{ display:flex; }
aside{ padding:4rem; box-sizing:border-box; width:50%; }
section > .leftSide{
max-width: 700px;
border-right: 1px solid #CDE6FF;
background:#F5FAFF;
font-size: 1.1em;
}
section > .rightSide{ }
.leftSide style {
display: block;
background: #333;
color: white;
font: 13px/1.8 Monaco, monospace;
padding: 1.1em;
margin-right: -2rem;
white-space: pre;
position:relative;
border-radius: 5px;
}
style[contenteditable]::before{
content: "Editable";
position: absolute;
top: 2px;
right: 8px;
color: salmon;
}
.leftSide{ padding-top:0; }
.leftSide > header{ padding-top:4rem; position:relative; }
.leftSide .demoLink{ float:right; width:38px; transform:translateX(calc(4rem + 50%)) translateY(-1px); position:relative; z-index:5; }
.leftSide .demoLink svg{ box-shadow: 0 0 0 3px black inset; border-radius:50%; transition:.12s ease-out; }
.leftSide .demoLink:hover svg{ box-shadow: 0 0 0 0 black inset; transform:scale(1.2); }
.leftSide > header > h3{ margin-top:.5rem; }
.leftSide h2{ color:salmon; text-transform:capitalize; font-size:1.6em; font-size:calc(1.3em + .5vw); line-height:1.2; margin-top:0; margin-bottom:0; }
.leftSide h2 > a{
color:inherit;
text-decoration: none;
}
.leftSide h2 > a::before{
content: '#';
position:absolute; color:inherit; opacity:0; font-weight:normal;
transform: translatex(-75%);
transition: .1s ease-out;
}
.leftSide h2 > a:hover::before{ opacity:.6; transform:translateX(-150%); }
.rightSide > .demoLink{
position: absolute;
left: 0;
width: 38px;
transform: translateX(-50%);
}
.rightSide .demoLink svg{ box-shadow: 0 0 0 3px black inset; border-radius:50%; transition:.12s ease-out; }
.rightSide .demoLink:hover svg{ box-shadow: 0 0 0 0 black inset; transform:scale(1.2); }
h3{ color:#388ffe; font-size:1.2em; margin:2rem 0 .5em; text-transform:capitalize; }
h3:first-child{ margin-top:4.3rem; }
xmp, pre{ white-space:normal; padding:8px; background:white; color:navy; border-radius:8px; }
pre{ white-space:pre; overflow:auto; border:1px solid #eef5fa; box-shadow:0 8px 15px #388ffe25; }
p{ line-height:1.4; }
code{ padding:2px 5px; background:lightyellow; border-radius:8px; }
pre code{ background:none; padding:0; }
body :not(pre)>code[class*=language-], body pre[class*=language-]{ background:white; font-size:12px; margin-right:-2rem; }
p{ line-height:1.4; }
code{ padding:2px 3px; background:lightyellow; }
pre code{ background:none; padding:0; }
pre[class*=language-]{ max-height:1000px; }
/* details expander */
summary{ outline: none; font-size:1.3em; color: #333; cursor:pointer; margin:1em 0 0 0; user-select:none; transition: .15s ease-out; }
details[open] summary{ margin-bottom: 1em; }
.forkLink{ display:none; position:absolute; top:.7em; right:50%; transform:translateX(50%); }
body > header{
position: sticky;
z-index: 100;
top: -1px;
left: 0;
right: 0;
display: flex;
align-items: center;
background:white;
border-bottom: 1px solid #DDD;
box-shadow: 0 0 6px rgba(0,0,0,.1);
padding: .8em 1em .8em 3em;
}
header.isSticky .repoLink{
height: 50px;
margin: -10px 0 -20px 0;
transition: .55s cubic-bezier(.5,0,.5,1.075);
}
header.isSticky .repoLink svg{ filter: none; }
.repoLink{
height: 70px;
margin: -10px 0 -30px 0;
transform: translateX(calc(50vw - 50%));
transition: .2s ease-out;
}
.repoLink svg{
filter: drop-shadow(0px 4px 0px white)
drop-shadow(-4px 0px 0px white)
drop-shadow(4px 0px 0px white)
drop-shadow(0px 3px 1px rgba(0,0,0,.15));
}
body > header .liveLink{ color:#333; text-decoration:none; font-size:1.4em; position:relative; line-height:1; }
body > header .liveLink::before{ content:'✎'; text-decoration:none; transform:translateX(-150%); position:absolute; top:1px; left:0; }
body > header .liveLink:hover{ text-decoration: underline; }
ul > li{
margin: .8em 0;
}
</style>
<script>
// if IE, add IE tagify's polyfills
!function( d ) {
if( !d.currentScript ){
var s = d.createElement( 'script' );
s.src = 'dist/tagify.polyfills.min.js';
d.head.appendChild( s );
}
}(document)
</script>
<script src="dist/tagify.js"></script>
<script src="https://unpkg.com/@yaireo/dragsort"></script>
<style>
section > .rightSide{
position: sticky;
top: 0;
align-self: start;
}
.tagify{
min-width:400px;
max-width:600px;
margin: 0 0 1em 0;
}
label{ cursor:pointer; }
.disabled tags{
max-width:none;
min-width:0;
border:0;
display: none;
}
.disabled tags tag,
.disabled tags div{ display:none !important; }
.showOriginal tags + input,
.showOriginal tags + textarea{
position: initial !important;
left: 0 !important;
transform: none !important;
width:100%; padding:6px; border:2px solid #999;
margin-bottom: 1em;
border-radius: 5px;
background: #F1F1F1;
}
/* .tagify.readonlyMix > tag:not([readonly]) div::before{ background:#d3e2e2; } */
.tagify__input .borderd-blue > div::before{ border:2px solid #8DAFFA; }
header label[for="toggle__tagifyStyleSettings"]{
margin-left: auto;
font-size: 1.5em;
line-height: 1;
position: relative;
animation: 1s settingsIconFrames 3;
}
header label[for="toggle__tagifyStyleSettings"]::before{
content: '';
position: absolute;
z-index: -1;
top: -2px;
left: 0;
width: 100%;
height: 120%;
border-radius: 50%;
pointer-events: none;
animation: 1s settingsIconShockwavesFrames 3;
}
@keyframes settingsIconFrames {
30%{ transform: scale(1.2); }
}
@keyframes settingsIconShockwavesFrames {
0%{ transform: scale(.6); box-shadow: 0 0 10px 2px red; }
90%{ transform: scale(10); box-shadow: 0 0 40px 2px yellow; }
100%{ transform: scale(12); opacity:0; }
}
/*
header label[for="toggle__tagifyStyleSettings"]::before{
content: "☝";
position: absolute;
font-size: 3rem;
left: -15px;
top: .5em;
pointer-events: none;
}
*/
#toggle__tagifyStyleSettings:checked + .tagifyStyleSettings{
transform: none;
}
.tagifyStyleSettings > label[for="toggle__tagifyStyleSettings"]{
float: right;
}
.tagifyStyleSettings{
position: fixed;
z-index: 999;
top: 0;
right: 0;
background: black;
padding: 1em;
color: white;
border-bottom-left-radius: 6px;
transform: translatex(100.5%);
transition: .45s cubic-bezier(.65,0,.35,1);
}
.tagifyStyleSettings > div{
display: flex;
align-items: center;
margin: 5px 0;
}
.tagifyStyleSettings > div > span{
flex: 1;
margin-right:1em;
}
@media only screen and (max-device-width: 600px){
body{
font-size: 12px;
}
body > header {
position: relative;
top: 0;
margin-bottom: 3em;
}
section{
flex-flow: column-reverse;
}
section > .leftSide{
padding: 1.5rem;
width: auto;
}
.leftSide > header{
padding-top: 0;
}
section > .rightSide{
width: 100%;
padding: 1.5em;
background: white;
border-bottom: 1px solid #CDE6FF;
}
.tagify{
min-width: auto;
width: 100%;
}
.rightSide > .demoLink {
display: none;
}
}
</style>
</head>
<body>
<header>
<a class='repoLink' title='Go To Repo' href='https://github.com/yairEO/tagify'>
<svg height="100%" viewBox="0 0 280 150" fill-rule="evenodd" fill="#444" xmlns="http://www.w3.org/2000/svg">
<path d="m86.601,17.001q3.1,0.6 4.65,2.1a5.288,5.288 0 0 1 1.073,1.435a4.56,4.56 0 0 1 0.477,2.065a9.273,9.273 0 0 1 -0.161,1.79q-0.198,1.007 -0.641,1.776a4.402,4.402 0 0 1 -1.048,1.234a4.933,4.933 0 0 1 -1.566,0.832q-1.69,0.563 -4.284,0.368q-6.891,-0.536 -11.466,-0.808a261.493,261.493 0 0 0 -2.584,-0.142q-4.517,-0.223 -11.555,-0.327a671.4,671.4 0 0 0 -1.695,-0.023q-3.7,18.4 -6.8,37q-1.1,6.8 -2.3,15.75q-1.073,8.006 -1.507,13.252a122.559,122.559 0 0 0 -0.093,1.198a6.511,6.511 0 0 1 -0.477,2.097a5.419,5.419 0 0 1 -1.923,2.353a8.433,8.433 0 0 1 -3.705,1.439a11.101,11.101 0 0 1 -1.595,0.111q-3.3,0 -5.1,-1.6a5.269,5.269 0 0 1 -1.789,-3.8a7.187,7.187 0 0 1 -0.011,-0.4q0,-1.809 0.426,-5.409a156.38,156.38 0 0 1 0.324,-2.541q0.75,-5.55 1.75,-11.65a316.042,316.042 0 0 0 0.755,-4.35q0.285,-1.719 0.521,-3.281a171.143,171.143 0 0 0 0.424,-2.969q1.1,-7.6 2.5,-15.1q1.4,-7.5 2.8,-14.2q0.3,-1.5 0.7,-3.45q0.4,-1.95 0.9,-4.35a138.602,138.602 0 0 0 -5.715,0.285q-5.22,0.377 -8.851,1.132a36.936,36.936 0 0 0 -0.834,0.183a30.163,30.163 0 0 0 -2.893,0.815q-2.915,0.992 -4.572,2.391a7.794,7.794 0 0 0 -0.485,0.444a7.93,7.93 0 0 0 -2.298,4.982a10.773,10.773 0 0 0 -0.052,1.068a11.586,11.586 0 0 0 1.531,5.721a14.176,14.176 0 0 0 0.469,0.779q0.4,0.7 0.4,1.5a3.407,3.407 0 0 1 -0.596,1.89q-0.347,0.53 -0.896,1.038a8.6,8.6 0 0 1 -0.758,0.622a9.129,9.129 0 0 1 -1.997,1.128a7.073,7.073 0 0 1 -2.653,0.522a4.734,4.734 0 0 1 -1.316,-0.174a3.7,3.7 0 0 1 -1.484,-0.826q-1.812,-1.54 -3.05,-4.272a18.514,18.514 0 0 1 -0.25,-0.578a16.991,16.991 0 0 1 -1.117,-4.269a21.937,21.937 0 0 1 -0.183,-2.881a21.081,21.081 0 0 1 0.881,-6.241a16.64,16.64 0 0 1 4.669,-7.409q5.55,-5.15 16.9,-7.55q11.35,-2.4 29.15,-2.4q9.389,0 15.536,0.292a148.328,148.328 0 0 1 2.014,0.108a121.637,121.637 0 0 1 5.415,0.446q2.459,0.261 4.624,0.611a67.021,67.021 0 0 1 1.411,0.243z"/>
<path d="m72.595,99.73a13.778,13.778 0 0 0 4.706,0.771q7.9,0 13.1,-8.4a16.672,16.672 0 0 0 1.021,2.303a12.716,12.716 0 0 0 3.129,3.847a11.7,11.7 0 0 0 0.433,0.338a9.221,9.221 0 0 0 5.617,1.912a10.999,10.999 0 0 0 2.045,-0.194q1.837,-0.347 3.728,-1.313a20.867,20.867 0 0 0 3.127,-1.993a44.987,44.987 0 0 0 3.38,-2.85a54.085,54.085 0 0 0 5.32,-5.75a6.749,6.749 0 0 0 0.903,-1.349q0.997,-1.953 0.997,-4.851q0,-1.23 -0.257,-2.152a4.376,4.376 0 0 0 -0.493,-1.148a3.165,3.165 0 0 0 -0.301,-0.408a2.225,2.225 0 0 0 -1.749,-0.792a3.137,3.137 0 0 0 -1.86,0.618a4.764,4.764 0 0 0 -0.84,0.782a181.098,181.098 0 0 1 -1.496,1.767q-3.559,4.146 -5.804,6.183q-2.7,2.45 -4.6,2.45a3.041,3.041 0 0 1 -0.221,-0.008a2.394,2.394 0 0 1 -1.729,-0.892a2.866,2.866 0 0 1 -0.202,-0.274q-0.318,-0.489 -0.451,-1.125a4.872,4.872 0 0 1 -0.097,-1.001a19.067,19.067 0 0 1 0.003,-0.32q0.057,-3.429 1.318,-10.52a245.902,245.902 0 0 1 0.979,-5.16a306.979,306.979 0 0 0 0.187,-0.991q1.313,-7.044 1.313,-9.009a4.851,4.851 0 0 0 -0.002,-0.141q-0.098,-3.359 -4.898,-3.359q-2.3,0 -4.4,0.4a16.337,16.337 0 0 0 -0.167,-0.672q-0.453,-1.664 -1.083,-2.378a1.767,1.767 0 0 0 -0.381,-0.321q-0.833,-0.529 -2.569,-0.529a21.082,21.082 0 0 0 -6.202,0.924a24.014,24.014 0 0 0 -6.848,3.426q-6.15,4.35 -9.85,11.5q-3.7,7.15 -3.7,15.15a28.402,28.402 0 0 0 0.002,0.359q0.089,7.052 3.698,11.441a11.86,11.86 0 0 0 5.194,3.729zm15.406,-18.829l3.7,-18.4a11.707,11.707 0 0 0 -6.51,2.189a15.265,15.265 0 0 0 -1.24,0.961a19.709,19.709 0 0 0 -4.116,4.979a25.263,25.263 0 0 0 -1.534,3.071q-2.1,5 -2.1,10.6a12.33,12.33 0 0 0 0.099,1.617q0.25,1.888 1.135,2.964a3.841,3.841 0 0 0 0.016,0.019a4.086,4.086 0 0 0 2.786,1.464a5.852,5.852 0 0 0 0.664,0.036q2.2,0 4.2,-2.6q2,-2.6 2.9,-6.9z"/>
<path d="m150.501,96.801l-6.4,4.3q-2.484,13.529 -5.971,23.278a75.028,75.028 0 0 1 -3.979,9.272a32.613,32.613 0 0 1 -3.394,5.323q-2.196,2.754 -4.72,4.346a13.857,13.857 0 0 1 -7.536,2.181a13.461,13.461 0 0 1 -3.83,-0.52a10.533,10.533 0 0 1 -4.47,-2.63a10.575,10.575 0 0 1 -3.087,-6.406a14.662,14.662 0 0 1 -0.113,-1.844a21.012,21.012 0 0 1 1.22,-6.857q0.948,-2.751 2.631,-5.64a43.813,43.813 0 0 1 1.749,-2.753a46.804,46.804 0 0 1 3.925,-4.881q6.006,-6.616 17.075,-15.169l0.6,-3.9q-1.7,2.7 -4.45,4.15q-2.75,1.45 -5.45,1.45a13.778,13.778 0 0 1 -4.706,-0.771a11.86,11.86 0 0 1 -5.194,-3.729q-3.609,-4.389 -3.698,-11.441a28.402,28.402 0 0 1 -0.002,-0.359q0,-8 3.7,-15.15q3.7,-7.15 9.85,-11.5a24.014,24.014 0 0 1 6.848,-3.426a21.082,21.082 0 0 1 6.202,-0.924q1.736,0 2.569,0.529a1.767,1.767 0 0 1 0.381,0.321q0.63,0.714 1.083,2.378a16.337,16.337 0 0 1 0.167,0.672q1.742,-0.367 3.989,-0.397a30.328,30.328 0 0 1 0.411,-0.003q2.5,0 3.55,0.75q1.001,0.715 1.048,2.748a8.802,8.802 0 0 1 0.002,0.202q0,1.113 -0.086,1.796a6.337,6.337 0 0 1 -0.014,0.104q-0.4,3.1 -2.5,15.7q-0.4,2.4 -0.85,5.25q-0.45,2.85 -0.95,6.05q7.7,-6 14.8,-10.6a7.207,7.207 0 0 1 0.783,-0.422q0.83,-0.378 1.517,-0.378a2.186,2.186 0 0 1 1.736,0.81a3.273,3.273 0 0 1 0.314,0.44q0.75,1.25 0.75,3.15q0,1.497 -0.297,2.571a4.943,4.943 0 0 1 -0.403,1.029q-0.7,1.3 -2.2,2.3q-8.6,5.8 -12.6,8.6zm-15.2,-17.2l3.2,-17.1a11.292,11.292 0 0 0 -6.139,2.023a14.986,14.986 0 0 0 -1.461,1.127a19.815,19.815 0 0 0 -3.986,4.835a25.642,25.642 0 0 0 -1.614,3.215q-2.1,5 -2.1,10.6a12.33,12.33 0 0 0 0.099,1.617q0.25,1.888 1.135,2.964a3.841,3.841 0 0 0 0.016,0.019a4.086,4.086 0 0 0 2.786,1.464a5.852,5.852 0 0 0 0.664,0.036a4.113,4.113 0 0 0 2.179,-0.655q0.657,-0.405 1.297,-1.058a10.912,10.912 0 0 0 0.924,-1.087q1.54,-2.053 2.435,-5.398a29.644,29.644 0 0 0 0.565,-2.602zm-15.7,56.2a2.805,2.805 0 0 0 1.542,-0.529q1.712,-1.132 3.688,-4.691a38.125,38.125 0 0 0 0.42,-0.78q3.15,-6 6.05,-19.1q-7.615,6.527 -11.024,11.783a27.437,27.437 0 0 0 -0.076,0.117q-2.151,3.353 -2.941,6.186a11.603,11.603 0 0 0 -0.459,3.114q0,1.7 0.65,2.8q0.65,1.1 2.15,1.1z" />
<path d="m168.485,100.052a14.405,14.405 0 0 0 3.716,0.449a13.017,13.017 0 0 0 2.983,-0.354q5.115,-1.201 10.667,-6.47a57.215,57.215 0 0 0 4.85,-5.276a6.749,6.749 0 0 0 0.903,-1.349q0.997,-1.953 0.997,-4.851q0,-1.23 -0.257,-2.152a4.376,4.376 0 0 0 -0.493,-1.148a3.165,3.165 0 0 0 -0.301,-0.408a2.225,2.225 0 0 0 -1.749,-0.792a3.137,3.137 0 0 0 -1.86,0.618a4.764,4.764 0 0 0 -0.84,0.782a184.196,184.196 0 0 1 -1.465,1.737q-2.309,2.703 -4.074,4.528a42.627,42.627 0 0 1 -1.661,1.635q-2.7,2.5 -4.5,2.5a3.986,3.986 0 0 1 -0.537,-0.035q-0.802,-0.109 -1.37,-0.559a2.931,2.931 0 0 1 -0.793,-1.006q-0.8,-1.6 -0.8,-4.6a18.033,18.033 0 0 1 0.045,-1.205q0.213,-3.139 1.42,-9.222a243.091,243.091 0 0 1 0.935,-4.473a333.394,333.394 0 0 0 0.054,-0.257q1.444,-6.943 1.758,-9.964a13.831,13.831 0 0 0 0.088,-1.379q0,-2.736 -3.302,-3.27a11.317,11.317 0 0 0 -1.798,-0.13q-2.114,0 -3.489,0.493a4.516,4.516 0 0 0 -1.311,0.707a4.047,4.047 0 0 0 -0.275,0.242q-0.903,0.867 -1.571,2.516a15.701,15.701 0 0 0 -0.554,1.642a96.723,96.723 0 0 0 -1.259,4.709a115.141,115.141 0 0 0 -1.691,8.441q-0.755,4.627 -1.014,8.155a46.575,46.575 0 0 0 -0.136,3.395a35.4,35.4 0 0 0 0.086,2.505q0.417,5.88 2.864,9.695a9.47,9.47 0 0 0 5.734,4.151zm2.207,-53.423a14.478,14.478 0 0 0 2.309,0.172a12.934,12.934 0 0 0 2.784,-0.284a8.852,8.852 0 0 0 4.116,-2.066a7.555,7.555 0 0 0 2.219,-3.529a9.921,9.921 0 0 0 0.381,-2.821a8.542,8.542 0 0 0 -0.056,-0.994a5.858,5.858 0 0 0 -2.244,-4.106a7.5,7.5 0 0 0 -0.488,-0.351q-1.281,-0.846 -2.946,-1.198a12.408,12.408 0 0 0 -2.566,-0.251a12.993,12.993 0 0 0 -1.617,0.098a9.725,9.725 0 0 0 -5.233,2.252a9.427,9.427 0 0 0 -0.413,0.374a7.313,7.313 0 0 0 -2.337,5.476a9.57,9.57 0 0 0 0.205,2.036a6.381,6.381 0 0 0 1.895,3.414q1.477,1.371 3.991,1.778z"/>
<path d="m225.87,72.406a2.564,2.564 0 0 0 -1.469,-0.405q-0.9,0 -1.8,0.1q-0.9,0.1 -1.7,0.2q-4.9,0.7 -8.9,0.7a27.307,27.307 0 0 1 -0.332,-0.002q-0.995,-0.012 -1.768,-0.098a99.703,99.703 0 0 0 -1.269,-0.083q-2,-0.117 -3.531,-0.117a1.775,1.775 0 0 0 -0.4,0.047q-0.66,0.153 -1.419,0.797a8.2,8.2 0 0 0 -0.681,0.656a12.714,12.714 0 0 0 -0.601,0.693a14.05,14.05 0 0 0 -1.749,2.807a14.72,14.72 0 0 0 -0.07,0.15q-0.876,1.899 -0.78,3.15a231.116,231.116 0 0 1 1.245,5.963a193.785,193.785 0 0 1 1.605,9.437a98.157,98.157 0 0 1 0.065,0.457a106.247,106.247 0 0 1 0.985,14.643a56.187,56.187 0 0 1 -0.076,3.047q-0.252,4.62 -1.342,6.338a1.861,1.861 0 0 1 -1.582,1.015q-1.35,0 -2.059,-7.724a116.118,116.118 0 0 1 -0.241,-3.126a359.188,359.188 0 0 1 -0.011,-0.169a328.402,328.402 0 0 1 -0.689,-20.981q0,-7.4 1,-17.2a179.38,179.38 0 0 0 2.296,-2.304q25.804,-26.376 25.804,-48.896a33.422,33.422 0 0 0 -0.118,-2.866q-0.196,-2.281 -0.72,-4.204a15.529,15.529 0 0 0 -1.812,-4.23a11.636,11.636 0 0 0 -0.486,-0.711q-1.209,-1.635 -2.792,-2.503a8.323,8.323 0 0 0 -4.072,-0.986a11.515,11.515 0 0 0 -2.712,0.323q-5.148,1.243 -9.76,7.268a44.915,44.915 0 0 0 -3.478,5.359a80.564,80.564 0 0 0 -2.972,5.879q-2.701,5.91 -4.88,12.965a155.054,155.054 0 0 0 -3.548,13.856q-4.15,19.75 -4.15,38.95q0,20.6 3.05,30.8q1.18,3.945 2.98,6.364a8.709,8.709 0 0 0 7.27,3.836a9.618,9.618 0 0 0 6.798,-2.694a14.408,14.408 0 0 0 2.402,-3.006a15.999,15.999 0 0 0 0.125,-0.207q2.355,-3.968 3.067,-10.33a53.781,53.781 0 0 0 0.308,-5.963a72.868,72.868 0 0 0 -0.091,-3.501q-0.092,-1.893 -0.275,-4.071a173.83,173.83 0 0 0 -0.484,-4.878q-0.85,-7.55 -2.15,-13.75a78.893,78.893 0 0 0 1.457,0.278q3.447,0.622 5.443,0.622a36.857,36.857 0 0 0 0.881,-0.01q4.937,-0.118 7.757,-1.584a6.603,6.603 0 0 0 3.762,-6.306a9.695,9.695 0 0 0 -0.081,-1.309q-0.248,-1.809 -1.25,-2.486zm-11.569,-56.505q-1.8,0 -4.45,6.1q-2.65,6.1 -5.25,16.15a247.056,247.056 0 0 0 -3.506,15.722a282.802,282.802 0 0 0 -0.994,5.528a78.429,78.429 0 0 0 8.466,-11.518a65.753,65.753 0 0 0 3.834,-7.432a58.244,58.244 0 0 0 2.959,-8.379q1.277,-4.824 1.424,-9.313a35.708,35.708 0 0 0 0.017,-0.758a22.746,22.746 0 0 0 -0.074,-1.916q-0.356,-4.184 -2.426,-4.184z"/>
<path d="m272.701,88.201l-19.2,12.9q-2.484,13.529 -5.971,23.278a75.028,75.028 0 0 1 -3.979,9.272a32.613,32.613 0 0 1 -3.394,5.323q-2.196,2.754 -4.72,4.346a13.857,13.857 0 0 1 -7.536,2.181a13.461,13.461 0 0 1 -3.83,-0.52a10.533,10.533 0 0 1 -4.47,-2.63a10.575,10.575 0 0 1 -3.087,-6.406a14.662,14.662 0 0 1 -0.113,-1.844q0,-4.7 2.15,-9.6a26.719,26.719 0 0 1 1.915,-3.54q2.246,-3.543 6.085,-7.71a84.129,84.129 0 0 1 4.595,-4.584q4.933,-4.585 11.955,-9.966l0.3,-2.3q0.536,-2.833 1.189,-7.541a380.176,380.176 0 0 0 0.411,-3.059q-1.446,5.207 -3.729,8.609a17.233,17.233 0 0 1 -1.871,2.341q-2.806,2.923 -5.856,3.568a8.413,8.413 0 0 1 -1.744,0.182a8.258,8.258 0 0 1 -6.413,-2.947a12.208,12.208 0 0 1 -0.937,-1.203a15.755,15.755 0 0 1 -2.398,-5.735a22.346,22.346 0 0 1 -0.452,-4.615a98.01,98.01 0 0 1 0.299,-7.829a75.931,75.931 0 0 1 0.701,-5.921a78.663,78.663 0 0 1 1.646,-7.686a98.87,98.87 0 0 1 1.654,-5.564q0.706,-2.118 1.811,-3.389a5.856,5.856 0 0 1 0.989,-0.911a5.57,5.57 0 0 1 1.486,-0.74q1.655,-0.56 4.214,-0.56q1.743,0 2.639,0.44a2.096,2.096 0 0 1 0.411,0.26q0.827,0.681 0.849,2.024a4.518,4.518 0 0 1 0.001,0.076a3.471,3.471 0 0 1 -0.039,0.434q-0.137,1.008 -0.764,3.706a198.933,198.933 0 0 1 -0.297,1.26a124.01,124.01 0 0 0 -0.875,3.42q-0.39,1.625 -0.686,3.086a74.279,74.279 0 0 0 -0.039,0.194q-0.8,4.1 -1.4,7.85a63.407,63.407 0 0 0 -0.316,2.212q-0.284,2.288 -0.284,3.938a10.271,10.271 0 0 0 0.074,1.292q0.32,2.508 2.026,2.508q1.452,0 3.606,-2.81a22.589,22.589 0 0 0 0.144,-0.19a23.883,23.883 0 0 0 1.436,-2.178q1.384,-2.344 2.874,-5.771a89.066,89.066 0 0 0 0.49,-1.151q1.952,-4.67 3.817,-10.982a175.362,175.362 0 0 0 1.133,-4.018a12.336,12.336 0 0 1 0.583,-1.709q0.378,-0.875 0.862,-1.536a5.37,5.37 0 0 1 1.005,-1.055a5.254,5.254 0 0 1 1.595,-0.835q1.383,-0.465 3.355,-0.465q1.787,0 2.729,0.362a2.402,2.402 0 0 1 0.471,0.238a1.919,1.919 0 0 1 0.794,1.132q0.093,0.339 0.104,0.749a4.199,4.199 0 0 1 0.002,0.119q0,2.5 -2.6,17.2l-2.6,16.1q7.7,-5.8 15,-10.6a7.207,7.207 0 0 1 0.783,-0.422q0.83,-0.378 1.517,-0.378a2.186,2.186 0 0 1 1.736,0.81a3.273,3.273 0 0 1 0.314,0.44q0.75,1.25 0.75,3.15q0,1.497 -0.297,2.571a4.943,4.943 0 0 1 -0.403,1.029q-0.7,1.3 -2.2,2.3zm-38.506,42.54a36.133,36.133 0 0 0 0.406,-0.74q2.4,-4.49 4.8,-13.595a184.128,184.128 0 0 0 1.4,-5.705a90.074,90.074 0 0 0 -4.397,3.95q-4.381,4.222 -6.753,7.9q-2.176,3.374 -2.979,6.211a11.534,11.534 0 0 0 -0.471,3.139q0,1.7 0.65,2.8q0.65,1.1 2.15,1.1q2.335,0 5.194,-5.06z"/>
</svg>
</a>
<a class='forkLink' title='Go To Repo' href='https://github.com/yairEO/tagify'>
<img src='https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png' alt='GitHub Repo'>
</a>
</header>
<!-- SVG codeopen logo template -->
<svg style='display:none' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<g id='codepen-logo' viewBox="0 0 120 120">
<path class="inner-box" d="M97 48v-1a3 3 0 00-1-1L62 23h-4L24 46a3 3 0 00-1 1v26a4 4 0 001 0v1l34 23a3 3 0 004 0l34-23a3 3 0 001-1v-1-23-1zM63 32l25 17-11 7-14-9V32zm-6 0v15l-14 9-11-7 25-17zM29 55l8 5-8 5V55zm28 33L32 71l11-7 14 9v15zm3-20l-11-8 11-8 11 8-11 8zm3 20V73l14-9 11 7-25 17zm28-23l-8-5 8-5v10z"/>
</g>
</svg>
<!-- template end -->
<form>
<!----------- SECTION -------------->
<section id='section-basic'>
<aside class='leftSide'>
<header>
<h2><a href='#section-basic'>basic</a></h2>
</header>
<p>
Passing the input element as a parameter to <em>Tagify</em> will transform it into a tags-component.
Without any settings, the user will be allowed to create any tags they want, without a count limit.
</p>
<p>
If the input element has a pre-defined <code>value</code> attribute, tags will be created from it.
</p>
<p>
(<strong>Try <em>Double-clicking</em> a tag to edit it</strong>)
</p>
<details>
<summary>Code</summary>
<h3>HTML</h3>
<pre class="language-markup"><code><input name='basic' value='tag1, tag2' autofocus></code></pre>
<h3>JAVASCRIPT</h3>
<pre class='language-js'><code>// The DOM element you wish to replace with Tagify
var input = document.querySelector('input[name=basic]');
// initialize Tagify on the above input node reference
new Tagify(input)</code></pre>
</details>
</aside>
<aside class='rightSide'>
<a class='demoLink' title='View in Codepen' target='_blank' href='https://codepen.io/vsync/pen/PoNqYVY'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">
<use class="logo-use" xlink:href="#codepen-logo"/>
</svg>
</a>
<input name='basic' value='tag1, tag2' autofocus>
</aside>
<script>
(function(){
// The DOM element you wish to replace with Tagify
var input = document.querySelector('input[name=basic]');
// initialize Tagify on the above input node reference
new Tagify(input)
})()
</script>
</section>
<!----------- SECTION -------------->
<section id='section-input'>
<aside class='leftSide'>
<header>
<h2><a href='#section-input'>Text Input</a></h2>
</header>
<h3>In this example:</h3>
<ul>
<li>Tagify instance with initial <em>settings</em> Object</li>
<li>Only allow tags from the whitelist to exist</li>
<li>Manually create initial <em>whitelist</em> from the original input's value</li>
<li>Simulate fetching <em>whitelist</em> (from a server) as the user is typing</li>
<li><em>"Remove all tags"</em> by an external button</li>
<li>Listen to various Tagify <a href='https://github.com/yairEO/tagify#events'>events</a></li>
<li>Un-listen to specific event (see <code>onAddTag</code> function)</li>
</ul>
<h3>Intro:</h3>
<p>
The input element is pre-ocupied with <strong>4</strong> tags. The <em>last</em> tag, <em>"CSS"</em>,
has the same value as the <em>first</em> tag, and will be <em>removed</em>, because the <code>duplicates</code>
setting is set to <code>true</code>.
</p>
<p>
Note that <code>whitelist</code> & <code>blacklist</code> may also be set on to <i>Tagify</i> as <code>data-</code>
attributes on the input tag itself as a list of tags seperated by the same delimeter defined in the Tagify's configuration.
Default is comma (<code>,</code>)
</p>
<p>
As text is typed, the <code>onInput</code> Tagify event is fired, on each key stroke.
Reseting the current whitelist and fetching a new one (from <code>mockAjax()</code>)
</p>
<p>
In real-life scenarios, a developer might wish to use different <em>whitelists</em> suggested to the user,
according to the typed text, asusming the possibilities are too large to load at-once as the inital <em>whitelist</em>.
</p>
<details>
<summary>Code</summary>
<h3>HTML</h3>
<pre class="language-markup"><code><!-- https://codepen.io/vsync/pen/PoNqYVY -->
<input name='input' class='some_class_name' placeholder='Type an English letter' value='css, html, javascript, css' data-blacklist='.NET, PHP'>
<br/>
<button class='tags--removeAllBtn' type='button'>Remove all these tags ⬆</button></code></pre>
<h3>JAVASCRIPT</h3>
<pre class='language-js'><code>var inputElm = document.querySelector('input[name=input]'),
whitelist = ["A# .NET", "A# (Axiom)", "A-0 System", "A+", "A++", "ABAP", "ABC", "ABC ALGOL", "ABSET", "ABSYS", "ACC", "Accent", "Ace DASL", "ACL2", "Avicsoft", "ACT-III", "Action!", "ActionScript", "Ada", "Adenine", "Agda", "Agilent VEE", "Agora", "AIMMS", "Alef", "ALF", "ALGOL 58", "ALGOL 60", "ALGOL 68", "ALGOL W", "Alice", "Alma-0", "AmbientTalk", "Amiga E", "AMOS", "AMPL", "Apex (Salesforce.com)", "APL", "AppleScript", "Arc", "ARexx", "Argus", "AspectJ", "Assembly language", "ATS", "Ateji PX", "AutoHotkey", "Autocoder", "AutoIt", "AutoLISP / Visual LISP", "Averest", "AWK", "Axum", "Active Server Pages", "ASP.NET", "B", "Babbage", "Bash", "BASIC", "bc", "BCPL", "BeanShell", "Batch (Windows/Dos)", "Bertrand", "BETA", "Bigwig", "Bistro", "BitC", "BLISS", "Blockly", "BlooP", "Blue", "Boo", "Boomerang", "Bourne shell (including bash and ksh)", "BREW", "BPEL", "B", "C--", "C++ – ISO/IEC 14882", "C# – ISO/IEC 23270", "C/AL", "Caché ObjectScript", "C Shell", "Caml", "Cayenne", "CDuce", "Cecil", "Cesil", "Céu", "Ceylon", "CFEngine", "CFML", "Cg", "Ch", "Chapel", "Charity", "Charm", "Chef", "CHILL", "CHIP-8", "chomski", "ChucK", "CICS", "Cilk", "Citrine (programming language)", "CL (IBM)", "Claire", "Clarion", "Clean", "Clipper", "CLIPS", "CLIST", "Clojure", "CLU", "CMS-2", "COBOL – ISO/IEC 1989", "CobolScript – COBOL Scripting language", "Cobra", "CODE", "CoffeeScript", "ColdFusion", "COMAL", "Combined Programming Language (CPL)", "COMIT", "Common Intermediate Language (CIL)", "Common Lisp (also known as CL)", "COMPASS", "Component Pascal", "Constraint Handling Rules (CHR)", "COMTRAN", "Converge", "Cool", "Coq", "Coral 66", "Corn", "CorVision", "COWSEL", "CPL", "CPL", "Cryptol", "csh", "Csound", "CSP", "CUDA", "Curl", "Curry", "Cybil", "Cyclone", "Cython", "Java", "Javascript", "M2001", "M4", "M#", "Machine code", "MAD (Michigan Algorithm Decoder)", "MAD/I", "Magik", "Magma", "make", "Maple", "MAPPER now part of BIS", "MARK-IV now VISION:BUILDER", "Mary", "MASM Microsoft Assembly x86", "MATH-MATIC", "Mathematica", "MATLAB", "Maxima (see also Macsyma)", "Max (Max Msp – Graphical Programming Environment)", "Maya (MEL)", "MDL", "Mercury", "Mesa", "Metafont", "Microcode", "MicroScript", "MIIS", "Milk (programming language)", "MIMIC", "Mirah", "Miranda", "MIVA Script", "ML", "Model 204", "Modelica", "Modula", "Modula-2", "Modula-3", "Mohol", "MOO", "Mortran", "Mouse", "MPD", "Mathcad", "MSIL – deprecated name for CIL", "MSL", "MUMPS", "Mystic Programming L"];
// initialize Tagify on the above input node reference
var tagify = new Tagify(inputElm, {
enforceWhitelist: true,
whitelist: inputElm.value.trim().split(/\s*,\s*/) // Array of values. stackoverflow.com/a/43375571/104380
})
// "remove all tags" button event listener
document.querySelector('.tags--removeAllBtn')
.addEventListener('click', tagify.removeAllTags.bind(tagify))
// Chainable event listeners
tagify.on('add', onAddTag)
.on('remove', onRemoveTag)
.on('input', onInput)
.on('edit', onTagEdit)
.on('invalid', onInvalidTag)
.on('click', onTagClick)
.on('focus', onTagifyFocusBlur)
.on('blur', onTagifyFocusBlur)
.on('dropdown:hide dropdown:show', e => console.log(e.type))
.on('dropdown:select', onDropdownSelect)
var mockAjax = (function mockAjax(){
var timeout;
return function(duration){
clearTimeout(timeout); // abort last request
return new Promise(function(resolve, reject){
timeout = setTimeout(resolve, duration || 700, whitelist)
})
}
})()
// tag added callback
function onAddTag(e){
console.log("onAddTag: ", e.detail);
console.log("original input value: ", inputElm.value)
tagify.off('add', onAddTag) // exmaple of removing a custom Tagify event
}
// tag remvoed callback
function onRemoveTag(e){
console.log("onRemoveTag:", e.detail, "tagify instance value:", tagify.value)
}
// on character(s) added/removed (user is typing/deleting)
function onInput(e){
console.log("onInput: ", e.detail);
tagify.whitelist = null; // reset current whitelist
tagify.loading(true) // show the loader animation
// get new whitelist from a delayed mocked request (Promise)
mockAjax()
.then(function(result){
tagify.settings.whitelist = result.concat(tagify.value) // add already-existing tags to the new whitelist array
tagify
.loading(false)
// render the suggestions dropdown.
.dropdown.show(e.detail.value);
})
.catch(err => tagify.dropdown.hide())
}
function onTagEdit(e){
console.log("onTagEdit: ", e.detail);
}
// invalid tag added callback
function onInvalidTag(e){
console.log("onInvalidTag: ", e.detail);
}
// invalid tag added callback
function onTagClick(e){
console.log(e.detail);
console.log("onTagClick: ", e.detail);
}
function onTagifyFocusBlur(e){
console.log(e.type, "event fired")
}
function onDropdownSelect(e){
console.log("onDropdownSelect: ", e.detail)
}</code></pre>
</details>
</aside>
<aside class='rightSide'>
<a class='demoLink' title='View in Codepen' target='_blank' href='https://codepen.io/vsync/pen/OJNVyQR'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">
<use class="logo-use" xlink:href="#codepen-logo"/>
</svg>
</a>
<!-- https://codepen.io/vsync/pen/PoNqYVY -->
<input name='input' class='some_class_name' placeholder='Type an English letter' value='css, html, javascript, css' data-blacklist='.NET, PHP'>
<br/>
<button class='tags--removeAllBtn' type='button'>Remove all these tags ⬆</button>
</aside>
<script>
(function(){
var inputElm = document.querySelector('input[name=input]'),
whitelist = ["A# .NET", "A# (Axiom)", "A-0 System", "A+", "A++", "ABAP", "ABC", "ABC ALGOL", "ABSET", "ABSYS", "ACC", "Accent", "Ace DASL", "ACL2", "Avicsoft", "ACT-III", "Action!", "ActionScript", "Ada", "Adenine", "Agda", "Agilent VEE", "Agora", "AIMMS", "Alef", "ALF", "ALGOL 58", "ALGOL 60", "ALGOL 68", "ALGOL W", "Alice", "Alma-0", "AmbientTalk", "Amiga E", "AMOS", "AMPL", "Apex (Salesforce.com)", "APL", "AppleScript", "Arc", "ARexx", "Argus", "AspectJ", "Assembly language", "ATS", "Ateji PX", "AutoHotkey", "Autocoder", "AutoIt", "AutoLISP / Visual LISP", "Averest", "AWK", "Axum", "Active Server Pages", "ASP.NET", "B", "Babbage", "Bash", "BASIC", "bc", "BCPL", "BeanShell", "Batch (Windows/Dos)", "Bertrand", "BETA", "Bigwig", "Bistro", "BitC", "BLISS", "Blockly", "BlooP", "Blue", "Boo", "Boomerang", "Bourne shell (including bash and ksh)", "BREW", "BPEL", "B", "C--", "C++ – ISO/IEC 14882", "C# – ISO/IEC 23270", "C/AL", "Caché ObjectScript", "C Shell", "Caml", "Cayenne", "CDuce", "Cecil", "Cesil", "Céu", "Ceylon", "CFEngine", "CFML", "Cg", "Ch", "Chapel", "Charity", "Charm", "Chef", "CHILL", "CHIP-8", "chomski", "ChucK", "CICS", "Cilk", "Citrine (programming language)", "CL (IBM)", "Claire", "Clarion", "Clean", "Clipper", "CLIPS", "CLIST", "Clojure", "CLU", "CMS-2", "COBOL – ISO/IEC 1989", "CobolScript – COBOL Scripting language", "Cobra", "CODE", "CoffeeScript", "ColdFusion", "COMAL", "Combined Programming Language (CPL)", "COMIT", "Common Intermediate Language (CIL)", "Common Lisp (also known as CL)", "COMPASS", "Component Pascal", "Constraint Handling Rules (CHR)", "COMTRAN", "Converge", "Cool", "Coq", "Coral 66", "Corn", "CorVision", "COWSEL", "CPL", "CPL", "Cryptol", "csh", "Csound", "CSP", "CUDA", "Curl", "Curry", "Cybil", "Cyclone", "Cython", "Java", "Javascript", "M2001", "M4", "M#", "Machine code", "MAD (Michigan Algorithm Decoder)", "MAD/I", "Magik", "Magma", "make", "Maple", "MAPPER now part of BIS", "MARK-IV now VISION:BUILDER", "Mary", "MASM Microsoft Assembly x86", "MATH-MATIC", "Mathematica", "MATLAB", "Maxima (see also Macsyma)", "Max (Max Msp – Graphical Programming Environment)", "Maya (MEL)", "MDL", "Mercury", "Mesa", "Metafont", "Microcode", "MicroScript", "MIIS", "Milk (programming language)", "MIMIC", "Mirah", "Miranda", "MIVA Script", "ML", "Model 204", "Modelica", "Modula", "Modula-2", "Modula-3", "Mohol", "MOO", "Mortran", "Mouse", "MPD", "Mathcad", "MSIL – deprecated name for CIL", "MSL", "MUMPS", "Mystic Programming L"];
// initialize Tagify on the above input node reference
var tagify = new Tagify(inputElm, {
enforceWhitelist: true,
whitelist: inputElm.value.trim().split(/\s*,\s*/) // Array of values. stackoverflow.com/a/43375571/104380
})
// "remove all tags" button event listener
document.querySelector('.tags--removeAllBtn')
.addEventListener('click', tagify.removeAllTags.bind(tagify))
// Chainable event listeners
tagify.on('add', onAddTag)
.on('remove', onRemoveTag)
.on('input', onInput)
.on('edit', onTagEdit)
.on('invalid', onInvalidTag)
.on('click', onTagClick)
.on('focus', onTagifyFocusBlur)
.on('blur', onTagifyFocusBlur)
.on('dropdown:hide dropdown:show', e => console.log(e.type))
.on('dropdown:select', onDropdownSelect)
var mockAjax = (function mockAjax(){
var timeout;
return function(duration){
clearTimeout(timeout); // abort last request
return new Promise(function(resolve, reject){
timeout = setTimeout(resolve, duration || 700, whitelist)
})
}
})()
// tag added callback
function onAddTag(e){
console.log("onAddTag: ", e.detail);
console.log("original input value: ", inputElm.value)
tagify.off('add', onAddTag) // exmaple of removing a custom Tagify event
}
// tag remvoed callback
function onRemoveTag(e){
console.log("onRemoveTag:", e.detail, "tagify instance value:", tagify.value)
}
// on character(s) added/removed (user is typing/deleting)
function onInput(e){
console.log("onInput: ", e.detail);
tagify.whitelist = null; // reset current whitelist
tagify.loading(true) // show the loader animation
// get new whitelist from a delayed mocked request (Promise)
mockAjax()
.then(function(result){
tagify.settings.whitelist = result.concat(tagify.value) // add already-existing tags to the new whitelist array
tagify
.loading(false)
// render the suggestions dropdown.
.dropdown.show(e.detail.value);
})
.catch(err => tagify.dropdown.hide())
}
function onTagEdit(e){
console.log("onTagEdit: ", e.detail);
}
// invalid tag added callback
function onInvalidTag(e){
console.log("onInvalidTag: ", e.detail);
}
// invalid tag added callback
function onTagClick(e){
console.log(e.detail);
console.log("onTagClick: ", e.detail);
}
function onTagifyFocusBlur(e){
console.log(e.type, "event fired")
}
function onDropdownSelect(e){
console.log("onDropdownSelect: ", e.detail)
}
})()
</script>
</section>
<!----------- SECTION -------------->
<section id='section-input-suggestions-styled-as-tags'>
<aside class='leftSide'>
<header>
<h3>Same using custom suggestions:</h3>
</header>
<p>The dropdown will appear immediately when Tagify has focus.</p>
<p>The suggestions are styled as tags this time. Clicking on a suggested it, it will be added to <em>Tagify</em></p>
<details>
<summary>Code</summary>
<h3>HTML</h3>
<pre class="language-markup"><code><input name='input-custom-dropdown' class='tagify--custom-dropdown' placeholder='Type an English letter' value='css, html, javascript'></code></pre>
<h3>JAVASCRIPT</h3>
<pre class='language-js'><code>var input = document.querySelector('input[name="input-custom-dropdown"]'),
// init Tagify script on the above inputs
tagify = new Tagify(input, {
whitelist: ["A# .NET", "A# (Axiom)", "A-0 System", "A+", "A++", "ABAP", "ABC", "ABC ALGOL", "ABSET", "ABSYS", "ACC", "Accent", "Ace DASL", "ACL2", "Avicsoft", "ACT-III", "Action!", "ActionScript", "Ada", "Adenine", "Agda", "Agilent VEE", "Agora", "AIMMS", "Alef", "ALF", "ALGOL 58", "ALGOL 60", "ALGOL 68", "ALGOL W", "Alice", "Alma-0", "AmbientTalk", "Amiga E", "AMOS", "AMPL", "Apex (Salesforce.com)", "APL", "AppleScript", "Arc", "ARexx", "Argus", "AspectJ", "Assembly language", "ATS", "Ateji PX", "AutoHotkey", "Autocoder", "AutoIt", "AutoLISP / Visual LISP", "Averest", "AWK", "Axum", "Active Server Pages", "ASP.NET", "B", "Babbage", "Bash", "BASIC", "bc", "BCPL", "BeanShell", "Batch (Windows/Dos)", "Bertrand", "BETA", "Bigwig", "Bistro", "BitC", "BLISS", "Blockly", "BlooP", "Blue", "Boo", "Boomerang", "Bourne shell (including bash and ksh)", "BREW", "BPEL", "B", "C--", "C++ – ISO/IEC 14882", "C# – ISO/IEC 23270", "C/AL", "Caché ObjectScript", "C Shell", "Caml", "Cayenne", "CDuce", "Cecil", "Cesil", "Céu", "Ceylon", "CFEngine", "CFML", "Cg", "Ch", "Chapel", "Charity", "Charm", "Chef", "CHILL", "CHIP-8", "chomski", "ChucK", "CICS", "Cilk", "Citrine (programming language)", "CL (IBM)", "Claire", "Clarion", "Clean", "Clipper", "CLIPS", "CLIST", "Clojure", "CLU", "CMS-2", "COBOL – ISO/IEC 1989", "CobolScript – COBOL Scripting language", "Cobra", "CODE", "CoffeeScript", "ColdFusion", "COMAL", "Combined Programming Language (CPL)", "COMIT", "Common Intermediate Language (CIL)", "Common Lisp (also known as CL)", "COMPASS", "Component Pascal", "Constraint Handling Rules (CHR)", "COMTRAN", "Converge", "Cool", "Coq", "Coral 66", "Corn", "CorVision", "COWSEL", "CPL", "CPL", "Cryptol", "csh", "Csound", "CSP", "CUDA", "Curl", "Curry", "Cybil", "Cyclone", "Cython", "Java", "Javascript", "M2001", "M4", "M#", "Machine code", "MAD (Michigan Algorithm Decoder)", "MAD/I", "Magik", "Magma", "make", "Maple", "MAPPER now part of BIS", "MARK-IV now VISION:BUILDER", "Mary", "MASM Microsoft Assembly x86", "MATH-MATIC", "Mathematica", "MATLAB", "Maxima (see also Macsyma)", "Max (Max Msp – Graphical Programming Environment)", "Maya (MEL)", "MDL", "Mercury", "Mesa", "Metafont", "Microcode", "MicroScript", "MIIS", "Milk (programming language)", "MIMIC", "Mirah", "Miranda", "MIVA Script", "ML", "Model 204", "Modelica", "Modula", "Modula-2", "Modula-3", "Mohol", "MOO", "Mortran", "Mouse", "MPD", "Mathcad", "MSIL – deprecated name for CIL", "MSL", "MUMPS", "Mystic Programming L"],
maxTags: 10,
dropdown: {
maxItems: 20, // <- mixumum allowed rendered suggestions
classname: 'tags-look', // <- custom classname for this dropdown, so it could be targeted
enabled: 0, // <- show suggestions on focus
closeOnSelect: false // <- do not hide the suggestions dropdown once an item has been selected
}
})</code></pre>
<h3>CSS</h3>
<style contenteditable>.tags-look .tagify__dropdown__item{
display: inline-block;
vertical-align: middle;
border-radius: 3px;
padding: .3em .5em;
border: 1px solid #CCC;
background: #F3F3F3;
margin: .2em;
font-size: .85em;
color: black;
transition: 0s;
}
.tags-look .tagify__dropdown__item--active{
border-color: black;
}
.tags-look .tagify__dropdown__item:hover{
background: lightyellow;
border-color: gold;
}
.tags-look .tagify__dropdown__item--hidden {
max-width: 0;
max-height: initial;
padding: .3em 0;
margin: .2em 0;
white-space: nowrap;
text-indent: -20px;
border: 0;
}</style>
</details>
</aside>
<aside class='rightSide'>
<a class='demoLink' title='View in Codepen' target='_blank' href='https://codepen.io/vsync/pen/bGpdVMW'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">
<use class="logo-use" xlink:href="#codepen-logo"/>
</svg>
</a>
<input name='input-custom-dropdown' class='tagify--custom-dropdown' placeholder='Type an English letter' value='css, html, javascript'>
</aside>
<script>
(function(){
var input = document.querySelector('input[name="input-custom-dropdown"]'),
// init Tagify script on the above inputs
tagify = new Tagify(input, {
whitelist: ["A# .NET", "A# (Axiom)", "A-0 System", "A+", "A++", "ABAP", "ABC", "ABC ALGOL", "ABSET", "ABSYS", "ACC", "Accent", "Ace DASL", "ACL2", "Avicsoft", "ACT-III", "Action!", "ActionScript", "Ada", "Adenine", "Agda", "Agilent VEE", "Agora", "AIMMS", "Alef", "ALF", "ALGOL 58", "ALGOL 60", "ALGOL 68", "ALGOL W", "Alice", "Alma-0", "AmbientTalk", "Amiga E", "AMOS", "AMPL", "Apex (Salesforce.com)", "APL", "AppleScript", "Arc", "ARexx", "Argus", "AspectJ", "Assembly language", "ATS", "Ateji PX", "AutoHotkey", "Autocoder", "AutoIt", "AutoLISP / Visual LISP", "Averest", "AWK", "Axum", "Active Server Pages", "ASP.NET", "B", "Babbage", "Bash", "BASIC", "bc", "BCPL", "BeanShell", "Batch (Windows/Dos)", "Bertrand", "BETA", "Bigwig", "Bistro", "BitC", "BLISS", "Blockly", "BlooP", "Blue", "Boo", "Boomerang", "Bourne shell (including bash and ksh)", "BREW", "BPEL", "B", "C--", "C++ – ISO/IEC 14882", "C# – ISO/IEC 23270", "C/AL", "Caché ObjectScript", "C Shell", "Caml", "Cayenne", "CDuce", "Cecil", "Cesil", "Céu", "Ceylon", "CFEngine", "CFML", "Cg", "Ch", "Chapel", "Charity", "Charm", "Chef", "CHILL", "CHIP-8", "chomski", "ChucK", "CICS", "Cilk", "Citrine (programming language)", "CL (IBM)", "Claire", "Clarion", "Clean", "Clipper", "CLIPS", "CLIST", "Clojure", "CLU", "CMS-2", "COBOL – ISO/IEC 1989", "CobolScript – COBOL Scripting language", "Cobra", "CODE", "CoffeeScript", "ColdFusion", "COMAL", "Combined Programming Language (CPL)", "COMIT", "Common Intermediate Language (CIL)", "Common Lisp (also known as CL)", "COMPASS", "Component Pascal", "Constraint Handling Rules (CHR)", "COMTRAN", "Converge", "Cool", "Coq", "Coral 66", "Corn", "CorVision", "COWSEL", "CPL", "CPL", "Cryptol", "csh", "Csound", "CSP", "CUDA", "Curl", "Curry", "Cybil", "Cyclone", "Cython", "Java", "Javascript", "M2001", "M4", "M#", "Machine code", "MAD (Michigan Algorithm Decoder)", "MAD/I", "Magik", "Magma", "make", "Maple", "MAPPER now part of BIS", "MARK-IV now VISION:BUILDER", "Mary", "MASM Microsoft Assembly x86", "MATH-MATIC", "Mathematica", "MATLAB", "Maxima (see also Macsyma)", "Max (Max Msp – Graphical Programming Environment)", "Maya (MEL)", "MDL", "Mercury", "Mesa", "Metafont", "Microcode", "MicroScript", "MIIS", "Milk (programming language)", "MIMIC", "Mirah", "Miranda", "MIVA Script", "ML", "Model 204", "Modelica", "Modula", "Modula-2", "Modula-3", "Mohol", "MOO", "Mortran", "Mouse", "MPD", "Mathcad", "MSIL – deprecated name for CIL", "MSL", "MUMPS", "Mystic Programming L"],
maxTags: 10,
dropdown: {
maxItems: 20, // <- mixumum allowed rendered suggestions
classname: 'tags-look', // <- custom classname for this dropdown, so it could be targeted
enabled: 0, // <- show suggestions on focus
closeOnSelect: false // <- do not hide the suggestions dropdown once an item has been selected
}
})
})()
</script>
</section>
<!----------- SECTION -------------->
<section id='section-textarea'>
<aside class='leftSide'>
<header>
<h2><a href='#section-textarea'>textarea</a></h2>
</header>
<p>
In this example, the field is pre-ocupied with 3 tags, and last tag is <strong>not included</strong> in the whitelist,
and will be <em>removed</em> because the <code>enforceWhitelist</code> <em>setting flag</em> is set to <code>true</code>
</p>
<p>
🚩 This example is very interesting because it shows another layer of complexity - Films' names might include commas (<code>,</code>),
and therefore it is <strong>very important</strong> to load initial values as Object <em>Collection</em> (Array of Objects)
where each Object is proper JSON as shown in the example below, or else initial tags will not get parsed well if they include commas.
</p>
<p>
🚩 <strong>Another important</strong> thing to keep in mind is that the default <code>delimiters</code>
setting of Tagify is to split tags by commas, and when tags (might) contain commas inside them,
this setting should be changed to <code>null</code>, so when a user is typing, for example,
a movie name which contains commans, a tag will <em>not</em> be created as soon as comma was inputed.
</p>
<details>
<summary>Code</summary>
<h3>HTML</h3>
<pre class="language-markup"><code><textarea name='tags2' placeholder='Movie names'> [{"value":"The Good, the Bad and the Ugly"}, {"value":"The Matrix"}]</textarea></code></pre>
<h3>JAVASCRIPT</h3>
<pre class='language-js'><code>var input = document.querySelector('textarea[name=tags2]'),
tagify = new Tagify(input, {
enforceWhitelist : true,
delimiters : null,
whitelist : ["The Shawshank Redemption", "The Godfather", "The Godfather: Part II", "The Dark Knight", "12 Angry Men", "Schindler's List", "Pulp Fiction", "The Lord of the Rings: The Return of the King", "The Good, the Bad and the Ugly", "Fight Club", "The Lord of the Rings: The Fellowship of the Ring", "Star Wars: Episode V - The Empire Strikes Back", "Forrest Gump", "Inception", "The Lord of the Rings: The Two Towers", "One Flew Over the Cuckoo's Nest", "Goodfellas", "The Matrix", "Seven Samurai", "Star Wars: Episode IV - A New Hope", "City of God", "Se7en", "The Silence of the Lambs", "It's a Wonderful Life", "The Usual Suspects", "Life Is Beautiful", "Léon: The Professional", "Spirited Away", "Saving Private Ryan", "La La Land", "Once Upon a Time in the West", "American History X", "Interstellar", "Casablanca", "Psycho", "City Lights", "The Green Mile", "Raiders of the Lost Ark", "The Intouchables", "Modern Times", "Rear Window", "The Pianist", "The Departed", "Terminator 2: Judgment Day", "Back to the Future", "Whiplash", "Gladiator", "Memento", "Apocalypse Now", "The Prestige", "The Lion King", "Alien", "Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb", "Sunset Boulevard", "The Great Dictator", "Cinema Paradiso", "The Lives of Others", "Paths of Glory", "Grave of the Fireflies", "Django Unchained", "The Shining", "WALL·E", "American Beauty", "The Dark Knight Rises", "Princess Mononoke", "Aliens", "Oldboy", "Once Upon a Time in America", "Citizen Kane", "Das Boot", "Witness for the Prosecution", "North by Northwest", "Vertigo", "Star Wars: Episode VI - Return of the Jedi", "Reservoir Dogs", "M", "Braveheart", "Amélie", "Requiem for a Dream", "A Clockwork Orange", "Taxi Driver", "Lawrence of Arabia", "Like Stars on Earth", "Double Indemnity", "To Kill a Mockingbird", "Eternal Sunshine of the Spotless Mind", "Toy Story 3", "Amadeus", "My Father and My Son", "Full Metal Jacket", "The Sting", "2001: A Space Odyssey", "Singin' in the Rain", "Bicycle Thieves", "Toy Story", "Dangal", "The Kid", "Inglourious Basterds", "Snatch", "Monty Python and the Holy Grail", "Hacksaw Ridge", "3 Idiots", "L.A. Confidential", "For a Few Dollars More", "Scarface", "Rashomon", "The Apartment", "The Hunt", "Good Will Hunting", "Indiana Jones and the Last Crusade", "A Separation", "Metropolis", "Yojimbo", "All About Eve", "Batman Begins", "Up", "Some Like It Hot", "The Treasure of the Sierra Madre", "Unforgiven", "Downfall", "Raging Bull", "The Third Man", "Die Hard", "Children of Heaven", "The Great Escape", "Heat", "Chinatown", "Inside Out", "Pan's Labyrinth", "Ikiru", "My Neighbor Totoro", "On the Waterfront", "Room", "Ran", "The Gold Rush", "The Secret in Their Eyes", "The Bridge on the River Kwai", "Blade Runner", "Mr. Smith Goes to Washington", "The Seventh Seal", "Howl's Moving Castle", "Lock, Stock and Two Smoking Barrels", "Judgment at Nuremberg", "Casino", "The Bandit", "Incendies", "A Beautiful Mind", "A Wednesday", "The General", "The Elephant Man", "Wild Strawberries", "Arrival", "V for Vendetta", "Warrior", "The Wolf of Wall Street", "Manchester by the Sea", "Sunrise", "The Passion of Joan of Arc", "Gran Torino", "Rang De Basanti", "Trainspotting", "Dial M for Murder", "The Big Lebowski", "The Deer Hunter", "Tokyo Story", "Gone with the Wind", "Fargo", "Finding Nemo", "The Sixth Sense", "The Thing", "Hera Pheri", "Cool Hand Luke", "Andaz Apna Apna", "Rebecca", "No Country for Old Men", "How to Train Your Dragon", "Munna Bhai M.B.B.S.", "Sholay", "Kill Bill: Vol. 1", "Into the Wild", "Mary and Max", "Gone Girl", "There Will Be Blood", "Come and See", "It Happened One Night", "Life of Brian", "Rush", "Hotel Rwanda", "Platoon", "Shutter Island", "Network", "The Wages of Fear", "Stand by Me", "Wild Tales", "In the Name of the Father", "Spotlight", "Star Wars: The Force Awakens", "The Nights of Cabiria", "The 400 Blows", "Butch Cassidy and the Sundance Kid", "Mad Max: Fury Road", "The Maltese Falcon", "12 Years a Slave", "Ben-Hur", "The Grand Budapest Hotel", "Persona", "Million Dollar Baby", "Amores Perros", "Jurassic Park", "The Princess Bride", "Hachi: A Dog's Tale", "Memories of Murder", "Stalker", "Nausicaä of the Valley of the Wind", "Drishyam", "The Truman Show", "The Grapes of Wrath", "Before Sunrise", "Touch of Evil", "Annie Hall", "The Message", "Rocky", "Gandhi", "Harry Potter and the Deathly Hallows: Part 2", "The Bourne Ultimatum", "Diabolique", "Donnie Darko", "Monsters, Inc.", "Prisoners", "8½", "The Terminator", "The Wizard of Oz", "Catch Me If You Can", "Groundhog Day", "Twelve Monkeys", "Zootopia", "La Haine", "Barry Lyndon", "Jaws", "The Best Years of Our Lives", "Infernal Affairs", "Udaan", "The Battle of Algiers", "Strangers on a Train", "Dog Day Afternoon", "Sin City", "Kind Hearts and Coronets", "Gangs of Wasseypur", "The Help"],
callbacks : {
add : console.log, // callback when adding a tag
remove : console.log // callback when removing a tag
}
})</code></pre>
</details>
</aside>
<aside class='rightSide'>
<a class='demoLink' title='View in Codepen' target='_blank' href='https://codepen.io/vsync/pen/dyMoYKb'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">
<use class="logo-use" xlink:href="#codepen-logo"/>
</svg>
</a>
<textarea name='tags2' placeholder='Movie names'> [{"value":"The Good, the Bad and the Ugly"}, {"value":"The Matrix"}]</textarea>
</aside>
<script>
(function(){
var input = document.querySelector('textarea[name=tags2]'),
tagify = new Tagify(input, {
enforceWhitelist : true,
delimiters : null,
whitelist : ["The Shawshank Redemption", "The Godfather", "The Godfather: Part II", "The Dark Knight", "12 Angry Men", "Schindler's List", "Pulp Fiction", "The Lord of the Rings: The Return of the King", "The Good, the Bad and the Ugly", "Fight Club", "The Lord of the Rings: The Fellowship of the Ring", "Star Wars: Episode V - The Empire Strikes Back", "Forrest Gump", "Inception", "The Lord of the Rings: The Two Towers", "One Flew Over the Cuckoo's Nest", "Goodfellas", "The Matrix", "Seven Samurai", "Star Wars: Episode IV - A New Hope", "City of God", "Se7en", "The Silence of the Lambs", "It's a Wonderful Life", "The Usual Suspects", "Life Is Beautiful", "Léon: The Professional", "Spirited Away", "Saving Private Ryan", "La La Land", "Once Upon a Time in the West", "American History X", "Interstellar", "Casablanca", "Psycho", "City Lights", "The Green Mile", "Raiders of the Lost Ark", "The Intouchables", "Modern Times", "Rear Window", "The Pianist", "The Departed", "Terminator 2: Judgment Day", "Back to the Future", "Whiplash", "Gladiator", "Memento", "Apocalypse Now", "The Prestige", "The Lion King", "Alien", "Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb", "Sunset Boulevard", "The Great Dictator", "Cinema Paradiso", "The Lives of Others", "Paths of Glory", "Grave of the Fireflies", "Django Unchained", "The Shining", "WALL·E", "American Beauty", "The Dark Knight Rises", "Princess Mononoke", "Aliens", "Oldboy", "Once Upon a Time in America", "Citizen Kane", "Das Boot", "Witness for the Prosecution", "North by Northwest", "Vertigo", "Star Wars: Episode VI - Return of the Jedi", "Reservoir Dogs", "M", "Braveheart", "Amélie", "Requiem for a Dream", "A Clockwork Orange", "Taxi Driver", "Lawrence of Arabia", "Like Stars on Earth", "Double Indemnity", "To Kill a Mockingbird", "Eternal Sunshine of the Spotless Mind", "Toy Story 3", "Amadeus", "My Father and My Son", "Full Metal Jacket", "The Sting", "2001: A Space Odyssey", "Singin' in the Rain", "Bicycle Thieves", "Toy Story", "Dangal", "The Kid", "Inglourious Basterds", "Snatch", "Monty Python and the Holy Grail", "Hacksaw Ridge", "3 Idiots", "L.A. Confidential", "For a Few Dollars More", "Scarface", "Rashomon", "The Apartment", "The Hunt", "Good Will Hunting", "Indiana Jones and the Last Crusade", "A Separation", "Metropolis", "Yojimbo", "All About Eve", "Batman Begins", "Up", "Some Like It Hot", "The Treasure of the Sierra Madre", "Unforgiven", "Downfall", "Raging Bull", "The Third Man", "Die Hard", "Children of Heaven", "The Great Escape", "Heat", "Chinatown", "Inside Out", "Pan's Labyrinth", "Ikiru", "My Neighbor Totoro", "On the Waterfront", "Room", "Ran", "The Gold Rush", "The Secret in Their Eyes", "The Bridge on the River Kwai", "Blade Runner", "Mr. Smith Goes to Washington", "The Seventh Seal", "Howl's Moving Castle", "Lock, Stock and Two Smoking Barrels", "Judgment at Nuremberg", "Casino", "The Bandit", "Incendies", "A Beautiful Mind", "A Wednesday", "The General", "The Elephant Man", "Wild Strawberries", "Arrival", "V for Vendetta", "Warrior", "The Wolf of Wall Street", "Manchester by the Sea", "Sunrise", "The Passion of Joan of Arc", "Gran Torino", "Rang De Basanti", "Trainspotting", "Dial M for Murder", "The Big Lebowski", "The Deer Hunter", "Tokyo Story", "Gone with the Wind", "Fargo", "Finding Nemo", "The Sixth Sense", "The Thing", "Hera Pheri", "Cool Hand Luke", "Andaz Apna Apna", "Rebecca", "No Country for Old Men", "How to Train Your Dragon", "Munna Bhai M.B.B.S.", "Sholay", "Kill Bill: Vol. 1", "Into the Wild", "Mary and Max", "Gone Girl", "There Will Be Blood", "Come and See", "It Happened One Night", "Life of Brian", "Rush", "Hotel Rwanda", "Platoon", "Shutter Island", "Network", "The Wages of Fear", "Stand by Me", "Wild Tales", "In the Name of the Father", "Spotlight", "Star Wars: The Force Awakens", "The Nights of Cabiria", "The 400 Blows", "Butch Cassidy and the Sundance Kid", "Mad Max: Fury Road", "The Maltese Falcon", "12 Years a Slave", "Ben-Hur", "The Grand Budapest Hotel", "Persona", "Million Dollar Baby", "Amores Perros", "Jurassic Park", "The Princess Bride", "Hachi: A Dog's Tale", "Memories of Murder", "Stalker", "Nausicaä of the Valley of the Wind", "Drishyam", "The Truman Show", "The Grapes of Wrath", "Before Sunrise", "Touch of Evil", "Annie Hall", "The Message", "Rocky", "Gandhi", "Harry Potter and the Deathly Hallows: Part 2", "The Bourne Ultimatum", "Diabolique", "Donnie Darko", "Monsters, Inc.", "Prisoners", "8½", "The Terminator", "The Wizard of Oz", "Catch Me If You Can", "Groundhog Day", "Twelve Monkeys", "Zootopia", "La Haine", "Barry Lyndon", "Jaws", "The Best Years of Our Lives", "Infernal Affairs", "Udaan", "The Battle of Algiers", "Strangers on a Train", "Dog Day Afternoon", "Sin City", "Kind Hearts and Coronets", "Gangs of Wasseypur", "The Help"],
callbacks : {
add : console.log, // callback when adding a tag
remove : console.log // callback when removing a tag
}
})
})()
</script>
</section>
<!----------- SECTION -------------->
<section id='section-rtl'>
<aside class='leftSide'>
<header>
<h2><a href='#section-rtl'>RTL & uncapped dropdown width</a></h2>
</header>
<p>
In this example, the <em>Tagify</em> field is inside a container which has <code>dir='rtl'</code> attribute and
also the Tagify <code>RTL</code> setting for the <code>dropdown</code> is set accordingly
(because it's better not infer it from the HTML but defined explicitly)
</p>
<p>
This example also showcases the ability to have the suggestions dropdown's maximum <code>width</code>
as wide as the longest item in the suggestions list, but still not less wide than the Taigy field
for which the dropdown "belongs".
</p>
<details>
<summary>Code</summary>
<h3>HTML</h3>
<pre class="language-markup"><code><div dir='rtl'>
<input name='rtl-example' class='tagify--rtl-exmaple' placeholder='לחץ בשדה והוסף ערך'/>
</div></code></pre>
<h3>JAVASCRIPT</h3>
<pre class='language-js'><code>// The DOM element you wish to replace with Tagify
var input = document.querySelector('input[name=rtl-example]');
// initialize Tagify on the above input node reference
new Tagify(input, {
whitelist: [
{ value: "מיכאל כהן", full: "<em>מיכאל כהן</em> - פיתוח תוכנה מתקדם ויישום טכנולוגיות חדשניות בתחום התעשייה והייצור" },
{ value: "שרה לוי", full: "<em>שרה לוי</em> - ניהול ופיתוח פתרונות אקולוגיים וסביבתיים למתן יתרון תחרותי לעסקים" },
{ value: "אברהם גולן", full: "<em>אברהם גולן</em> - יישום ופיתוח טכנולוגיות מתקדמות לשיפור פרודוקטיביות ויצירתיות בארגונים" },
{ value: "רחל רביבו", full: "<em>רחל רביבו</em> - מחקר ופיתוח טכנולוגי בתחום החדשנות והיזמות לקידום עסקים ותעשיות" },
{ value: "דוד כהן", full: "<em>דוד כהן</em> - פיתוח ויישום טכנולוגיות מתקדמות לשיפור תשתיות מידע עסקיות" },
{ value: "רבקה אריאל", full: "<em>רבקה אריאל</em> - ייזום ופיתוח מוצרים חדשניים עבור תעשיות יצירתיות ומתקדמות" }
],
dropdown: {
mapValueTo: 'full',
classname: 'tagify__dropdown--rtl-example',
enabled: 0, // shows the suggestiosn dropdown once field is focused
RTL: true,
escapeHTML: false // allows HTML inside each suggestion item
}
})</code></pre>
<h3>CSS</h3>
<style contenteditable>.tagify__dropdown--rtl-example {
max-width: none !important;
}
/* each suggestion item in the dropdown should be rendered as a single line of text */
.tagify__dropdown--rtl-example .tagify__dropdown__item {
white-space: nowrap;
}
/* just for fun */
.tagify__dropdown--rtl-example .tagify__dropdown__item > em {
font-weight: 700;
}
/* in this example the tagify itself is narrower than the other examples */
.tagify--rtl-exmaple {
min-width: 300px;
}</style>
</details>
</aside>
<aside class='rightSide'>
<a class='demoLink' title='View in Codepen' target='_blank' href='https://codepen.io/vsync/pen/VwReGKL'>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120">
<use class="logo-use" xlink:href="#codepen-logo"/>
</svg>
</a>
<div dir='rtl'>
<input name='rtl-example' class='tagify--rtl-exmaple' placeholder='לחץ בשדה והוסף ערך'/>
</div>
</aside>
<script>
(function(){
// The DOM element you wish to replace with Tagify
var input = document.querySelector('input[name=rtl-example]');
// initialize Tagify on the above input node reference
new Tagify(input, {
whitelist: [
{ value: "מיכאל כהן", full: "<em>מיכאל כהן</em> - פיתוח תוכנה מתקדם ויישום טכנולוגיות חדשניות בתחום התעשייה והייצור" },
{ value: "שרה לוי", full: "<em>שרה לוי</em> - ניהול ופיתוח פתרונות אקולוגיים וסביבתיים למתן יתרון תחרותי לעסקים" },
{ value: "אברהם גולן", full: "<em>אברהם גולן</em> - יישום ופיתוח טכנולוגיות מתקדמות לשיפור פרודוקטיביות ויצירתיות בארגונים" },
{ value: "רחל רביבו", full: "<em>רחל רביבו</em> - מחקר ופיתוח טכנולוגי בתחום החדשנות והיזמות לקידום עסקים ותעשיות" },
{ value: "דוד כהן", full: "<em>דוד כהן</em> - פיתוח ויישום טכנולוגיות מתקדמות לשיפור תשתיות מידע עסקיות" },
{ value: "רבקה אריאל", full: "<em>רבקה אריאל</em> - ייזום ופיתוח מוצרים חדשניים עבור תעשיות יצירתיות ומתקדמות" }
],
dropdown: {
mapValueTo: 'full',
classname: 'tagify__dropdown--rtl-example',
enabled: 0, // shows the suggestiosn dropdown once field is focused
RTL: true,
escapeHTML: false // allows HTML inside each suggestion item
}
})
})()
</script>
</section>
<!----------- SECTION -------------->
<section id='section-different-look'>
<aside class='leftSide'>
<header>
<h2><a href='#section-different-look'>Easy to customize</a></h2>
</header>
<p>
The easiest way to customize styles <em>(colors, borders, spacing, radii, etc.)</em> is by using <a href='https://github.com/yairEO/tagify#css-variables'>CSS variables</a>.
</p>
<p>
No placeholder, and no way of adding tags from within the component, but only
by clicking the (+) button, which is not related to Tagify in anyway, but in this example
it is shown how combining a few simple things make customization easy.
</p>
<p>
(This example also shows how to implement minimum-allowed tags)
</p>
<details>
<summary>Code</summary>
<h3>HTML</h3>
<pre class="language-markup"><code><input class='customLook' value='some.name@website.com'><button type="button">+</button></code></pre>
<h3>JAVASCRIPT</h3>
<pre class='language-js'><code>// generate random whilist items (for the demo)
var randomStringsArr = Array.apply(null, Array(100)).map(function () {
return Array.apply(null, Array(~~(Math.random() * 10 + 3))).map(function () {
return String.fromCharCode(Math.random() * (123 - 97) + 97)
}).join('') + '@gmail.com'
})
var input = document.querySelector('.customLook'),
button = input.nextElementSibling,
tagify = new Tagify(input, {
editTags: {
keepInvalid: false, // better to auto-remove invalid tags which are in edit-mode (on blur)
},
// email address validation (https://stackoverflow.com/a/46181/104380)
pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
whitelist: randomStringsArr,
callbacks: {
"invalid": onInvalidTag
},