@ministryofjustice/frontend 3.3.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -10
- package/govuk-prototype-kit.config.json +5 -16
- package/moj/all.jquery.min.js +15 -4
- package/moj/all.js +2856 -2280
- package/moj/all.scss +2 -0
- package/moj/components/_all.scss +1 -0
- package/moj/components/action-bar/_action-bar.scss +4 -6
- package/moj/components/add-another/_add-another.scss +9 -7
- package/moj/components/add-another/add-another.js +128 -76
- package/moj/components/alert/README.md +0 -0
- package/moj/components/alert/_alert.scss +142 -0
- package/moj/components/alert/alert.js +482 -0
- package/moj/components/alert/alert.spec.helper.js +92 -0
- package/moj/components/alert/macro.njk +3 -0
- package/moj/components/alert/template.njk +83 -0
- package/moj/components/badge/_badge.scss +3 -4
- package/moj/components/banner/_banner.scss +5 -10
- package/moj/components/button-menu/_button-menu.scss +10 -9
- package/moj/components/button-menu/button-menu.js +348 -318
- package/moj/components/cookie-banner/_cookie-banner.scss +6 -5
- package/moj/components/currency-input/_currency-input.scss +4 -4
- package/moj/components/date-picker/README.md +14 -17
- package/moj/components/date-picker/_date-picker.scss +122 -106
- package/moj/components/date-picker/date-picker.js +927 -900
- package/moj/components/filter/README.md +1 -1
- package/moj/components/filter/_filter.scss +53 -75
- package/moj/components/filter-toggle-button/filter-toggle-button.js +122 -87
- package/moj/components/form-validator/form-validator.js +399 -156
- package/moj/components/header/_header.scss +17 -19
- package/moj/components/identity-bar/_identity-bar.scss +5 -5
- package/moj/components/interruption-card/_interruption-card.scss +2 -2
- package/moj/components/messages/_messages.scss +12 -19
- package/moj/components/multi-file-upload/README.md +1 -1
- package/moj/components/multi-file-upload/_multi-file-upload.scss +34 -30
- package/moj/components/multi-file-upload/multi-file-upload.js +454 -183
- package/moj/components/multi-select/_multi-select.scss +4 -3
- package/moj/components/multi-select/multi-select.js +106 -70
- package/moj/components/notification-badge/_notification-badge.scss +12 -12
- package/moj/components/organisation-switcher/_organisation-switcher.scss +1 -1
- package/moj/components/page-header-actions/_page-header-actions.scss +3 -2
- package/moj/components/pagination/_pagination.scss +26 -31
- package/moj/components/password-reveal/_password-reveal.scss +1 -2
- package/moj/components/password-reveal/password-reveal.js +63 -31
- package/moj/components/primary-navigation/_primary-navigation.scss +26 -29
- package/moj/components/progress-bar/_progress-bar.scss +21 -26
- package/moj/components/rich-text-editor/_rich-text-editor.scss +17 -16
- package/moj/components/rich-text-editor/rich-text-editor.js +186 -139
- package/moj/components/search/_search.scss +6 -4
- package/moj/components/search-toggle/search-toggle.js +83 -53
- package/moj/components/search-toggle/search-toggle.scss +21 -15
- package/moj/components/side-navigation/_side-navigation.scss +12 -21
- package/moj/components/sortable-table/_sortable-table.scss +25 -23
- package/moj/components/sortable-table/sortable-table.js +162 -119
- package/moj/components/sub-navigation/_sub-navigation.scss +24 -28
- package/moj/components/tag/_tag.scss +8 -9
- package/moj/components/task-list/_task-list.scss +8 -7
- package/moj/components/ticket-panel/_ticket-panel.scss +14 -6
- package/moj/components/timeline/_timeline.scss +18 -20
- package/moj/filters/all.js +28 -30
- package/moj/filters/prototype-kit-13-filters.js +2 -1
- package/moj/helpers/_all.scss +1 -0
- package/moj/helpers/_hidden.scss +1 -1
- package/moj/helpers/_links.scss +20 -0
- package/moj/helpers.js +218 -51
- package/moj/init.js +2 -2
- package/moj/moj-frontend.min.css +2 -2
- package/moj/moj-frontend.min.js +15 -4
- package/moj/objects/_filter-layout.scss +11 -10
- package/moj/objects/_scrollable-pane.scss +11 -14
- package/moj/settings/_colours.scss +5 -0
- package/moj/settings/_measurements.scss +0 -2
- package/moj/utilities/_hidden.scss +3 -3
- package/moj/utilities/_width-container.scss +1 -1
- package/moj/version.js +28 -1
- package/package.json +1 -1
- package/moj/all.spec.js +0 -22
- package/moj/components/button-menu/button-menu.spec.js +0 -361
- package/moj/components/date-picker/date-picker.spec.js +0 -1130
- package/moj/components/filter-toggle-button/filter-toggle-button.spec.js +0 -304
- package/moj/components/multi-select/multi-select.spec.js +0 -135
- package/moj/components/password-reveal/password-reveal.spec.js +0 -55
- package/moj/components/search-toggle/search-toggle.spec.js +0 -134
- package/moj/namespace.js +0 -1
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.moj-progress-bar__list {
|
|
10
|
-
|
|
11
|
-
list-style: none;
|
|
10
|
+
position: relative;
|
|
12
11
|
margin: 0;
|
|
13
12
|
padding: 0;
|
|
14
|
-
|
|
13
|
+
font-size: 0; // Hide white space between elements
|
|
14
|
+
list-style: none;
|
|
15
15
|
text-align: justify;
|
|
16
16
|
vertical-align: top;
|
|
17
17
|
|
|
@@ -22,84 +22,79 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&::before {
|
|
25
|
-
border-top: 6px solid govuk-colour("green");
|
|
26
25
|
content: "";
|
|
27
|
-
left: 0;
|
|
28
26
|
position: absolute;
|
|
29
27
|
top: 13px;
|
|
28
|
+
left: 0;
|
|
30
29
|
width: 100%;
|
|
30
|
+
border-top: 6px solid govuk-colour("green");
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
.moj-progress-bar__item {
|
|
36
35
|
@include govuk-font(19);
|
|
37
36
|
display: inline-block;
|
|
38
|
-
max-width: 20%;
|
|
39
37
|
position: relative;
|
|
38
|
+
max-width: 20%;
|
|
40
39
|
text-align: center;
|
|
41
40
|
vertical-align: top;
|
|
42
41
|
|
|
43
42
|
&:first-child,
|
|
44
43
|
&:last-child {
|
|
45
44
|
&::before {
|
|
46
|
-
border-top: 6px solid govuk-colour("white");
|
|
47
45
|
content: "";
|
|
48
46
|
position: absolute;
|
|
49
|
-
top: 13px;
|
|
47
|
+
top: 13px;
|
|
48
|
+
left: 0;
|
|
50
49
|
width: 50%;
|
|
50
|
+
border-top: 6px solid govuk-colour("white");
|
|
51
51
|
}
|
|
52
|
-
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
&:first-child {
|
|
56
|
-
|
|
57
55
|
&::before {
|
|
58
56
|
left: 0;
|
|
59
57
|
}
|
|
60
|
-
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
&:last-child {
|
|
64
|
-
|
|
65
61
|
&::before {
|
|
66
|
-
left: auto;
|
|
67
62
|
right: 0;
|
|
63
|
+
left: auto;
|
|
68
64
|
}
|
|
69
|
-
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
&[aria-current=step] {
|
|
67
|
+
&[aria-current="step"] {
|
|
68
|
+
// https://tink.uk/using-the-aria-current-attribute
|
|
73
69
|
@include govuk-font($size: 19, $weight: "bold");
|
|
74
70
|
}
|
|
75
|
-
|
|
76
71
|
}
|
|
77
72
|
|
|
78
73
|
.moj-progress-bar__icon {
|
|
79
|
-
position: relative;
|
|
80
|
-
background-color: govuk-colour("white");
|
|
81
|
-
border: 6px solid govuk-colour("green");
|
|
82
|
-
border-radius: 50%;
|
|
83
74
|
box-sizing: border-box;
|
|
84
75
|
display: block;
|
|
76
|
+
position: relative;
|
|
77
|
+
width: 32px;
|
|
85
78
|
height: 32px;
|
|
86
|
-
margin-left: auto;
|
|
87
79
|
margin-right: auto;
|
|
88
|
-
|
|
80
|
+
margin-left: auto;
|
|
81
|
+
border: 6px solid govuk-colour("green");
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
background-color: govuk-colour("white");
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
.moj-progress-bar__icon--complete {
|
|
92
87
|
background-color: govuk-colour("green");
|
|
93
88
|
background-image: url(#{$moj-images-path}icon-progress-tick.svg);
|
|
94
|
-
background-position: 50% 50%;
|
|
95
89
|
background-repeat: no-repeat;
|
|
90
|
+
background-position: 50% 50%;
|
|
96
91
|
}
|
|
97
92
|
|
|
98
93
|
.moj-progress-bar__label {
|
|
99
94
|
@include govuk-font(16);
|
|
100
95
|
display: block;
|
|
101
|
-
font-weight: inherit;
|
|
102
|
-
margin-top: govuk-spacing(3);
|
|
103
96
|
position: relative;
|
|
97
|
+
margin-top: govuk-spacing(3);
|
|
98
|
+
font-weight: inherit;
|
|
104
99
|
word-wrap: break-word; // Just in case
|
|
105
100
|
}
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.moj-rich-text-editor__toolbar-button {
|
|
11
|
+
width: 40px;
|
|
12
|
+
height: 40px;
|
|
13
|
+
margin-left: -2px;
|
|
14
|
+
float: left;
|
|
15
|
+
border: 2px solid govuk-colour("black");
|
|
16
|
+
outline: 0;
|
|
17
|
+
color: govuk-colour("black");
|
|
11
18
|
background-color: govuk-colour("white");
|
|
12
|
-
background-position: 50% 50%;
|
|
13
19
|
background-repeat: no-repeat;
|
|
20
|
+
background-position: 50% 50%;
|
|
14
21
|
background-size: 40px 40px;
|
|
15
|
-
border: 2px solid govuk-colour("black");
|
|
16
|
-
color: govuk-colour("black");
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
float: left;
|
|
19
22
|
text-decoration: none;
|
|
20
|
-
height: 40px;
|
|
21
|
-
margin-left: -2px;
|
|
22
|
-
outline: 0;
|
|
23
23
|
vertical-align: top;
|
|
24
|
-
|
|
24
|
+
cursor: pointer;
|
|
25
25
|
|
|
26
26
|
&:first-child {
|
|
27
27
|
margin-left: 0;
|
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&:focus {
|
|
37
|
-
background-color: $govuk-focus-colour;
|
|
38
|
-
color: $govuk-focus-text-colour;
|
|
39
|
-
box-shadow: 0 -2px $govuk-focus-colour, 0 4px $govuk-focus-text-colour;
|
|
40
|
-
outline: none;
|
|
41
37
|
position: relative;
|
|
42
38
|
z-index: 2;
|
|
39
|
+
outline: none;
|
|
40
|
+
color: $govuk-focus-text-colour;
|
|
41
|
+
background-color: $govuk-focus-colour;
|
|
42
|
+
box-shadow:
|
|
43
|
+
0 -2px $govuk-focus-colour,
|
|
44
|
+
0 4px $govuk-focus-text-colour;
|
|
43
45
|
}
|
|
44
|
-
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
.moj-rich-text-editor__toolbar-button--bold {
|
|
@@ -57,8 +58,8 @@
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
.moj-rich-text-editor__toolbar-button--unordered-list {
|
|
60
|
-
background-image: url(#{$moj-images-path}icon-wysiwyg-unordered-list.svg);
|
|
61
61
|
margin-left: govuk-spacing(2);
|
|
62
|
+
background-image: url(#{$moj-images-path}icon-wysiwyg-unordered-list.svg);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
.moj-rich-text-editor__toolbar-button--ordered-list {
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
|
|
68
69
|
.moj-rich-text-editor__content {
|
|
69
70
|
min-height: 130px;
|
|
70
|
-
outline: none;
|
|
71
71
|
overflow: auto;
|
|
72
72
|
resize: vertical;
|
|
73
|
+
outline: none;
|
|
73
74
|
}
|
|
@@ -1,139 +1,186 @@
|
|
|
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
|
-
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MOJFrontend = factory());
|
|
5
|
+
})(this, (function () { 'use strict';
|
|
6
|
+
|
|
7
|
+
function getDefaultExportFromCjs (x) {
|
|
8
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var _global_window_jQuery = window.jQuery;
|
|
12
|
+
|
|
13
|
+
var richTextEditor$1;
|
|
14
|
+
var hasRequiredRichTextEditor;
|
|
15
|
+
|
|
16
|
+
function requireRichTextEditor () {
|
|
17
|
+
if (hasRequiredRichTextEditor) return richTextEditor$1;
|
|
18
|
+
hasRequiredRichTextEditor = 1;
|
|
19
|
+
const $ = _global_window_jQuery;
|
|
20
|
+
|
|
21
|
+
function RichTextEditor(options) {
|
|
22
|
+
if (!('contentEditable' in document.documentElement)) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
this.options = options;
|
|
27
|
+
this.options.toolbar = this.options.toolbar || {
|
|
28
|
+
bold: false,
|
|
29
|
+
italic: false,
|
|
30
|
+
underline: false,
|
|
31
|
+
bullets: true,
|
|
32
|
+
numbers: true
|
|
33
|
+
};
|
|
34
|
+
this.textarea = this.options.textarea;
|
|
35
|
+
this.container = $(this.textarea).parent();
|
|
36
|
+
|
|
37
|
+
if (this.container.data('moj-rich-text-editor-initialised')) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.container.data('moj-rich-text-editor-initialised', true);
|
|
42
|
+
|
|
43
|
+
this.createToolbar();
|
|
44
|
+
this.hideDefault();
|
|
45
|
+
this.configureToolbar();
|
|
46
|
+
this.keys = {
|
|
47
|
+
left: 37,
|
|
48
|
+
right: 39,
|
|
49
|
+
up: 38,
|
|
50
|
+
down: 40
|
|
51
|
+
};
|
|
52
|
+
this.container.on(
|
|
53
|
+
'click',
|
|
54
|
+
'.moj-rich-text-editor__toolbar-button',
|
|
55
|
+
$.proxy(this, 'onButtonClick')
|
|
56
|
+
);
|
|
57
|
+
this.container
|
|
58
|
+
.find('.moj-rich-text-editor__content')
|
|
59
|
+
.on('input', $.proxy(this, 'onEditorInput'));
|
|
60
|
+
this.container.find('label').on('click', $.proxy(this, 'onLabelClick'));
|
|
61
|
+
this.toolbar.on('keydown', $.proxy(this, 'onToolbarKeydown'));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RichTextEditor.prototype.onToolbarKeydown = function (e) {
|
|
65
|
+
let focusableButton;
|
|
66
|
+
switch (e.keyCode) {
|
|
67
|
+
case this.keys.right:
|
|
68
|
+
case this.keys.down: {
|
|
69
|
+
focusableButton = this.toolbar.find('button[tabindex=0]');
|
|
70
|
+
const nextButton = focusableButton.next('button');
|
|
71
|
+
if (nextButton[0]) {
|
|
72
|
+
nextButton.focus();
|
|
73
|
+
focusableButton.attr('tabindex', '-1');
|
|
74
|
+
nextButton.attr('tabindex', '0');
|
|
75
|
+
}
|
|
76
|
+
break
|
|
77
|
+
}
|
|
78
|
+
case this.keys.left:
|
|
79
|
+
case this.keys.up: {
|
|
80
|
+
focusableButton = this.toolbar.find('button[tabindex=0]');
|
|
81
|
+
const previousButton = focusableButton.prev('button');
|
|
82
|
+
if (previousButton[0]) {
|
|
83
|
+
previousButton.focus();
|
|
84
|
+
focusableButton.attr('tabindex', '-1');
|
|
85
|
+
previousButton.attr('tabindex', '0');
|
|
86
|
+
}
|
|
87
|
+
break
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
RichTextEditor.prototype.getToolbarHtml = function () {
|
|
93
|
+
let html = '';
|
|
94
|
+
|
|
95
|
+
html += '<div class="moj-rich-text-editor__toolbar" role="toolbar">';
|
|
96
|
+
|
|
97
|
+
if (this.options.toolbar.bold) {
|
|
98
|
+
html +=
|
|
99
|
+
'<button class="moj-rich-text-editor__toolbar-button moj-rich-text-editor__toolbar-button--bold" type="button" data-command="bold"><span class="govuk-visually-hidden">Bold</span></button>';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (this.options.toolbar.italic) {
|
|
103
|
+
html +=
|
|
104
|
+
'<button class="moj-rich-text-editor__toolbar-button moj-rich-text-editor__toolbar-button--italic" type="button" data-command="italic"><span class="govuk-visually-hidden">Italic</span></button>';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (this.options.toolbar.underline) {
|
|
108
|
+
html +=
|
|
109
|
+
'<button class="moj-rich-text-editor__toolbar-button moj-rich-text-editor__toolbar-button--underline" type="button" data-command="underline"><span class="govuk-visually-hidden">Underline</span></button>';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (this.options.toolbar.bullets) {
|
|
113
|
+
html +=
|
|
114
|
+
'<button class="moj-rich-text-editor__toolbar-button moj-rich-text-editor__toolbar-button--unordered-list" type="button" data-command="insertUnorderedList"><span class="govuk-visually-hidden">Unordered list</span></button>';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (this.options.toolbar.numbers) {
|
|
118
|
+
html +=
|
|
119
|
+
'<button class="moj-rich-text-editor__toolbar-button moj-rich-text-editor__toolbar-button--ordered-list" type="button" data-command="insertOrderedList"><span class="govuk-visually-hidden">Ordered list</span></button>';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
html += '</div>';
|
|
123
|
+
return html
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
RichTextEditor.prototype.getEnhancedHtml = function (val) {
|
|
127
|
+
return `${this.getToolbarHtml()}<div class="govuk-textarea moj-rich-text-editor__content" contenteditable="true" spellcheck="false"></div>`
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
RichTextEditor.prototype.hideDefault = function () {
|
|
131
|
+
this.textarea = this.container.find('textarea');
|
|
132
|
+
this.textarea.addClass('govuk-visually-hidden');
|
|
133
|
+
this.textarea.attr('aria-hidden', true);
|
|
134
|
+
this.textarea.attr('tabindex', '-1');
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
RichTextEditor.prototype.createToolbar = function () {
|
|
138
|
+
this.toolbar = document.createElement('div');
|
|
139
|
+
this.toolbar.className = 'moj-rich-text-editor';
|
|
140
|
+
this.toolbar.innerHTML = this.getEnhancedHtml();
|
|
141
|
+
this.container.append(this.toolbar);
|
|
142
|
+
this.toolbar = this.container.find('.moj-rich-text-editor__toolbar');
|
|
143
|
+
this.container
|
|
144
|
+
.find('.moj-rich-text-editor__content')
|
|
145
|
+
.html(this.textarea.val());
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
RichTextEditor.prototype.configureToolbar = function () {
|
|
149
|
+
this.buttons = this.container.find('.moj-rich-text-editor__toolbar-button');
|
|
150
|
+
this.buttons.prop('tabindex', '-1');
|
|
151
|
+
const firstTab = this.buttons.first();
|
|
152
|
+
firstTab.prop('tabindex', '0');
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
RichTextEditor.prototype.onButtonClick = function (e) {
|
|
156
|
+
document.execCommand($(e.currentTarget).data('command'), false, null);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
RichTextEditor.prototype.getContent = function () {
|
|
160
|
+
return this.container.find('.moj-rich-text-editor__content').html()
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
RichTextEditor.prototype.onEditorInput = function (e) {
|
|
164
|
+
this.updateTextarea();
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
RichTextEditor.prototype.updateTextarea = function () {
|
|
168
|
+
document.execCommand('defaultParagraphSeparator', false, 'p');
|
|
169
|
+
this.textarea.val(this.getContent());
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
RichTextEditor.prototype.onLabelClick = function (e) {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
this.container.find('.moj-rich-text-editor__content').focus();
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
richTextEditor$1 = { RichTextEditor };
|
|
178
|
+
return richTextEditor$1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
var richTextEditorExports = requireRichTextEditor();
|
|
182
|
+
var richTextEditor = /*@__PURE__*/getDefaultExportFromCjs(richTextEditorExports);
|
|
183
|
+
|
|
184
|
+
return richTextEditor;
|
|
185
|
+
|
|
186
|
+
}));
|
|
@@ -26,17 +26,19 @@
|
|
|
26
26
|
|
|
27
27
|
.moj-search__button {
|
|
28
28
|
display: inline-block;
|
|
29
|
-
margin-bottom: 0;
|
|
30
|
-
margin-left: govuk-spacing(2);
|
|
31
29
|
position: relative;
|
|
32
30
|
top: -2px; // Override default gov properties due to active pixel movement
|
|
33
|
-
vertical-align: bottom;
|
|
34
31
|
width: auto;
|
|
32
|
+
margin-bottom: 0;
|
|
33
|
+
margin-left: govuk-spacing(2);
|
|
34
|
+
vertical-align: bottom;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.moj-search--inline {
|
|
38
|
+
// stylelint-disable-next-line declaration-no-important
|
|
38
39
|
padding: govuk-spacing(2) 0 !important;
|
|
39
40
|
@include govuk-media-query($from: desktop) {
|
|
41
|
+
// stylelint-disable-next-line declaration-no-important
|
|
40
42
|
padding: 0 !important;
|
|
41
43
|
}
|
|
42
|
-
}
|
|
44
|
+
}
|