Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bryanbraun/35b7962f29fab3f2240f to your computer and use it in GitHub Desktop.
A patch to CKEditor's image2 plugin, which makes the alt text field required.
From f788a1a6c27be0fb421d2758492f9366b895ba20 Mon Sep 17 00:00:00 2001
From: Bryan Braun <bryanbraun@1410008.no-reply.drupal.org>
Date: Tue, 18 Nov 2014 14:43:17 -0500
Subject: [PATCH] Make the alt-text field required (and add a class for styling
it).
Signed-off-by: Bryan Braun <bryanbraun@1410008.no-reply.drupal.org>
---
dialogs/image2.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dialogs/image2.js b/dialogs/image2.js
index 319be69..0fb7021 100644
--- a/dialogs/image2.js
+++ b/dialogs/image2.js
@@ -425,13 +425,15 @@ CKEDITOR.dialog.add( 'image2', function( editor ) {
{
id: 'alt',
type: 'text',
+ className: 'ck-alt-required',
label: lang.alt,
setup: function( widget ) {
this.setValue( widget.data.alt );
},
commit: function( widget ) {
widget.setData( 'alt', this.getValue() );
- }
+ },
+ validate: CKEDITOR.dialog.validate.notEmpty( 'Alternative text is required.' )
},
{
type: 'hbox',
--
2.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment