Skip to content

Commit b890dad

Browse files
committed
Merge branch 'DLS-Release-v1.3.0' of https://github.com/TechnologyEnhancedLearning/DLSV2 into DLS-Release-v1.3.0
2 parents 8fa1d92 + 9b11221 commit b890dad

File tree

4 files changed

+168
-91
lines changed

4 files changed

+168
-91
lines changed

DigitalLearningSolutions.Web/Scripts/frameworks/htmleditor.ts

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,19 @@ if (jodited === false) {
7070
const clean = DOMPurify.sanitize(editor.editor.innerHTML);
7171
editor.editor.innerHTML = clean;
7272
});
73+
74+
document.addEventListener('DOMContentLoaded', () => {
75+
removeWaveErrors();
76+
removeDevToolsIssues();
77+
});
78+
79+
// ** Start* for jodit editor error (display red outline, focus on summary error text click) ****
7380
const textarea = document.querySelector('.nhsuk-textarea.html-editor.nhsuk-input--error') as HTMLTextAreaElement | null;
7481
if (textarea) {
7582
const editorDiv = document.querySelector('.jodit-container.jodit.jodit_theme_default.jodit-wysiwyg_mode') as HTMLDivElement | null;
7683
editorDiv?.classList.add('jodit-container', 'jodit', 'jodit_theme_default', 'jodit-wysiwyg_mode', 'jodit-error');
7784
}
78-
7985
const summary = document.querySelector('.nhsuk-list.nhsuk-error-summary__list') as HTMLDivElement | null;
80-
8186
if (summary) {
8287
summary.addEventListener('click', (e: Event) => {
8388
if (textarea) {
@@ -96,5 +101,70 @@ if (jodited === false) {
96101
}
97102
});
98103
}
104+
// ** End* for jodit editor error (display red outline, focus on summary error text click) ****
105+
}
106+
}
107+
108+
function removeWaveErrors() {
109+
const input = Array.from(document.querySelectorAll<HTMLInputElement>('input[tab-index="-1"]'))
110+
.find((el) => el.style.width === '0px' && el.style.height === '0px'
111+
&& el.style.position === 'absolute' && el.style.visibility === 'hidden');
112+
113+
if (input) {
114+
input.setAttribute('aria-label', 'Hidden input for accessibility');
115+
input.setAttribute('title', 'HiddenInput');
116+
}
117+
118+
const observer = new MutationObserver((mutations, obs) => {
119+
const textarea = document.querySelector('.ace_text-input') as HTMLTextAreaElement | null;
120+
if (textarea) {
121+
textarea.setAttribute('aria-label', 'ace_text-input');
122+
obs.disconnect();
123+
}
124+
});
125+
observer.observe(document.body, {
126+
childList: true,
127+
subtree: true,
128+
});
129+
}
130+
function removeDevToolsIssues() {
131+
// set role = 'list' to toolbar
132+
const toolbarbox = document.querySelector('.jodit-toolbar__box') as HTMLElement | null;
133+
if (toolbarbox) {
134+
toolbarbox.setAttribute('role', 'list');
135+
}
136+
// set role = 'list' to statusbar
137+
const statusbar = document.querySelector('.jodit-xpath') as HTMLElement | null;
138+
if (statusbar) {
139+
statusbar.setAttribute('role', 'list');
99140
}
141+
document.querySelectorAll('.jodit-toolbar-button__trigger').forEach((el) => {
142+
el.removeAttribute('role');
143+
});
144+
// observer to detect role='trigger' and remove role
145+
const observer = new MutationObserver(() => {
146+
document.querySelectorAll('.jodit-toolbar-button__trigger').forEach((el) => {
147+
el.removeAttribute('role');
148+
});
149+
});
150+
const target = document.querySelector('.jodit-toolbar__box');
151+
if (target) {
152+
observer.observe(target, { subtree: true, childList: true });
153+
}
154+
155+
// observer to detect iframe and set title
156+
const observer2 = new MutationObserver(() => {
157+
const hiddenIframe = Array.from(document.querySelectorAll('iframe')).find((iframe) => {
158+
const rect = iframe.getBoundingClientRect();
159+
return rect.width === 0 && rect.height === 0 && (iframe.src === 'about:blank' || iframe.getAttribute('src') === 'about:blank');
160+
});
161+
if (hiddenIframe) {
162+
hiddenIframe.setAttribute('title', 'Hidden iframe');
163+
observer2.disconnect(); // Stop observing once found
164+
}
165+
});
166+
observer2.observe(document.body, {
167+
childList: true,
168+
subtree: true,
169+
});
100170
}

