Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ace_editor
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ace_editor
Merge requests
!16
Issue
#3513683
: Required Validation Issue with ACE Editor Field
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3513683
: Required Validation Issue with ACE Editor Field
issue/ace_editor-3513683:3513683-required-validation-issue
into
2.0.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Ahmad Abbad
requested to merge
issue/ace_editor-3513683:3513683-required-validation-issue
into
2.0.x
3 weeks ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Remaining tasks
File an issue
Addition/Change/Update/Fix
Testing to ensure no regression
Automated unit testing coverage
Automated functional testing coverage
UX/UI designer responsibilities
Readability
Accessibility
Performance
Security
Documentation
Code review by maintainers
Full testing and approval
Credit contributors
Review with the product owner
Release notes snippet
Release
Closes
#3513683
0
0
Merge request reports
Compare
2.0.x
2.0.x (HEAD)
and
latest version
latest version
569b2396
1 commit,
3 weeks ago
1 file
+
14
−
2
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
js/editor.js
+
14
−
2
Options
@@ -2,6 +2,8 @@
@@ -2,6 +2,8 @@
'
use strict
'
;
'
use strict
'
;
// A page may contain multiple editors. editors variable store all of them as { id: editor_object }
// A page may contain multiple editors. editors variable store all of them as { id: editor_object }
var
editors
=
{};
var
editors
=
{};
// Store required elements to restore them later
var
requiredElements
=
new
Set
();
/**
/**
* @file
* @file
* Defines AceEditor as a Drupal editor.
* Defines AceEditor as a Drupal editor.
@@ -18,7 +20,13 @@
@@ -18,7 +20,13 @@
// Creating a unique id for our new text editor
// Creating a unique id for our new text editor
var
ace_editor_id
=
element_id
+
"
-ace-editor
"
;
var
ace_editor_id
=
element_id
+
"
-ace-editor
"
;
// Handle the 'required' attribute
if
(
element
.
hasAttribute
(
'
required
'
))
{
// Store the ID of the required element
requiredElements
.
add
(
element_id
);
// Remove the 'required' attribute
element
.
removeAttribute
(
'
required
'
);
}
// We don't delete the original textarea, but hide it.
// We don't delete the original textarea, but hide it.
$element
.
hide
().
css
(
'
visibility
'
,
'
hidden
'
);
$element
.
hide
().
css
(
'
visibility
'
,
'
hidden
'
);
@@ -64,7 +72,11 @@
@@ -64,7 +72,11 @@
else
{
else
{
editors
[
ace_editor_id
].
destroy
();
editors
[
ace_editor_id
].
destroy
();
editors
[
ace_editor_id
].
container
.
remove
();
editors
[
ace_editor_id
].
container
.
remove
();
// Restore the 'required' attribute if it was originally present
if
(
requiredElements
.
has
(
element_id
))
{
element
.
setAttribute
(
'
required
'
,
'
required
'
);
requiredElements
.
delete
(
element_id
);
// Remove from the set
}
$element
.
show
().
css
(
'
visibility
'
,
'
visible
'
);
$element
.
show
().
css
(
'
visibility
'
,
'
visible
'
);
//element.removeAttribute('contentEditable');
//element.removeAttribute('contentEditable');
}
}
Loading