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
use crateDrake;
use crate*;
use *;
use JsCast;
extern "C"
/// Activates the dragula drag-and-drop system with sane default options
///
/// The simplest way to activate dragula is to call `dragula` and pass it
/// the list of containers whose contents will draggable.
///
/// ### Example:
/// ```no_run
/// use dragula::*;
///
/// let doc = web_sys::window().unwrap().document().unwrap();
/// let element_1 = doc.get_element_by_id("drag-container-1").unwrap();
/// let element_2 = doc.get_element_by_id("drag-container-2").unwrap();
///
/// let drake = dragula(&[element_1, element_2]);
///
/// ```
/// Calling `dragula` will return a [`Drake`](crate::Drake), allowing you to
/// interact with the active system managing drag-and-drop.
/// Activates the dragula drag-and-drop system with provided options
///
/// If you would like to customize the behaviour of the drag-and-drop systems
/// past the defaults provided, you can call `dragula_options` and provide an
/// [`Options`](crate::Options) instance to specify behaviour of certain
/// drag-and-drop features.
///
/// ### Example:
/// ```no_run
/// use dragula::*;
/// use dragula::options::CopyValue;
/// use web_sys::Element;
///
/// let doc = web_sys::window().unwrap().document().unwrap();
/// let element_1 = doc.get_element_by_id("drag-container-1").unwrap();
/// let element_2 = doc.get_element_by_id("drag-container-2").unwrap();
///
/// let options = Options {
/// moves: Box::new(|_el, _source, handle, _sibling| {
/// Element::from(handle).class_list().contains("drag-handle")
/// }),
/// copy: CopyValue::Func(Box::new(|_el, source| {
/// Element::from(source).class_list().contains("copy-container")
/// })),
/// ignore_input_text_selection: true,
/// ..Options::default()
/// };
///
/// let drake = dragula_options(&[element_1, element_2], options);
///
/// ```
/// Calling `dragula_options` will return a [`Drake`](crate::Drake), allowing you to
/// interact with the active system managing drag-and-drop.