Created
May 23, 2018 11:06
-
-
Save pgrunewald/f0d00a1899b533d5cc467aa5195b57e5 to your computer and use it in GitHub Desktop.
CKEditor widget demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.simplebox { | |
padding: 8px; | |
margin: 10px; | |
background: #eee; | |
border-radius: 8px; | |
border: 1px solid #ddd; | |
box-shadow: 0 1px 1px #fff inset, 0 -1px 0px #ccc inset; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CKEDITOR.plugins.add( 'simplebox', { | |
requires: 'widget', | |
icons: 'simplebox', | |
init: function( editor ) { | |
editor.widgets.add( 'simplebox', { | |
button: 'Create a simple box', | |
template: | |
'<div class="simplebox"></div>', | |
allowedContent: | |
'div(!simplebox)', | |
requiredContent: 'div(simplebox)', | |
upcast: function( element ) { | |
return element.name == 'div' && element.hasClass( 'simplebox' ); | |
} | |
} ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment