File: togglebuttonscreenreader.html

package info (click to toggle)
ckeditor 4.22.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 290,692 kB
  • sloc: javascript: 237,176; sh: 202; makefile: 64; python: 37; php: 15; xml: 5
file content (29 lines) | stat: -rw-r--r-- 595 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<div id="editor">
	<p>Whatever</p>
</div>

<script>
	CKEDITOR.replace( 'editor', {
		toolbar: [ [ 'toggleButton' ] ],
		on: {
			pluginsLoaded: function( evt ) {
				evt.editor.addCommand( 'toggleButton', {
					exec: function() {
						if ( this.state === CKEDITOR.TRISTATE_OFF ) {
							this.setState( CKEDITOR.TRISTATE_ON );
						} else {
							this.setState( CKEDITOR.TRISTATE_OFF );
						}
					}
				} );

				evt.editor.ui.addButton( 'toggleButton', {
					label: 'Sample button',
					icon: 'Link',
					isToggle: true,
					command: 'toggleButton'
				} );
			}
		}
	} );
</script>