Disable Table Editing

Native contenteditable execCommands were being tried before the surface was attached to the DOM. This is necessary for disabling native contenteditable object editing and resizing.

Change-Id: Idff6a30432396726deb8a38356172380ea12fced
This commit is contained in:
Christian Williams 2012-11-14 17:14:45 -08:00
parent 17b33dc94e
commit 9f4a4d9e92
2 changed files with 6 additions and 4 deletions

View file

@ -66,10 +66,6 @@ ve.ce.Surface = function VeCeSurface( $container, model, surface ) {
}, this ) );
// Initialization
try {
document.execCommand( 'enableObjectResizing', false, false );
document.execCommand( 'enableInlineTableEditing', false, false );
} catch ( e ) { /* Silently ignore */ }
rangy.init();
ve.ce.Surface.clearLocalStorage();
this.$.append( this.documentView.getDocumentNode().$ );

View file

@ -43,6 +43,12 @@ ve.Surface = function VeSurface( parent, dom, options ) {
this.setupCommands();
ve.instances.push( this );
this.model.startHistoryTracking();
// Turn off native object editing. This must be tried after the surface has been added to DOM.
try {
document.execCommand( 'enableObjectResizing', false, false );
document.execCommand( 'enableInlineTableEditing', false, false );
} catch ( e ) { /* Silently ignore */ }
};
/* Static Members */