Opened 7 years ago

Last modified 7 years ago

#10227 confirmed Bug

Magicline should carefully register commands, keystrokes and listeners

Reported by: Piotrek Koszuliński Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0 Beta
Keywords: Cc:

Description

This code is executed multiple times when switching between modes. It is hard to predict whether this is safe or not, therefore it should be fixed.

	// Editor commands for accessing difficult focus spaces.
	editor.addCommand( 'accessPreviousSpace', accessFocusSpaceCmd( that ) );
	editor.addCommand( 'accessNextSpace', accessFocusSpaceCmd( that, true ) );

	editor.setKeystroke( [
		[ config.magicline_keystrokePrevious, 'accessPreviousSpace' ],
		[ config.magicline_keystrokeNext, 'accessNextSpace' ]
	] );

	// Revert magicline hot node on undo/redo.
	editor.on( 'loadSnapshot', function( event ) {
		var elements = doc.getElementsByTag( that.enterBehavior ),
			element;

		for ( var i = elements.count(); i--; ) {
			if ( ( element = elements.getItem( i ) ).hasAttribute( 'data-cke-magicline-hot' ) ) {
				// Restore hotNode
				that.hotNode = element;
				// Restore last access direction
				that.lastCmdDirection = element.getAttribute( 'data-cke-magicline-dir' ) === 'true' ? true : false;
				break;
			}
		}
	} );

Change History (1)

comment:1 Changed 7 years ago by Piotrek Koszuliński

Status: newconfirmed
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy