Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
924be51a
Commit
924be51a
authored
Apr 18, 2013
by
alexpott
Browse files
Issue
#1954968
by Wim Leers | YesCT: Fixed Required CKEditor fields always fail HTML5 validation.
parent
24f54620
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/editor/js/editor.js
View file @
924be51a
...
...
@@ -96,12 +96,28 @@ Drupal.behaviors.editor = {
Drupal
.
editorAttach
=
function
(
field
,
format
)
{
if
(
format
.
editor
)
{
// HTML5 validation cannot ever work for WYSIWYG editors, because WYSIWYG
// editors always hide the underlying textarea element, which prevents
// browsers from putting the error message bubble in the right location.
// Hence: disable HTML5 validation for this element.
if
(
'
required
'
in
field
.
attributes
)
{
field
.
setAttribute
(
'
data-editor-required
'
,
true
);
field
.
removeAttribute
(
'
required
'
);
}
Drupal
.
editors
[
format
.
editor
].
attach
(
field
,
format
);
}
};
Drupal
.
editorDetach
=
function
(
field
,
format
,
trigger
)
{
if
(
format
.
editor
)
{
// Restore the HTML5 validation "required" attribute if it was removed in
// Drupal.editorAttach().
if
(
'
data-editor-required
'
in
field
.
attributes
)
{
field
.
setAttribute
(
'
required
'
,
'
required
'
);
field
.
removeAttribute
(
'
data-editor-required
'
);
}
Drupal
.
editors
[
format
.
editor
].
detach
(
field
,
format
,
trigger
);
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment