Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
h5p-editor-php-library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
h5p-editor-php-library
Commits
d06277fb
Commit
d06277fb
authored
5 years ago
by
Frode Petterson
Browse files
Options
Downloads
Patches
Plain Diff
JI-1318 Add IDs for list widgets as well
(very useful for text editors)
parent
33e5ee9a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/h5peditor-list-editor.js
+2
-0
2 additions, 0 deletions
scripts/h5peditor-list-editor.js
scripts/h5peditor-semantic-structure.js
+25
-2
25 additions, 2 deletions
scripts/h5peditor-semantic-structure.js
with
27 additions
and
2 deletions
scripts/h5peditor-list-editor.js
+
2
−
0
View file @
d06277fb
...
...
@@ -13,6 +13,8 @@ H5PEditor.ListEditor = (function ($) {
var
entity
=
list
.
getEntity
();
// Create list html
var
$list
=
$
(
'
<ul/>
'
,
{
id
:
list
.
getId
(),
'
aria-describedby
'
:
list
.
getDescriptionId
(),
'
class
'
:
'
h5p-ul
'
});
...
...
This diff is collapsed.
Click to expand it.
scripts/h5peditor-semantic-structure.js
+
25
−
2
View file @
d06277fb
...
...
@@ -23,6 +23,9 @@ H5PEditor.SemanticStructure = (function ($) {
// Support old editor libraries
self
.
field
=
{};
const
id
=
H5PEditor
.
getNextFieldId
(
field
);
const
descriptionId
=
(
field
.
description
!==
undefined
?
H5PEditor
.
getDescriptionId
(
id
)
:
undefined
)
/**
* Global instance variables.
* @private
...
...
@@ -48,13 +51,14 @@ H5PEditor.SemanticStructure = (function ($) {
// Create field label
if
(
field
.
label
!==
0
)
{
// Add label
createLabel
(
self
.
label
,
field
.
optional
).
appendTo
(
$wrapper
);
createLabel
(
self
.
label
,
field
.
optional
,
id
).
appendTo
(
$wrapper
);
}
// Create description
var
$description
;
if
(
field
.
description
!==
undefined
)
{
$description
=
$
(
'
<div/>
'
,
{
'
id
'
:
descriptionId
,
'
class
'
:
'
h5peditor-field-description
'
,
text
:
field
.
description
,
appendTo
:
$wrapper
...
...
@@ -247,6 +251,24 @@ H5PEditor.SemanticStructure = (function ($) {
return
field
.
name
;
};
/**
* Get the input id the label points to.
*
* @returns {String} Name of the current field
*/
self
.
getId
=
function
()
{
return
id
;
};
/**
* Get the description id to point to.
*
* @returns {String} Name of the current field
*/
self
.
getDescriptionId
=
function
()
{
return
descriptionId
;
};
// Must be last
init
();
}
...
...
@@ -262,8 +284,9 @@ H5PEditor.SemanticStructure = (function ($) {
* @param {String} text
* @returns {jQuery}
*/
var
createLabel
=
function
(
text
,
optional
)
{
var
createLabel
=
function
(
text
,
optional
,
id
)
{
return
$
(
'
<label/>
'
,
{
'
for
'
:
id
,
'
class
'
:
'
h5peditor-label
'
+
(
optional
?
''
:
'
h5peditor-required
'
),
text
:
text
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment