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
GitLab 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
by ahmad abbad: Required Validation Issue with ACE Editor Field
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Issue
#3513683
by ahmad abbad: Required Validation Issue with ACE Editor Field
issue/ace_editor-3513683:3513683-required-validation-issue
into
2.0.x
Overview
0
Commits
2
Pipelines
0
Changes
1
Merged
Issue #3513683 by ahmad abbad: Required Validation Issue with ACE Editor Field
Ahmad Abbad
requested to merge
issue/ace_editor-3513683:3513683-required-validation-issue
into
2.0.x
4 months ago
Overview
0
Commits
2
Pipelines
0
Changes
1
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
Edited
1 week ago
by
Rajab Natshah
1
0
Merge request reports
Compare
2.0.x
version 1
569b2396
4 months ago
2.0.x (base)
and
latest version
latest version
f3e0f091
2 commits,
1 week ago
version 1
569b2396
1 commit,
4 months ago
1 file
+
14
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
js/editor.js
+
14
−
2
View file @ f3e0f091
Edit in single-file editor
Open in Web IDE
Show full file
@@ -2,6 +2,8 @@
'
use strict
'
;
// A page may contain multiple editors. editors variable store all of them as { id: editor_object }
var
editors
=
{};
// Store required elements to restore them later
var
requiredElements
=
new
Set
();
/**
* @file
* Defines AceEditor as a Drupal editor.
@@ -18,7 +20,13 @@
// Creating a unique id for our new text 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.
$element
.
hide
().
css
(
'
visibility
'
,
'
hidden
'
);
@@ -64,7 +72,11 @@
else
{
editors
[
ace_editor_id
].
destroy
();
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.removeAttribute('contentEditable');
}
Loading