DigitalLearningSolutions.Web/Styles/jodit.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
border: 2px solid red !important;
55
border-radius: 4px;
66
}
7+
.jodit-placeholder {
8+
display: none !important;
9+
}
Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,106 @@
11
@using DigitalLearningSolutions.Web.ViewModels.Frameworks;
22
@model FrameworkCompetencyViewModel;
33
@{
4-
ViewData["Title"] = !string.IsNullOrWhiteSpace(Model.VocabSingular()) ? Model.VocabSingular(): "Competency";
5-
ViewData["Application"] = "Framework Service";
6-
ViewData["HeaderPathName"] = "Framework Service";
4+
ViewData["Title"] = !string.IsNullOrWhiteSpace(Model.VocabSingular()) ? Model.VocabSingular() : "Competency";
5+
ViewData["Application"] = "Framework Service";
6+
ViewData["HeaderPathName"] = "Framework Service";
77
}
88
<link rel="stylesheet" href="@Url.Content("~/css/frameworks/frameworksShared.css")" asp-append-version="true">
99
<link rel="stylesheet" href="@Url.Content("~/css/jodit.css")" asp-append-version="true">
1010
@section NavMenuItems {
11-
<partial name="Shared/_NavMenuItems" />
11+
<partial name="Shared/_NavMenuItems" />
1212
}
13-
@section NavBreadcrumbs {
14-
<nav class="nhsuk-breadcrumb" aria-label="Breadcrumb">
15-
<div class="nhsuk-width-container">
16-
<ol class="nhsuk-breadcrumb__list">
17-
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link trigger-loader" asp-action="ViewFrameworks" asp-route-tabname="Mine">Frameworks</a></li>
18-
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link trigger-loader" asp-action="ViewFramework" asp-route-frameworkCompetencyGroupId="@Model.FrameworkCompetencyGroupId" asp-fragment="[email protected]" asp-route-frameworkId="@Model.DetailFramework.ID" asp-route-tabname="Structure">Framework Structure</a></li>
19-
<li class="nhsuk-breadcrumb__item">@Model.VocabSingular()</li>
20-
</ol>
13+
@section NavBreadcrumbs {
14+
<nav class="nhsuk-breadcrumb" aria-label="Breadcrumb">
15+
<div class="nhsuk-width-container">
16+
<ol class="nhsuk-breadcrumb__list">
17+
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link trigger-loader" asp-action="ViewFrameworks" asp-route-tabname="Mine">Frameworks</a></li>
18+
<li class="nhsuk-breadcrumb__item"><a class="nhsuk-breadcrumb__link trigger-loader" asp-action="ViewFramework" asp-route-frameworkCompetencyGroupId="@Model.FrameworkCompetencyGroupId" asp-fragment="[email protected]" asp-route-frameworkId="@Model.DetailFramework.ID" asp-route-tabname="Structure">Framework Structure</a></li>
19+
<li class="nhsuk-breadcrumb__item">@Model.VocabSingular()</li>
20+
</ol>
2121
<p class="nhsuk-breadcrumb__back"><a class="nhsuk-breadcrumb__backlink" asp-action="ViewFramework" asp-route-frameworkCompetencyGroupId="@Model.FrameworkCompetencyGroupId" asp-fragment="[email protected]" asp-route-frameworkId="@Model.DetailFramework.ID" asp-route-tabname="Structure">Back to framework structure</a></p>
22-
</div>
23-
</nav>
22+
</div>
23+
</nav>
2424
}
25-
<div class="nhsuk-grid-row">
25+
<div class="nhsuk-grid-row">
2626

2727
<div class="nhsuk-grid-column-full">
28-
@if (Model.FrameworkCompetency.Id > 0)
29-
{
30-
<h1>
31-
Edit @Model.VocabSingular().ToLower()
32-
</h1>
33-
}
34-
else
35-
{
36-
<h1>
37-
Add new @Model.VocabSingular().ToLower()
38-
</h1>
39-
}
40-
@if (Model.DetailFramework.PublishStatusID == 3)
41-
{
42-
<partial name="Shared/_PublishedWarning" />
43-
}
44-
<form method="post">
45-
@if (!ViewData.ModelState.IsValid)
46-
{
47-
<partial name="_ErrorSummary" />
48-
}
49-
<nhs-form-group nhs-validation-for="FrameworkCompetency.Name">
50-
<label class="nhsuk-label" id="competency-name-label" for="competency-name">
51-
@Model.VocabSingular() statement
52-
</label>
53-
<span nhs-validation-for="FrameworkCompetency.Name"></span>
54-
<input class="nhsuk-input" asp-for="FrameworkCompetency.Name" id="Name" name="Name" type="text" error-class-toggle="nhsuk-input--error" aria-describedby="competency-name-label">
55-
</nhs-form-group>
56-
<div class="nhsuk-form-group">
57-
<vc:text-area asp-for="FrameworkCompetency.Description"
58-
label="@Model.VocabSingular() description"
59-
populate-with-current-value="true"
60-
rows="5"
61-
spell-check="false"
62-
hint-text=""
63-
css-class="html-editor"
64-
character-count="null"
65-
populate-with-current-value="true" />
66-
</div>
67-
@if (Model.CompetencyFlags?.Count() > 0)
68-
{
69-
<div class="nhsuk-form-group">
70-
<label class="nhsuk-label nhsuk-u-margin-bottom-2" id="competency-description-label" for="competency-description">
71-
@Model.VocabSingular() tags
72-
</label>
73-
@foreach (var flag in Model.CompetencyFlags)
74-
{
75-
<div class="nhsuk-checkboxes__item">
76-
<input class="nhsuk-checkboxes__input" name="selectedFlagIds" type="checkbox" value="@flag.FlagId" @(flag.Selected ? "checked" : string.Empty) />
77-
<label class="nhsuk-label nhsuk-checkboxes__label">
78-
@flag.FlagName
79-
</label>
28+
@if (Model.FrameworkCompetency.Id > 0)
29+
{
30+
<h1>
31+
Edit @Model.VocabSingular().ToLower()
32+
</h1>
33+
}
34+
else
35+
{
36+
<h1>
37+
Add new @Model.VocabSingular().ToLower()
38+
</h1>
39+
}
40+
@if (Model.DetailFramework.PublishStatusID == 3)
41+
{
42+
<partial name="Shared/_PublishedWarning" />
43+
}
44+
<form method="post">
45+
@if (!ViewData.ModelState.IsValid)
46+
{
47+
<partial name="_ErrorSummary" />
48+
}
49+
<nhs-form-group nhs-validation-for="FrameworkCompetency.Name">
50+
<label class="nhsuk-label" id="competency-name-label" for="name">
51+
@Model.VocabSingular() statement
52+
</label>
53+
<span nhs-validation-for="FrameworkCompetency.Name"></span>
54+
<input class="nhsuk-input" asp-for="FrameworkCompetency.Name" id="Name" name="Name" type="text" error-class-toggle="nhsuk-input--error" aria-describedby="competency-name-label">
55+
</nhs-form-group>
56+
<div class="nhsuk-form-group">
57+
<vc:text-area asp-for="FrameworkCompetency.Description"
58+
label="@Model.VocabSingular() description"
59+
populate-with-current-value="true"
60+
rows="5"
61+
spell-check="false"
62+
hint-text=""
63+
css-class="html-editor"
64+
character-count="null"
65+
populate-with-current-value="true" />
8066
</div>
81-
}
82-
</div>
83-
}
67+
@if (Model.CompetencyFlags?.Count() > 0)
68+
{
69+
<div class="nhsuk-form-group">
70+
<label class="nhsuk-label nhsuk-u-margin-bottom-2" id="competency-description-label" for="competency-description">
71+
@Model.VocabSingular() tags
72+
</label>
73+
@foreach (var flag in Model.CompetencyFlags)
74+
{
75+
<div class="nhsuk-checkboxes__item">
76+
<input class="nhsuk-checkboxes__input" name="selectedFlagIds" type="checkbox" value="@flag.FlagId" @(flag.Selected ? "checked" : string.Empty) />
77+
<label class="nhsuk-label nhsuk-checkboxes__label">
78+
@flag.FlagName
79+
</label>
80+
</div>
81+
}
82+
</div>
83+
}
8484

85-
<input name="Id" type="hidden" asp-for="FrameworkCompetency.Id" />
86-
<input name="CompetencyID" type="hidden" asp-for="FrameworkCompetency.CompetencyID" />
87-
<input name="Ordering" type="hidden" asp-for="FrameworkCompetency.Ordering" />
85+
<input name="Id" type="hidden" asp-for="FrameworkCompetency.Id" />
86+
<input name="CompetencyID" type="hidden" asp-for="FrameworkCompetency.CompetencyID" />
87+
<input name="Ordering" type="hidden" asp-for="FrameworkCompetency.Ordering" />
8888

89-
<button class="nhsuk-button" type="submit">
90-
Save
91-
</button>
92-
<div class="nhsuk-back-link">
93-
<a class="nhsuk-back-link__link" asp-action="ViewFramework" asp-route-frameworkCompetencyGroupId="@Model.FrameworkCompetencyGroupId" asp-fragment="[email protected]" asp-route-frameworkId="@Model.DetailFramework.ID" asp-route-tabname="Structure">
94-
<svg class="nhsuk-icon nhsuk-icon__chevron-left" focusable='false' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
95-
<path d="M13.41 12l5.3-5.29a1 1 0 1 0-1.42-1.42L12 10.59l-5.29-5.3a1 1 0 0 0-1.42 1.42l5.3 5.29-5.3 5.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l5.29-5.3 5.29 5.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"></path>
96-
</svg>
97-
Cancel
98-
</a>
99-
</div>
100-
</form>
101-
</div>
89+
<button class="nhsuk-button" type="submit">
90+
Save
91+
</button>
92+
<div class="nhsuk-back-link">
93+
<a class="nhsuk-back-link__link" asp-action="ViewFramework" asp-route-frameworkCompetencyGroupId="@Model.FrameworkCompetencyGroupId" asp-fragment="[email protected]" asp-route-frameworkId="@Model.DetailFramework.ID" asp-route-tabname="Structure">
94+
<svg class="nhsuk-icon nhsuk-icon__chevron-left" focusable='false' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
95+
<path d="M13.41 12l5.3-5.29a1 1 0 1 0-1.42-1.42L12 10.59l-5.29-5.3a1 1 0 0 0-1.42 1.42l5.3 5.29-5.3 5.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l5.29-5.3 5.29 5.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z"></path>
96+
</svg>
97+
Cancel
98+
</a>
99+
</div>
100+
</form>
101+
</div>
102102
</div>
103103
@section scripts {
104-
<script src="@Url.Content("~/js/frameworks/htmleditor.js")" asp-append-version="true"></script>
104+
<script src="@Url.Content("~/js/frameworks/htmleditor.js")" asp-append-version="true"></script>
105105
}
106106

DigitalLearningSolutions.Web/Views/Frameworks/Developer/Import/ImportCompleted.cshtml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,19 @@
4747
{
4848
<text>
4949
<li>
50-
Some existing @Model.FrameworkVocabularySingular.ToLower() @(Model.CompetenciesToReorderCount == 1 ? "record" : "records") have changed sequence in your uploaded sheet. You can choose whether to fix them in the new order next.
50+
Some existing @Model.FrameworkVocabularySingular.ToLower() @(Model.CompetenciesToReorderCount == 1 ? "record" : "records") have changed sequence in your uploaded sheet. You can choose whether to fix them in the new order next.
5151
</li></text>
5252
}
5353
<li>No errors</li>
5454
}
5555
</ul>
5656
@if (Model.ErrorCount == 0)
5757
{
58-
<a asp-controller="Frameworks" role="button" asp-route-frameworkId="@ViewContext.RouteData.Values["frameworkId"]" asp-route-tabname="Structure" asp-action="ApplyCompetencyOrdering" class="nhsuk-button">Continue</a>
58+
<a asp-controller="Frameworks" role="button" asp-route-frameworkId="@ViewContext.RouteData.Values["frameworkId"]"
59+
asp-route-tabname="Structure" asp-action="ApplyCompetencyOrdering" class="nhsuk-button">
60+
Continue
61+
<span class="nhsuk-u-visually-hidden">to apply sequence changes</span>
62+
</a>
5963
}
6064
else
6165
{

0 commit comments

Comments
 (0)