namibia
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "sourcearea" plugin. It registers the "source" editing * mode, which displays the raw data being edited in the editor. */ CKEDITOR.plugins.add( 'sourcearea', { requires : [ 'editingblock' ], init : function( editor ) { var sourcearea = CKEDITOR.plugins.sourcearea, win = CKEDITOR.document.getWindow(); editor.on( 'editingBlockReady', function() { var textarea, onResize; editor.addMode( 'source', { load : function( holderElement, data ) { if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) holderElement.setStyle( 'position', 'relative' ); // Create the source area <textarea>. editor.textarea = textarea = new CKEDITOR.dom.element( 'textarea' ); textarea.setAttributes( { dir : 'ltr', tabIndex : CKEDITOR.env.webkit ? -1 : editor.tabIndex, 'role' : 'textbox', 'aria-label' : editor.lang.editorTitle.replace( '%1', editor.name ) }); textarea.addClass( 'cke_source' ); textarea.addClass( 'cke_enable_context_menu' ); editor.readOnly && textarea.setAttribute( 'readOnly', 'readonly' ); var styles = { // IE7 has overflow the <textarea> from wrapping table cell. width : CKEDITOR.env.ie7Compat ? '99%' : '100%', height : '100%', resize : 'none', outline : 'none', 'text-align' : 'left' }; // Having to make <textarea> fixed sized to conque the following bugs: // 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7. // 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor // if text content within it has overflowed. (#4762) if ( CKEDITOR.env.ie ) { onResize = function() { // Holder rectange size is stretched by textarea, // so hide it just for a moment. textarea.hide(); textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' ); textarea.setStyle( 'width', holderElement.$.clientWidth + 'px' ); // When we have proper holder size, show textarea again. textarea.show(); }; editor.on( 'resize', onResize ); win.on( 'resize', onResize ); setTimeout( onResize, 0 ); } // Reset the holder element and append the // <textarea> to it. holderElement.setHtml( '' ); holderElement.append( textarea ); textarea.setStyles( styles ); editor.fire( 'ariaWidget', textarea ); textarea.on( 'blur', function() { editor.focusManager.blur(); }); textarea.on( 'focus', function() { editor.focusManager.focus(); }); // The editor data "may be dirty" after this point. editor.mayBeDirty = true; // Set the <textarea> value. this.loadData( data ); var keystrokeHandler = editor.keystrokeHandler; if ( keystrokeHandler ) keystrokeHandler.attach( textarea ); setTimeout( function() { editor.mode = 'source'; editor.fire( 'mode', { previousMode : editor._.previousMode } ); }, ( CKEDITOR.env.gecko || CKEDITOR.env.webkit ) ? 100 : 0 ); }, loadData : function( data ) { textarea.setValue( data ); editor.fire( 'dataReady' ); }, getData : function() { return textarea.getValue(); }, getSnapshotData : function() { return textarea.getValue(); }, unload : function( holderElement ) { textarea.clearCustomData(); editor.textarea = textarea = null; if ( onResize ) { editor.removeListener( 'resize', onResize ); win.removeListener( 'resize', onResize ); } if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) holderElement.removeStyle( 'position' ); }, focus : function() { textarea.focus(); } }); }); editor.on( 'readOnly', function() { if ( editor.mode == 'source' ) { if ( editor.readOnly ) editor.textarea.setAttribute( 'readOnly', 'readonly' ); else editor.textarea.removeAttribute( 'readOnly' ); } }); editor.addCommand( 'source', sourcearea.commands.source ); if ( editor.ui.addButton ) { editor.ui.addButton( 'Source', { label : editor.lang.source, command : 'source' }); } editor.on( 'mode', function() { editor.getCommand( 'source' ).setState( editor.mode == 'source' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); }); } }); /** * Holds the definition of commands an UI elements included with the sourcearea * plugin. * @example */ CKEDITOR.plugins.sourcearea = { commands : { source : { modes : { wysiwyg:1, source:1 }, editorFocus : false, readOnly : 1, exec : function( editor ) { if ( editor.mode == 'wysiwyg' ) editor.fire( 'saveSnapshot' ); editor.getCommand( 'source' ).setState( CKEDITOR.TRISTATE_DISABLED ); editor.setMode( editor.mode == 'source' ? 'wysiwyg' : 'source' ); }, canUndo : false } } }; |
Commits for namibiapublic/scripts/ckeditor/_source/plugins/sourcearea/plugin.js
Revision | Author | Commited | Message |
---|---|---|---|
df0489 ... | Mark | Fri 14 Oct, 2016 10:01:00 +0000 | initial commit |