forked from Botanical/BotanJS
Display session data in textarea instead of prompt
This commit is contained in:
parent
f85e65c23e
commit
9f7c0c4b7d
@ -27,9 +27,9 @@
|
|||||||
this.__cursor.unsuppressEvent();
|
this.__cursor.unsuppressEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
VA_REC.prototype.handler = function( e, endReplay )
|
VA_REC.prototype.handler = function( e, args, range )
|
||||||
{
|
{
|
||||||
if( endReplay )
|
if( args == true )
|
||||||
{
|
{
|
||||||
var msg = Mesg( "VA_REC_END" );
|
var msg = Mesg( "VA_REC_END" );
|
||||||
var lastLine = Mesg( "WAIT_FOR_INPUT" );
|
var lastLine = Mesg( "WAIT_FOR_INPUT" );
|
||||||
@ -60,9 +60,16 @@
|
|||||||
if( session.started )
|
if( session.started )
|
||||||
{
|
{
|
||||||
session.__dispose();
|
session.__dispose();
|
||||||
this.__msg = "Exported Session Data";
|
var head = "Press Escape to conitnue edit\n===\n";
|
||||||
|
var data = JSON.stringify( session.data );
|
||||||
|
|
||||||
|
var element = sender.element;
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
window.prompt( "Session data ( Ctrl + C )", JSON.stringify( session.data ) );
|
inst.display(
|
||||||
|
head + data, function(){
|
||||||
|
element.selectionStart = head.length;
|
||||||
|
element.selectionEnd = element.selectionStart + data.length;
|
||||||
|
} );
|
||||||
}, 1 );
|
}, 1 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -267,6 +267,40 @@
|
|||||||
this.dispatchEvent( new BotanEvent( "Visualized" ) );
|
this.dispatchEvent( new BotanEvent( "Visualized" ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VimArea.prototype.display = function( data, handler )
|
||||||
|
{
|
||||||
|
var _self = this;
|
||||||
|
var stage = this.stage;
|
||||||
|
var cursor = this.__cursor;
|
||||||
|
|
||||||
|
var evts = this.__stagedEvents;
|
||||||
|
for( var i in evts ) stage.removeEventListener( evts[ i ] );
|
||||||
|
cursor.suppressEvent();
|
||||||
|
this.__active = false;
|
||||||
|
|
||||||
|
stage.removeAttribute( "data-vimarea" );
|
||||||
|
setTimeout( function() {
|
||||||
|
stage.element.value = data;
|
||||||
|
if( handler ) handler();
|
||||||
|
}, 100 );
|
||||||
|
|
||||||
|
var ContinueEdit = new EventKey( "KeyDown", function( e ) {
|
||||||
|
var evt = new ActionEvent( _self, e );
|
||||||
|
if( evt.kMap( "Escape" ) )
|
||||||
|
{
|
||||||
|
stage.removeEventListener( ContinueEdit );
|
||||||
|
stage.setAttribute( new DataKey( "vimarea", 1 ) );
|
||||||
|
stage.addEventListeners( _self.__stagedEvents );
|
||||||
|
cursor.unsuppressEvent();
|
||||||
|
cursor.feeder.dispatcher.dispatchEvent( new BotanEvent( "VisualUpdate" ) );
|
||||||
|
_self.__active = true;
|
||||||
|
stage.element.focus();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
stage.addEventListener( ContinueEdit );
|
||||||
|
};
|
||||||
|
|
||||||
VimArea.prototype.demo = function( seq )
|
VimArea.prototype.demo = function( seq )
|
||||||
{
|
{
|
||||||
if( this.__demoActive ) return;
|
if( this.__demoActive ) return;
|
||||||
|
@ -14,6 +14,8 @@ Components.Vim.VimArea.statusBar;
|
|||||||
|
|
||||||
/** @type Function */
|
/** @type Function */
|
||||||
Components.Vim.VimArea.demo;
|
Components.Vim.VimArea.demo;
|
||||||
|
/** @type Function */
|
||||||
|
Components.Vim.VimArea.display;
|
||||||
|
|
||||||
/** @type Number */
|
/** @type Number */
|
||||||
Components.Vim.VimArea.index;
|
Components.Vim.VimArea.index;
|
||||||
|
Loading…
Reference in New Issue
Block a user